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

Generator does not consider .h5 files of varying lengths #5

Open
vitoriapacela opened this issue Mar 22, 2018 · 3 comments
Open

Generator does not consider .h5 files of varying lengths #5

vitoriapacela opened this issue Mar 22, 2018 · 3 comments

Comments

@vitoriapacela
Copy link
Contributor

gen_from_data() seems to assume that all the HDF5 files in the given directory path have the same number of samples.

@DannyWeitekamp
Copy link
Owner

DannyWeitekamp commented Mar 22, 2018 via email

@vitoriapacela
Copy link
Contributor Author

vitoriapacela commented Mar 23, 2018

I was doing model.fit_generator() and I got the following error:

ValueError                                Traceback (most recent call last)
<ipython-input-15-f1360b97f12e> in <module>()
      4                            nb_val_samples=val_samples, verbose=1,
      5                            callbacks=[EarlyStopping(monitor='val_loss', patience=8, verbose=1, mode='min')
----> 6                            , ModelCheckpoint(filepath='/nfshome/vitoriabp/gpu-4-culture-plate-sm/new_ds_notebooks/fix_pi0_dnn.h5', monitor='val_loss', verbose=0, save_best_only=True, mode='min')]
      7                             )

/usr/local/lib/python2.7/dist-packages/keras/engine/training.pyc in fit_generator(self, generator, samples_per_epoch, nb_epoch, verbose, callbacks, validation_data, nb_val_samples, class_weight, max_q_size, nb_worker, pickle_safe, initial_epoch)
   1530                                          '(x, y, sample_weight) '
   1531                                          'or (x, y). Found: ' +
-> 1532                                          str(generator_output))
   1533                     if len(generator_output) == 2:
   1534                         x, y = generator_output

ValueError: output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: None

I checked the shapes of the gen_from_data objects I had created and they were correct. I got rid of the error after removing from my train directory the files that contained less samples.

@DannyWeitekamp
Copy link
Owner

DannyWeitekamp commented Mar 23, 2018 via email

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

2 participants