Errors with Torchvision

How to solve this type of runtime error…?!

T.CenterCrop(image_size),
4 T.ToTensor(),
----> 5 T.Normalize(*stats)]))
6

/opt/conda/lib/python3.7/site-packages/torchvision/datasets/folder.py in init(self, root, transform, target_transform, loader, is_valid_file)
204 transform=transform,
205 target_transform=target_transform,
–> 206 is_valid_file=is_valid_file)
207 self.imgs = self.samples

/opt/conda/lib/python3.7/site-packages/torchvision/datasets/folder.py in init(self, root, loader, extensions, transform, target_transform, is_valid_file)
96 if len(samples) == 0:
97 raise (RuntimeError("Found 0 files in subfolders of: " + self.root + “\n”
—> 98 "Supported extensions are: " + “,”.join(extensions)))
99
100 self.loader = loader

RuntimeError: Found 0 files in subfolders of: …/input/stanford-cars-dataset/cars_train/cars_train
Supported extensions are: .jpg,.jpeg,.png,.ppm,.bmp,.pgm,.tif,.tiff,.webp

As the error says… There are no images in given directory. Make sure it’s correct.

My suspicion is you doubled the cars_train directory when giving the path during creation of dataset.

1 Like