CNN感受野计算

转自:作者 DexterLei
链接:https://www.jianshu.com/p/e875117e5372

0. Calculating Receptive Field of CNN

 

CNN特征图的两种可视化方法


感受野指的是一个特定的 CNN 特征(特征图上的某个点)在输入空间所受影响的区域。一个感受野可以用中信位置和打表来表征。然而,对于一个 CNN 特征来说,感受野中的每一个像素值并不是同等重要。一个像素点越接近感受野中心,它对输出特征的计算所起作用越大。这意味着某一个特征不仅仅是受限在输入图片中某个特定的区域(感受野),并且呈指数级聚焦在区域的中心。

 

感受野的计算公式如下:
l_{k} = l_{k-1}+ \left [ (f_{k}-1)*\prod_{i=1}^{k-1}s_{i} \right ]
其中 l_{k-1} 为第 k-1 层对应的感受野大小,f_k 为第 k 层的卷积核大小,或者是池化层的池化尺寸大小。

更为细致的解释如下:

The receptive field (RF) lk of layer k is:
l_{k} = l_{k-1}+ \left [ (f_{k}-1)*\prod_{i=1}^{k-1}s_{i} \right ]
where l_{k-1} is the receptive field of layer k−1, f_k is the filter size (height or width, but assuming they are the same here), and s_i is the stride of layer i.
The formula above calculates receptive field from bottom up (from layer 1). Intuitively, RF in layer k covers (f_k−1)∗s_{k−1} more pixels relative with layer k−1. However, the increment needs to be translated to the first layer, so the increments is a factorial — a stride in layer k−1 is exponentially more strides in the lower layers.

1. 举个例子

感受野的计算是逐层进行的,以下表中的网络结构为例。

No.LayersKernel SizeStride
1Conv13*31
2Pool12*22
3Conv23*31
4Pool22*22
5Conv33*31
6Conv43*31
7Pool32*22

感受野初始值 l_0 = 1,每层的感受野计算过程如下:
l_0 = 1
l_1 = 1 + (3-1) = 3
l_2 = 3 + (2-1)*1 = 4
l_3 = 4 + (3-1)*1*2 = 8
l_4 = 8 + (2-1)*1*2*1 = 10
l_5 = 10 + (3-1)*1*2*1*2 = 18
l_6 = 18 + (3-1)*1*2*1*2*1 = 26
l_7 = 26 + (2-1)*1*2*1*2*1*1 = 30

参考文献




 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值