Bounding-box 回归

R-CNN系列均训练了Bounding-box回归器来对窗口进行校正,其目标是学习一种转换关系将预测得到的窗口P映射为真实窗口G(Ground truth).

box regression

变换方式

可以通过简单的仿射变换以及指数变换将当前预测出的Bounding-box P向Ground truth纠正:

\[\begin{cases} \widehat{G_x}=P_wd_x(P)+P_x \\ \widehat{G_y}=P_hd_y(P)+P_y \end{cases} \tag{仿射} \]

\[\begin{cases} \widehat{G_w}=P_we^{d_w(P)} \\ \widehat{G_h}=P_he^{d_h(P)} \end{cases}\tag{尺度缩放} \]

其中(x,y)是区域的中心点坐标,(w,h)是宽和高.
注意:只有当Proposal和Ground Truth比较接近时(线性问题),我们才能将其作为训练样本训练我们的线性回归模型.RCNN计算预测的Proposal与多个Ground Truth的IoU,如果没有任何重叠(IoU=0),则忽略这个Proposal不加入训练;将最大IoU对应的窗口作为Proposal"最近"的Ground Truth,如果此最大的IoU小于阈值(如0.6)也忽略掉.

通过上述\(\widehat G - P\)公式可计算出需要学习的目标target:

\[\begin{cases} t_x = (G_x− P_x)/P_w \\ t_y = (G_y− P_y)/P_h \\ t_w = \log(G_w/P_w) \\ t_h = \log(G_h/P_h) \end{cases} \]

带L2正则项的(ridge regression)目标函数为:

\[w_*= \text{argmin}_{\hat w_*}\sum_i^N(t^i_*-s^i_*)^2+\lambda\|\hat w_*\|^2 \]

其中\(s^i_*=\hat w_*^T\phi(P^i)\) ,而\(w_*\)是可学习的参数,\(\phi\)是CNN中某一层的特征.
目标函数除了计算差方和的方式还可以是smooth L1.

加旋转角度

对于船只等目标,通常是长条形且在图片中呈倾斜状态,对其进行一定程度的旋转可能能取得更好的效果。因此可以同时在训练集、预测值、损失函数中加入旋转角度。参考论文"A High Resolution Optical Satellite Image Dataset for Ship Recognition and Some New Baselines" (ICPRAM 2017,Zikun Liu,Yiping Yang),"Rotated Region Based CNN for Ship Detection"(Zikun Liu,ICIP 2017)

在预测的proposal中加入旋转角度\(\theta=P_a\),得到:

\[\begin{cases} t_x = (G_x− P_x)/(P_w\cosθ+P_h\sin|θ|) \\ t_y = (G_y− P_y)/(P_w\sin|θ|+P_h\cosθ) \\ t_w = \log(G_w/P_w) \\ t_h = \log(G_h/P_h) \\ ta= (G_a−P_a)/(λ180) \end{cases} \]

λ是个常数(λ = 0.5)。
在上式中求\(t_x,t_y\)时旋转映射不稳定,可以替换为如下方式,先映射再直接对宽和高进行normalize。

\[\begin{cases} t_x = (\cosα(G_x− P_x) + \sinα(G_y− P_y))/P_w \\ t_y = (−\sinα(G_x− P_x) + \cosα(G_y− P_y))/P_h \end{cases} \]

scale-invariant translation (SIT)的示例图:
bbox rotate

posted @ 2018-03-15 11:49  康行天下  阅读(1759)  评论(0编辑  收藏  举报