输出尺寸(
o
h
o_h
oh,
o
w
o_w
ow)与输入尺寸(
n
h
n_h
nh,
n
w
n_w
nw)、核尺寸(
k
h
k_h
kh,
k
w
k_w
kw)、padding(
p
h
p_h
ph,
p
w
p_w
pw)和stride(
s
w
s_w
sw,
s
h
s_h
sh)的关系
o
h
=
(
n
h
+
p
h
−
k
h
+
s
h
)
/
s
h
o
w
=
(
n
w
+
p
w
−
k
w
+
s
w
)
/
s
w
o_h=(n_h+p_h-k_h+s_h)/s_h \\ o_w=(n_w+p_w-k_w+s_w)/s_w
oh=(nh+ph−kh+sh)/show=(nw+pw−kw+sw)/sw
这里的
p
h
p_h
ph,
p
w
p_w
pw表示两侧padding的和,即在单侧padding
p
h
/
2
p_h/2
ph/2,
p
w
/
2
p_w/2
pw/2
LeNet
LeNet
Data:MNIST
Input:(batch_size,1,28,28)
1st Conv: kernel=6*5*5 pad=2 stride=1 -----> (28+4-5+1)/1=28 output.shape=(batch_size,6,28,28)
Sigmoid
1st AvgPool: kernel=2*2 pad=0 stride=2 -----> (28+0-2+2)/2=14 output.shape=(batch_size,6,14,14)
2st Conv: kernel=16*5*5 pad=0 stride=1 -----> (14+0-5+1)/1=10 output.shape=(batch_size,16,10,10)
Sigmoid
2st AvgPool: kernel=2*2 pad=0 stride=2 -----> (10+0-2+2)/2=5 output.shape=(batch_size,16,5,5)
Flatten: feature_map展成向量长度16*5*5=400 (batch_size,400)
1st FC: 权重矩阵400*120 (batch_size,120)
2st FC: 权重矩阵120*84 (batch_size,84)
3st FC: 权重矩阵84*10 (batch_size,10)
AlexNet
AlexNet
Data:ImageNet
Input:(batch_size,3,224,224) kernel.shape=(n_channel,width,height)
1st Conv:
kernel=96*11*11 pad=0 stride=4 -----> (224+0-11+4)/4=28 (batch_size,96,54,54)
Relu
1st MaxPool:
kernel=3*3 pad=0 stride=2 -----> (54+0-3+2)/2=26 (batch_size,96,26,26)
2nd Conv:
kernel=256*5*5 pad=2 stride=1 -----> (26+4-5+1)/1=26 (batch_size,256,26,26)
Relu
2nd MaxPool:
kernel=3*3 pad=0 stride=2 -----> (26+0-3+2)/2=12 (batch_size,256,12,12)
3rd Conv:
kernel=384*3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 (batch_size,384,12,12)
Relu
4th Conv:
kernel=384*3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 (batch_size,384,12,12)
Relu
5th Conv:
kernel=384*3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 (batch_size,384,12,12)
Relu
3rd MaxPool:
kernel=3*3 pad=0 stride=2 -----> (12+0-3+2)/2=5 (batch_size,384,5,5)
Flatten: feature_map展成向量长度384*5*5=9600 (batch_size,9600)
1st FC: 权重矩阵9600*4096 (batch_size,4096)
Relu
Dropout
2st FC: 权重矩阵4096*4096 (batch_size,4096)
Relu
Dropout
3st FC: 权重矩阵4096*1000 (batch_size,1000)
VGG
NiN
GoogLeNet
GoogLeNet:
Data:Fashion-MNIST
Input: (batch_size,1,96,96)
1st Conv: kernel=64*7*7 pad=3 stride=2 -----> (96+6-7+2)/2=28 feature_map.shape=(batch_size,64,48,48)
Relu
1st MaxPool: kernel=3*3 pad=1 stride=2 -----> (48+2-3+2)/2=24 feature_map.shape=(batch_size,64,24,24)
2nd Conv: kernel=64*1*1 pad=0 stride=1 -----> (24+0-1+1)/1=24 feature_map.shape=(batch_size,64,24,24)
Relu
3rd Conv: kernel=192*3*3 pad=1 stride=1 -----> (24+2-3+1)/1=24 feature_map.shape=(batch_size,192,24,24)
Relu
2nd MaxPool: kernel=3*3 pad=1 stride=2 -----> (24+2-3+2)/2=12 feature_map.shape=(batch_size,192,12,12)
1st Inception:
line 1:
Conv: kernel=64*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,64,12,12)
line 2:
Conv: kernel=96*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,96,12,12)
Conv: kernel=128*3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,128,12,12)
line 3:
Conv: kernel=16*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,16,12,12)
Conv: kernel=32*5*5 pad=2 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,32,12,12)
line 4:
MaxPool: kernel=3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,192,12,12)
Conv: kernel=32*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,32,12,12)
2st Inception:
line 1:
Conv: kernel=128*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,128,12,12)
line 2:
Conv: kernel=128*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,128,12,12)
Conv: kernel=192*3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,192,12,12)
line 3:
Conv: kernel=32*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,32,12,12)
Conv: kernel=96*5*5 pad=2 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,96,12,12)
line 4:
MaxPool: kernel=3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,256,12,12)
Conv: kernel=64*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,64,12,12)
3rd MaxPool: kernel=3*3 pad=1 stride=2 -----> (12+2-3+2)/2=12 feature_map.shape=(batch_size,480,12,12)
3rd Inception:
line 1:
Conv: kernel=192*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,192,12,12)
line 2:
Conv: kernel=96*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,96,12,12)
Conv: kernel=208*3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,208,12,12)
line 3:
Conv: kernel=16*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,16,12,12)
Conv: kernel=48*5*5 pad=2 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,48,12,12)
line 4:
MaxPool: kernel=3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,480,12,12)
Conv: kernel=64*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,64,12,12)
4th Inception:
line 1:
Conv: kernel=192*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,192,12,12)
line 2:
Conv: kernel=96*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,96,12,12)
Conv: kernel=208*3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,208,12,12)
line 3:
Conv: kernel=16*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,16,12,12)
Conv: kernel=48*5*5 pad=2 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,48,12,12)
line 4:
MaxPool: kernel=3*3 pad=1 stride=1 -----> (12+2-3+1)/1=12 feature_map.shape=(batch_size,480,12,12)
Conv: kernel=64*1*1 pad=0 stride=1 -----> (12+0-1+1)/1=12 feature_map.shape=(batch_size,64,12,12)