Gil-Simas commited on
Commit
cd8d22b
·
1 Parent(s): 2ea1288

add recognition rate th in other functinos

Browse files
Files changed (1) hide show
  1. user-friendly-metrics.py +11 -4
user-friendly-metrics.py CHANGED
@@ -86,10 +86,14 @@ class UserFriendlyMetrics(evaluate.Metric):
86
  # TODO: Download external resources if needed
87
  pass
88
 
89
- def _compute(self, payload, max_iou: float = 0.5, debug: bool = False):
 
 
 
 
90
  """Returns the scores"""
91
  # TODO: Compute the different scores of the module
92
- return calculate_from_payload(payload, max_iou, debug)
93
  #return calculate(predictions, references, max_iou)
94
 
95
  def recognition(track_ratios, th = 0.5):
@@ -151,7 +155,10 @@ def calculate(predictions,
151
 
152
  return summary
153
 
154
- def calculate_from_payload(payload: dict, max_iou: float = 0.5, debug: bool = False):
 
 
 
155
  if not isinstance(payload, dict):
156
  try:
157
  payload = payload.to_dict()
@@ -200,7 +207,7 @@ def calculate_from_payload(payload: dict, max_iou: float = 0.5, debug: bool = Fa
200
  elif len(formated_references) == 0:
201
  output[sequence][model] = "No ground truth."
202
  else:
203
- output[sequence][model] = calculate(formated_predictions, formated_references, max_iou=max_iou)
204
  return output
205
 
206
 
 
86
  # TODO: Download external resources if needed
87
  pass
88
 
89
+ def _compute(self,
90
+ payload,
91
+ max_iou: float = 0.5,
92
+ recognition_thresholds = [0.3, 0.5, 0.8],
93
+ debug: bool = False):
94
  """Returns the scores"""
95
  # TODO: Compute the different scores of the module
96
+ return calculate_from_payload(payload, max_iou, recognition_thresholds, debug)
97
  #return calculate(predictions, references, max_iou)
98
 
99
  def recognition(track_ratios, th = 0.5):
 
155
 
156
  return summary
157
 
158
+ def calculate_from_payload(payload: dict,
159
+ max_iou: float = 0.5,
160
+ recognition_thresholds = [0.3, 0.5, 0.8],
161
+ debug: bool = False):
162
  if not isinstance(payload, dict):
163
  try:
164
  payload = payload.to_dict()
 
207
  elif len(formated_references) == 0:
208
  output[sequence][model] = "No ground truth."
209
  else:
210
+ output[sequence][model] = calculate(formated_predictions, formated_references, max_iou=max_iou, recognition_thresholds = recognition_thresholds)
211
  return output
212
 
213