From e293ffb60cd413bccf9822a0a75a3049b0dcc049 Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Mon, 6 Feb 2023 15:51:56 +0800 Subject: [PATCH] fix postprocess (#7684) --- ppdet/modeling/architectures/blazeface.py | 6 +++--- ppdet/modeling/architectures/ssd.py | 6 +++--- ppdet/modeling/heads/fcosr_head.py | 5 +++-- ppdet/modeling/heads/ppyoloe_r_head.py | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ppdet/modeling/architectures/blazeface.py b/ppdet/modeling/architectures/blazeface.py index af6aa269d..2f5d0d238 100644 --- a/ppdet/modeling/architectures/blazeface.py +++ b/ppdet/modeling/architectures/blazeface.py @@ -74,9 +74,9 @@ class BlazeFace(BaseArch): self.inputs['gt_class']) else: preds, anchors = self.blaze_head(neck_feats, self.inputs['image']) - bbox, bbox_num = self.post_process(preds, anchors, - self.inputs['im_shape'], - self.inputs['scale_factor']) + bbox, bbox_num, before_nms_indexes = self.post_process( + preds, anchors, self.inputs['im_shape'], + self.inputs['scale_factor']) return bbox, bbox_num def get_loss(self, ): diff --git a/ppdet/modeling/architectures/ssd.py b/ppdet/modeling/architectures/ssd.py index 34bf24108..2d2bf1dd2 100644 --- a/ppdet/modeling/architectures/ssd.py +++ b/ppdet/modeling/architectures/ssd.py @@ -75,9 +75,9 @@ class SSD(BaseArch): self.inputs['gt_class']) else: preds, anchors = self.ssd_head(body_feats, self.inputs['image']) - bbox, bbox_num = self.post_process(preds, anchors, - self.inputs['im_shape'], - self.inputs['scale_factor']) + bbox, bbox_num, before_nms_indexes = self.post_process( + preds, anchors, self.inputs['im_shape'], + self.inputs['scale_factor']) return bbox, bbox_num def get_loss(self, ): diff --git a/ppdet/modeling/heads/fcosr_head.py b/ppdet/modeling/heads/fcosr_head.py index 97cd949d7..df98883df 100644 --- a/ppdet/modeling/heads/fcosr_head.py +++ b/ppdet/modeling/heads/fcosr_head.py @@ -391,5 +391,6 @@ class FCOSRHead(nn.Layer): ], axis=-1).reshape([-1, 1, 8]) pred_rboxes /= scale_factor - bbox_pred, bbox_num, _ = self.nms(pred_rboxes, pred_scores) - return bbox_pred, bbox_num + bbox_pred, bbox_num, before_nms_indexes = self.nms(pred_rboxes, + pred_scores) + return bbox_pred, bbox_num, before_nms_indexes diff --git a/ppdet/modeling/heads/ppyoloe_r_head.py b/ppdet/modeling/heads/ppyoloe_r_head.py index 7b5eabcbe..fba401d7e 100644 --- a/ppdet/modeling/heads/ppyoloe_r_head.py +++ b/ppdet/modeling/heads/ppyoloe_r_head.py @@ -258,7 +258,7 @@ class PPYOLOERHead(nn.Layer): pad_gt_mask = gt_meta['pad_gt_mask'] # label assignment if gt_meta['epoch_id'] < self.static_assigner_epoch: - assigned_labels, assigned_bboxes, assigned_scores, _ = \ + assigned_labels, assigned_bboxes, assigned_scores = \ self.static_assigner( anchor_points, stride_tensor, @@ -271,7 +271,7 @@ class PPYOLOERHead(nn.Layer): pred_bboxes.detach() ) else: - assigned_labels, assigned_bboxes, assigned_scores, _ = \ + assigned_labels, assigned_bboxes, assigned_scores = \ self.assigner( pred_scores.detach(), pred_bboxes.detach(), -- GitLab