彻底搞懂感受野的含义与计算

文章目录什么是感受野约定感受野大小感受野中心小结参考博客:博客园 | CSDN | blog什么是感受野The receptive field is defined as the region in the input space that a particular CNN’s feature is looking at (i.e. be affected by).—— A guide ...
摘要由CSDN通过智能技术生成


博客: 博客园 | CSDN | blog

什么是感受野

The receptive field is defined as the region in the input space that a particular CNN’s feature is looking at (i.e. be affected by).

—— A guide to receptive field arithmetic for Convolutional Neural Networks

感受野(Receptive Field),指的是神经网络中神经元“看到的”输入区域,在卷积神经网络中,feature map上某个元素的计算受输入图像上某个区域的影响,这个区域即该元素的感受野。

卷积神经网络中,越深层的神经元看到的输入区域越大,如下图所示,kernel size 均为 3 × 3 3 \times 3 3×3,stride均为1,绿色标记的是 L a y e r 2 Layer 2 Layer2 每个神经元看到的区域,黄色标记的是 L a y e r 3 Layer 3 Layer3 看到的区域,具体地, L a y e r 2 Layer 2 Layer2每个神经元可看到 L a y e r 1 Layer 1 Layer1 3 × 3 3 \times 3 3×3 大小的区域, L a y e r 3 Layer3 Layer3 每个神经元看到 L a y e r 2 Layer 2 Layer2 3 × 3 3 \times 3 3×3 大小的区域,该区域可以又看到 L a y e r 1 Layer 1 Layer1 5 × 5 5 \times 5 5×5 大小的区域。

https://www.researchgate.net/publication/316950618_Maritime_Semantic_Labeling_of_Optical_Remote_Sens

所以,感受野是个相对概念,某层feature map上的元素看到前面不同层上的区域范围是不同的,通常在不特殊指定的情况下,感受野指的是看到输入图像上的区域。

为了具体计算感受野,这里借鉴视觉系统中的概念,
r e c e p t i v e   f i e l d = c e n t e r + s u r r o u n d receptive \ field = center + surround receptive field=center+surround

准确计算感受野,需要回答两个子问,即视野中心在哪和视野范围多大

  • 只有看到”合适范围的信息”才可能做出正确的判断,否则就可能“盲人摸象”或者“一览众山小”;
  • 目标识别问题中,我们需要知道神经元看到是哪个区域,才能合理推断物体在哪以及判断是什么物体。

但是,网络架构多种多样,每层的参数配置也不尽相同,感受野具体该怎么计算?

约定

在正式计算之前,先对数学符号做如下约定,

https://medium.com/mlreview/a-guide-to-receptive-field-arithmetic-for-convolutional-neural-networks-e0f514068807

  • k k k:kernel size

  • p p p:padding size

  • s s s:stride size

  • L a y e r Layer Layer:用 L a y e r Layer Layer表示feature map,特别地 L a y e r   0 Layer \ 0 Layer 0为输入图像;

  • C o n v Conv Conv:用 C o n v Conv Conv表示卷积, k k k p p p s s s为卷积层的超参数, C o n v   l Conv \ l Conv l的输入和输出分别为 L a y e r   l − 1 Layer \ l-1 Layer l1 L a y e r   l + 1 Layer \ l+1 Layer l+1

  • n n n:feature map size为 n × n n \times n n×n,这里假定 h e i g h t = w i d t h height = width height=width

  • r r r:receptive field size为 r × r r \times r r×r,这里假定感受野为方形;

  • j j j:feature map上相邻元素间的像素距离,即将feature map上的元素与输入图像 L a y e r   0 Layer \ 0 Layer 0 上感受野的中心对齐后,相邻元素在输入图像上的像素距离,也可以理解为 feature map上前进1步相当于输入图像上前进多少个像素,如下图所示,feature map上前进1步,相当于输入图像上前进2个像素, j = 2 j=2 j=2

    https://github.com/vdumoulin/conv_arithmetic/blob/master/gif/padding_strides.gif

  • s t a r t start start:feature map左上角元素在输入图像上的感受野中心坐标 ( s t a r t , s t a r t ) (start, start) (start,start),即视野中心的坐标,在上图中,左上角绿色块感受野中心坐标为 ( 0.5 , 0.5 ) (0.5, 0.5) (0.5,0.5),即左上角蓝色块中心的坐标,左上角白色虚线块中心的坐标为 ( − 0.5 , − 0.5 ) (-0.5, -0.5) (0.5,0.5)

  • l l l l l l表示层,卷积层为 C o n v   l Conv \ l Conv l,其输入feature map为 L a y e r   l − 1 Layer \ l-1 Layer l1,输出为 L a y e r   l Layer \ l Layer l

下面假定所有层均为卷积层。

感受野大小

感受野大小的计算是个递推公式。

再看上面的动图,如果feature map $Layer \ 2 $ 上的一个元素 A A

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值