Commit c6fbadc5 authored by Soumith Chintala's avatar Soumith Chintala Committed by Soumith Chintala
Browse files

check for non-zero number of images in ImageFolder

parent f0a13fdc
...@@ -47,6 +47,9 @@ class ImageFolder(data.Dataset): ...@@ -47,6 +47,9 @@ class ImageFolder(data.Dataset):
loader=default_loader): loader=default_loader):
classes, class_to_idx = find_classes(root) classes, class_to_idx = find_classes(root)
imgs = make_dataset(root, class_to_idx) imgs = make_dataset(root, class_to_idx)
if len(imgs) == 0:
raise(RuntimeError("Found 0 images in subfolders of: " + root + "\n"
"Supported image extensions are: " + ",".join(IMG_EXTENSIONS)))
self.root = root self.root = root
self.imgs = imgs self.imgs = imgs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment