Commit 8fe6e45a authored by NC Cullen's avatar NC Cullen Committed by Soumith Chintala
Browse files

recursive dir walking (#80)

parent c0a6cfe1
...@@ -28,11 +28,12 @@ def make_dataset(dir, class_to_idx): ...@@ -28,11 +28,12 @@ def make_dataset(dir, class_to_idx):
if not os.path.isdir(d): if not os.path.isdir(d):
continue continue
for filename in os.listdir(d): for root, _, fnames in sorted(os.walk(d)):
if is_image_file(filename): for fname in fnames:
path = '{0}/{1}'.format(target, filename) if is_image_file(fname):
item = (path, class_to_idx[target]) path = os.path.join(root, fname)
images.append(item) item = (path, class_to_idx[target])
images.append(item)
return images return images
......
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