SeparableConv2D
类tf_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,
**kwargs
)
深度可分离二维卷积。
可分离卷积由首先执行深度空间卷积(它独立作用于每个输入通道)以及随后执行点式卷积(该点式卷积混合产生的输出通道)组成。depth_multiplier
参数控制在深度卷积步骤中每个输入通道生成多少个输出通道。深度卷积输出通道的总数将等于 filters_in * depth_multiplier
。
从直观上讲,可分离卷积可以理解为将卷积核分解为两个更小的核的方法,或者理解为 Inception 块的极端版本。
参数
dilation_rate
值不兼容。"valid"
或 "same"
之一(不区分大小写)。"valid"
表示无填充。"same"
会在输入的左/右或上/下均匀填充零,使得输出与输入具有相同的高度/宽度维度。channels_last
(默认)或 channels_first
之一。输入中维度的顺序。channels_last
对应于形状为 (batch_size, height, width, channels)
的输入,而 channels_first
对应于形状为 (batch_size, channels, height, width)
的输入。未指定时,使用在你的 Keras 配置文件 ~/.keras/keras.json
(如果存在)中找到的 image_data_format
值,否则使用 'channels_last'。默认值为 'channels_last'。filters_in * depth_multiplier
。keras.activations
)。keras.initializers
)。如果为 None,则将使用默认初始化器('glorot_uniform')。keras.initializers
)。如果为 None,则将使用默认初始化器('glorot_uniform')。keras.initializers
)。keras.regularizers
)。keras.regularizers
)。keras.regularizers
)。keras.regularizers
)。keras.constraints
)。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, filters, new_rows, new_cols)
;如果 data_format='channels_last',形状为 (batch_size, new_rows, new_cols, filters)
。rows
和 cols
的值可能因填充而改变。
返回值
表示 activation(separableconv2d(inputs, kernel) + bias)
的 4 阶张量。
异常
padding
是 "causal"。