UpscaleDNYBlock

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

Bases: object

Upscale block that implements methodology similar to the Disney Research Paper using an upsampling2D block and 2 x convolutions

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

References

https://studios.disneyresearch.com/2020/06/29/high-resolution-neural-face-swapping-for-visual-effects/

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

  • 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”

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

  • interpolation (["nearest", "bilinear"], optional) – Interpolation to use for up-sampling. Default: “bilinear”

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

  • padding (str)

Methods Summary

__call__(inputs)

Call the UpscaleDNY block

Methods Documentation

__call__(inputs: KerasTensor) KerasTensor

Call the UpscaleDNY block

Parameters:

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

Returns:

The output from the block

Return type:

keras.KerasTensor

__call__(inputs: KerasTensor) KerasTensor

Call the UpscaleDNY block

Parameters:

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

Returns:

The output from the block

Return type:

keras.KerasTensor