为什么一个5*5的卷积核可以用两个3*3的卷积核代替,一个7*7的卷积核可以用三个的3*3卷积核代替? - 知乎
为什么一个5*5的卷积核可以用两个3x3卷积核代替呢?
主要原因很简单,因为两个3x3的卷积核的感受野的大小刚好是5x5。
下图是padding=1的情况,也可以padding=0。
可以从这张图上看到,两个3x3的卷积核的感受野是不是5x5呢?那么为什么要进行把5x5替换成两个3x3呢?原因其实很简单,两个3x3的 参数量少 。
- 假设输入维度 input_channel = output_channel;则
参数量:2个3x3的参数量为 2*3*3*input_channel * output_channel
5x5的参数量为:5*5*input_channel * output_channel。
对比起来,5*5的kernel是2个3*3kernel的参数量的25/18=1.39倍。
2. 假设输入维度 input_channel * α= output_channel;则
Google文章说的是 Having a two layer replacement for the 5 × 5 layer, it seems reasonable to reach this expansion in two steps: increasing the number of filters by sqrt(α) in both steps。
则 mid_dim = sqrt(alpha)*input_channel
3x3的参数量为:3*3*input_channel* mid_dim + 3*3*mid_dim* output_channel
而且两个3*3 kernel 的表现力不输 5*5。还一个就是两个3*3的卷积核跟着两个激活activation(3x3-activation-3x3-activation), 可以有 更强的非线性能力。
引用下这张图的解释:
the first layer is a 3 × 3 convolution, the second is a fully connected layer on top of the 3 × 3 output grid of the first layer (see Figure 1). Sliding this small network over the input activation grid boils down to replacing the 5 × 5 convolution with two layers of 3 × 3 convolution