Principle:Zai org CogVideo PatchGAN Discriminator
| Knowledge Sources | |
|---|---|
| Domains | Generative_Adversarial_Networks, Image_Synthesis |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
A PatchGAN discriminator classifies overlapping local patches of an image as real or fake rather than making a single global decision, encouraging the generator to produce sharp, realistic textures at fine spatial scales.
Description
Traditional GAN discriminators produce a single scalar output for the entire image, which captures global structure but provides limited gradient signal for local texture quality. The PatchGAN discriminator instead outputs a spatial map where each element corresponds to a receptive field (patch) of the input image. Each patch is independently classified as real or fake, and the overall discriminator loss is the average over all patches.
The architecture is a fully convolutional network with no fully connected layers, consisting of:
- A series of strided convolutional layers (typically 4x4 kernels with stride 2) that progressively downsample the input
- Normalization (BatchNorm or alternatives like ActNorm) and LeakyReLU activations after each convolution
- A final convolutional layer that maps to a single-channel output
The effective receptive field size determines the "patch" that each output element evaluates. With the standard configuration (3 downsampling layers, 4x4 kernels), the receptive field is 70x70 pixels, which has been shown to produce a good balance between capturing local texture and maintaining some structural awareness.
Usage
Use a PatchGAN discriminator when training generative models that must produce sharp, locally coherent textures. It is particularly effective for:
- Image-to-image translation tasks
- Autoencoder training where reconstruction sharpness is important
- Any GAN setup where local texture quality matters more than global layout
Theoretical Basis
The PatchGAN discriminator can be viewed as a form of texture/style loss. Let be the discriminator and be its output at spatial position . The adversarial loss is:
where is a per-element loss (e.g., cross-entropy or hinge loss) and is the number of spatial positions.
Each output element has a receptive field determined by the network architecture. For a network with layers of kernel size and stride :
The spatial averaging of per-patch losses means that the generator receives dense gradient feedback for every local region of the output, rather than a single gradient for the entire image. This encourages uniform local quality across the generated image and has been shown empirically to produce results comparable to full-image discriminators for high-frequency (texture) quality, while being more parameter-efficient and stable to train.
The fully convolutional design also means the discriminator can accept inputs of any spatial resolution without architectural changes, making it flexible for variable-resolution training.