ijkguo / mx-rcnn

Parallel Faster R-CNN implementation with MXNet.
Other
669 stars 292 forks source link

Anchor assignment issues #104

Closed kaleidoscopical closed 5 years ago

kaleidoscopical commented 5 years ago

https://github.com/ijkguo/mx-rcnn/blob/e005b38dd2c67c95e4b71ab5a846d2c4573f3d36/symdata/anchor.py#L124

I found an overlap between fg_ind and bg_ind may occur in current code. It may cause several positive labels are set to be negative, but their corresponding box regressions are still functioning.

ijkguo commented 5 years ago

Thanks. Overlap occurs when a proposal is argmax to a gt_box but also considered as background (overlap < 0.3 and not argmax to another gt_box).

I am thinking to change them to

overlaps = bbox_overlaps(anchors.astype(np.float), gt_boxes.astype(np.float))
gt_max_overlaps = overlaps.max(axis=0)
max_overlaps = overlaps.max(axis=1)

# fg anchors: anchor with highest overlap for each gt; or overlap > iou thresh
fg_inds = np.where((max_overlaps >= self._fg_overlap) | (max_overlaps == gt_max_overlaps))[0]

# bg anchor: anchor with overlap < iou thresh but not highest overlap for some gt
bg_inds = np.where((max_overlaps < self._bg_overlap) & (max_overlaps < gt_max_overlaps))[0]

with the assumption that anchor with the highest overlap for each gt_box does not have higher overlap with any other gt_box.

ijkguo commented 5 years ago

Revert to the old assign anchor in https://github.com/ijkguo/mx-rcnn/commit/dff47b8c4bee1121ce74414ec06f170eafac06e1