Plot multiple graphs in one plot using Tensorboard

Kavitha Devan picture Kavitha Devan · Feb 23, 2018 · Viewed 19.7k times · Source

I am using Keras with Tensorflow backend. My work involves comparing the performances of several models such as Inception, VGG, Resnet etc on my dataset. I would like to plot the training accuracies of several models in one graph. I am trying to do this in Tensorboard, but it is not working.

Is there a way of plotting multiple graphs in one plot using Tensorboard or is there some other way I can do this?

Thank you

Answer

Benjamin Crouzier picture Benjamin Crouzier · Aug 22, 2019

If you are using the SummaryWriter from tensorboardX or pytorch 1.2, you have a method called add_scalars:

Call it like this:

my_summary_writer.add_scalars(f'loss/check_info', {
    'score': score[iteration],
    'score_nf': score_nf[iteration],
}, iteration)

And it will show up like this:

tensorboard image


Be careful that add_scalars will mess with the organisation of your runs: it will add mutliple entries to this list (and thus create confusion):

tensorboard image

I would recommend that instead you just do:

my_summary_writer.add_scalar(f'check_info/score',    score[iter],    iter)
my_summary_writer.add_scalar(f'check_info/score_nf', score_nf[iter], iter)