PatchGANDiscriminator#

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

Bases: Module

PatchGAN Discriminator model.

This discriminator model was originally proposed by Isola et al.[1] and classifies whether each patch of an image is real or fake.

Implementation adapted from Kupyn et al.[2].

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


References:

forward(x)[source]#

Forward pass of discriminator model.

Parameters:

x (torch.Tensor) – input image

Examples using PatchGANDiscriminator:#

Imaging inverse problems with adversarial networks

Imaging inverse problems with adversarial networks