From c1bd0ac245b8aa4943f3c23ae12bfbda2257eb2a Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Fri, 14 May 2021 22:05:33 +0800 Subject: [PATCH] fix none output in rcnn (#2984) --- ppdet/modeling/post_process.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ppdet/modeling/post_process.py b/ppdet/modeling/post_process.py index d6bebef8d..eb1f82f9e 100644 --- a/ppdet/modeling/post_process.py +++ b/ppdet/modeling/post_process.py @@ -86,6 +86,13 @@ class BBoxPostProcess(object): pred_result (Tensor): The final prediction results with shape [N, 6] including labels, scores and bboxes. """ + + if bboxes.shape[0] == 0: + bbox_pred = paddle.to_tensor( + np.array( + [[-1, 0.0, 0.0, 0.0, 0.0, 0.0]], dtype='float32')) + bbox_num = paddle.to_tensor(np.array([1], dtype='int32')) + origin_shape = paddle.floor(im_shape / scale_factor + 0.5) origin_shape_list = [] -- GitLab