diff --git a/ppdet/modeling/heads/mask_head.py b/ppdet/modeling/heads/mask_head.py index 5b9de3760fb935ae088b083829e27d1ff53a4f7f..604847a2d07224314b2eba700eefa00729b4f95f 100644 --- a/ppdet/modeling/heads/mask_head.py +++ b/ppdet/modeling/heads/mask_head.py @@ -209,7 +209,7 @@ class MaskHead(nn.Layer): scale_factor (Tensor): The scale factor from origin size to input size """ if not self.export_onnx and rois.shape[0] == 0: - mask_out = paddle.full([1, 1, 1, 1], -1) + mask_out = paddle.full([1, 1, 1], -1) else: bbox = [rois[:, 2:]] labels = rois[:, 0].cast('int32') diff --git a/ppdet/modeling/ops.py b/ppdet/modeling/ops.py index 7d08a19799df6ea3a16a87487bad6393a47c0061..52a4f33962a49c45a3597c372842d965a0023166 100644 --- a/ppdet/modeling/ops.py +++ b/ppdet/modeling/ops.py @@ -482,6 +482,8 @@ def collect_fpn_proposals(multi_rois, rois_num = helper.create_variable_for_type_inference(dtype='int32') rois_num.stop_gradient = True outputs['RoisNum'] = rois_num + else: + rois_num = None helper.append_op( type='collect_fpn_proposals', inputs=inputs, @@ -602,6 +604,8 @@ def distribute_fpn_proposals(fpn_rois, for i in range(num_lvl) ] outputs['MultiLevelRoIsNum'] = rois_num_per_level + else: + rois_num_per_level = None helper.append_op( type='distribute_fpn_proposals',