From a7289a08c05653b594f70d2d24990052983cf308 Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Thu, 5 Aug 2021 15:43:44 +0800 Subject: [PATCH] fix no label training in bs2 (#3891) --- ppdet/modeling/proposal_generator/target.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ppdet/modeling/proposal_generator/target.py b/ppdet/modeling/proposal_generator/target.py index c767408c6..cc38b1ba3 100644 --- a/ppdet/modeling/proposal_generator/target.py +++ b/ppdet/modeling/proposal_generator/target.py @@ -215,7 +215,8 @@ def generate_proposal_target(rpn_rois, if gt_bbox.shape[0] > 0: sampled_bbox = paddle.gather(gt_bbox, sampled_gt_ind) else: - sampled_bbox = paddle.zeros([0, 4], dtype='float32') + num = rois_per_image.shape[0] + sampled_bbox = paddle.zeros([num, 4], dtype='float32') rois_per_image.stop_gradient = True sampled_gt_ind.stop_gradient = True -- GitLab