在一张图中绘制多个图

在一张图中绘制多个图

本文介绍了使用 Tensorboard 在一张图中绘制多个图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有 Tensorflow 后端的 Keras.我的工作涉及在我的数据集上比较多个模型(如 Inception、VGG、Resnet 等)的性能.我想在一张图中绘制多个模型的训练精度.我正在尝试在 Tensorboard 中执行此操作,但它不起作用.

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.

有没有办法使用 Tensorboard 在一个图中绘制多个图形,或者有其他方法可以做到这一点?

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

谢谢

推荐答案

如果您使用的是 SummaryWriter 来自 tensorboardX 或 pytorch 1.2,您有一个名为 add_scalars:

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

这样称呼它:

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

它会像这样显示:

小心 add_scalars 会干扰你的运行组织:它会向这个列表添加多个条目(从而造成混乱):

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):

我建议您这样做:

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)

这篇关于使用 Tensorboard 在一张图中绘制多个图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 16:43