:beers: Update extensions.
Browse files- image-folder.py +5 -3
image-folder.py
CHANGED
@@ -19,7 +19,7 @@ class CatsAndDogs(datasets.GeneratorBasedBuilder):
|
|
19 |
|
20 |
if folder is None:
|
21 |
raise RuntimeError()
|
22 |
-
|
23 |
classes = sorted([x.name.lower() for x in Path(folder).glob('*/**')])
|
24 |
|
25 |
return datasets.DatasetInfo(
|
@@ -48,5 +48,7 @@ class CatsAndDogs(datasets.GeneratorBasedBuilder):
|
|
48 |
def _generate_examples(self, archive_path):
|
49 |
labels = self.info.features['labels']
|
50 |
logger.info("generating examples from = %s", archive_path)
|
51 |
-
|
52 |
-
|
|
|
|
|
|
19 |
|
20 |
if folder is None:
|
21 |
raise RuntimeError()
|
22 |
+
|
23 |
classes = sorted([x.name.lower() for x in Path(folder).glob('*/**')])
|
24 |
|
25 |
return datasets.DatasetInfo(
|
|
|
48 |
def _generate_examples(self, archive_path):
|
49 |
labels = self.info.features['labels']
|
50 |
logger.info("generating examples from = %s", archive_path)
|
51 |
+
extensions = {'.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif', '.tiff', '.webp'}
|
52 |
+
for i, path in enumerate(Path(archive_path).glob('**/*')):
|
53 |
+
if path.suffix in extensions:
|
54 |
+
yield i, {'file': path.as_posix(), 'labels': labels.encode_example(path.parent.name.lower())}
|