Update mini_car_bikes_detection.py
Browse files- mini_car_bikes_detection.py +11 -8
mini_car_bikes_detection.py
CHANGED
@@ -90,22 +90,25 @@ class MiniCarBikesDetection(datasets.GeneratorBasedBuilder):
|
|
90 |
# image_id_to_annotations = collections.defaultdict(list)
|
91 |
# id = []
|
92 |
for image_file in image_files:
|
93 |
-
objects = {
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
}
|
98 |
image_name = image_file[0].split("/")[1]
|
99 |
for annotation in annotations:
|
100 |
if image_name == annotation["image"]:
|
101 |
-
objects["category"].append(annotation["name"])
|
102 |
-
objects["bbox"].append(float(n) for n in annotation["bbox"])
|
103 |
yield image_file, {
|
104 |
"image": {"path": image_file[0], "bytes": image_file[1].read()},
|
105 |
"image_name": image_name,
|
106 |
"width": annotation["width"],
|
107 |
"height": annotation["height"],
|
108 |
-
"objects":
|
|
|
|
|
|
|
109 |
}
|
110 |
|
111 |
|
|
|
90 |
# image_id_to_annotations = collections.defaultdict(list)
|
91 |
# id = []
|
92 |
for image_file in image_files:
|
93 |
+
# objects = {
|
94 |
+
# # "id": [],
|
95 |
+
# "category": [],
|
96 |
+
# "bbox": [],
|
97 |
+
# }
|
98 |
image_name = image_file[0].split("/")[1]
|
99 |
for annotation in annotations:
|
100 |
if image_name == annotation["image"]:
|
101 |
+
# objects["category"].append(annotation["name"])
|
102 |
+
# objects["bbox"].append(float(n) for n in annotation["bbox"])
|
103 |
yield image_file, {
|
104 |
"image": {"path": image_file[0], "bytes": image_file[1].read()},
|
105 |
"image_name": image_name,
|
106 |
"width": annotation["width"],
|
107 |
"height": annotation["height"],
|
108 |
+
"objects": {
|
109 |
+
"category": annotation["name"],
|
110 |
+
"bbox": annotation["bbox"]
|
111 |
+
}
|
112 |
}
|
113 |
|
114 |
|