def evaluate( self, results, metric=None, iou_thr=(0.25, 0.5), logger=None, show=False, out_dir=None, ): """Evaluate. Evaluation in indoor protocol. Args: results (list[dict]): List of results. metric (str | list[str]): Metrics to be evaluated. iou_thr (list[float]): AP IoU thresholds. show (bool): Whether to visualize. Default: False. out_dir (str): Path to save the visualization results. Default: None. Returns: dict: Evaluation results. """ from mmdet3d.core.evaluation import indoor_eval assert isinstance( results, list ), f"Expect results to be list, got {type(results)}." assert len(results) > 0, "Expect length of results > 0." assert len(results) == len(self.data_infos) assert isinstance( results[0], dict ), f"Expect elements in results to be dict, got {type(results[0])}." gt_annos = [info["annos"] for info in self.data_infos] label2cat = {i: cat_id for i, cat_id in enumerate(self.CLASSES)} ret_dict = indoor_eval( gt_annos, results, iou_thr, label2cat, logger=logger, box_type_3d=self.box_type_3d, box_mode_3d=self.box_mode_3d, ) if show: self.show(results, out_dir) return ret_dict
def evaluate(gt_infos, pre_dict, part_name_list, iou_th=(0.25, 0.5, 0.75, 0.9)): from mmdet3d.core.evaluation import indoor_eval from mmdet3d.core.bbox.structures.box_3d_mode import Box3DMode, DepthInstance3DBoxes gt_annos = [info['annos'] for info in gt_infos] label2cat = {i: cat_id for i, cat_id in enumerate(part_name_list)} ret_dict = indoor_eval(gt_annos, pre_dict, iou_th, label2cat, logger=None, box_type_3d=DepthInstance3DBoxes, box_mode_3d=Box3DMode.DEPTH) #print(ret_dict) #exit(0) info_image = generate_infos(gt_annos, pre_dict, iou_th, DepthInstance3DBoxes, Box3DMode.DEPTH) return ret_dict, info_image