Update SkyScenes.py
Browse files- SkyScenes.py +14 -14
SkyScenes.py
CHANGED
|
@@ -94,18 +94,18 @@ class SKYSCENES(datasets.GeneratorBasedBuilder):
|
|
| 94 |
"metadata_path": split_metadata_paths,
|
| 95 |
},
|
| 96 |
),
|
| 97 |
-
]
|
| 98 |
|
| 99 |
-
def _generate_examples(self, images, metadata_path):
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
|
|
|
| 94 |
"metadata_path": split_metadata_paths,
|
| 95 |
},
|
| 96 |
),
|
| 97 |
+
]
|
| 98 |
|
| 99 |
+
def _generate_examples(self, images, metadata_path):
|
| 100 |
+
"""Generate images and labels for splits."""
|
| 101 |
+
with open(metadata_path, encoding="utf-8") as f:
|
| 102 |
+
files_to_keep = set(f.read().split("\n"))
|
| 103 |
+
print('KEEP',files_to_keep)
|
| 104 |
+
for file_path, file_obj in images:
|
| 105 |
+
print('FILE',file_path)
|
| 106 |
+
# if file_path.startswith(_IMAGES_DIR):
|
| 107 |
+
# if file_path[len(_IMAGES_DIR) : -len(".jpg")] in files_to_keep:
|
| 108 |
+
# label = file_path.split("/")[2]
|
| 109 |
+
yield file_path, {
|
| 110 |
+
"image": {"path": file_path, "bytes": file_obj.read()},
|
| 111 |
+
}
|