README.md 19.6 KB
Newer Older
1
[**中文**](./README_CN.md)
2 3

<p align="center">
4
  <img src="https://raw.githubusercontent.com/PaddlePaddle/VisualDL/develop/frontend/packages/core/public/images/logo-visualdl.svg?sanitize=true" width="70%"/>
5 6
</p>

走神的阿圆's avatar
走神的阿圆 已提交
7 8 9 10 11 12 13 14 15

<p align="center">
<a href="https://travis-ci.org/PaddlePaddle/VisualDL"><img src="https://img.shields.io/travis/paddlepaddle/visualdl/develop?style=flat-square" alt="Build Status" /></a>
<a href="https://pypi.org/project/visualdl/"><img src="https://img.shields.io/pypi/v/visualdl?style=flat-square" alt="PyPI" /></a>
<a href="https://pypi.org/project/visualdl/#files"><img src="https://img.shields.io/pypi/dm/visualdl?style=flat-square" alt="Downloads" /></a>
<a href="https://github.com/PaddlePaddle/VisualDL/blob/develop/LICENSE"><img src="https://img.shields.io/github/license/paddlepaddle/visualdl?style=flat-square" alt="License" /></a>
</p>

<p align="center">
16
<a href="javascript:void(0)"><img src="https://img.shields.io/badge/QQ_Group-1045783368-52B6EF?style=social&logo=tencent-qq&logoColor=000&logoWidth=20" alt="QQ Group" /></a>
走神的阿圆's avatar
走神的阿圆 已提交
17
</p>
18

19 20
## Introduction
VisualDL, a visualization analysis tool of PaddlePaddle, provides a variety of charts to show the trends of parameters, and visualizes model structures, data samples, histograms of tensors, pr curves and high-dimensional data distributions. It enables users to understand the training process and the model structure more clearly and intuitively so as to optimize models efficiently.
21

走神的阿圆's avatar
走神的阿圆 已提交
22
VisualDL provides various visualization functions, including tracking metrics in real-time, visualizing the model structure, displaying the data sample, presenting the changes of distributions of tensors, showing the pr curves, projecting high-dimensional data to a lower dimensional space and more. Additionally, VisualDL provides VDL.service, which enables developers easily to save, track and share visualization results of experiments. For specific guidelines of each function, please refer to  [**VisualDL User Guide**](./docs/components/README.md). Currently, VisualDL iterates rapidly and new functions will be continously added.
23

24
VisualDL natively supports the use of Python. Developers can retrieve plentiful visualization results by simply adding a few lines of Python code into the model before training. 
25

26
## Contents
27

