我有一个存储在本地磁盘上的图像数据集,我将其命名为:
path = '../input/resized/Resized Dataset.zip/Resized Data'
我正在使用以下代码从 fastai.vision 库中调用 ImageDataBunch 的一个实例:
data = ImageDataBunch.from_folder(path, train=".", ds_tfms=get_transforms(),size=224, valid_pct=0.2)
但由于某种原因,我收到了一个错误
File "../src/script.py", line 17, in <module>
data = ImageDataBunch.from_folder(path, train=".", ds_tfms=get_transforms(),size=20, valid_pct=0.2)
File "/opt/conda/lib/python3.6/site-packages/fastai/vision/data.py", line 110, in from_folder
src = src.label_from_folder(classes=classes)
File "/opt/conda/lib/python3.6/site-packages/fastai/data_block.py", line 463, in _inner
self.train = ft(*args, from_item_lists=True, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/fastai/data_block.py", line 292, in label_from_folder
label_cls=label_cls, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/fastai/data_block.py", line 287, in label_from_func
return self._label_from_list([func(o) for o in self.items], label_cls=label_cls, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/fastai/data_block.py", line 262, in _label_from_list
label_cls = self.get_label_cls(labels, label_cls=label_cls, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/fastai/data_block.py", line 251, in get_label_cls
it = index_row(labels,0)
File "/opt/conda/lib/python3.6/site-packages/fastai/core.py", line 250, in index_row
3.5s
3
return a[idxs]
IndexError: index 0 is out of bounds for axis 0 with size 0
我使用了多个不同的数据集并且遇到了同样的问题