UpscaleBlock

class lib.model.nn_blocks.UpscaleBlock(filters: int, kernel_size: int | tuple[int, int] = 3, padding: str = 'same', scale_factor: int = 2, normalization: str | None = None, activation: str | None = 'leakyrelu', **kwargs)

Bases: object

An upscale layer for sub-pixel up-scaling.

Adds reflection padding if it has been selected by the user, and other post-processing if requested by the plugin.

Parameters:
  • filters (int) – The dimensionality of the output space (i.e. the number of output filters in the convolution)

  • kernel_size (int, optional) – An integer or tuple/list of 2 integers, specifying the height and width of the 2D convolution window. Can be a single integer to specify the same value for all spatial dimensions. Default: 3

  • padding (["valid", "same"], optional) – The padding to use. NB: If reflect padding has been selected in the user configuration options, then this argument will be ignored in favor of reflect padding. Default: “same”

  • scale_factor (int, optional) – The amount to upscale the image. Default: 2

  • normalization (str or None, optional) – Normalization to apply after the Convolution Layer. Select one of “batch” or “instance”. Set to None to not apply normalization. Default: None

  • activation (str or None, optional) – The activation function to use. This is applied at the end of the convolution block. Select one of “leakyrelu”, “prelu” or “swish”. Set to None to not apply an activation function. Default: “leakyrelu”

  • kwargs (dict) – Any additional Keras standard layer keyword arguments to pass to the Convolutional 2D layer

Methods Summary

__call__(inputs)

Call the Faceswap Convolutional Layer.

Methods Documentation

__call__(inputs: KerasTensor) KerasTensor

Call the Faceswap Convolutional Layer.

Parameters:

inputs (keras.KerasTensor) – The input to the layer

Returns:

The output tensor from the Upscale Layer

Return type:

keras.KerasTensor

__call__(inputs: KerasTensor) KerasTensor

Call the Faceswap Convolutional Layer.

Parameters:

inputs (keras.KerasTensor) – The input to the layer

Returns:

The output tensor from the Upscale Layer

Return type:

keras.KerasTensor