Spaces:
Sleeping
Sleeping
VascoDVRodrigues
commited on
Commit
·
63e748f
1
Parent(s):
f6fb469
- mot-metrics.py +11 -5
mot-metrics.py
CHANGED
@@ -141,16 +141,14 @@ class MotMetrics(evaluate.Metric):
|
|
141 |
# TODO: Download external resources if needed
|
142 |
pass
|
143 |
|
144 |
-
def _compute(self, payload, max_iou: float = 0.5):
|
145 |
"""Returns the scores"""
|
146 |
# TODO: Compute the different scores of the module
|
147 |
-
return calculate_from_payload(payload, max_iou)
|
148 |
#return calculate(predictions, references, max_iou)
|
149 |
|
150 |
def calculate(predictions, references, max_iou: float = 0.5):
|
151 |
"""Returns the scores"""
|
152 |
-
print("predictions", predictions)
|
153 |
-
print("references", references)
|
154 |
|
155 |
try:
|
156 |
np_predictions = np.array(predictions)
|
@@ -189,11 +187,16 @@ def calculate(predictions, references, max_iou: float = 0.5):
|
|
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:
|
@@ -216,6 +219,9 @@ def calculate_from_payload(payload: dict, max_iou: float = 0.5):
|
|
216 |
confidence = detection['confidence']
|
217 |
confidence = 1 #TODO: remove this line
|
218 |
formated_predictions.append([frame_id+1, id, x, y, w, h, confidence])
|
|
|
|
|
|
|
219 |
output[sequence][model] = calculate(formated_predictions, formatted_references, max_iou=max_iou)
|
220 |
return output
|
221 |
|
|
|
141 |
# TODO: Download external resources if needed
|
142 |
pass
|
143 |
|
144 |
+
def _compute(self, payload, max_iou: float = 0.5, debug: bool = False):
|
145 |
"""Returns the scores"""
|
146 |
# TODO: Compute the different scores of the module
|
147 |
+
return calculate_from_payload(payload, max_iou, debug)
|
148 |
#return calculate(predictions, references, max_iou)
|
149 |
|
150 |
def calculate(predictions, references, max_iou: float = 0.5):
|
151 |
"""Returns the scores"""
|
|
|
|
|
152 |
|
153 |
try:
|
154 |
np_predictions = np.array(predictions)
|
|
|
187 |
|
188 |
return summary
|
189 |
|
190 |
+
def calculate_from_payload(payload: dict, max_iou: float = 0.5, debug: bool = False):
|
191 |
gt_field_name = payload['gt_field_name']
|
192 |
models = payload['models']
|
193 |
sequence_list = payload['sequence_list']
|
194 |
|
195 |
+
if debug:
|
196 |
+
print("gt_field_name: ", gt_field_name)
|
197 |
+
print("models: ", models)
|
198 |
+
print("sequence_list: ", sequence_list)
|
199 |
+
|
200 |
output = {}
|
201 |
|
202 |
for sequence in sequence_list:
|
|
|
219 |
confidence = detection['confidence']
|
220 |
confidence = 1 #TODO: remove this line
|
221 |
formated_predictions.append([frame_id+1, id, x, y, w, h, confidence])
|
222 |
+
if debug:
|
223 |
+
print("formated_predictions: ", formated_predictions)
|
224 |
+
print("formatted_references: ", formatted_references)
|
225 |
output[sequence][model] = calculate(formated_predictions, formatted_references, max_iou=max_iou)
|
226 |
return output
|
227 |
|