Awesome, glad that fixed it!
@KevinB I’m having the same error message and I tried the class_checker
tool you wrote and it seems to work. Would you be able to tell me what I’m doing wrong?
path = Path(r'E:\Data\Processed\WallabiesAndRoos_fa')
data = ImageImageList.from_folder(path)
data = data.split_by_folder(train='train', valid='valid')
This works but when I run
data.label_from_folder()
I get:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
~\anaconda3\envs\pt\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
700 type_pprinters=self.type_printers,
701 deferred_pprinters=self.deferred_printers)
--> 702 printer.pretty(obj)
703 printer.flush()
704 return stream.getvalue()
~\anaconda3\envs\pt\lib\site-packages\IPython\lib\pretty.py in pretty(self, obj)
392 if cls is not object \
393 and callable(cls.__dict__.get('__repr__')):
--> 394 return _repr_pprint(obj, self, cycle)
395
396 return _default_pprint(obj, self, cycle)
~\anaconda3\envs\pt\lib\site-packages\IPython\lib\pretty.py in _repr_pprint(obj, p, cycle)
698 """A pprint that just redirects to the normal repr function."""
699 # Find newlines and replace them with p.break_()
--> 700 output = repr(obj)
701 lines = output.splitlines()
702 with p.group():
~\Documents\GitHub\fastai-pythonic\fastai\data_block.py in __repr__(self)
754
755 def __repr__(self) -> str:
--> 756 return f"{self.__class__.__name__};\n\nTrain: {self.train};\n\nValid: {self.valid};\n\nTest: {self.test}"
757
758 def __getattr__(self, k):
~\Documents\GitHub\fastai-pythonic\fastai\data_block.py in __repr__(self)
985
986 def __repr__(self) -> str:
--> 987 items = [self[i] for i in range(min(5, len(self.items)))]
988 res = f"{self.__class__.__name__} ({len(self.items)} items)\n"
989 res += f"x: {self.x.__class__.__name__}\n{show_some([i[0] for i in items])}\n"
~\Documents\GitHub\fastai-pythonic\fastai\data_block.py in <listcomp>(.0)
985
986 def __repr__(self) -> str:
--> 987 items = [self[i] for i in range(min(5, len(self.items)))]
988 res = f"{self.__class__.__name__} ({len(self.items)} items)\n"
989 res += f"x: {self.x.__class__.__name__}\n{show_some([i[0] for i in items])}\n"
~\Documents\GitHub\fastai-pythonic\fastai\data_block.py in __getitem__(self, idxs)
1027 if isinstance(idxs, Integral):
1028 if self.item is None:
-> 1029 x, y = self.x[idxs], self.y[idxs]
1030 else:
1031 x, y = self.item, 0
~\Documents\GitHub\fastai-pythonic\fastai\data_block.py in __getitem__(self, idxs)
206 idxs = try_int(idxs)
207 if isinstance(idxs, Integral):
--> 208 return self.get(idxs)
209 else:
210 return self.new(self.items[idxs], inner_df=index_row(self.inner_df, idxs))
~\Documents\GitHub\fastai-pythonic\fastai\vision\data.py in get(self, i)
526 def get(self, i):
527 fn = super().get(i)
--> 528 res = self.open(fn)
529 self.sizes[i] = res.size
530 return res
~\Documents\GitHub\fastai-pythonic\fastai\vision\data.py in open(self, fn)
521 "Open image in `fn`, subclass and overwrite for custom behavior."
522 return open_image(
--> 523 fn, convert_mode=self.convert_mode, after_open=self.after_open
524 )
525
~\Documents\GitHub\fastai-pythonic\fastai\vision\image.py in open_image(fn, div, convert_mode, cls, after_open)
617 with warnings.catch_warnings():
618 warnings.simplefilter("ignore", UserWarning) # EXIF warning from TiffPlugin
--> 619 x = PIL.Image.open(fn).convert(convert_mode)
620 if after_open:
621 x = after_open(x)
~\anaconda3\envs\pt\lib\site-packages\PIL\Image.py in open(fp, mode)
2841
2842 if filename:
-> 2843 fp = builtins.open(filename, "rb")
2844 exclusive_fp = True
2845
FileNotFoundError: [Errno 2] No such file or directory: 'kangaroos'
When I run class_checker(path)
I get:
`([Path('E:/Data/Processed/WallabiesAndRoos_fa/valid/kangaroos'), Path('E:/Data/Processed/WallabiesAndRoos_fa/valid/wallabies')], [Path('E:/Data/Processed/WallabiesAndRoos_fa/train/kangaroos'), Path('E:/Data/Processed/WallabiesAndRoos_fa/train/wallabies')])`
I don’t know the details of why the above didn’t work but I found that if I change data = ImageImageList.from_folder(path)
to data = ImageList.from_folder(path)
it works.