# CNN 感受野计算公式

## 0. Calculating Receptive Field of CNN

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

$$l_{k} = l_{k-1}+ \left [ (f_{k}-1)*\prod_{i=1}^{k-1}s_{i} \right ]$$

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_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$

• 版权声明 本文源自 DexterLei 整理整理发表
• 除非特殊声明，本站文章均为原创，转载请务必保留本文链接