Input args:
rpn_cls_score,#只是用来获得输入特征图的尺寸
gt_boxes, #为anchor分配标签
gt_boxes_3d, #产生相对位移
im_info, #保存了原始图片信息,和尺度因子
_feat_stride = [16,], #池化缩放倍数(8)
anchor_scales = [8, 16, 32]#这里没用上的参数
Output args:
rpn_labels,#输出所有anchor的label(-1:忽略,0:背景,1:目标)
rpn_bbox_targets,#输出所有anchor相应的bbox targets,也就是相对位移量
anchors,#labels不等于-1的anchor的bv_bbox,blob的第一维是0向量
anchors_3d,#labels不等于-1的anchor的3D_bbox
Some questions about the latent bugs
- In line 121~123:
gt_max_overlaps =overlaps[gt_argmax_overlaps, np.arange(overlaps.shape[1])]
gt_argmax_overlaps = np.where(overlaps == gt_max_overlaps)[0]
这段代码似乎有点多余,重复实现了
- line 129:
hard_negative = np.logical_and(0 < max_overlaps, max_overlaps < cfg.TRAIN.RPN_NEGATIVE_OVERLAP)
这句代码的目的有待研究,0是否可以取其他值
- line 165~166:
anchors_3d = bv_anchor_to_lidar(anchors)
bbox_targets = _compute_targets_3d(anchors_3d, gt_boxes_3d[argmax_overlaps, :])
这里是不是应该取label!=-1的anchor进行处理,效率会高点,还是说这里是统一后面test时的网络(ps:后面test的时候没有用到这个层:!)
- line 176~183:
labels[max_overlaps < cfg.TRAIN.RPN_NEGATIVE_OVERLAP] = 0
# subsample negative labels if we have too many
num_bg = cfg.TRAIN.RPN_BATCHSIZE - np.sum(labels == 1)
bg_inds = np.where(labels == 0)[0]
if len(bg_inds) > num_bg:
disable_inds = npr.choice(
bg_inds, size=(len(bg_inds) - num_bg), replace=False)
labels[disable_inds] = -1
很可能是一个bug,这里与前面的处理冲突了