Commit 3a38b7bc authored by Ashwin Bharambe's avatar Ashwin Bharambe Committed by Facebook Github Bot

Fix a bug in RPN proposal label generation

Summary:
Negative labels were never set if `len(bg_inds) <= num_bg`. This
condition happens when there aren't as many negative anchor samples compared to the
typical batch size (256). Since detection scales are typically ~800, there are
plenty of negative samples and this bug is likely never hit. In any case, it
is certainly a bug which should be fixed!

Reviewed By: rbgirshick

Differential Revision: D9647703

fbshipit-source-id: fada9f4f2e0a0b5c1619940328c505e73f9a1c7e
parent 6e95bea8
......@@ -202,7 +202,10 @@ def _get_rpn_blobs(im_height, im_width, foas, all_anchors, gt_boxes):
bg_inds = np.where(anchor_to_gt_max < cfg.TRAIN.RPN_NEGATIVE_OVERLAP)[0]
if len(bg_inds) > num_bg:
enable_inds = bg_inds[npr.randint(len(bg_inds), size=num_bg)]
labels[enable_inds] = 0
else:
enable_inds = bg_inds
labels[enable_inds] = 0
bg_inds = np.where(labels == 0)[0]
bbox_targets = np.zeros((num_inside, 4), dtype=np.float32)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment