Rich feature hierarchies for accurate object detection and semantic segmentation
Ross Girshick Jeff Donahue Trevor Darrell Jitendra Malik
该论文提出了一种简单且可扩展的目标检测方法,其mAP高达53.3%,比VOC 2012最好的结果高出至少30%。
该方法有两个关键的深刻见解:
1. 在输入图像的Region Proposals上应用了大规模CNN,来对目标进行定位与检测
2. 提出了对有监督的预训练模型进行迎合特定任务的微调,以解决训练样本的不足的问题,而且会带来性能的提升
由于该工作结合了region proposals与CNNs,故称该方法为R-CNN。
1.基于R-CNN的目标检测
该论文的目标检测模型分为三个模块:第一个模块用于产生一些与类别无关的候选区域(region proposals)。第二个模块是一个CNN模型,它将会从每个region proposals中提取固定长度的特征向量。第三个模块为一系列面向特定类别的SVM分类器。
<1> region proposals的产生
对于产生与类别无关的 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.
而本工作采用了selective search算法。
<2> 特征提取
使用基于caffe实现的CNN从每个region proposal中提取一个4096维的特征向量,该工作所使用的的CNN架构是由Alex Krizhevsky等人所提出的著名的AlexNet。这里需要将 region proposal 变形成CNN要求的227x227的尺寸。至于如何将一个任意尺寸的 region proposal 变形成CNN要求的227x227的尺寸,这里选取了最简单的做法:直接用 region proposal 内的像素均值进行padding,直至填充成227x227.
2.测试阶段的目标检测
先使用 selective search 在input image上选取2000个 region proposa ,然后对这些 region proposal 作变形,再送入CNN提取特征。接下来使用面向特定类别的SVM分类器对CNN提取的特征向量进行打分(这些分数是这2000个 region proposal 对于该SVM所面向类别的置信度)
然后采取贪心非最大值抑制办法(greedy non-maximum suppression ):经过上述特定类别的SVM判分后,对于那些发生相互重叠的 region proposal ,如果它们的IoU大于一定的阈值,则去掉SVM判分较低的 region proposal,仅保留分数最高的 那个 region proposal。
3.边框回归
借助边框回归技术这一简单的技术可以提升目标定位的准确度
基于上述贪心非最大值抑制方法过滤筛选后得到的 region proposals ,可以使用一个面向特定类别的边框回归器来产生一个新的边框,该新边框将会更加接近于真实标注的边框(ground-truth bounding box)。
设 region proposal 的中心坐标为
(
P
x
,
P
y
)
(P_x, P_y)
(Px,Py), 其高与宽为
(
P
w
,
P
h
)
(P_w, P_h)
(Pw,Ph)。同样地,真实标注的边框也可以表示为
(
G
x
,
G
y
,
G
w
,
G
h
)
(G_x, G_y,G_w, G_h)
(Gx,Gy,Gw,Gh)
对于特定的类别,假设存在
N
N
N个 目标,则这
N
N
N个 目标就对应有
N
N
N个真实标注边框 ,也对应有
N
N
N个待回归的 region proposal 边框,即有训练样本对
{
(
P
i
,
G
i
)
}
i
=
1
,
.
.
.
,
N
\left\{(P^i, G^i)\right\}_{i=1,...,N}
{(Pi,Gi)}i=1,...,N,其中
P
i
=
(
P
x
,
P
y
,
P
w
,
P
h
)
P^i=(P_x, P_y,P_w, P_h)
Pi=(Px,Py,Pw,Ph) 我们的目标是学习出一种简单的线性变换来将 region proposal 的
P
P
P映射至真实的边框
G
G
G
假设经回归器计算得到的预测值为
G
^
\hat{G}
G^,则有变换关系:
{
G
x
^
=
P
x
+
Δ
x
=
P
x
+
P
w
d
x
(
P
)
G
y
^
=
P
y
+
Δ
y
=
P
y
+
P
h
d
y
(
P
)
G
w
^
=
Δ
w
P
w
=
P
w
e
x
p
(
d
w
(
P
)
)
G
h
^
=
Δ
h
P
h
=
P
h
e
x
p
(
d
h
(
P
)
)
\left\{ \begin{array}{c} \hat{G_x}=P_x + \Delta{x} = P_x + P_w d_x(P) \\ \hat{G_y}=P_y + \Delta{y} = P_y + P_h d_y(P) \\ \hat{G_w}=\Delta{w} P_w = P_w exp(d_w(P)) \\ \hat{G_h}=\Delta{h} P_h = P_h exp(d_h(P)) \end{array} \right.
⎩⎪⎪⎨⎪⎪⎧Gx^=Px+Δx=Px+Pwdx(P)Gy^=Py+Δy=Py+Phdy(P)Gw^=ΔwPw=Pwexp(dw(P))Gh^=ΔhPh=Phexp(dh(P))
这里的
d
∗
(
P
)
d_*(P)
d∗(P)是 region proposal
P
P
P 经CNN前向计算并从Pool5层输出的特征图
ϕ
5
(
P
)
\phi_5(P)
ϕ5(P) 的线性函数,即
d
∗
(
P
)
=
ω
∗
T
ϕ
5
(
P
)
d_*(P)=\omega_*^T \phi_5(P)
d∗(P)=ω∗Tϕ5(P),其中
ω
∗
\omega_*
ω∗为待训练的模型参数.
{
(
P
i
,
G
i
)
}
i
=
1
,
.
.
.
,
N
\left\{(P^i, G^i)\right\}_{i=1,...,N}
{(Pi,Gi)}i=1,...,N
令
G
∗
^
=
G
∗
\hat{G_*}=G_*
G∗^=G∗,结合上述变换关系,则有:
{
d
x
(
P
)
=
(
G
x
−
P
x
)
/
P
w
=
ω
x
T
ϕ
5
(
P
)
d
y
(
P
)
=
(
G
y
−
P
y
)
/
P
h
=
ω
y
T
ϕ
5
(
P
)
d
w
(
P
)
=
log
(
G
w
/
P
w
)
=
ω
w
T
ϕ
5
(
P
)
d
h
(
P
)
=
log
(
G
h
/
P
h
)
=
ω
h
T
ϕ
5
(
P
)
\left\{ \begin{array}{c} d_x(P) = (G_x-P_x)/P_w = \omega_x^T \phi_5(P)\\ d_y(P) = (G_y-P_y)/P_h = \omega_y^T \phi_5(P)\\ d_w(P) = \log{(G_w/P_w)} = \omega_w^T \phi_5(P)\\ d_h(P) = \log{(G_h/P_h)} = \omega_h^T \phi_5(P) \end{array} \right.
⎩⎪⎪⎨⎪⎪⎧dx(P)=(Gx−Px)/Pw=ωxTϕ5(P)dy(P)=(Gy−Py)/Ph=ωyTϕ5(P)dw(P)=log(Gw/Pw)=ωwTϕ5(P)dh(P)=log(Gh/Ph)=ωhTϕ5(P)
进而有:
{
ω
x
T
=
(
G
x
−
P
x
)
/
P
w
[
ϕ
5
(
P
)
]
−
1
ω
y
T
=
(
G
y
−
P
y
)
/
P
h
[
ϕ
5
(
P
)
]
−
1
ω
w
T
=
log
(
G
w
/
P
w
)
[
ϕ
5
(
P
)
]
−
1
ω
h
T
=
log
(
G
h
/
P
h
)
[
ϕ
5
(
P
)
]
−
1
\left\{ \begin{array}{c} \omega_x^T = (G_x-P_x)/P_w [\phi_5(P)]^{-1}\\ \omega_y^T = (G_y-P_y)/P_h [\phi_5(P)]^{-1}\\ \omega_w^T = \log{(G_w/P_w)} [\phi_5(P)]^{-1}\\ \omega_h^T = \log{(G_h/P_h)} [\phi_5(P)]^{-1} \end{array} \right.
⎩⎪⎪⎨⎪⎪⎧ωxT=(Gx−Px)/Pw[ϕ5(P)]−1ωyT=(Gy−Py)/Ph[ϕ5(P)]−1ωwT=log(Gw/Pw)[ϕ5(P)]−1ωhT=log(Gh/Ph)[ϕ5(P)]−1
这便是
(
P
,
G
)
(P,G)
(P,G)样本对的回归目标,也是
ω
∗
\omega_*
ω∗的优化方向。
故有,模型的
L
2
L_2
L2正则化损失函数可以定义为如下,其中
t
∗
i
t_*^i
t∗i表示上述的
ω
∗
\omega_*
ω∗的优化目标:
l
o
s
s
=
∑
i
N
(
t
∗
i
−
ω
∗
^
T
ϕ
5
P
i
)
2
+
λ
∥
ω
∗
^
∥
2
loss = \sum_i^N(t_*^i - \hat{\omega_*}^T\phi_5{P^i} )^2 + \lambda\left \| \hat{\omega_*}\right \|^2
loss=i∑N(t∗i−ω∗^Tϕ5Pi)2+λ∥ω∗^∥2