Indoor Evaluation. Evaluate the result of the detection. Args: gt_annos (list[dict]): Ground truth annotations. dt_annos (list[dict]): Detection annotations. the dict includes the following keys - labels_3d (torch.Tensor): Labels of boxes.
(gt_annos,
dt_annos,
metric,
label2cat,
logger=None,
box_mode_3d=None,
classes_split=None)
| 222 | |
| 223 | |
| 224 | def indoor_eval(gt_annos, |
| 225 | dt_annos, |
| 226 | metric, |
| 227 | label2cat, |
| 228 | logger=None, |
| 229 | box_mode_3d=None, |
| 230 | classes_split=None): |
| 231 | """Indoor Evaluation. |
| 232 | |
| 233 | Evaluate the result of the detection. |
| 234 | |
| 235 | Args: |
| 236 | gt_annos (list[dict]): Ground truth annotations. |
| 237 | dt_annos (list[dict]): Detection annotations. the dict |
| 238 | includes the following keys |
| 239 | |
| 240 | - labels_3d (torch.Tensor): Labels of boxes. |
| 241 | - bboxes_3d (:obj:`BaseInstance3DBoxes`): |
| 242 | 3D bounding boxes in Depth coordinate. |
| 243 | - scores_3d (torch.Tensor): Scores of boxes. |
| 244 | metric (list[float]): IoU thresholds for computing average precisions. |
| 245 | label2cat (tuple): Map from label to category. |
| 246 | logger (logging.Logger | str, optional): The way to print the mAP |
| 247 | summary. See `mmdet.utils.print_log()` for details. Default: None. |
| 248 | |
| 249 | Return: |
| 250 | dict[str, float]: Dict of results. |
| 251 | """ |
| 252 | assert len(dt_annos) == len(gt_annos) |
| 253 | pred = {} # map {class_id: pred} |
| 254 | gt = {} # map {class_id: gt} |
| 255 | for img_id in range(len(dt_annos)): |
| 256 | # parse detected annotations |
| 257 | det_anno = dt_annos[img_id] |
| 258 | for i in range(len(det_anno['labels_3d'])): |
| 259 | label = det_anno['labels_3d'].numpy()[i] |
| 260 | bbox = det_anno['bboxes_3d'].convert_to(box_mode_3d)[i] |
| 261 | score = det_anno['scores_3d'].numpy()[i] |
| 262 | if label not in pred: |
| 263 | pred[int(label)] = {} |
| 264 | if img_id not in pred[label]: |
| 265 | pred[int(label)][img_id] = [] |
| 266 | if label not in gt: |
| 267 | gt[int(label)] = {} |
| 268 | if img_id not in gt[label]: |
| 269 | gt[int(label)][img_id] = [] |
| 270 | pred[int(label)][img_id].append((bbox, score)) |
| 271 | |
| 272 | # parse gt annotations |
| 273 | gt_anno = gt_annos[img_id] |
| 274 | |
| 275 | gt_boxes = gt_anno['gt_bboxes_3d'] |
| 276 | labels_3d = gt_anno['gt_labels_3d'] |
| 277 | |
| 278 | for i in range(len(labels_3d)): |
| 279 | label = labels_3d[i] |
| 280 | bbox = gt_boxes[i] |
| 281 | if label not in gt: |
no test coverage detected