SeparableConv2D
classtf_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
)
Depthwise separable 2D convolution.
Separable convolutions consist of first performing
a depthwise spatial convolution
(which acts on each input channel separately)
followed by a pointwise convolution which mixes the resulting
output channels. The depth_multiplier
argument controls how many
output channels are generated per input channel in the depthwise step.
Intuitively, separable convolutions can be understood as a way to factorize a convolution kernel into two smaller kernels, or as an extreme version of an Inception block.
Arguments
dilation_rate
value != 1."valid"
or "same"
(case-insensitive).
"valid"
means no padding. "same"
results in padding with zeros
evenly to the left/right or up/down of the input such that output has
the same height/width dimension as the input.channels_last
(default) or channels_first
.
The ordering of the dimensions in the inputs.
channels_last
corresponds to inputs with shape
(batch_size, height, width, channels)
while channels_first
corresponds to inputs with shape
(batch_size, channels, height, width)
.
When unspecified, uses image_data_format
value found in your Keras
config file at ~/.keras/keras.json
(if exists) else 'channels_last'.
Defaults to 'channels_last'.filters_in * depth_multiplier
.keras.activations
).keras.initializers
). If None, then the default initializer
('glorot_uniform') will be used.keras.initializers
). If None, then the default initializer
('glorot_uniform') will be used.keras.initializers
).keras.regularizers
).keras.regularizers
).keras.regularizers
).keras.regularizers
).keras.constraints
).keras.constraints
).keras.constraints
).Input shape
4D tensor with shape:
(batch_size, channels, rows, cols)
if data_format='channels_first'
or 4D tensor with shape:
(batch_size, rows, cols, channels)
if data_format='channels_last'.
Output shape
4D tensor with shape:
(batch_size, filters, new_rows, new_cols)
if
data_format='channels_first'
or 4D tensor with shape:
(batch_size, new_rows, new_cols, filters)
if
data_format='channels_last'. rows
and cols
values might have changed
due to padding.
Returns
A tensor of rank 4 representing
activation(separableconv2d(inputs, kernel) + bias)
.
Raises
padding
is "causal".