This is the 20th day of my participation in the August Text Challenge.More challenges in August

An introduction to the

Tensorboard was originally a visualization tool for TensorFlow, and other deep learning computing frameworks can also use Tensorboard for visualization. In cases where PyTorch’s native visualization tools are not friendly enough, TensorboardX is recommended for PyTorch’s modeling visualization. You can quickly draw the basic structure of the model, observe the dynamic changes of model evaluation indicators during the training process, and observe the image data. You can call the Tensorboard in the torch. Utils module. It needs to be installed separately. TensorBoard uses a model that starts the service locally, logs the results locally, and reads the results on the Web, which is very different from the model that generates the results locally and reads them instantly in the REPL environment.

Ii. Follow the Steps

If TensorFlow has been installed, the Tensorboard is automatically installed during TensorFlow installation. You can use the Tensorboard directly afterwards. Of course, students who only have PyTorch installed can use the following steps to separate The TensorboardX component:

2.1 Select a new Luncher in jupyterLab

2.2 Select create a Terminal

2.3 Installation using PIP

2.4 Check whether the installation is successful

Import related packages. If no error message is displayed, the installation is successful

from torch.utils.tensorboard import SummaryWriter
Copy the code

Three Tensorboard use

Real production environment, large-scale deep learning model is deployed on the server running, not like drawing in the local IDE while input data observation, only will need to record the key results recorded and stored in a file, and then in the local or open a service on the server to read the file information. As a result, the whole process is a little more complicated than drawing locally, but it is a mainstream operation in a real production environment.

Writer = SummaryWriter(log_dir='test') writer.log_dir # View the summary object record file locationCopy the code

Enter in Terminal

tensorboard --logdir="test"  
Copy the code

To invoke the service, open port TensorBoard 2.6.0 at http://localhost:6006/ (Press CTRL+C to quit) Enter localhost:6006 in the address bar to go to the TensorBoard display page. We’ve already recorded a set of data via write, and you can see the results.

  • If the default port 6006 conflicts, you can also change the service port number by entering the parameter –port XXXX after running the command.
  • Graphics can be easily manipulated. At the most basic level, we can hold down the Alt key, scroll the mouse wheel to zoom in and out, and drag and drop them with the left mouse button
  • Tensorboard has only recorded a line chart, but in fact the core application scenario of ADD_Scalar method is used to record the changes of some numerical indicators, such as loss value and accuracy value, with the increase of the number of iterations during the operation of the model. In any case, we need to know that Tensorboard’s core application scenario is a visual representation of the deep learning modeling process.