Working with TensorBoard in PyTorch

 TensorBoard is a tool designed for visualizing the results of neural net training runs.  It is a part of Tensorflow, but you don't have to be running or working with Tensorflow to utilize it. PyTorch has specific hooks so you can use TensorBoard to visualize the results of your PyTorch defined and run neural net models.

You could of course be using matplotlib or any other graphing library to directly do this in your PyTorch code.  One nice thing about using TensorBoard instead is that you can work with interactive visualizations in a Jupyter notebook.

But TensorBoard is much more than just a graph plot toolkit.  TensorBoard allows us to directly compare multiple training results in a single graph plot.  This can be very useful for finding the best set of hyperparamters for a model, and can help visualize problems like vanishing or exploding gradients.


Here's a quick intro overview video on Visualization with TensorBoard from PyTorch Developer Day 2020.



Here's a link to TensorBoard on the Tensorflow site.


Here's a tutorial on the PyTorch site on 'Visualizing Models, Data, and Training with TensorBoard.

Here's the documentation in PyTorch for torch.utils.tensorboard (PyTorch's TensorBoard support).


Here's a tutorial video tutorial on how to use TensorBoard with PyTorch. Note that he's using Visual Studio Code on a mac to edit his PyTorch code in this tutorial video (as opposed to using a Jupyter Notebook running on something like colab).


The above tutorial shows how to setup TensorBoard manually.  Note that PyTorch Lightning provides some hooks within Lightning's logger support to make it easier to work with TensorBoard (avoiding quite a bit of the manual coding required in the video tutorial above).

Here's a link to PyTorch Lightning documentation on Loggers (note that TensorBoard is but one of many different loggers that Lightning supports).

Here's a link to Logging in PyTorch Lightning documentation.

Here's a tutorial on working with TensorBoard and PyTorch Lightning on the Learn OpenCV blog site.  Note that this site tries to sell you courses and get you into their newsletter email database so they can send you emails to try and sell you stuff.

Comments

Popular posts from this blog

CycleGAN: a GAN architecture for learning unpaired image to image transformations

Pix2Pix: a GAN architecture for image to image transformation

Smart Fabrics