Update mmod2.py
Browse files
mmod2.py
CHANGED
|
@@ -73,8 +73,10 @@ class Mmod2(datasets.GeneratorBasedBuilder):
|
|
| 73 |
),
|
| 74 |
]
|
| 75 |
|
| 76 |
-
def _generate_examples(self, images, metadata_path):
|
| 77 |
"""Generate images and labels for splits."""
|
|
|
|
|
|
|
| 78 |
with open(metadata_path, encoding="utf-8") as f:
|
| 79 |
files_to_keep = set(f.read().split("\n"))
|
| 80 |
|
|
|
|
| 73 |
),
|
| 74 |
]
|
| 75 |
|
| 76 |
+
def _generate_examples(self, images, metadata_path=None, split_key="train"):
|
| 77 |
"""Generate images and labels for splits."""
|
| 78 |
+
|
| 79 |
+
metadata_path = "validation.txt" if split_key == "validation" else "train.txt"
|
| 80 |
with open(metadata_path, encoding="utf-8") as f:
|
| 81 |
files_to_keep = set(f.read().split("\n"))
|
| 82 |
|