PatchGANDiscriminator#
- class deepinv.models.PatchGANDiscriminator(input_nc=3, ndf=64, n_layers=3, use_sigmoid=False, batch_norm=True, bias=True, dim=2)[source]#
Bases:
ModulePatchGAN 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
dim (str, int) β Whether to build 2D or 3D network (if str, can be β2β, β2dβ, β3Dβ, etc.)
- References:
- forward(x)[source]#
Forward pass of discriminator model.
- Parameters:
x (torch.Tensor) β input image
Examples using PatchGANDiscriminator:#
Imaging inverse problems with adversarial networks