DepthwiseConv2D

class lib.model.nn_blocks.DepthwiseConv2D(*args, padding: str = 'same', is_upscale: bool = False, **kwargs)

Bases: object

A standard Keras Depthwise Convolution 2D layer with parameters updated to be more appropriate for Faceswap architecture.

Parameters are the same, with the same defaults, as a standard keras.layers.DepthwiseConv2D except where listed below. The default initializer is updated to HeUniform or convolutional aware based on user configuration settings.

Parameters:
  • padding (str, optional) – One of “valid” or “same” (case-insensitive). Default: “same”. Note that “same” is slightly inconsistent across backends with strides != 1, as described here.

  • is_upscale (bool, optional) – True if the convolution is being called from an upscale layer. This causes the instance to check the user configuration options to see if ICNR initialization has been selected and should be applied. This should only be passed in as True from UpscaleBlock layers. Default: False

Methods Summary

__call__(*args, **kwargs)

Call the DepthwiseConv2D layer

Methods Documentation

__call__(*args, **kwargs) KerasTensor

Call the DepthwiseConv2D layer

Parameters:
  • args (tuple) – Standard DepthwiseConv2D layer call arguments

  • kwargs (dict[str, Any]) – Standard DepthwiseConv2D layer call keyword arguments

Returns:

The Tensor from the DepthwiseConv2D layer

Return type:

class: keras.KerasTensor

__call__(*args, **kwargs) KerasTensor

Call the DepthwiseConv2D layer

Parameters:
  • args (tuple) – Standard DepthwiseConv2D layer call arguments

  • kwargs (dict[str, Any]) – Standard DepthwiseConv2D layer call keyword arguments

Returns:

The Tensor from the DepthwiseConv2D layer

Return type:

class: keras.KerasTensor