DepthwiseConv2D深度方向的空间卷积
pointwise convolution,
SeparableConv2D深度可分离卷积
SeparableConv2D实现整个深度分离卷积过程,即深度方向的空间卷积 (分别作用于每个输入通道)+ 输出通道混合在一起的逐点卷积,
DepthwiseConv2D仅仅实现前半部分的空间卷积 (分别作用于每个输入通道)。
DepthwiseConv2D:不同channel用不同的卷积核做卷积
深度可分离 2D 卷积。
深度可分离卷积包括仅执行深度空间卷积中的第一步(其分别作用于每个输入通道)。 depth_multiplier 参数控制深度步骤中每个输入通道生成多少个输出通道。
keras.layers.DepthwiseConv2D(kernel_size, strides=(1, 1), padding='valid', depth_multiplier=1, data_format=None, activation=None, use_bias=True, depthwise_initializer='glorot_uniform', bias_initializer='zeros', depthwise_regularizer=None, bias_regularizer=None, activity_regularizer=None, depthwise_constraint=None, bias_constraint=None)
卷积核是作用于所有的depth方向的. depthwise conv对不同channel用不同的卷积核做卷积
pointwise convolution
depthwise卷积没有考虑到同一位置不同channel上的数据之间的关联.所以我们用一个1 x
1的卷积核对depthwise得到的[3,64,64]输出再做卷积.这里做的就是常规卷积. 得到[1,64,64].
用4个这样的1x1卷积核去做常规卷积. 得到输出[4,64,64].
SeparableConv2D
keras.layers.SeparableConv2D(filters, kernel_size, strides=(1, 1), padding='valid', data_format=None, dilation_rate=(1, 1), depth_multiplier=1, activation=None, use_bias=True, depthwise_initializer='glorot_uniform', pointwise_initializer='glorot_uniform', bias_initializer='zeros', depthwise_regularizer=None, pointwise_regularizer=None, bias_regularizer=None, activity_regularizer=None, depthwise_constraint=None, pointwise_constraint=None, bias_constraint=None)