VisualDL is a visualization tool for deep learning, including scalar, parameter distribution, model structure, image visualization and other features.
The project is under development, and will provide more features.
Most of the DNN platforms are using Python. VisualDL supports Python out of the box.
By just adding a few lines of configuration to the code, VisualDL can provide a rich visual support for the training process.
In addition to Python SDK, the underlying VisualDL is written in C++, and its exposed C++ SDK can be integrated into other platforms.
Users can access the original features and monitor customized matrix.
## Components
VisualDL supports four componments:
- graph
- scalar
- image
- histogram
### graph
Compatible with ONNX (Open Neural Network Exchange) [https://github.com/onnx/onnx]. VisualDL is compatible with the mainstream DNN platforms such as PaddlePaddle, Pytorch, and MXNet through Python SDK.
<palign="center">
<imgsrc="./images/introduction_graph.png"/>
</p>
### scalar
Show the error trend throughout the training.
<palign="center">
<imgsrc="./images/introduction_scalar.png"/>
</p>
### image
To visualize any tensor, or model generated images
<palign="center">
<imgsrc="./images/introduction_image.png"/>
</p>
### histogram
To visualize the distribution of elements in any tensor
<palign="center">
<imgsrc="./images/introduction_histogram.png"/>
</p>
## SDK
VisualDL also provides Python SDK and C++ SDK for different platforms.
### Python SDK
Take the simplest Scalar component, for example, to try to create a scalar component and log the data:
```python
importrandom
fromvisualdlimportLogWriter
logdir="./tmp"
logger=LogWriter(dir,sync_cycle=10)
# mark the components with 'train' label.
withlogger.mode("train"):
# create a scalar component called 'scalars/scalar0'
scalar0=logger.scalar("scalars/scalar0")
# add some records during DL model running, lets start from another block.
withlogger.mode("train"):
# add scalars
forstepinrange(100):
scalar0.add_record(step,random.random())
```
### C++ SDK
The same code for C++ SDK in the above Python SDK is as follows
```c++
#include <cstdlib>
#include <string>
#include "visualdl/sdk.h"
namespacevs=visualdl;
namepsacecp=visualdl::components;
intmain(){
conststd::stringdir="./tmp";
vs::LogWriterlogger(dir,10);
logger.SetMode("train");
autotablet=logger.NewTablet("scalars/scalar0");
cp::Scalar<float>scalar0(tablet);
for(intstep=0;step<1000;step++){
floatv=(float)std::rand()/RAND_MAX;
scalar0.AddRecord(step,v);
}
return0;
}
```
## Activate Board
When the log data has been generated during the training process, the board can be started for real-time data visualization.
```
visualDL --logdir <some log dir>
```
the Board supports configuration of remote access.