Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xiaofengqing opened this issue Nov 9, 2017 · 11 comments

Comments

@xiaofengqing
Copy link

After i trained the first epoch,i meet this error
File "/home/s405/pengcheng/project/Keras-FCN/train.py", line 232, in
label_suffix=label_suffix, ignore_label=ignore_label, label_cval=label_cval)
File "/home/s405/pengcheng/project/Keras-FCN/train.py", line 164, in train
class_weight=class_weight
File "/usr/local/lib/python3.4/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/keras/engine/training.py", line 2082, in fit_generator
callbacks.on_epoch_end(epoch, epoch_logs)
File "/usr/local/lib/python3.4/dist-packages/keras/callbacks.py", line 77, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/usr/local/lib/python3.4/dist-packages/keras/callbacks.py", line 751, 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.

I don't know how to fix this problem, can you give me some suggestions?

@zwlshine
Copy link

zwlshine commented Nov 9, 2017

I have also meet this error and I could not solve it yet ! Need help also!

@zwlshine
Copy link

@xiaofengqing Comment out this code: # if K.backend() == 'tensorflow':
# tensorboard = TensorBoard(log_dir=os.path.join(save_path, 'logs'), histogram_freq=10, write_graph=True)
# callbacks.append(tensorboard)

Then it can run.

@IsaacTegeler
Copy link

Change histogram_freq=10 to histogram_freq=0 you can still use tensor board with this fix rather than removing it all together.

@peachthiefmedia
Copy link

It is general issue with keras/tboard that you cannot get histograms with a validation_generator, changing histogram_freq=0 stops it trying to produce them.

@NoushNabi
Copy link

@zwlshine
I tried following lines and did not work for me.
if K.backend() == 'tensorflow':
tensorboard = TensorBoard(log_dir=os.path.join(save_path, 'logs'), histogram_freq=10, write_graph=True)
callbacks.append(tensorboard)

@IsaacIsOkay
When I turned histogram_freq to zero, it worked.

niuliang42 added a commit to niuliang42/Keras-FCN that referenced this issue Apr 20, 2018
@mueller91
Copy link

mueller91 commented Aug 2, 2018

How is turning histogram_freq to zero a fix?! I need those histograms.

@peachthiefmedia
Copy link

@mueller91 you can pass validation data separately to generate the histograms I think in a separate step, but yeah it isn't whats needed really.

@MaximilianPavon
Copy link

@mueller91 I am not sure if you still have this issue, but this issue keras-team/keras#3358 and the suggested solution by juiceboxjoe helped me.

@lucy9410
Copy link

Change histogram_freq=10 to histogram_freq=0 you can still use tensor board with this fix rather than removing it all together.

the original callbacks.py is with histogram_freq=0, but i still have ValueError: If printing histograms, validation_data must be provided, and cannot be a generator.

@guysoft
Copy link

guysoft commented Dec 20, 2018

Is there a method from a validation generator, that would just spit out a bunch of them to test with?
something along the line of get_validation(validation_generator) that would return what we need to add there?

@WittmannF
Copy link

It is general issue with keras/tboard that you cannot get histograms with a validation_generator, changing histogram_freq=0 stops it trying to produce them.

What's the issue? Why it is not possible when the validation set is a generator?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants