Tensorboard- 叠加 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(...)
这篇关于Tensorboard- 叠加 2 个图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!