目标检测之RCNN论文简读

135 阅读2分钟

前言

RCNN是目标检测的经典论文,后面有许多算法也是借鉴里面的思想,所以有必要好好研究一下。

R-CNN

论文 用CNN提取出Region Proposals中的featues,然后进行SVM分类与bbox的回归。 image.png

模型设计

确定候选框(RP)

Region proposals. A variety of recent papers offer methods for generating category-independent region proposals. Examples include: objectness [1], selective search [39], category-independent object proposals [14], constrained parametric min-cuts (CPMC) [5], multi-scale combinatorial grouping [3], and Cires¸an et al. [6], who detect mitotic cells by applying a CNN to regularly-spaced square crops, which are a special case of region proposals. While R-CNN is agnostic to the particular region proposal method, we use selective search to enable a controlled comparison with prior detection work (e.g., [39, 41]). 论文中使用selective search方法确定候选区域。 通过selective search(SS)算法生成1k-2k个候选框。 使用opencv模拟了一把

im = cv2.imread("./test.jpg")

ss = cv2.ximgproc.segmentation.createSelectiveSearchSegmentation()

ss.setBaseImage(im)
ss.switchToSelectiveSearchQuality()

rects = ss.process()

image image

提取特征(ALexNet)

使用CNN进行特征提取 产生的候选框强制缩放成227*227,并同ALexNet模型进行特征提取,提取成一个4096的特征向量,并用SVM分类器进行分类。 image

分类(SVM)

使用SVM进行目标分类,并进行打分,就是相似度。 image 假如有2000个候选框提取的4096特征向量,和svm的权重矩阵相乘,要对其打分分类: 2 为了减少计算量,得到分数后,就是使用nms算法,剔除不合格的候选框 image 大致的过程是:

  1. 获取iou大于某个值的重叠区域
  2. 在这些区域中,只要分数最高的区域,其他的全部删除

通过这样的过程,可以淘汰不少候选框,减少后回归的计算压力。

回归(Bounding-Box regression)

大致过程:进行校验回归,修正目标框 image 引入数量N的训练对{(Pi,Gi)}i=1,...,N\{(P^i,G^i)\}_i=1,...,N Px,Py代表图片中的坐标;Pw,Ph代表框的宽高P_x,P_y代表图片中的坐标;P_w,P_h代表框的宽高 P代表预测框,G代表真实框 目标是训练一种”转换“,这样”转换“是将预测框P映射到真实框G image image 有个函数d(P),使P接近于G,无论是xy坐标还是框高wh有个函数d(P),使P接近于G,无论是xy坐标还是框高wh 所有有公式: 先做平移

G^x=Pwdx(P)+PxG^y=Phdy(P)+Py\hat{G}_x=P_wd_x(P)+P_x\\ \hat{G}_y=P_hd_y(P)+P_y\\

再做尺度缩放

G^w=Pwexp(dw(P))G^h=Phexp(dh(P))\hat{G}_w=P_w\exp(d_w(P))\\ \hat{G}_h=P_h\exp(d_h(P))\\

image image 因为区域P的特征用ϕ5(P)表示,用SVM进行预测可以用d(P)=WTϕ5(P)表示。因为区域P的特征用\phi_5(P)表示,用SVM进行预测可以用d_*(P)=W_{*}^{T}\phi_5(P)表示。 W是可以学习的参数,目的是通过优化正则化最小二来学习它。W_*是可以学习的参数,目的是通过优化正则化最小二来学习它。 t是真实的偏移量,WTϕ5(P)是预测的偏移量,目的是用他们相减尽可能小。t_*是真实的偏移量,W_{*}^{T}\phi_5(P)是预测的偏移量,目的是用他们相减尽可能小。 (tx,ty)是偏移量,(tw,th)是尺度缩放(t_x,t_y)是偏移量,(t_w,t_h)是尺度缩放 image PS:论文的内容还有很多,这是我自己挑选认为重要论文的大致思想,有些疏漏和错误请不吝指出!