Spaces:
Sleeping
Sleeping
add unique ids
Browse files- user-friendly-metrics.py +6 -3
user-friendly-metrics.py
CHANGED
@@ -17,8 +17,7 @@ import datasets
|
|
17 |
import motmetrics as mm
|
18 |
from motmetrics.metrics import (events_to_df_map,
|
19 |
obj_frequencies,
|
20 |
-
track_ratios
|
21 |
-
num_gt_ids)
|
22 |
import numpy as np
|
23 |
|
24 |
_CITATION = """\
|
@@ -97,6 +96,10 @@ def recognition(track_ratios, th = 0.5):
|
|
97 |
"""Number of objects tracked for at least 20 percent of lifespan."""
|
98 |
return track_ratios[track_ratios >= th].count()
|
99 |
|
|
|
|
|
|
|
|
|
100 |
def calculate(predictions,
|
101 |
references,
|
102 |
max_iou: float = 0.5,
|
@@ -144,7 +147,7 @@ def calculate(predictions,
|
|
144 |
summary[key] = summary[key][0]
|
145 |
|
146 |
for th in recognition_thresholds:
|
147 |
-
summary[f'recognition_{th}'] = recognition(tr_ratios, th)
|
148 |
|
149 |
return summary
|
150 |
|
|
|
17 |
import motmetrics as mm
|
18 |
from motmetrics.metrics import (events_to_df_map,
|
19 |
obj_frequencies,
|
20 |
+
track_ratios)
|
|
|
21 |
import numpy as np
|
22 |
|
23 |
_CITATION = """\
|
|
|
96 |
"""Number of objects tracked for at least 20 percent of lifespan."""
|
97 |
return track_ratios[track_ratios >= th].count()
|
98 |
|
99 |
+
def num_gt_ids(df):
|
100 |
+
"""Number of unique gt ids."""
|
101 |
+
return df.full["OId"].dropna().unique().shape[0]
|
102 |
+
|
103 |
def calculate(predictions,
|
104 |
references,
|
105 |
max_iou: float = 0.5,
|
|
|
147 |
summary[key] = summary[key][0]
|
148 |
|
149 |
for th in recognition_thresholds:
|
150 |
+
summary[f'recognition_{th}'] = recognition(tr_ratios, th)/unique_gt_ids
|
151 |
|
152 |
return summary
|
153 |
|