Spaces:
Sleeping
Sleeping
VascoDVRodrigues
commited on
Commit
·
f7c3a58
1
Parent(s):
76eeea1
cringe
Browse files- mot-metrics.py +15 -10
mot-metrics.py
CHANGED
@@ -189,12 +189,23 @@ def calculate(predictions, references, max_iou: float = 0.5):
|
|
189 |
|
190 |
return summary
|
191 |
|
192 |
-
def
|
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 = []
|
@@ -205,16 +216,10 @@ def parse_standard_payload(payload: dict):
|
|
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 |
|
|
|
189 |
|
190 |
return summary
|
191 |
|
192 |
+
def calculate_from_payload(payload: dict, max_iou: float = 0.5):
|
193 |
gt_field_name = payload['gt_field_name']
|
194 |
models = payload['models']
|
195 |
sequence_list = payload['sequence_list']
|
196 |
|
197 |
+
output = {}
|
198 |
+
|
199 |
for sequence in sequence_list:
|
200 |
+
output[sequence] = {}
|
201 |
+
frames = payload['sequences'][sequence][gt_field_name]
|
202 |
+
formatted_references = []
|
203 |
+
for frame_id, frame in enumerate(frames):
|
204 |
+
for detection in frame:
|
205 |
+
id = detection['index']
|
206 |
+
x, y, w, h = detection['bounding_box']
|
207 |
+
formatted_references.append([frame_id, id, x, y, w, h])
|
208 |
+
|
209 |
for model in models:
|
210 |
frames = payload['sequences'][sequence][model]
|
211 |
formated_predictions = []
|
|
|
216 |
confidence = detection['confidence']
|
217 |
confidence = 1 #TODO: remove this line
|
218 |
formated_predictions.append([frame_id, id, x, y, w, h, confidence])
|
219 |
+
output[sequence][model] = calculate(formated_predictions, formatted_references, max_iou=max_iou)
|
220 |
+
return output
|
221 |
+
|
222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
|
224 |
|
225 |
|