1.1 离散卷积(conv)
i (output),k (kernel_size), s (stride), p (pooling), o (output)
1.2 池化(pooling)
i, k, s, o
2.卷积(conv)
2.1 no padding
o = ( i - k ) / s + 1 # 向下取整
2.2 pdding
o = ( i - k + 2*p ) / s +1 p = 2/k 或 p=k-1 # 向下取整
3.反卷积(deconv/transposed conv/ fractionally strided conv)
一般反卷积在decoding时使用,大多时候用于上采样,为了减少棋盘效应(伪影),k取偶数(例,k=4,s=2,deconv后特征长、宽变为原来2倍)
A guide to convolution arithmetic for deep learning
中以K=3为例,W矩阵实际运算时变为:
卷积:O = C * I (C: 4x16 I:4x4, reshape为 16x1 ,卷积得到O:4x1, rehshape 为 2x2 ) 4x4--------->2x2
反卷积:I = * O (转置卷积由来) (: 16x4 O:2x2, rehsape成 4x1, I:16x1, reshape为4x4