Lesson 2 - Empty Generator

I have built my own dataset containing two categories, each having 14 images.
I forgot to choose the same size for all the images so that could also be an issue but
when i fit the model this is the error i get:

UserWarning: Your generator is empty.
warn(“Your generator is empty.”)

Also facing errors when running these two snippets:

bears = bears.new(item_tfms=RandomResizedCrop(128, min_scale=0.3))
dls = bears.dataloaders(path)
dls.train.show_batch(max_n=4, nrows=1, unique=True)

and

bears = bears.new(item_tfms=RandomResizedCrop(128, min_scale=0.3))
dls = bears.dataloaders(path)
dls.train.show_batch(max_n=4, nrows=1, unique=True)

Running this code without any limitations on number, gives me just 5 images

dls.valid.show_batch(max_n=4, nrows=1)

The issue is your batch size. When training we drop the last incomplete set for the training DataLoader. So a batch size of up to 4-6 would be okay but I wouldn’t go higher

1 Like

Wouldn’t choosing such a small dataset be prone to overfitting?

I used a batch of 6 images this time and it still gives the same error.

dls.valid.show_batch(max_n=4, nrows=1)

This just shows 2 images now.

I had the same problem with you.I add the number of image and solve it,you can have a try i think.