tf.keras.layers.SeparableConv2D

View source on GitHub

Depthwise separable 2D convolution.

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
)

Separable convolutions consist in first performing a depthwise spatial convolution (which acts on each input channel separately) followed by a pointwise convolution which mixes together 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:

Input shape:

4D tensor with shape: (batch, channels, rows, cols) if data_format='channels_first' or 4D tensor with shape: (batch, rows, cols, channels) if data_format='channels_last'.

Output shape:

4D tensor with shape: (batch, filters, new_rows, new_cols) if data_format='channels_first' or 4D tensor with shape: (batch, new_rows, new_cols, filters) if data_format='channels_last'. rows and cols values might have changed due to padding.