前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >彻底搞懂感受野的含义与计算

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

作者头像
李拜六不开鑫
修改2020-04-26 15:05:37
3.5K0
修改2020-04-26 15:05:37
举报
文章被收录于专栏:本立2道生本立2道生

什么是感受野

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上某个元素的计算受输入图像上某个区域的影响,这个区域即该元素的感受野。

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

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

为了具体计算感受野,这里借鉴视觉系统中的概念,

receptive \ field = center + surround

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

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

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

约定

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

https://medium.com/mlreview/a-guide-to-receptive-field-arithmetic-for-convolutional-neural-networks-e0f514068807
https://medium.com/mlreview/a-guide-to-receptive-field-arithmetic-for-convolutional-neural-networks-e0f514068807
https://github.com/vdumoulin/conv_arithmetic/blob/master/gif/padding_strides.gif
https://github.com/vdumoulin/conv_arithmetic/blob/master/gif/padding_strides.gif

感受野大小

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

可视化如下图所示,

receptive field size
receptive field size

感受野中心

receptive field center
receptive field center
receptive field center calculation
receptive field center calculation

小结

将感受野的相关计算小结一下,

\begin{aligned}j_{l} &= j_{l-1} \times s_{l} \\j_l &= \prod_{i=1}^{l} s_{i}\\r_{l} &= r_{l-1} + \left(k_{l}-1\right) * j_{l-1} \\&= r_{l-1}+\left(\left(k_{l}-1\right) * \prod_{i=1}^{l-1} s_{i}\right) \\start_{l} &= start_{l-1} + (\frac{k_l - 1}{2} - p_l) * j_{l-1}\end{aligned}

由上面的递推公式,就可以从前向后逐层计算感受野了,代码可参见computeReceptiveField.py,在线可视化计算可参见Receptive Field Calculator

以上。

参考

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-12-19 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 什么是感受野
  • 约定
  • 感受野大小
  • 小结
  • 参考
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档