Args: dataset_name (str): name of the dataset to be evaluated. distributed (bool): if True, will collect results from all ranks for evaluation. Otherwise, will evaluate the results in the current process. output_dir (str): an output direct
(
self,
dataset_name,
config,
distributed=True,
output_dir=None,
)
| 19 | """ |
| 20 | |
| 21 | def __init__( |
| 22 | self, |
| 23 | dataset_name, |
| 24 | config, |
| 25 | distributed=True, |
| 26 | output_dir=None, |
| 27 | ): |
| 28 | """ |
| 29 | Args: |
| 30 | dataset_name (str): name of the dataset to be evaluated. |
| 31 | distributed (bool): if True, will collect results from all ranks for evaluation. |
| 32 | Otherwise, will evaluate the results in the current process. |
| 33 | output_dir (str): an output directory to dump results. |
| 34 | num_classes, ignore_label: deprecated argument |
| 35 | """ |
| 36 | self._logger = logging.getLogger(__name__) |
| 37 | |
| 38 | self._dataset_name = dataset_name |
| 39 | self._distributed = distributed |
| 40 | self._output_dir = output_dir |
| 41 | |
| 42 | self._cpu_device = torch.device("cpu") |
| 43 | |
| 44 | self.use_nms = config.evaluation.cfg.get('use_nms', True) |
| 45 | self.soft_nms = config.evaluation.cfg.soft_nms |
| 46 | self.nms_thr = config.evaluation.cfg.nms_thr |
| 47 | self.oks_thr = config.evaluation.cfg.oks_thr |
| 48 | self.vis_thr = config.evaluation.cfg.vis_thr |
| 49 | self.cls_logits_vis_thr = config.evaluation.cfg.get('cls_logits_vis_thr', -1) |
| 50 | |
| 51 | self.dataset = config.evaluation.cfg.dataset |
| 52 | |
| 53 | if 'coco' in dataset_name.lower(): |
| 54 | self.sigmas = np.array([ |
| 55 | .26, .25, .25, .35, .35, .79, .79, .72, .72, .62, .62, 1.07, 1.07, |
| 56 | .87, .87, .89, .89 |
| 57 | ]) / 10.0 |
| 58 | elif 'aic' in dataset_name.lower(): |
| 59 | self.sigmas = np.array([ |
| 60 | 0.01388152, 0.01515228, 0.01057665, 0.01417709, 0.01497891, 0.01402144, |
| 61 | 0.03909642, 0.03686941, 0.01981803, 0.03843971, 0.03412318, 0.02415081, |
| 62 | 0.01291456, 0.01236173 |
| 63 | ]) |
| 64 | |
| 65 | self.interval = config.evaluation.cfg.interval |
| 66 | self.metric = config.evaluation.cfg.metric |
| 67 | self.key_indicator = config.evaluation.cfg.key_indicator |
| 68 | |
| 69 | self.ann_info = {} |
| 70 | self.ann_info['num_joints'] = config.dataset.kwargs.data_cfg['num_joints'] |
| 71 | |
| 72 | self.annot_json_path = config.dataset.kwargs.ann_file |
| 73 | |
| 74 | self.use_area = config.evaluation.cfg.get('use_area', True) |
| 75 | |
| 76 | # for pseudo_label |
| 77 | self.pseudo_labels_results = [] |
| 78 | self.annot_id = 1 |