Skip to content

Commit 6fdfcde

Browse files
authored
Upgrade version and docs
1 parent 15dbace commit 6fdfcde

File tree

10 files changed

+344
-77
lines changed

10 files changed

+344
-77
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,18 @@ Developers can compare multiple experiments by specifying and uploading the path
315315

316316
### Graph
317317

318-
**Graph** enables developers to visualize model structures by only one click. Moreover, **Graph** allows developers to explore model attributes, node information, node input and output. aiding them analyze model structures quickly and understand the direction of data flow easily.
318+
**Graph** enables developers to visualize model structures by only one click. Moreover, **Graph** allows developers to explore model attributes, node information, node input and output. aiding them analyze model structures quickly and understand the direction of data flow easily. Additionally, Graph supports the visualization of dynamic and static model graph respectively.
319+
320+
- dynamic graph
321+
322+
<p align="center">
323+
<img src="https://user-images.githubusercontent.com/22424850/175811841-64b44d99-7d48-4fe9-a679-01156d15af74.gif" width="85%"/>
324+
</p>
325+
326+
- static graph
319327

320328
<p align="center">
321-
<img src="https://user-images.githubusercontent.com/48054808/90869866-6aecee00-e3cb-11ea-8211-b8af070239e6.png" width="85%"/>
329+
<img src="https://user-images.githubusercontent.com/22424850/175811795-1fd21737-06f0-42fc-bea3-ef7a17216fc9.gif" width="85%"/>
322330
</p>
323331

324332

README_CN.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,18 @@ value: 3.1297709941864014
337337

338338
### Graph
339339

340-
一键可视化模型的网络结构。可查看模型属性、节点信息、节点输入输出等,并支持节点搜索,辅助用户快速分析模型结构与了解数据流向。
340+
一键可视化模型的网络结构。可查看模型属性、节点信息、节点输入输出等,并支持节点搜索,辅助用户快速分析模型结构与了解数据流向,覆盖动态图与静态图两种格式。
341+
- 动态图
341342

342343
<p align="center">
343-
<img src="https://user-images.githubusercontent.com/48054808/84483052-5acdd980-accb-11ea-8519-1608da7ee698.png" width="85%"/>
344+
<img src="https://user-images.githubusercontent.com/22424850/175770313-2509f7e9-041a-4654-9a0f-45f4bd76e1e8.gif" width="85%"/>
344345
</p>
345346

347+
- 静态图
348+
349+
<p align="center">
350+
<img src="https://user-images.githubusercontent.com/22424850/175770315-11e2c3f5-141c-4f05-be86-0e1e2785e11f.gif" width="85%"/>
351+
</p>
346352

347353
### Histogram
348354

docs/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,21 @@ Developers can compare with multiple experiments by specifying and uploading the
239239

240240
### Graph
241241

242-
**Graph** enables developers to visualize model structures by only one click. Moreover, **Graph** allows Developers to explore model attributes, node information, node input and output. aiding them analyze model structure quickly and understand the direction of data flow easily.
242+
**Graph** enables developers to visualize model structures by only one click. Moreover, **Graph** allows developers to explore model attributes, node information, node input and output. aiding them analyze model structures quickly and understand the direction of data flow easily. Additionally, Graph supports the visualization of dynamic and static model graph respectively.
243+
244+
- dynamic graph
245+
246+
<p align="center">
247+
<img src="https://user-images.githubusercontent.com/22424850/175811841-64b44d99-7d48-4fe9-a679-01156d15af74.gif" width="85%"/>
248+
</p>
249+
250+
- static graph
243251

244252
<p align="center">
245-
<img src="https://user-images.githubusercontent.com/48054808/90869866-6aecee00-e3cb-11ea-8211-b8af070239e6.png" width="85%"/>
253+
<img src="https://user-images.githubusercontent.com/22424850/175811795-1fd21737-06f0-42fc-bea3-ef7a17216fc9.gif" width="85%"/>
246254
</p>
247255

256+
248257
### Histogram
249258

250259
**Histogram** displays how the trend of tensors (weight, bias, gradient, etc.) changes during the training process in the form of histogram. Developers can adjust the model structures accurately by having an in-depth understanding of the effect of each layer.

docs/README_CN.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,17 @@ app.run(logdir="./log")
250250

251251
### Graph
252252

