mmdetection-mini icon indicating copy to clipboard operation
mmdetection-mini copied to clipboard

这里为什么要+1呢?

Open lfydegithub opened this issue 5 years ago • 1 comments

https://github.com/hhaAndroid/mmdetection-mini/blob/3858c8c2f071c064fe78ce24088a1c9815ae1a21/mmdet/det_core/bbox/assigners/grid_assigner.py#L140

这里为什么要+1呢? 我理解argmax_overlaps里存储了max_overlaps所对应的gt_box的idx, 直接赋值不就好了吗, +1是出于什么考虑呢? 而且在同文件的161~162行进行分配label的时候又去-1已获得gt_box idx, 感觉有点多此一举啊, 但感觉肯定不是没有原因的,所以想问下

            if pos_inds.numel() > 0:
                assigned_labels[pos_inds] = gt_labels[
                    assigned_gt_inds[pos_inds] - 1]  # 正样本anchor处的label值

lfydegithub avatar Dec 21 '20 06:12 lfydegithub

可能是由于负样本对应的gt_box设置为0,无效样本设置为-1,正样本设置为gt_box的idx,为了不与负样本设置的0冲突,所以正样本idx+1,不从0开始。

xzjzsa avatar May 26 '21 01:05 xzjzsa