Spaces:
Sleeping
Sleeping
VascoDVRodrigues
commited on
Commit
•
a98be6c
1
Parent(s):
ba20988
test
Browse files- mot-metrics.py +31 -0
mot-metrics.py
CHANGED
@@ -188,3 +188,34 @@ def calculate(predictions, references, max_iou: float = 0.5):
|
|
188 |
summary[key] = summary[key][0]
|
189 |
|
190 |
return summary
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
summary[key] = summary[key][0]
|
189 |
|
190 |
return summary
|
191 |
+
|
192 |
+
def parse_standard_payload(payload: dict):
|
193 |
+
gt_field_name = payload['gt_field_name']
|
194 |
+
models = payload['models']
|
195 |
+
sequence_list = payload['sequence_list']
|
196 |
+
|
197 |
+
for sequence in sequence_list:
|
198 |
+
for model in models:
|
199 |
+
frames = payload['sequences'][sequence][model]
|
200 |
+
formated_predictions = []
|
201 |
+
for frame_id, frame in enumerate(frames):
|
202 |
+
for detection in frame:
|
203 |
+
id = detection['index']
|
204 |
+
x, y, w, h = detection['bounding_box']
|
205 |
+
confidence = detection['confidence']
|
206 |
+
confidence = 1 #TODO: remove this line
|
207 |
+
formated_predictions.append([frame_id, id, x, y, w, h, confidence])
|
208 |
+
|
209 |
+
frames = payload['sequences'][sequence][gt_field_name]
|
210 |
+
formatted_references = []
|
211 |
+
for frame_id, frame in enumerate(frames):
|
212 |
+
for detection in frame:
|
213 |
+
id = detection['index']
|
214 |
+
x, y, w, h = detection['bounding_box']
|
215 |
+
formatted_references.append([frame_id, id, x, y, w, h])
|
216 |
+
|
217 |
+
print(calculate(formated_predictions, formatted_references, max_iou=0.5))
|
218 |
+
|
219 |
+
|
220 |
+
|
221 |
+
|