From e4909b55af2f9e080adce724341f60c5502c1aaf Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Thu, 18 Feb 2021 20:12:12 +0800 Subject: [PATCH] fix ssd export (#2177) --- dygraph/ppdet/modeling/architectures/ssd.py | 5 ++--- dygraph/ppdet/modeling/heads/ssd_head.py | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dygraph/ppdet/modeling/architectures/ssd.py b/dygraph/ppdet/modeling/architectures/ssd.py index 4d195191f..6ff55c54a 100644 --- a/dygraph/ppdet/modeling/architectures/ssd.py +++ b/dygraph/ppdet/modeling/architectures/ssd.py @@ -43,9 +43,8 @@ class SSD(BaseArch): self.inputs['gt_bbox'], self.inputs['gt_class']) else: - boxes, scores, anchors = self.ssd_head(body_feats, - self.inputs['image']) - bbox, bbox_num = self.post_process((boxes, scores), anchors, + 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']) return bbox, bbox_num diff --git a/dygraph/ppdet/modeling/heads/ssd_head.py b/dygraph/ppdet/modeling/heads/ssd_head.py index 3ad8259e9..c346e2a12 100644 --- a/dygraph/ppdet/modeling/heads/ssd_head.py +++ b/dygraph/ppdet/modeling/heads/ssd_head.py @@ -130,8 +130,8 @@ class SSDHead(nn.Layer): box_preds = [] cls_scores = [] prior_boxes = [] - for i, (feat, box_conv, score_conv - ) in enumerate(zip(feats, self.box_convs, self.score_convs)): + for feat, box_conv, score_conv in zip(feats, self.box_convs, + self.score_convs): box_pred = box_conv(feat) box_pred = paddle.transpose(box_pred, [0, 2, 3, 1]) box_pred = paddle.reshape(box_pred, [0, -1, 4]) @@ -148,7 +148,7 @@ class SSDHead(nn.Layer): return self.get_loss(box_preds, cls_scores, gt_bbox, gt_class, prior_boxes) else: - return box_preds, cls_scores, prior_boxes + return (box_preds, cls_scores), prior_boxes def get_loss(self, boxes, scores, gt_bbox, gt_class, prior_boxes): return self.loss(boxes, scores, gt_bbox, gt_class, prior_boxes) -- GitLab