From 576f52cf131fb3ac931ff77f5568859f9895e1ef Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Tue, 21 Dec 2021 21:21:36 +0800 Subject: [PATCH] fix no label training in bs=2 (#4977) --- ppdet/modeling/proposal_generator/target.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ppdet/modeling/proposal_generator/target.py b/ppdet/modeling/proposal_generator/target.py index af83cfdb8..7af30f641 100644 --- a/ppdet/modeling/proposal_generator/target.py +++ b/ppdet/modeling/proposal_generator/target.py @@ -50,8 +50,8 @@ def rpn_anchor_target(anchors, labels = paddle.scatter(labels, fg_inds, paddle.ones_like(fg_inds)) # Step3: make output if gt_bbox.shape[0] == 0: - matched_gt_boxes = paddle.zeros([0, 4]) - tgt_delta = paddle.zeros([0, 4]) + matched_gt_boxes = paddle.zeros([matches.shape[0], 4]) + tgt_delta = paddle.zeros([matches.shape[0], 4]) else: matched_gt_boxes = paddle.gather(gt_bbox, matches) tgt_delta = bbox2delta(anchors, matched_gt_boxes, weights) -- GitLab