253-
一键可视化模型的网络结构。可查看模型属性、节点信息、节点输入输出等,并支持节点搜索,辅助用户快速分析模型结构与了解数据流向。
253+
一键可视化模型的网络结构。可查看模型属性、节点信息、节点输入输出等,并支持节点搜索,辅助用户快速分析模型结构与了解数据流向,覆盖动态图与静态图两种格式。
254+
- 动态图
255+
256+
<p align="center">
257+
<img src="https://user-images.githubusercontent.com/22424850/175770313-2509f7e9-041a-4654-9a0f-45f4bd76e1e8.gif" width="85%"/>
258+
</p>
259+
260+
- 静态图
261+
254262
<p align="center">
255-
<img src="https://user-images.githubusercontent.com/48054808/84483052-5acdd980-accb-11ea-8519-1608da7ee698.png" width="85%"/>
263+
<img src="https://user-images.githubusercontent.com/22424850/175770315-11e2c3f5-141c-4f05-be86-0e1e2785e11f.gif" width="85%"/>
256264
</p>
257265

258266
### Histogram

docs/components/README.md

Lines changed: 125 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -454,44 +454,114 @@ Then, open the browser and enter the address`http://127.0.0.1:8080` to view:
454454

455455
Graph can visualize the network structure of the model by one click. It enables developers to view the model attributes, node information, searching node and so on. These functions help developers analyze model structures and understand the directions of data flow quickly.
456456

