bascobasculino commited on
Commit
f2d45cf
1 Parent(s): 68c72a6
Files changed (1) hide show
  1. my_metricv2.py +9 -4
my_metricv2.py CHANGED
@@ -140,10 +140,15 @@ def calculate(predictions, references, max_iou: float = 0.5):
140
  for i in range(1, num_frames+1):
141
  preds = np_predictions[np_predictions[:, 0] == i, 1:6]
142
  refs = np_references[np_references[:, 0] == i, 1:6]
143
- print(preds)
144
- print(refs)
 
 
 
 
145
 
146
  return {
147
- "predictions": predictions,
148
- "references": references
 
149
  }
 
140
  for i in range(1, num_frames+1):
141
  preds = np_predictions[np_predictions[:, 0] == i, 1:6]
142
  refs = np_references[np_references[:, 0] == i, 1:6]
143
+ C = mm.distances.iou_matrix(refs[:,1:], preds[:,1:], max_iou = max_iou)
144
+ acc.update(refs[:,0].astype('int').tolist(), preds[:,0].astype('int').tolist(), C)
145
+
146
+ mh = mm.metrics.create()
147
+ summary = mh.compute(acc, metrics=['num_frames', 'mota', 'motp'], name='acc')
148
+
149
 
150
  return {
151
+ "mota": summary['mota'],
152
+ "motp": summary['motp'],
153
+ "num_frames": summary['num_frames']
154
  }