废话不多说, 直接上示例
1. 前戏
卷积前后大小变化示例
现实中的例子
featural金字塔
cnn内部可视化
filter, activation map可视化
cnn识别过程内部可视化
2. 卷积缩放过程尺度变化
回顾
3. 公式总结1: 不考虑zero paddings(理想情况)
3x3 filter & stride=1
7x7 input (spatially) +assume 3x3 filter + applied with stride 1 => 5x5 output!
3x3 filter & stride=2
7x7 input (spatially) +assume 3x3 filter + applied with stride 1 => 3x3 output!
公式总结
Output size:
e.g. N = 7, F = 3:
stride 1 => (7 - 3)/1 + 1 = 5
stride 2 => (7 - 3)/2 + 1 = 3
stride 3 => (7 - 3)/3 + 1 = 2.33 :\
4. 公式总结2: 考虑padding
e.g. input 7x7
3x3 filter, applied with stride 1
pad with 1 pixel border => 7x7 output!
in general, common to see CONV layers with stride 1, filters of size FxF, and zero-padding with (F-1)/2. (will preserve size spatially)
e.g. F = 3 => zero pad with 1
F = 5 => zero pad with 2 F = 7 => zero pad with 3
公式总结:
举例:
vgg16中,
Conv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
:
N= 224, F=3, stride=1, padding=1,
maxPool2d相当于filter=2, stride=2
N=4, F=2,stride=2,padding=0,
N=N -> maxPool2d -> -> maxPool2d -> -> maxPool2d >
4次池化后(大小=2,步长=2)后, 相当于将原图缩放16倍()
5. 回顾卷积对dimensions的shrinking过程:
example1: