diff --git a/ppdet/data/source/keypoint_coco.py b/ppdet/data/source/keypoint_coco.py index 27379a0c3e9e6e2fa02a90b56e99e80bac4ff08d..471a7de9f356f4ad1fe20b0b342b50bb4d4cc5e5 100644 --- a/ppdet/data/source/keypoint_coco.py +++ b/ppdet/data/source/keypoint_coco.py @@ -60,7 +60,6 @@ class KeypointBottomUpBaseDataset(DetDataset): self.test_mode = test_mode self.ann_info['num_joints'] = num_joints - self.img_ids = [] def __len__(self): diff --git a/ppdet/engine/trainer.py b/ppdet/engine/trainer.py index e99bddae62040c4a8b9e1f7bf8582677f5b507da..76fb613cb97c8635eaa0fcff26d4f04529eca244 100644 --- a/ppdet/engine/trainer.py +++ b/ppdet/engine/trainer.py @@ -147,6 +147,7 @@ class Trainer(object): eval_dataset.check_or_download_dataset() anno_file = eval_dataset.get_anno() + IouType = self.cfg['IouType'] if 'IouType' in self.cfg else 'bbox' self._metrics = [ COCOMetric( anno_file=anno_file, @@ -154,6 +155,7 @@ class Trainer(object): classwise=classwise, output_eval=output_eval, bias=bias, + IouType=IouType, save_prediction_only=save_prediction_only) ] elif self.cfg.metric == 'VOC': diff --git a/ppdet/metrics/coco_utils.py b/ppdet/metrics/coco_utils.py index cff1e8903e68990f1707f38a0aac9f26e214ed0c..60f29155a0a19cd215c7edfaded67e0ce7b095d8 100644 --- a/ppdet/metrics/coco_utils.py +++ b/ppdet/metrics/coco_utils.py @@ -107,7 +107,6 @@ def cocoapi_eval(jsonfile, coco_eval.params.maxDets = list(max_dets) elif style == 'keypoints_crowd': coco_eval = COCOeval(coco_gt, coco_dt, style, sigmas, use_area) - coco_gt.anno_file.append("") else: coco_eval = COCOeval(coco_gt, coco_dt, style) coco_eval.evaluate() diff --git a/ppdet/modeling/architectures/keypoint_hrhrnet.py b/ppdet/modeling/architectures/keypoint_hrhrnet.py index ee6a67769753da64a4f5b4f91c2cf4c318205584..df7ace682e34b206e4b0d2aa09ffdb40ba2b861f 100644 --- a/ppdet/modeling/architectures/keypoint_hrhrnet.py +++ b/ppdet/modeling/architectures/keypoint_hrhrnet.py @@ -52,7 +52,7 @@ class HigherHRNet(BaseArch): super(HigherHRNet, self).__init__() self.backbone = backbone self.hrhrnet_head = hrhrnet_head - self.post_process = HrHRNetPostProcess() + self.post_process = post_process self.flip = eval_flip self.flip_perm = paddle.to_tensor(flip_perm) self.deploy = False @@ -85,6 +85,7 @@ class HigherHRNet(BaseArch): return self.hrhrnet_head(body_feats, self.inputs) else: outputs = self.hrhrnet_head(body_feats) + if self.flip and not self.deploy: outputs = [paddle.split(o, 2) for o in outputs] output_rflip = [ @@ -105,7 +106,6 @@ class HigherHRNet(BaseArch): w = self.inputs['im_shape'][0, 1].numpy().item() kpts, scores = self.post_process(*outputs, h, w) res_lst.append([kpts, scores]) - return res_lst def get_loss(self): @@ -157,7 +157,7 @@ class HrHRNetPostProcess(object): original_height, original_width (float): the original image size ''' - def __init__(self, max_num_people=30, heat_thresh=0.2, tag_thresh=1.): + def __init__(self, max_num_people=30, heat_thresh=0.1, tag_thresh=1.): self.max_num_people = max_num_people self.heat_thresh = heat_thresh self.tag_thresh = tag_thresh