未验证 提交 b3e0bd3a 编写于 作者: W wangguanzhong 提交者: GitHub

fix rcnn export (#4920)

上级 87f4c883
......@@ -42,10 +42,6 @@ class BBoxPostProcess(nn.Layer):
self.num_classes = num_classes
self.decode = decode
self.nms = nms
self.fake_bboxes = paddle.to_tensor(
np.array(
[[-1, 0.0, 0.0, 0.0, 0.0, 0.0]], dtype='float32'))
self.fake_bbox_num = paddle.to_tensor(np.array([1], dtype='int32'))
def forward(self, head_out, rois, im_shape, scale_factor):
"""
......@@ -94,11 +90,16 @@ class BBoxPostProcess(nn.Layer):
bboxes_list = []
bbox_num_list = []
id_start = 0
fake_bboxes = paddle.to_tensor(
np.array(
[[-1, 0.0, 0.0, 0.0, 0.0, 0.0]], dtype='float32'))
fake_bbox_num = paddle.to_tensor(np.array([1], dtype='int32'))
# add fake bbox when output is empty for each batch
for i in range(bbox_num.shape[0]):
if bbox_num[i] == 0:
bboxes_i = self.fake_bboxes
bbox_num_i = self.fake_bbox_num
bboxes_i = fake_bboxes
bbox_num_i = fake_bbox_num
id_start += 1
else:
bboxes_i = bboxes[id_start:id_start + bbox_num[i], :]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册