Getting following error when loading data using ImageDataBunch.from_folder

directories in path are -train,test and val

bs = 4 # batch size
img_size = 224 # image size
tfms = get_transforms(do_flip=False, flip_vert=False, max_rotate=0.0, max_zoom=0.0, max_lighting=0.0, max_warp=0.0, p_affine=0.0, p_lighting=0.0)
data = ImageDataBunch.from_folder(path, ds_tfms=tfms, bs = bs,num_workers=0,valid=‘val’,test=‘test’)

normalising the dataset using the same normalisation applied to the imagenet dataset

data.normalize(imagenet_stats)


IndexError Traceback (most recent call last)
in ()
2 img_size = 224 # image size
3 tfms = get_transforms(do_flip=False, flip_vert=False, max_rotate=0.0, max_zoom=0.0, max_lighting=0.0, max_warp=0.0, p_affine=0.0, p_lighting=0.0)
----> 4 data = ImageDataBunch.from_folder(path, ds_tfms=tfms, bs = bs,num_workers=0,valid=‘val’,test=‘test’)
5 # normalising the dataset using the same normalisation applied to the imagenet dataset
6 data.normalize(imagenet_stats)

~/anaconda3/envs/py36/lib/python3.6/site-packages/fastai/vision/data.py in from_folder(cls, path, train, valid, valid_pct, classes, **kwargs)
109 path=Path(path)
110 il = ImageItemList.from_folder(path)
–> 111 if valid_pct is None: src = il.split_by_folder(train=train, valid=valid)
112 else: src = il.random_split_by_pct(valid_pct)
113 src = src.label_from_folder(classes=classes)

~/anaconda3/envs/py36/lib/python3.6/site-packages/fastai/data_block.py in split_by_folder(self, train, valid)
148 def split_by_folder(self, train:str=‘train’, valid:str=‘valid’)->‘ItemLists’:
149 “Split the data depending on the folder (train or valid) in which the filenames are.”
–> 150 return self.split_by_idxs(self._get_by_folder(train), self._get_by_folder(valid))
151
152 def random_split_by_pct(self, valid_pct:float=0.2, seed:int=None)->‘ItemLists’:

~/anaconda3/envs/py36/lib/python3.6/site-packages/fastai/data_block.py in _get_by_folder(self, name)
144
145 def _get_by_folder(self, name):
–> 146 return [i for i in range_of(self) if self.items[i].parts[self.num_parts]==name]
147
148 def split_by_folder(self, train:str=‘train’, valid:str=‘valid’)->‘ItemLists’:

~/anaconda3/envs/py36/lib/python3.6/site-packages/fastai/data_block.py in (.0)
144
145 def _get_by_folder(self, name):
–> 146 return [i for i in range_of(self) if self.items[i].parts[self.num_parts]==name]
147
148 def split_by_folder(self, train:str=‘train’, valid:str=‘valid’)->‘ItemLists’:

IndexError: index 0 is out of bounds for axis 0 with size 0

I’m also getting the same error. Have you solved this

I get the same error, how was this solved?