Update mini_car_bikes_detection.py
Browse files
mini_car_bikes_detection.py
CHANGED
@@ -40,10 +40,10 @@ class MiniCarBikesDetection(datasets.GeneratorBasedBuilder):
|
|
40 |
"image_name": datasets.Value("string"),
|
41 |
"width": datasets.Value("int32"),
|
42 |
"height": datasets.Value("int32"),
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
}
|
48 |
)
|
49 |
|
@@ -82,11 +82,13 @@ class MiniCarBikesDetection(datasets.GeneratorBasedBuilder):
|
|
82 |
image_name = image_file[0].split("/")[1]
|
83 |
for annotation in annotations:
|
84 |
if image_name == annotation["image"]:
|
|
|
85 |
yield image_file, {
|
86 |
"image": {"path": image_file[0], "bytes": image_file[1].read()},
|
87 |
"image_name": image_name,
|
88 |
"width": annotation["width"],
|
89 |
-
"height": annotation["height"]
|
|
|
90 |
}
|
91 |
|
92 |
|
|
|
40 |
"image_name": datasets.Value("string"),
|
41 |
"width": datasets.Value("int32"),
|
42 |
"height": datasets.Value("int32"),
|
43 |
+
"objects": datasets.Sequence{
|
44 |
+
"bbox": datasets.Sequence(datasets.Value("float32"), length=4),
|
45 |
+
"category": datasets.ClassLabel(names=_CATEGORIES),
|
46 |
+
}
|
47 |
}
|
48 |
)
|
49 |
|
|
|
82 |
image_name = image_file[0].split("/")[1]
|
83 |
for annotation in annotations:
|
84 |
if image_name == annotation["image"]:
|
85 |
+
objects =
|
86 |
yield image_file, {
|
87 |
"image": {"path": image_file[0], "bytes": image_file[1].read()},
|
88 |
"image_name": image_name,
|
89 |
"width": annotation["width"],
|
90 |
+
"height": annotation["height"],
|
91 |
+
"objects": [annotation["bbox"], annotation["name"]]
|
92 |
}
|
93 |
|
94 |
|