diff --git a/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml b/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml index 3719f6d02ac0c3b81eda5f2e13c5abc48cdf919c..630b9aa09d9eee6aa10b532c097a15500a5ba6d4 100644 --- a/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml +++ b/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml @@ -34,7 +34,7 @@ RPNHead: nms_thresh: 0.7 pre_nms_top_n: 12000 post_nms_top_n: 2000 - topk_after_collect: True + topk_after_collect: False test_proposal: min_size: 0.0 nms_thresh: 0.7 diff --git a/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml b/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml index 9a6942c9e89390f2ba0df7083dae31dbb8ed0efd..e2043cf673e418c2a68bb74096f69ed18ec3be82 100644 --- a/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml +++ b/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml @@ -35,7 +35,7 @@ RPNHead: nms_thresh: 0.7 pre_nms_top_n: 12000 post_nms_top_n: 2000 - topk_after_collect: True + topk_after_collect: False test_proposal: min_size: 0.0 nms_thresh: 0.7 diff --git a/dygraph/ppdet/modeling/backbones/resnet.py b/dygraph/ppdet/modeling/backbones/resnet.py index 86a3c9b963581b27b0a702980b88fbb3e7662784..e59f1761464a59538b692e5413292577175b2be9 100755 --- a/dygraph/ppdet/modeling/backbones/resnet.py +++ b/dygraph/ppdet/modeling/backbones/resnet.py @@ -555,7 +555,7 @@ class Res5Head(nn.Layer): def out_shape(self): return [ShapeSpec( channels=self.feat_out, - stride=32, )] + stride=16, )] def forward(self, roi_feat, stage=0): y = self.res5(roi_feat) diff --git a/dygraph/ppdet/modeling/bbox_utils.py b/dygraph/ppdet/modeling/bbox_utils.py index a8566140d4e49c44e9f41499aa84b3a1fbdb2c89..9d90831b6fcdcfccae89a0d30a8e3248f00b58bc 100644 --- a/dygraph/ppdet/modeling/bbox_utils.py +++ b/dygraph/ppdet/modeling/bbox_utils.py @@ -50,7 +50,7 @@ def delta2bbox(deltas, boxes, weights): dy = deltas[:, 1::4] / wy dw = deltas[:, 2::4] / ww dh = deltas[:, 3::4] / wh - # Prevent sending too large values into np.exp() + # Prevent sending too large values into paddle.exp() dw = paddle.clip(dw, max=clip_scale) dh = paddle.clip(dh, max=clip_scale) @@ -64,7 +64,7 @@ def delta2bbox(deltas, boxes, weights): pred_boxes.append(pred_ctr_y - 0.5 * pred_h) pred_boxes.append(pred_ctr_x + 0.5 * pred_w) pred_boxes.append(pred_ctr_y + 0.5 * pred_h) - pred_boxes = paddle.concat(pred_boxes, axis=-1) + pred_boxes = paddle.stack(pred_boxes, axis=-1) return pred_boxes diff --git a/dygraph/ppdet/modeling/heads/bbox_head.py b/dygraph/ppdet/modeling/heads/bbox_head.py index 3ad260e3ebc5d5caa331248dea0a9320935f8542..9a604e287cbe8c264453cc830dac2d7175b0d955 100644 --- a/dygraph/ppdet/modeling/heads/bbox_head.py +++ b/dygraph/ppdet/modeling/heads/bbox_head.py @@ -128,7 +128,7 @@ class BBoxHead(nn.Layer): def forward(self, body_feats=None, rois=None, rois_num=None, inputs=None): """ body_feats (list[Tensor]): Feature maps from backbone - rois (Tensor): RoIs generated from RPN module + rois (list[Tensor]): RoIs generated from RPN module rois_num (Tensor): The number of RoIs in each image inputs (dict{Tensor}): The ground-truth of image """ diff --git a/dygraph/ppdet/modeling/heads/cascade_head.py b/dygraph/ppdet/modeling/heads/cascade_head.py index 2ef88a3dcca3a1587ac4d38a12525dead531c82f..f1a33e1173d5bf6c284fccbdc1cb3a57987190f7 100644 --- a/dygraph/ppdet/modeling/heads/cascade_head.py +++ b/dygraph/ppdet/modeling/heads/cascade_head.py @@ -187,6 +187,7 @@ class CascadeHead(BBoxHead): pred_proposals = paddle.concat(proposals) if len( proposals) > 1 else proposals[0] pred_bbox = delta2bbox(deltas, pred_proposals, weights) + pred_bbox = paddle.reshape(pred_bbox, [-1, deltas.shape[-1]]) num_prop = [p.shape[0] for p in proposals] return pred_bbox.split(num_prop) diff --git a/dygraph/ppdet/modeling/proposal_generator/rpn_head.py b/dygraph/ppdet/modeling/proposal_generator/rpn_head.py index 426d33bf28f44aac87044b8cdc5f69c28059f4d2..6a1c980a452f0390b6e7355210cfc190ceab184a 100644 --- a/dygraph/ppdet/modeling/proposal_generator/rpn_head.py +++ b/dygraph/ppdet/modeling/proposal_generator/rpn_head.py @@ -116,7 +116,6 @@ class RPNHead(nn.Layer): rois, rois_num = self._gen_proposal(scores, deltas, anchors, inputs, batch_size) - if self.training: loss = self.get_loss(scores, deltas, anchors, inputs) return rois, rois_num, loss diff --git a/dygraph/ppdet/py_op/post_process.py b/dygraph/ppdet/py_op/post_process.py index 41d366787fe6468404b08a24c5ec0c5fef4163b9..04fabaa31001942290495e28e90b3a924b58dd7a 100755 --- a/dygraph/ppdet/py_op/post_process.py +++ b/dygraph/ppdet/py_op/post_process.py @@ -55,6 +55,8 @@ def get_seg_res(masks, bboxes, mask_nums, image_id, label_to_cat_id_map): score = float(bboxes[k][1]) label = int(bboxes[k][0]) k = k + 1 + if label == -1: + continue cat_id = label_to_cat_id_map[label] rle = mask_util.encode( np.array(