ValueError: If printing histograms, validation_data must be provided, and cannot be a generator.

网友投稿 298 2022-11-29

ValueError: If printing histograms, validation_data must be provided, and cannot be a generator.

今天在用tensorboard的时候遇见了下面的错误:

Traceback (most recent call last): File "vgg16_finetune.py", line 368, in callbacks=[tbCallBack,csvlog,checkpointer]) File "/home/eric/anaconda3/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/home/eric/anaconda3/lib/python3.6/site-packages/keras/engine/training.py", line 2280, in fit_generator callbacks.on_epoch_end(epoch, epoch_logs) File "/home/eric/anaconda3/lib/python3.6/site-packages/keras/callbacks.py", line 77, in on_epoch_end callback.on_epoch_end(epoch, logs) File "/home/eric/anaconda3/lib/python3.6/site-packages/keras/callbacks.py", line 820, in on_epoch_end raise ValueError('If printing histograms, validation_data must be 'ValueError: If printing histograms, validation_data must be provided, and cannot be a generator.

我的tensorboard的代码为:

tbCallBack = TensorBoard(log_dir=TENSORBOARD_PATH, histogram_freq=10, write_graph=True, write_images=True)#* tensorboard --logdir path_to_current_dir/Graph --port 8080 print("tensorboard --logdir {} --port 8080".format(TENSORBOARD_PATH))

解决办法

直接把histogram置为0,就行了,我的环境是keras2.1.4, ubuntu 16.04

tbCallBack = TensorBoard(log_dir=TENSORBOARD_PATH, histogram_freq=0, write_graph=True, write_images=True)#* tensorboard --logdir path_to_current_dir/Graph --port 8080 print("tensorboard --logdir {} --port 8080".format(TENSORBOARD_PATH))

参考文献

[1].TensorBoard callback does not create histograms when a generator is used to create validation data. ​​autoencoder with Tensorflow Dataset API and logging to Tensorboard. ​​https://stackoverflow.com/questions/54953883/keras-autoencoder-with-tensorflow-dataset-api-and-logging-to-tensorboard​​

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Java程序中方法的用法重载和递归
下一篇:[leetcode] 474. Ones and Zeroes
相关文章

 发表评论

暂时没有评论,来抢沙发吧~