https://www.cnblogs.com/chaofn/p/9310912.html
输入图像,经过卷积层输出feature map;
在feature map上用3 * 3的sliding window滑动,每个window的中心对应原图的中心生成9个anchor,这9个anchor与ground truth找IOU,找出需要的正样本(IOU>0.7,前景,有物体),负样本(IOU<0.3,背景,没物体);
选出的这些的"合适"的anchor对应回feature map的3 * 3 * 256的滑动窗;
选择的这些anchor来自不同的滑动窗.
Proposal Layer forward(caffe layer的前传函数)按照以下顺序依次处理:
生成anchors,利用[公式]对所有的anchors做bbox regression回归(这里的anchors生成和训练时完全一致)
按照输入的positive softmax scores由大到小排序anchors,提取前pre_nms_topN(e.g. 6000)个anchors,即提取修正位置后的positive anchors。
限定超出图像边界的positive anchors为图像边界(防止后续roi pooling时proposal超出图像边界)
剔除非常小(width<threshold or height<threshold)的positive anchors
对剩余的positive anchors进行NMS(nonmaximum suppression)
Proposal Layer有3个输入:positive和negative anchors分类器结果rpn_cls_prob_reshape,对应的bbox reg的(e.g. 300)结果作为proposal输出。
在原文中使用的是ZF model中,其Conv Layers中最后的conv5层num_output=256,对应生成256张特征图,所以相当于feature map每个点都是256-dimensions
在conv5之后,做了rpn_conv/3x3卷积且num_output=256,相当于每个点又融合了周围3x3的空间信息;
选中的anchor对应的滑动窗经过卷积生成256-dimension的向量,分别通过fg/bg 分类层和 bbox回归层,输出(4 + 2) * 9维; 这9个维度可能只有一两个对应了有用的anchor;