While the progress bar we used in the first example of this chapter displayed useful information, we might want to access more detailed graphs. TensorFlow provides a powerful tool for monitoring—TensorBoard. Installed by default with TensorFlow, it is also very easy to use when combined with Keras's callbacks:
callbacks = [tf.keras.callbacks.TensorBoard('./logs_keras')]
model.fit(x_train, y_train, epochs=5, verbose=1, validation_data=(x_test, y_test), callbacks=callbacks)
In this updated code, we pass the TensorBoard callback to the model.fit() method. By default, TensorFlow will automatically write the loss and the metrics to the folder we specified. We can then launch TensorBoard from the command line:
$ tensorboard --logdir ./logs_keras
This command outputs a URL that we can then open to display the TensorBoard interface. In the Scalars tab, we can find graphs displaying the loss and the accuracy:
Figure 2.5: Two graphs displayed by TensorBoard during...