张量板-叠加2个图 [英] Tensorboard- superimpose 2 plots
问题描述
在张量板上,我想在同一张图上叠加2个图(神经网络的训练和验证损失).
In tensorboard, I would like to superimpose 2 plots on the same graph (training and validation losses of a neural network).
我可以看到2个单独的图,但是看不到有2条叠加曲线的图.否则,我会在锯齿形中得到一个积.
I can see 2 separate plots, but not one plot with 2 superimposed curves. Otherwise, I get one plot in zigzag.
我该怎么办?
推荐答案
可以在Tensorboard中叠加两个图.您必须满足以下两个条件:
It is possible to superimpose two plots in Tensorboard. You'll have to satisfy both of the following:
-
创建两个单独的
tf.train.SummaryWriter
对象,以使其在两个文件夹中输出.
Create two separate
tf.train.SummaryWriter
objects such that it outputs in two folders.
用相同的名称创建两个摘要(例如tf.scalar_summary
).
Create two summaries (e.g. tf.scalar_summary
) with the same name.
例如,绘制训练和验证损失的图:
For example to plot training and validation loss:
# Before training
train_summary = tf.scalar_summary('Loss', train_loss)
vali_summary = tf.scalar_summary('Loss', vali_loss)
train_writer = tf.train.SummaryWriter('/tmp/train'), sess.graph)
vali_writer = tf.train.SummaryWriter('/tmp/vali'), sess.graph)
# And then later
train_writer.add_summary(...)
vali_writer.add_summary(...)
这篇关于张量板-叠加2个图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!