aurora95 / Keras-FCN

Keras-tensorflow implementation of Fully Convolutional Networks for Semantic Segmentation(Unfinished)
MIT License
650 stars 268 forks source link

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

Open xiaofengqing opened 7 years ago

xiaofengqing commented 7 years ago

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 commented 7 years ago

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

zwlshine commented 7 years ago

@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 commented 7 years ago

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

peachthiefmedia commented 6 years ago

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 commented 6 years ago

@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.

mueller91 commented 6 years ago

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

peachthiefmedia commented 6 years ago

@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 commented 6 years ago

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

lucy9410 commented 6 years ago

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 commented 5 years ago

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 commented 5 years ago

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?