Loading the same data with different approaches

Hello,

I am using two different techniques to create my dataset:

data1 = ImageDataBunch.from_folder(path=Path('../data').resolve(), train='train', valid='validation', dl_tfms=get_transforms(), num_workers=0, bs=64, size=224).normalize(imagenet_stats)

and

data2 = ImageImageList.from_folder(path=Path('../data').resolve()).split_by_folder(train='train', valid='validation').label_from_folder().transform(get_transforms(), size=224).databunch(num_workers=0, bs=64).normalize(imagenet_stats)

According to the documentation, I should get the same result from both. But I get the following error when I use the second method.

You can deactivate this warning by passing `no_check=True`.
/opt/conda/lib/python3.6/site-packages/fastai/basic_data.py:247: UserWarning: There seems to be something wrong with your dataset, for example, in the first batch can't access any element of self.train_ds.
Tried: 919,143,513,936,593...
  warn(warn_msg)

Can anyone point out to where I am making a mistake here? I feel it is the .label_from_folder() method which is doing something different in the second technique.

I’m getting the same error when using “.label_from_df”

It only started happening after I updated to the latest fastai version

Try swapping ImageImageList for ImageList, that worked for me!

Thank you! I got confused between ImageImageList and ImageList and was using the wrong one.

2 Likes