在命令行中启动 tensorboard 后,会报如下错误:
Found more than one graph event per run, or there was a metagraph containing a graph_def, as well as one or more graph events. Overwri
ting the graph with the newest event.
Found more than one metagraph event per run. Overwriting the metagraph with the newest event.
出现错误原因:由于多次运行程序,之前的logs一直保留着,新的logs只是续写,没有覆盖,所以tensorflow报出提醒,你点开tensorboard后会发现你的loss图有些奇怪。
解决办法:在你训练之前,可以将文件中的内容删除,代码如下:
import tensorflow as tf
logdir = './logs/'
if tf.gfile.Exists(logdir):
tf.gfile.DeleteRecursively(logdir)