翻译:
http://noahsnail.com/2018/01/03/2018-01-03-Faster%20R-CNN%E8%AE%BA%E6%96%87%E7%BF%BB%E8%AF%91%E2%80%94%E2%80%94%E4%B8%AD%E8%8B%B1%E6%96%87%E5%AF%B9%E7%85%A7/
https://blog.csdn.net/sloanqin/article/details/51545125
https://blog.csdn.net/u011718701/article/details/53758927
https://blog.csdn.net/wopawn/article/details/52223282
Faster RCNN
解决提出区域框的问题
亮点:
1) 引入RPN层共享特征——解决了区域建议网络速度慢的问题
【RPN做什么】
在卷积特征层输入n*n(n=3)的滑动窗口(图像上的anchor以滑动窗口为中心,3尺度3长宽比),每个移动窗口会映射成一个低维特征,该特征会输入到2层fc层(reg、cls)
【为什么要RPN】
共享卷积计算
【RPN好处】
平移不变性
尺度不变性——模板9种
长宽比
模型
Loss
|
| ||||||||||||||
cls | 二值分类object vs. not object 正类: 1)the anchor/anchors with the highest Intersection-overUnion (IoU) overlap with a ground-truth box 2)an anchor that has an IoU overlap higher than 0.7 负类: IoU ratio is lower than 0.3 for all ground-truth boxes | ||||||||||||||
Reg | where x, y, w, and h denote the box’s center coordinates and its width and height. Variables x, xa, and x∗ are for the predicted box, anchor box, and ground-truth box respectively (likewise for y, w, h). E ach regressor is responsible for one scale and one aspect ratio, and the k regressors do not share weights. | ||||||||||||||
其他 | stochastic gradient descent (SGD) 采样策略:“image-centric” sampling strategy——randomly sample 256 anchors in an image to compute the loss function of a mini-batch 采样比例:the sampled positive and negative anchors have a ratio of up to 1:1. If there are fewer than 128 positive samples in an image, we pad the mini-batch with negative ones.
| ||||||||||||||
Anchor | Anchors是一组大小固定的参考窗口,对任意图像任意滑窗位置都是9个模板 三种尺度{128^2,256^2,512^2}×三种长宽比{1:1,1:2,2:1}
根据图像大小计算滑窗中心点对应原图区域的中心点,通过原图中心点和size就可以得到滑窗位置和原图位置的映射关系,由此得到原图位置并根据与Ground Truth重复率贴上正负标签,让RPN学习该Anchors是否有物体即可。 |
训练
1用预训练模型初始化网络参数,然后fine-tune训练RPN
2用预训练模型初始化网络参数,并使用RPN网络输出的regionproposals来fine-tune训练Fast R-CNN,
3用2中的网络初始化RPN,固定共有的conv层(参数不再变化),只fine-tunedRPN独有的层
使用数据【随机选取256个anchor,对训练集标记区域和实际区域做比较,确定为前景(IOU>0.7的建议框或者IOU最高)、背景(IOU<0.3建议框);使用mini-batch=256,50%前景样本50%背景样本】,用模型finetune,获取整幅图像的特征conv5,得到特征图
4固定共有的conv层,fine-tuneFast R-CNN的FC层
5重复3、4
测试
A:训练集中所有的图像
(1)经过CNN传播至共享卷积层得到特征图
(2)特征图经过RPN得到区域建议和区域得分,对区域得分使用NMS(0.7),输出前top N个区域建议
C: 前top N个区域建议
(3)将(2)+C输入ROI,提取对应区域建议的特征
D:分类结果+对应的四个实值(边框信息)
(4)用nms进行筛选,得到最终的bounding box,类别及其score