MCPcopy Index your code
hub / github.com/InternRobotics/EmbodiedScan / eval_map_recall

Function eval_map_recall

embodiedscan/eval/indoor_eval.py:185–221  ·  view source on GitHub ↗

Evaluate mAP and recall. Generic functions to compute precision/recall for object detection for multiple classes. Args: pred (dict): Information of detection results, which maps class_id and predictions. gt (dict): Information of ground truths, which map

(pred, gt, ovthresh=None)

Source from the content-addressed store, hash-verified

183
184
185def eval_map_recall(pred, gt, ovthresh=None):
186 """Evaluate mAP and recall.
187
188 Generic functions to compute precision/recall for object detection
189 for multiple classes.
190
191 Args:
192 pred (dict): Information of detection results,
193 which maps class_id and predictions.
194 gt (dict): Information of ground truths, which maps class_id and
195 ground truths.
196 ovthresh (list[float], optional): iou threshold. Default: None.
197
198 Return:
199 tuple[dict]: dict results of recall, AP, and precision for all classes.
200 """
201
202 ret_values = {}
203 for classname in gt.keys():
204 if classname in pred:
205 ret_values[classname] = eval_det_cls(pred[classname],
206 gt[classname], ovthresh)
207 recall = [{} for i in ovthresh]
208 precision = [{} for i in ovthresh]
209 ap = [{} for i in ovthresh]
210
211 for label in gt.keys():
212 for iou_idx, thresh in enumerate(ovthresh):
213 if label in pred:
214 recall[iou_idx][label], precision[iou_idx][label], ap[iou_idx][
215 label] = ret_values[label][iou_idx]
216 else:
217 recall[iou_idx][label] = np.zeros(1)
218 precision[iou_idx][label] = np.zeros(1)
219 ap[iou_idx][label] = np.zeros(1)
220
221 return recall, precision, ap
222
223
224def indoor_eval(gt_annos,

Callers 1

indoor_evalFunction · 0.85

Calls 1

eval_det_clsFunction · 0.85

Tested by

no test coverage detected