Skip to content

Commit a2f57be

Browse files
authored
fix training in cascade_rcnn (#2386)
1 parent 588d78b commit a2f57be

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

dygraph/ppdet/modeling/heads/cascade_head.py

+2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ def _get_rois_from_boxes(self, boxes, im_shape):
227227
clip_box = clip_bbox(boxes_per_image, im_shape[i])
228228
if self.training:
229229
keep = nonempty_bbox(clip_box)
230+
if keep.shape[0] == 0:
231+
keep = paddle.zeros([1], dtype='int32')
230232
clip_box = paddle.gather(clip_box, keep)
231233
rois.append(clip_box)
232234
rois_num = paddle.concat([paddle.shape(r)[0] for r in rois])

0 commit comments

Comments
 (0)