Spatial Transformer Networks论文

0 引言

该论文是2015年发表在nips会议上的一篇文章,提出spatial transformer结构,可以改变输入特征图中某一对象的大小、形状。可用于基于注意力机制的网络。可以在CNN中的任意位置插入任意多个spatial transformer。

1 背景

卷积神经网络中最大池化支持对象发生微小变动的空间不变性(平移、旋转等),然而当对象发生比较大的变换时,就不支持空间不变性,因此作者提出一种spatial transformer结构,以调参的形式支持这种特性。
优点

  1. 可以加在CNN中的任何位置并且不用改变网络结构及损失函数。
  2. 可以端到端的进行训练。
  3. 可以提高精度。

缺点

  1. 需要调参。

2 结构

网络由三部分组成:localisation network(参数预测)、grid generator(坐标映射)、sampler(像素采集)。结构图如图2.1所示。效果如图2.2所示,a为自身转换(不变),b为旋转。

图2.1 spatial transformer结构图
图2.2 spatial transformer效果图

2.1 localisation network

预测转换的参数。
( x i s y i s ) = Γ θ ( G i ) = A θ ( x i t y i t 1 ) = [ θ 11 θ 12 θ 13 θ 21 θ 22 θ 23 ] ( x i t y i t 1 ) \begin{pmatrix}x_i^s\\ y_i^s\end{pmatrix}=\Gamma_\theta(G_i)=\Alpha_\theta\begin{pmatrix}x_i^t\\ y_i^t\\1 \end{pmatrix}=\begin{bmatrix} \theta_{11} & \theta_{12}&\theta_{13}\\\theta_{21} & \theta_{22}&\theta_{23}\end{bmatrix} \begin{pmatrix}x_i^t\\y_i^t\\1 \end{pmatrix} (xisyis)=Γθ(Gi)=Aθxityit1=[θ11θ21θ12θ22θ13θ23]xityit1
− 1 ≤ x i s , y i s , x i t , y i t ≤ 1 -1\leq x_i^s,y_i^s,x_i^t,y_i^t\leq1 1xis,yis,xit,yit1

几种变换:
identity变换时: A θ = [ 1 0 0 0 1 0 ] A_\theta=\begin{bmatrix} 1 & 0 & 0\\ 0&1&0 \end{bmatrix} Aθ=[100100]
平移变换时: A θ = [ 1 0 θ 1 0 1 θ 2 ] A_\theta=\begin{bmatrix} 1 & 0 & \theta_1\\ 0&1&\theta_2 \end{bmatrix} Aθ=[1001θ1θ2]
旋转变换时: A θ = [ c o s θ − s i n θ 0 s i n θ − c o s θ 0 ] A_\theta=\begin{bmatrix} cos\theta & -sin\theta & 0\\ sin\theta& -cos\theta&0 \end{bmatrix} Aθ=[cosθsinθsinθcosθ00]
note

  1. x i t x_i^t xit为目标x坐标, y i t y_i^t yit为源x坐标。由目标坐标值(已知)推断源特征图(所求)的坐标。

2.2 grid generator

转换后生成特征图的大小由用户指定,计算每个像素的坐标。

2.3 sampler

计算每个坐标的像素值,坐标值可能为小数,此时要注意如何进行反向传播。因为如果像素值只取离坐标最近的点时,当坐标反向传播后,新的坐标对应的像素值可能仍为上一次的像素值,由此计算的损失值不变,梯度为0,反向传播失效。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值