Skip to content

Commit

Permalink
Multiple Anchors have same IOU
Browse files Browse the repository at this point in the history
Fixed the Todo for matching multiple anchors with the same IOU, and setting their value to 1. The previous version only picked the first anchor that had a maximum IOU. Now, if multiple anchors had the same IOU < 0.7, all of them will be set to a foreground class.
  • Loading branch information
karanchahal authored and waleedka committed Mar 4, 2019
1 parent 2b84add commit 1ad9fea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mrcnn/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1495,8 +1495,8 @@ def build_rpn_targets(image_shape, anchors, gt_class_ids, gt_boxes, config):
anchor_iou_max = overlaps[np.arange(overlaps.shape[0]), anchor_iou_argmax]
rpn_match[(anchor_iou_max < 0.3) & (no_crowd_bool)] = -1
# 2. Set an anchor for each GT box (regardless of IoU value).
# TODO: If multiple anchors have the same IoU match all of them
gt_iou_argmax = np.argmax(overlaps, axis=0)
# If multiple anchors have the same IoU match all of them
gt_iou_argmax = np.argwhere(overlaps == np.max(overlaps, axis=0))[:,0]
rpn_match[gt_iou_argmax] = 1
# 3. Set anchors with high overlap as positive.
rpn_match[anchor_iou_max >= 0.7] = 1
Expand Down

0 comments on commit 1ad9fea

Please sign in to comment.