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: Received an empty batch. Batches should at least contain one item. #102

Open
Spatialghost opened this issue Apr 10, 2019 · 5 comments

Comments

@Spatialghost
Copy link

Hi, i started train model with custom dataset and after 24 epochs i've got error:
Traceback (most recent call last):
File "train_model.py", line 94, in
validation_data=eval_generator, validation_steps=num_eval_examples//batch_size, verbose=2)
File "C:\Python36\lib\site-packages\keras\legacy\interfaces.py", line 87, in wrapper
return func(*args, **kwargs)
File "C:\Python36\lib\site-packages\keras\engine\training.py", line 2169, in fit_generator
use_multiprocessing=use_multiprocessing)
File "C:\Python36\lib\site-packages\keras\legacy\interfaces.py", line 87, in wrapper
return func(*args, **kwargs)
File "C:\Python36\lib\site-packages\keras\engine\training.py", line 2305, in evaluate_generator
raise ValueError('Received an empty batch. '
ValueError: Received an empty batch. Batches should at least contain one item.

batch_size=32

How to solve this problem?

@mitchellspryn
Copy link
Contributor

Is your batch size a multiple of 32?

@Spatialghost
Copy link
Author

Is your batch size a multiple of 32?

I use code without any changes.

@Spatialghost
Copy link
Author

Solved!
Just have to restart.
Different problem now, early stopping after 90 - 100 epochs.

@martsalz
Copy link

martsalz commented Nov 8, 2019

What did you have to restart? I have the problem on several machines.

@kutilanak
Copy link

Solved! Just have to restart. Different problem now, early stopping after 90 - 100 epochs.

AFAIK it doesn't have to complete the training to 500 epoch. If the val_loss did not improve after several epoch, it will automatically stop (early stopping)

u can use the latest model it saved.

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

4 participants