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,
**kwargs
)
2D 可分离卷积层。
此层执行深度卷积,对通道单独作用,然后执行逐点卷积,混合通道。如果 use_bias 为 True 并且提供了偏置初始化器,它会将一个偏置向量添加到输出中。然后它可选地应用一个激活函数来生成最终输出。
参数
strides > 1 与 dilation_rate > 1 不兼容。"valid" 或 "same"(不区分大小写)。"valid" 表示无填充。"same" 会在输入的左/右或上/下均匀填充。当 padding="same" 且 strides=1 时,输出与输入具有相同的大小。"channels_last" 或 "channels_first"。输入中维度的顺序。"channels_last" 对应形状为 (batch, height, width, channels) 的输入,而 "channels_first" 对应形状为 (batch, channels, height, width) 的输入。它默认为 Keras 配置文件 ~/.keras/keras.json 中 image_data_format 的值。如果从未设置,则为 "channels_last"。input_channel * depth_multiplier。None,则不应用激活。True,则会将偏置添加到输出中。"glorot_uniform")。"glorot_uniform")。Optimizer 更新深度核后应用于深度核(例如,用于层权重的范数约束或值约束)。该函数必须将未投影的变量作为输入,并且必须返回投影的变量(其形状必须相同)。Optimizer 更新逐点核后应用于逐点核。Optimizer 更新偏置后应用于偏置。输入形状
data_format="channels_last":形状为 (batch_size, height, width, channels) 的 4D 张量data_format="channels_first":形状为 (batch_size, channels, height, width) 的 4D 张量输出形状
data_format="channels_last":形状为 (batch_size, new_height, new_width, filters) 的 4D 张量data_format="channels_first":形状为 (batch_size, filters, new_height, new_width) 的 4D 张量返回
一个 4D 张量,表示 activation(separable_conv2d(inputs, kernel) + bias)。
示例
>>> x = np.random.rand(4, 10, 10, 12)
>>> y = keras.layers.SeparableConv2D(3, 4, 3, 2, activation='relu')(x)
>>> print(y.shape)
(4, 4, 4, 4)