DepthwiseConv2D 类tf_keras.layers.DepthwiseConv2D(
kernel_size,
strides=(1, 1),
padding="valid",
depth_multiplier=1,
data_format=None,
dilation_rate=(1, 1),
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,
**kwargs
)
深度方向(Depthwise)2D 卷积。
深度卷积是一种卷积类型,其中每个输入通道都与不同的核(称为深度核)进行卷积。你可以将深度卷积理解为深度可分离卷积的第一步。
它通过以下步骤实现:
depth_multiplier 输出通道的单独深度核进行卷积。与常规的 2D 卷积不同,深度方向卷积不会在不同的输入通道之间混合信息。
depth_multiplier 参数决定了每个输入通道应用多少个滤波器。因此,它控制在深度方向卷积步骤中为每个输入通道生成的输出通道数量。
参数
dilation_rate 值不兼容。'valid' 或 'same'(不区分大小写)之一。"valid" 表示不进行填充。"same" 会在输入的左/右或上/下均匀地填充零,以便输出在高度/宽度维度上与输入相同。filters_in * depth_multiplier。channels_last(默认)或 channels_first。输入维度中的排序方式。channels_last 对应于形状为 (batch_size, height, width, channels) 的输入,而 channels_first 对应于形状为 (batch_size, channels, height, width) 的输入。未指定时,将使用您的 TF-Keras 配置文件 ~/.keras/keras.json 中的 image_data_format 值(如果存在),否则默认为 'channels_last'。默认为 'channels_last'。dilation_rate 值都与指定任何大于 1 的 strides 值不兼容。keras.activations)。keras.initializers)。如果为 None,则将使用默认初始化器 ('glorot_uniform')。keras.initializers)。如果为 None,则将使用默认初始化器 ('zeros')。keras.regularizers)。keras.regularizers)。keras.regularizers)。keras.constraints)。keras.constraints)。输入形状
4D 张量,形状为:如果 data_format='channels_first',则为 [batch_size, channels, rows, cols];如果 data_format='channels_last',则为 [batch_size, rows, cols, channels]。
输出形状
4D 张量,形状为:如果 data_format='channels_first',则为 [batch_size, channels * depth_multiplier, new_rows, new_cols];如果 data_format='channels_last',则为 [batch_size, new_rows, new_cols, channels * depth_multiplier]。由于填充,rows 和 cols 的值可能会发生变化。
返回
一个秩为 4 的张量,表示 activation(depthwiseconv2d(inputs, kernel) + bias)。
引发
padding 为 "causal"。 ("因果")strides > 1 且 dilation_rate > 1 时。