PatchGANDiscriminator

class deepinv.models.PatchGANDiscriminator(input_nc: int = 3, ndf: int = 64, n_layers: int = 3, use_sigmoid: bool = False, batch_norm: bool = True, bias: bool = True)[source]

Bases: Module

PatchGAN Discriminator model.

This discriminator model was originally proposed in Image-to-Image Translation with Conditional Adversarial Networks (Isola et al.) and classifies whether each patch of an image is real or fake.

Implementation adapted from DeblurGAN: Blind Motion Deblurring Using Conditional Adversarial Networks (Kupyn et al.).

See Imaging inverse problems with adversarial networks for how to use this for adversarial training.

Parameters:
  • input_nc (int) – number of input channels, defaults to 3

  • ndf (int) – hidden layer size, defaults to 64

  • n_layers (int) – number of hidden conv layers, defaults to 3

  • use_sigmoid (bool) – use sigmoid activation at end, defaults to False

  • batch_norm (bool) – whether to use batch norm layers, defaults to True

  • bias (bool) – whether to use bias in conv layers, defaults to True

forward(input)[source]

Forward pass of discriminator model.

Parameters:

input (Tensor) – input image

Examples using PatchGANDiscriminator:

Imaging inverse problems with adversarial networks

Imaging inverse problems with adversarial networks