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)
| 183 | |
| 184 | |
| 185 | def 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 | |
| 224 | def indoor_eval(gt_annos, |
no test coverage detected