本文共 4292 字,大约阅读时间需要 14 分钟。
这半年忙于实习,很久没有写文章了。实习的工作又是深度学习框架的优化,NLP模型性能的优化,所以CV方面看的就越来越少了,现在有时间,把之前的坑补好,将RCNN系列文章写完,也算是对自己知识的一个总结回忆。后续会记录一些GAN、NLP、以及深度学习框架的东西,希望可以坚持下去。
上一篇写了 Fast-RCNN 算法,相比于 R-CNN 算法,已经大大降低了运行时间,这种基于 region proposal 的算法运行效率的瓶颈变为了候选框的选取上,以往都是选取大量候选框,然后在 feature map 上进行映射,随后再进行回归,确定最终的候选框,这种方式需要花费大量的时间在候选框的回归运算。针对这一点,Faster-RCNN 采用了 Region proposal Network (RPN) ,将候选框的选取也交给网络来做。文章主要创新在两方面:
RPN 输入是一张图片,输出是矩形候选框及对于的目标分数,这中间当然会用到卷积网络进行特征提取,至于如何与 Fast-RCNN 融合为一个网络,共用卷积网络进行特征提取,下一章节再表。
RPN 网络总的流程如上图,其中
conv feature map : 卷积提取特征,需要与 fast-rcnn 进行融合共用;
N * N spatial window : 进行 ROP pooling 时选用的卷积核,得到固定的输出,这里是 256-d 特征值; 1 * 1 conv : 分别为 cls 和 reg 两个task提供特征筛选,这里使用 1*1 的卷积和 fc全连接 是等价的,每个候选框生成 2+4 个值作为 候选框的位置 和 是特定目标的分数。
原文描述如下:
------To generate region proposals, we slide a small network over the convolutional feature map output by the last shared convolutional layer. This small network takes as input an n × n spatial window of the input convolutional feature map. Each sliding window is mapped to a lower-dimensional feature (256-d for ZF and 512-d for VGG, with ReLU [33] following). This feature is fed into two sibling fullyconnected layers—a box-regression layer (reg) and a box-classification layer (cls) .
下面这一句,说明 所有候选框 进行降维时的全连接层的参数是共享的:
------ Note that because the mini-network operates in a sliding-window fashion, the fully-connected layers are shared across all spatial locations. This architecture is naturally implemented with an n×n convolutional layer followed by two sibling 1×1 convolutional layers (for reg and cls, respectively).
锚框示意如下图(将改图所有矩形框中心移到同一点即可):
对应原文以及引用其他博客内容: ------ ------ An anchor is centered at the sliding window in question, and is associated with a scale and aspect ratio (Figure 3, left). By default we use 3 scales and 3 aspect ratios, yielding k = 9 anchors at each sliding position. For a convolutional feature map of a size W ×H (typically ∼2,400), there are WHk anchors in total.feature map对于anchorbox的生成的贡献就是提供了一个中心点而已,featuremap每个位置上的点,就对应一个anchorbox的中心,然后呢,我知道了这么多中心点,根据base size,scales,aspect ratios就可以算出来一个矩形的长和宽。矩形的中心点就是featuremap上的那个点对应原图上的点。
原文:
因为RPN和Fast-RCNN时单独训练的,且会根据不同的方式进行网络参数更新,如何进行 RPN 和 Fast-RCNN 直接的卷积层共享,作者分析了三种方法,最后采用了 alternating training,就是 “你一次,我一次” 的迭代训练。
具体训练时采用了4步训练法:
转载地址:http://mstii.baihongyu.com/