(dir, max_dataset_size=float("inf"))
| 21 | |
| 22 | |
| 23 | def make_dataset(dir, max_dataset_size=float("inf")): |
| 24 | images = [] |
| 25 | assert os.path.isdir(dir), '%s is not a valid directory' % dir |
| 26 | |
| 27 | for root, _, fnames in sorted(os.walk(dir)): |
| 28 | for fname in fnames: |
| 29 | if is_image_file(fname): |
| 30 | path = os.path.join(root, fname) |
| 31 | images.append(path) |
| 32 | return images[:min(max_dataset_size, len(images))] |
| 33 | |
| 34 | |
| 35 | def default_loader(path): |
no test coverage detected