Update tools/demo_api.py
Browse files- tools/demo_api.py +10 -10
tools/demo_api.py
CHANGED
@@ -171,16 +171,16 @@ def run_detection(predictor, path):
|
|
171 |
img_list.append(img_entry)
|
172 |
|
173 |
print(outputs[0])
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
data_dict = { "images": img_list,
|
185 |
"annotations": ann_list
|
186 |
}
|
|
|
171 |
img_list.append(img_entry)
|
172 |
|
173 |
print(outputs[0])
|
174 |
+
if len(outputs):
|
175 |
+
for id, output in enumerate(outputs[0]):
|
176 |
+
print(output)
|
177 |
+
ann_entry = {"id": id,
|
178 |
+
"image_id": img_id,
|
179 |
+
"bbox": (output[:4] / ratio).tolist(),
|
180 |
+
"cls": output[6].item(),
|
181 |
+
"score": (output[4] * output[5]).item() }
|
182 |
+
ann_list.append(ann_entry)
|
183 |
+
|
184 |
data_dict = { "images": img_list,
|
185 |
"annotations": ann_list
|
186 |
}
|