28 29 30 31 32 33 34
* [Key Highlights](#Key-Highlights)
* [Installation](#Installation)
* [Usage Guideline](#Usage-Guideline)
* [Function Preview](#Function-Preview)
* [Contribution](#Contribution)
* [More Details](#More-Details)
* [Technical Communication](#Technical-Communication)
35 36 37



38
## Key Highlights
39

40
### Easy to Use
41

42
The high-level design of API makes it easy to use. Only one click can initiate the visualization of model structures.
43

44
### Various Functions 
45

46
The function contains the visualization of training parameters, data samples, graph structures, histograms of tensors, PR curves and high-dimensional data.
47

48
### High Compatibility 
49

50
VisualDL provides the visualization of the mainstream model structures such as Paddle, ONNX, Caffe, widely supporting visual analysis for diverse users.
51

52
### Fully Support
53

54
By Integrating into PaddlePaddle and related modules, VisualDL allows developers to use different components unobstructed, and thus have the best experience in the PaddlePaddle ecosystem.
55

56
## Installation
57

58
### Install by PiP
59 60

```shell
走神的阿圆's avatar
走神的阿圆 已提交
61
python -m pip install visualdl -i https://mirror.baidu.com/pypi/simple
62
```
63
### Install by Code
64

走神的阿圆's avatar
走神的阿圆 已提交
65 66 67
```
git clone https://github.com/PaddlePaddle/VisualDL.git
cd VisualDL
68

走神的阿圆's avatar
走神的阿圆 已提交
69 70 71
python setup.py bdist_wheel
pip install --upgrade dist/visualdl-*.whl
```
72
Please note that Python 2 is no longer maintained officially since January 1, 2020. VisualDL now only supports Python 3 in order to ensure the usability of codes.
73

74
## Usage Guideline 
75

76
VisualDL stores the data, parameters and other information of the training process in a log file. Users can launch the panel to observe the visualization results.
77

78
### 1. Log
79

80
The Python SDK is provided at the back end of VisualDL, and a logger can be customized through LogWriter. The interface description is shown as follows:
81 82 83 84 85 86 87 88 89 90 91

```python
class LogWriter(logdir=None,
                comment='',
                max_queue=10,
                flush_secs=120,
                filename_suffix='',
                write_to_disk=True,
                **kwargs)
```

92
#### Interface Parameters
93

94
| parameters      | type    | meaning                                                      |
走神的阿圆's avatar
走神的阿圆 已提交
95
| --------------- | ------- | ------------------------------------------------------------ |
96 97 98 99 100 101 102
| logdir          | string  | The path location of log file. VisualDL will create a log file under this path to record information generated by the training process. If not specified, the path will be  `runs/${CURRENT_TIME}`as default. |
| comment         | string  | Add a suffix to the log folder name, which is invalid if logdir is already specified. |
| max_queue       | int     | The maximum capacity of the data generated before recording in a log file. Default value is 10. If the capacity is reached, the data is immediately written into the log file. The cache is not used if set to 0. |
| flush_secs      | int     | The maximum cache time of the data generated before recording in a log file. Default value is 120. When this time is reached, the data is immediately written to the log file. The cache is not used if set to 0. |
| filename_suffix | string  | Add a suffix to the default log file name.                   |
| write_to_disk   | boolean | Write into disk or not.                                      |
| display_name  | string | Set the name of different runs when `logdir` is too long or needed to be hidden. If not set, the default name is `logdir`.|
103 104


105 106 107
#### Example

Create a log file and record scalar values:
108 109 110 111

```python
from visualdl import LogWriter

112
# create a log file under `./log/scalar_test/train`
113
with LogWriter(logdir="./log/scalar_test/train") as writer:
114
    # use `add_scalar` to record scalar values
115 116 117 118 119
    writer.add_scalar(tag="acc", step=1, value=0.5678)
    writer.add_scalar(tag="acc", step=2, value=0.6878)
    writer.add_scalar(tag="acc", step=3, value=0.9878)
```

120
### 2. Launch Panel
121

122
In the above example, the log has recorded three sets of scalar values. Develpers can view the visualization results of the log file through launching the visualDL panel. There are two ways to launch a log file:
123

124
#### Launch by Command Line
125

126
Use the command line to launch the VisualDL panel:
127 128

```python
129
visualdl --logdir <dir_1, dir_2, ... , dir_n> --host <host> --port <port> --cache-timeout <cache_timeout> --language <language> --public-path <public_path> --api-only --component_tabs <tab_name1, tab_name2, ...>
130 131
```

132
Parameter details:
133

134 135 136 137 138 139 140 141 142
| parameters      | meaning                                                      |
| --------------- | ------------------------------------------------------------ |
| --logdir        | Set one or more directories of the log. VisualDL will search the log file recursively under this path to display the all experimental results. |
| --host          | Specify IP address. The default value is·`127.0.0.1`.        |
| --port          | Set the port. The default value is`8040`.                    |
| --cache-timeout | Cache time of the backend. During the cache time, the front end requests the same URL multiple times, and then the returned data is obtained from the cache. The default cache time is 20 seconds. |
| --language      | The language of the VisualDL panel. Language can be specified as 'en' or 'zh', and the default is the language used by the browser. |
| --public-path   | The URL path of the VisualDL panel. The default path is '/app', meaning that the access address is 'http://&lt;host&gt;:&lt;port&gt;/app'. |
| --api-only      | Decide whether or not to provide only API. If this parameter is set, VisualDL will only provides API service without displaying the web page, and the API address is 'http://&lt;host&gt;:&lt;port&gt;/&lt;public_path&gt;/api'. Additionally, If the public_path parameter is not specified, the default address is 'http://&lt;host&gt;:&lt;port&gt;/api'. |
143
| --component_tabs  | Decide which components are presented in page, currently support 15 components, i.e. 'scalar', 'image', 'text', 'embeddings', 'audio', 'histogram', 'hyper_parameters', 'static_graph', 'dynamic_graph', 'pr_curve', 'roc_curve', 'profiler', 'x2paddle', 'fastdeploy_server', 'fastdeploy_client'. If this parameter is set, only specified components will be presented. If not set, and specify --logdir parameter, only components with data in vdlrecords log are presented. If both --component_tabs and --logdir are not set, only present 'static_graph', 'x2paddle', 'fastdeploy_server', 'fastdeploy_client' components by default |
144

145
To visualize the log file generated in the previous step, developers can launch the panel through the command:
146 147 148 149 150

```
visualdl --logdir ./log
```

151
#### Launch in Python Script
152

153
Developers can start the VisualDL panel in Python script as follows: 
154 155 156 157 158 159 160

```python
visualdl.server.app.run(logdir,
                        host="127.0.0.1",
                        port=8080,
                        cache_timeout=20,
                        language=None,
161 162
                        public_path=None,
                        api_only=False,
163 164 165
                        open_browser=False)
```

166
Please note: since all parameters are indefinite except `logdir`, developers should specify parameter names when using them.
走神的阿圆's avatar
走神的阿圆 已提交
167

168
The interface parameters are as follows:
169

170 171 172 173 174 175 176 177 178 179
| parameters    | type                                               | meaning                                                      |
| ------------- | -------------------------------------------------- | ------------------------------------------------------------ |
| logdir        | string or list[string_1, string_2, ... , string_n] | Set one or more directories of the log. VisualDL will search the log file recursively under this path to display the all experimental results. |
| host          | string                                             | Specify IP address. The default value is·`127.0.0.1`.        |
| port          | int                                                | Set the port. The default value is`8040`.                    |
| cache_timeout | int                                                | Cache time of the backend. During the cache time, the front end requests the same URL multiple times, and then the returned data is obtained from the cache. The default cache time is 20 seconds. |
| language      | string                                             | The language of the VisualDL panel. Language can be specified as 'en' or 'zh', and the default is the language used by the browser. |
| public_path   | string                                             | The URL path of the VisualDL panel. The default path is '/app', meaning that the access address is 'http://&lt;host&gt;:&lt;port&gt;/app'. |
| api_only      | boolean                                            | Decide whether or not to provide only API. If this parameter is set, VisualDL will only provides API service without displaying the web page, and the API address is 'http://&lt;host&gt;:&lt;port&gt;/&lt;public_path&gt;/api'. Additionally, If the parameter public_path is not specified, the default address is 'http://&lt;host&gt;:&lt;port&gt;/api'. |
| open_browser  | boolean                                            | Whether or not to open the browser. If this parameter is set as True, the browser will be openned automatically and VisualDL panel will be launched at the same time. If parameter api_only is specified as True,  parameter open_browser can be ignored. |
180
| component_tabs | string or list[string_1, string_2, ... , string_n] | Decide which components are presented in page, currently support 15 components, i.e. 'scalar', 'image', 'text', 'embeddings', 'audio', 'histogram', 'hyper_parameters', 'static_graph', 'dynamic_graph', 'pr_curve', 'roc_curve', 'profiler', 'x2paddle', 'fastdeploy_server', 'fastdeploy_client'. If this parameter is set, only specified components will be presented. If not set, and specify --logdir parameter, only components with data in vdlrecords log are presented. If both --component_tabs and --logdir are not set, only present 'static_graph', 'x2paddle', 'fastdeploy_server', 'fastdeploy_client' components by default |
181

182
To visualize the log file generated in the previous step, developers can launch the panel through the command:
183 184 185 186

```python
from visualdl.server import app

走神的阿圆's avatar
走神的阿圆 已提交
187
app.run(logdir="./log")
188 189
```

190
After launching the panel by one of the above methods, developers can see the visualization results on the browser shown as blow:
191 192

<p align="center">
193
  <img src="https://user-images.githubusercontent.com/48054808/90868674-ba321f00-e3c9-11ea-83c1-f03c6dd19187.png" width="70%"/>
194 195 196 197
</p>



198
## Function Preview
199 200

### Scalar
201
**Scalar** makes use of various charts to display how the parameters, such as accuracy, loss and learning rate, change during the training process. In this case, developers can observe not only the single but also the multiple groups of parameters in order to understand the training process and thus speed up the process of model tuning.
202

203
#### Dynamic Display
204

205
After the launchment of VisualDL Board, the LogReader will continuously record the data to display in the front-end. Hence, the changes of parameters can be visualized in real-time, as shown below:
206 207

<p align="center">
208
  <img src="https://visualdl.bj.bcebos.com/images/dynamic_display.gif" width="60%"/>
209 210 211
</p>


212
#### Comparison of Multiple Experiments
213

214
Developers can compare with multiple experiments by specifying and uploading the path of each experiment at the same time so as to visualize the same parameters in the same chart.
215 216

<p align="center">
217
  <img src="https://user-images.githubusercontent.com/48054808/90869567-fdd95880-e3ca-11ea-9855-6c97ad5c8ae7.gif" width="100%"/>
218 219 220 221
</p>


### Image
222
**Image** provides real-time visualizations of the image data during the training process, allowing developers to observe the changes of images in different training stages and  to deeply understand the effects of the training process. 
223 224

<p align="center">
225
<img src="https://user-images.githubusercontent.com/48054808/90869677-22353500-e3cb-11ea-9830-2334bdd8e52e.gif" width="60%"/>
226 227
</p>

走神的阿圆's avatar
走神的阿圆 已提交
228
### Audio
229
**Audio** aims to allow developers to listen to the audio data in real-time during the training process, helping developers to monitor the process of speech recognition and text-to-speech.
走神的阿圆's avatar
走神的阿圆 已提交
230 231

<p align="center">
232
<img src="https://user-images.githubusercontent.com/48054808/90869771-47c23e80-e3cb-11ea-8b2a-a38b6c33d64b.png" width="85%"/>
走神的阿圆's avatar
走神的阿圆 已提交
233 234
</p>

走神的阿圆's avatar
走神的阿圆 已提交
235 236 237 238 239 240 241
### Text
**Text** visualizes the text output of NLP models within any stage, aiding developers to compare the changes of outputs so as to deeply understand the training process and simply evaluate the performance of the model.

<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/106248340-cdd09400-624b-11eb-8ea9-5a07a239c365.png" width="85%"/>
</p>

走神的阿圆's avatar
走神的阿圆 已提交
242 243
### Graph

C
chenjian 已提交
244 245 246 247 248 249 250 251 252
**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.

- dynamic graph

<p align="center">
<img src="https://user-images.githubusercontent.com/22424850/175811841-64b44d99-7d48-4fe9-a679-01156d15af74.gif" width="85%"/>
</p>

- static graph
253

走神的阿圆's avatar
走神的阿圆 已提交
254
<p align="center">
C
chenjian 已提交
255
<img src="https://user-images.githubusercontent.com/22424850/175811795-1fd21737-06f0-42fc-bea3-ef7a17216fc9.gif" width="85%"/>
走神的阿圆's avatar
走神的阿圆 已提交
256 257
</p>

C
chenjian 已提交
258

走神的阿圆's avatar
走神的阿圆 已提交
259 260
### Histogram

261
**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.
走神的阿圆's avatar
走神的阿圆 已提交
262

263
- Offset Mode
走神的阿圆's avatar
走神的阿圆 已提交
264 265

<p align="center">
266
<img src="https://user-images.githubusercontent.com/48054808/90870121-bd2e0f00-e3cb-11ea-89cf-6622cb607b89.png" width="85%"/>
走神的阿圆's avatar
走神的阿圆 已提交
267 268 269
</p>


270
- Overlay Mode
走神的阿圆's avatar
走神的阿圆 已提交
271 272

<p align="center">
273
<img src="https://user-images.githubusercontent.com/48054808/90870194-cfa84880-e3cb-11ea-8a66-bebcad267a10.png" width="85%"/>
走神的阿圆's avatar
走神的阿圆 已提交
274
</p>
275 276 277

### High Dimensional

278
**High Dimensional** provides two approaches--T-SNE and PCA--to do the dimensionality reduction, allowing developers to have an in-depth analysis of the relationship between high-dimensional data and to optimize algorithms based on the analysis. 
279 280

<p align="center">
走神的阿圆's avatar
走神的阿圆 已提交
281 282 283 284 285 286 287 288 289
<img src="https://user-images.githubusercontent.com/48054808/103188111-1b32ac00-4902-11eb-914e-c2368bdb8373.gif" width="85%"/>
</p>

### Hyper Parameters

**Hyper Parameters** visualize the relationship between hyperparameters and model metrics (such as accuracy and loss) in a rich view, helping you identify the best hyperparameters in an efficient way.

<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119247155-e9c0c280-bbb9-11eb-8175-58a9c7657a9c.gif" width="85%"/>
290 291
</p>

C
chenjian 已提交
292
### Performance Analysis
293
**Performance Analysis**(Profiler) visualize the profiling data collected during your program runs, helping you identify program bottlenecks and optimize performance. Please refer to [VisualDL Profiler Guide](./components/profiler/README.md).
C
chenjian 已提交
294 295 296 297
<p align="center">
<img src="https://user-images.githubusercontent.com/22424850/185894151-53ffc60b-7203-4cb8-a289-5d97332d0691.gif" width="85%"/>
</p>

298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
### X2Paddle
The X2Paddle component provides the functions of onnx model format visualization and transformation to paddle format.

<p align="center">
  <img src="https://user-images.githubusercontent.com/22424850/211203066-f2e43ef5-104f-436a-b44c-cad2b37ad518.gif" width="100%"/>
</p>


### FastDeployServer
The FastDeployServer component provides the functions of loading and editing the model repository, fastdeployserver service management and monitoring, and providing the client to test service. Please refer to [use VisualDL for fastdeploy serving deployment visualization](./components/fastdeploy_server/README.md).

 <p align="center">
  <img src="https://user-images.githubusercontent.com/22424850/211196832-1a05bf80-5aaa-493f-bba2-27e819c18bb9.gif" width="100%"/>
</p>


### FastDeployClient
The FastDeployClient component is mainly used to quickly access the fastdeployserver service, to help users visualize prediction requests and results. Please refer to [use VisualDL as fastdeploy client for request visualization](./components/fastdeploy_client/README.md).

<p align="center">
  <img src="https://user-images.githubusercontent.com/22424850/211203852-059d5b98-6299-4057-97d8-5209805aa67f.gif" width="100%"/>
</p>


322 323
### VDL.service

324
**VDL.service** enables developers to easily save, track and share visualization results with anyone for free.
325 326

<p align="center">
327 328 329 330
<img src=https://user-images.githubusercontent.com/48054808/93731055-fbeafb00-fbfd-11ea-80f4-bbfd08a0fc35.png
</p>   
  
## Contribution
331

332
VisualDL, in which Graph is powered by [Netron](https://github.com/lutzroeder/netron), is an open source project supported by  [PaddlePaddle](https://www.paddlepaddle.org/) and [ECharts](https://echarts.apache.org/) . Developers are warmly welcomed to use, comment and contribute.
333 334


335
## More Details
336

337
For more details related to the use of VisualDL, please refer to [**VisualDL User Guide**](./components/README.md), [**VisualDL Profiler Guide**](./components/profiler/README.md), [**Use VisualDL for fastdeploy serving deployment visualization**](./components/fastdeploy_server/README.md), [**Use VisualDL as fastdeploy client for request visualization**](./components/fastdeploy_client/README.md).
走神的阿圆's avatar
走神的阿圆 已提交
338

339
## Technical Communication
走神的阿圆's avatar
走神的阿圆 已提交
340

341
Welcome to join the official QQ group 104578336 to communicate with PaddlePaddle team and other developers.
走神的阿圆's avatar
走神的阿圆 已提交
342 343 344 345

<p align="center">
<img src="https://user-images.githubusercontent.com/48054808/82522691-c2758680-9b5c-11ea-9aee-fca994aba175.png" width="20%"/>
</p>