457+
### Record Interface
458+
459+
The interface of the Graph is shown as follows:
460+
461+
```python
462+
add_graph(model, input_spec, verbose=False):
463+
```
464+
465+
The interface parameters are described as follows:
466+
467+
| parameter | format | meaning |
468+
| -------------- | --------------------- | ------------------------------------------- |
469+
| model | paddle.nn.Layer | Dynamic model of paddle |
470+
| input_spec | list\[paddle.static.InputSpec\|Tensor\] | Describes the input of the saved model's [forward arguments](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/static/InputSpec_cn.html) |
471+
| verbose | bool | Whether to print graph statistic information in console. |
472+
473+
**Note**
474+
475+
If you want to use add_graph interface, paddle package is required. Please refer to website of [PaddlePaddle](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/en/install/pip/linux-pip_en.html)
476+
457477
### Demo
478+
The following shows an example of how to use Graph component, and script can be found in [Graph Demo](https://github.com/PaddlePaddle/VisualDL/blob/develop/demo/components/graph_test.py)
458479
There are two methods to launch this component:
459480

460-
- By the front end:
481+
```python
482+
import paddle
483+
import paddle.nn as nn
484+
import paddle.nn.functional as F
461485

462-
- If developers only need to use Graph, developers can launch VisualDL (Graph) by executing `visualdl`on the command line.
463-
- If developers need to use Graph and other functions at the same time, they need to specify the log file path (using `./log` as an example):
486+
from visualdl import LogWriter
464487

465-
```shell
466-
visualdl --logdir ./log --port 8080
467-
```
468488

489+
class MyNet(nn.Layer):
490+
def __init__(self):
491+
super(MyNet, self).__init__()
492+
self.conv1 = nn.Conv2D(
493+
in_channels=1, out_channels=20, kernel_size=5, stride=1, padding=2)
494+
self.max_pool1 = nn.MaxPool2D(kernel_size=2, stride=2)
495+
self.conv2 = nn.Conv2D(
496+
in_channels=20,
497+
out_channels=20,
498+
kernel_size=5,
499+
stride=1,
500+
padding=2)
501+
self.max_pool2 = nn.MaxPool2D(kernel_size=2, stride=2)
502+
self.fc = nn.Linear(in_features=980, out_features=10)
503+
504+
def forward(self, inputs):
505+
x = self.conv1(inputs)
506+
x = F.relu(x)
507+
x = self.max_pool1(x)
508+
x = self.conv2(x)
509+
x = F.relu(x)
510+
x = self.max_pool2(x)
511+
x = paddle.reshape(x, [x.shape[0], -1])
512+
x = self.fc(x)
513+
return x
514+
515+
516+
net = MyNet()
517+
with LogWriter(logdir="./log/graph_test/") as writer:
518+
writer.add_graph(
519+
model=net,
520+
input_spec=[paddle.static.InputSpec([-1, 1, 28, 28], 'float32')],
521+
verbose=True)
522+
```
469523

470-
- By the backend:
471524

472-
- Add the parameter `--model` and specify the **model file** path (not the folder path) to launch the panel:
473525

474-
```shell
475-
visualdl --model ./log/model --port 8080
476-
```
526+
After running the above program, developers can launch the panel by:
477527

528+
```shell
529+
visualdl --logdir ./log/graph_test/ --port 8080
530+
```
478531

479-
After the launch, developers can view the network structure:
532+
Then, open the browser and enter the address`http://127.0.0.1:8080` to view:
480533

481534
<p align="center">
482-
<img src="https://user-images.githubusercontent.com/48054808/90877274-6548d580-e3d6-11ea-9804-74a1ead47b30.png" width="80%"/>
535+
<img src="https://user-images.githubusercontent.com/22424850/175811156-a80ca0c4-207d-44d7-bd5a-9701a7875722.gif" width="80%"/>
483536
</p>
484537

538+
**Note**
539+
540+
We provide option --model to specify model structure file in previous versions, and this option is still supported now. You can specify model exported by `add_graph` interface ("vdlgraph" contained in filename), which will be shown in dynamic graph page, and we use string "manual_input_model" in the page to denote the model you specify by this option. Other supported file formats are presented in static graph page.
541+
542+
For example
543+
```shell
544+
visualdl --model ./log/model.pdmodel --port 8080
545+
```
546+
which will be shown in static graph page. And
547+
```shell
548+
visualdl --model ./log/vdlgraph.1655783158.log --port 8080
549+
```
550+
shown in dynamic graph page.
551+
485552
### Functional Instructions
486553

487-
- Upload the model file by one-click
488-
- Supported model:PaddlePaddle、ONNX、Keras、Core ML、Caffe、Caffe2、Darknet、MXNet、ncnn、TensorFlow Lite
489-
- Experimental supported model:TorchScript、PyTorch、Torch、 ArmNN、BigDL、Chainer、CNTK、Deeplearning4j、MediaPipe、ML.NET、MNN、OpenVINO、Scikit-learn、Tengine、TensorFlow.js、TensorFlow
554+
Graph page is divided into dynamic and static version currently. Dynamic version is used to visualize dynamic model of paddle, which is exported by add_graph interface.
555+
The other is used to visualize static model of paddle, which is exported by [paddle.jit.save](https://www.paddlepaddle.org.cn/documentation/docs/en/api/paddle/jit/save_en.html) interface and other supported formats.
556+
490557

491558
<p align="center">
492-
<img src="https://user-images.githubusercontent.com/48054808/90877449-a80aad80-e3d6-11ea-8016-0a2f3afe6f5e.png" width="80%"/>
559+
<img src="https://user-images.githubusercontent.com/22424850/175810574-d3526ef5-859f-4ea9-b705-f55bfc8ed5af.png" width="80%"/>
493560
</p>
494561

562+
**Common functions**
563+
564+
495565
- Developers are allowed to drag the model up and down,left and right,zoom in and zoom out.
496566

497567
<p align="center">
@@ -534,6 +604,44 @@ After the launch, developers can view the network structure:
534604
<img src="https://user-images.githubusercontent.com/48054808/90879247-34b66b00-e3d9-11ea-94ef-a26b1ba07dd0.png" width="25%"/>
535605
</p>
536606

607+
**Specific feature in dynamic version**
608+
609+
- Fold and unfold one node
610+
<p align="center">
611+
<img src="https://user-images.githubusercontent.com/22424850/175810800-4823b9f1-3d59-44e8-aaa5-a80577624452.png" width="80%"/>
612+
</p>
613+
<p align="center">
614+
<img src="https://user-images.githubusercontent.com/22424850/175810790-a35f83bf-a23c-4a28-afb7-2e0cf7711b9c.png" width="80%"/>
615+
</p>
616+
617+
- Fold and unfold all nodes
618+
<p align="center">
619+
<img src="https://user-images.githubusercontent.com/22424850/175810856-ff98a1ed-2a4f-4cc1-bc9b-3085857c0b81.png" width="80%"/>
620+
</p>
621+
<p align="center">
622+
<img src="https://user-images.githubusercontent.com/22424850/175810837-a0953956-7320-4e78-9c52-72ad13962216.png" width="80%"/>
623+
</p>
624+
625+
- Link api specification of paddle
626+
627+
If you use paddle.nn components to construct your network model, you can use alt+click mouse to direct to corresponding api specification.
628+
<p align="center">
629+
<img src="https://user-images.githubusercontent.com/22424850/175810992-b86e9aef-e700-4c2d-bcd0-21fc96fc2564.png" width="80%"/>
630+
</p>
631+
<p align="center">
632+
<img src="https://user-images.githubusercontent.com/22424850/175810997-0672d836-4d7c-432d-b5de-187f97c421ae.png" width="80%"/>
633+
</p>
634+
635+
**Specific feature in static version**
636+
637+
- Upload the model file by one-click
638+
- Supported model:PaddlePaddle、ONNX、Keras、Core ML、Caffe、Caffe2、Darknet、MXNet、ncnn、TensorFlow Lite
639+
- Experimental supported model:TorchScript、PyTorch、Torch、 ArmNN、BigDL、Chainer、CNTK、Deeplearning4j、MediaPipe、ML.NET、MNN、OpenVINO、Scikit-learn、Tengine、TensorFlow.js、TensorFlow
640+
641+
<p align="center">
642+
<img src="https://user-images.githubusercontent.com/48054808/90877449-a80aad80-e3d6-11ea-8016-0a2f3afe6f5e.png" width="80%"/>
643+
</p>
644+
537645
## Histogram--Distribution of Tensors
538646

539647
### Introduction

0 commit comments

Comments
 (0)