Search code examples
tensorflowtensorboard

Tensorboard: Plot loss curves of mutiple models together


In tensorboard, it is easy to display the loss curve of a single CNN model. If I trained two models seperately (inception-v4 and ResNet, for example) and I want to plot loss curves of those at the same time(like the figure shown below), what should I do? enter image description here


Solution

  • I think You can achieve this by creating two separate FileWriters - one for each model:

    inceptionWriter = tf.summary.FileWriter('/tmp/TensorBoards/example/inception4')
    ResnetWriter = tf.summary.FileWriter('/tmp/TensorBoards/example/ResNet')
    

    And then using those writers to add summaries for inpection and ResNet models respectively.

    inceptionWriter.add_summary(loss_summary, step)
    *
    *
    *
    ResnetWriter.add_summary(loss_summary, step)
    

    The only thing left to do is to run tensorBoard using
    command tensorboard --logdir=/tmp/TensorBoards/example TensorBoard will automatically combine data in one plot

    In my case it looks like this

    BTW There is really interesting demo of basic tensorboard capabilities presented by one of google's developers https://www.youtube.com/watch?v=eBbEDRsCmv4&t=773s