Mark III Systems Blog

Keras Tensorboard Callback – See What’s Happening As It’s Happening

This post is part 3 of my 4 part series on Keras Callbacks. A callback is an object that can perform actions at various stages of training and is specified when the model is trained using In today's post, I give a very brief overview of the Tensorboard callback.

Graphs showing training and validation accuracy and loss. Image from

If you are reading this post, then chances are that you have heard of Tensorboard. It is a great visualization tool that works with Tensorflow to allow you to visualize what is going on in the background while your job is running.  You can see nice graphs of loss and accuracy, as well as visualizations of your neural network. It has other features as well, but I'll only mention these for now.  Take a few minutes to explore it.  It is worth the time!


Visualization of neural network

While there are multiple arguments that the Tensorboard callback can take, the one I want to discuss today is the log_dir.  log_dir allows you to specify the directory where the Tensorboard log files are saved. The files in this directory are read by Tensorboard to create the visualizations.  This comes in very handy when you are train with different models or with different hyperparameters. Simply specify different directories and you are all set. If the directory does not exist, it will be created when the callback is used.

Here is a short snippet of code that creates and uses the callback. Since this particular job is doing linear regression with 100,000 datapoints, I add that to the directory name.  The newly created directory looks something like this.


Now we have the Tensorboard log files being written to a very specific directory that clearly tracks the specific training job. This is a great way to keep up with what you have done!