Tylersuard
commited on
Commit
·
76318e3
1
Parent(s):
7ef56ff
Update PathfinderX2.py
Browse files- PathfinderX2.py +6 -5
PathfinderX2.py
CHANGED
@@ -89,19 +89,20 @@ class PathfinderX2(datasets.GeneratorBasedBuilder):
|
|
89 |
]
|
90 |
|
91 |
def _generate_examples(self, data, split):
|
92 |
-
if split == "
|
93 |
images, annotations = data
|
94 |
-
|
|
|
95 |
# loads the annotations for the split into RAM (less than 100 MB) to support streaming
|
96 |
for path_annot, file_annot in annotations:
|
97 |
if path_annot.endswith(".png"):
|
98 |
image_id = os.path.basename(path_annot).split(".")[0]
|
99 |
-
|
100 |
for idx, (path_img, file_img) in enumerate(images):
|
101 |
if path_img.endswith(".png"):
|
102 |
image_id = os.path.basename(path_img).split(".")[0]
|
103 |
-
path_annot, bytes_annot =
|
104 |
yield idx, {
|
105 |
"image": {"path": path_img, "bytes": file_img.read()},
|
106 |
-
"annotation":
|
107 |
}
|
|
|
89 |
]
|
90 |
|
91 |
def _generate_examples(self, data, split):
|
92 |
+
if split == "training":
|
93 |
images, annotations = data
|
94 |
+
image_dict = {}
|
95 |
+
annotation_dict = {}
|
96 |
# loads the annotations for the split into RAM (less than 100 MB) to support streaming
|
97 |
for path_annot, file_annot in annotations:
|
98 |
if path_annot.endswith(".png"):
|
99 |
image_id = os.path.basename(path_annot).split(".")[0]
|
100 |
+
annotation_dict[image_id] = (path_annot, file_annot.read())
|
101 |
for idx, (path_img, file_img) in enumerate(images):
|
102 |
if path_img.endswith(".png"):
|
103 |
image_id = os.path.basename(path_img).split(".")[0]
|
104 |
+
path_annot, bytes_annot = image_dict[image_id]
|
105 |
yield idx, {
|
106 |
"image": {"path": path_img, "bytes": file_img.read()},
|
107 |
+
"annotation": {"path": path_annot, "bytes": file_annot.read()}
|
108 |
}
|