LightlyDataset with filenames bug on subfoldersSee original GitHub issue
LightlyDataset with filenames bug on subfolders
dataset = LightlyDataset(
I get an error when
filenames doesn’t contain at least one image from every subfolder, e.g.
filenames=[subfolder_1/img0.png'] will fail.
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Probably torchvision just assumes the directory
./test/.ipynb_checkpointsshould contain images when that’s obviously not true.
You can see all the directories in
./testwith the command
ls -a ./test
To fix your problem simply remove the
yep, have alread found out, forgot to edit the comment! Thanks anyways and keep up with the good work 😄
I have discussed this issue in length with some developers from torchvision: https://github.com/pytorch/vision/issues/4925
The key takeaway is: Do not use
LightlyDataset(input_dir) on input_dirs which contain subdirectories without images. This is needed to ensures that the labels returned when iterating over the
LightlyDataset are continuous, start with 0 and that there is at least one image for every label.