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