On Aliased Resizing and Surprising Subtleties in GAN Evaluation

Gaurav Parmar, Richard Zhang, Jun-Yan Zhu

TL;DR

Low-level image preprocessing choices—specifically resizing and JPEG compression—drastically distort generative model evaluation metrics like Fréchet Inception Distance (FID). Popular deep learning frameworks use non-adaptive resizing filters that introduce severe aliasing, leading to inconsistent model rankings and artificial score improvements. To fix this, the authors introduce Clean-FID, a standardized reference implementation that ensures fair and reproducible evaluation.

What Problem Does This Paper Address?

Evaluating generative models like GANs relies heavily on automated metrics, with Fréchet Inception Distance (FID) being the gold standard. FID works by passing real and generated images through a deep feature extractor (Inception-V3) and measuring the distance between their feature distributions. However, because Inception-V3 expects a fixed input resolution of 299x299, images must be resized before evaluation.

The authors identify a critical, overlooked flaw: different image processing libraries (like PIL, OpenCV, PyTorch, and TensorFlow) implement resizing in drastically different ways. Most popular deep learning libraries use fixed-width downsampling filters that violate basic signal processing principles, introducing severe aliasing artifacts. Consequently, two researchers evaluating the exact same generative model could report completely different FID scores simply due to their choice of preprocessing library, undermining the reliability of benchmark comparisons in the field.

Figure 3. Overview of the steps involved in FID. Generative modeling and evaluation require undergo subtleties in image pre-processing. Top: First, the image dataset may be downsampled before training (e.g., 1024→256 for FFHQ), requiring a resize (ψdata) and possible compression (Q). Bottom: Generated images may be saved as an unsigned 8-bit integer, resulting in a quantization and possible further compression ( bQ). FID aims to measure how well a generative model G(z) mimics the training distribution. The calculation resizes real and generated images to 299 resolution (ψFID and bψFID, respectively), extracts deep features using the Inception network [69], fits Gaussians, and takes the Fr´echet distance between two distributions. We study the effects of resizing the training images ψdata in Section 4.3, resizing to 299×299 ψFID and bψFID in Section 4.1 and the quantizations/image compressions bQ and Q in Section 4.2.

Methods

The authors analyze image downsampling through the lens of classical signal processing. According to the Nyquist-Shannon sampling theorem, downsampling an image requires a low-pass "prefilter" to remove high-frequency details that cannot be represented at the lower resolution. Crucially, the width of this prefilter must scale adaptively with the downsampling factor.

The paper systematically reviews how different libraries handle this:

  • PIL (Pillow): Correctly implements adaptive filtering, stretching the filter kernel based on the downsampling ratio.
  • PyTorch / TensorFlow / OpenCV: Use fixed-width filters by default, which fails to prevent aliasing when downsampling significantly.

To resolve these discrepancies, the authors propose Clean-FID, a standardized evaluation pipeline. Clean-FID enforces an anti-aliased resizing operation using an adaptive bicubic filter. Additionally, the authors mathematically and empirically characterize the downstream impact of quantization and lossy JPEG compression on deep feature activations.

Datasets

The methods were evaluated across several widely used image datasets:

  • FFHQ (Flickr-Faces-HQ, 1024x1024)
  • AFHQ-Cats (Animal Faces HQ, 512x512)
  • MetFaces (1024x1024)
  • LSUN-Churches

No new datasets were introduced, but the authors released pre-computed, standardized Inception statistics for these common datasets to facilitate fair benchmarking via their clean-fid repository.

Key Insights and Ideas

  • Hidden Aliasing Corrupts Features: Default resizing functions in PyTorch and TensorFlow introduce high-frequency aliasing patterns that resemble naive nearest-neighbor subsampling. These artifacts drastically alter the activation maps of the Inception-V3 network, corrupting the final metric calculation.
  • The JPEG Compression Trap: When a training dataset contains JPEG compression artifacts (e.g., LSUN), generative models often struggle to perfectly replicate these low-level statistical patterns. Surprisingly, manually applying JPEG compression to the generated images can artificially improve the FID score because it forces them to match the training set's compression artifacts, even though the actual image quality degrades.
  • Flawed Model and Checkpoint Selection: Because aliased resizing functions distort features non-monotonically, relying on standard framework implementations can lead researchers to select suboptimal model checkpoints or incorrectly conclude that one architecture outperforms another.
Downsampling a circle using different libraries, highlighting aliasing artifacts

Key Results

  • Artificial Discrepancies on Real Images: When comparing the exact same set of real FFHQ images resized via PIL-bicubic versus PyTorch-bilinear, the resulting FID score is 4.36 (ideally, it should be 0). This artificial error is larger than the typical performance gaps reported between competing state-of-the-art GAN models.
  • Sensitivity to Compression: Saving a real image as a JPEG with a quality factor of 75 instead of a lossless PNG results in an artificial FID score of 20.96, despite the images being perceptually indistinguishable to human eyes.
  • Improved Sensitivity: Using an anti-aliased resizing function (like PIL-bicubic) makes the FID metric significantly more sensitive to actual differences in image distributions, rather than being dominated by low-level preprocessing artifacts.
Figure 6. Effects of JPEG compression on an image. We show a sample image from the FFHQ dataset [37], saved with lossless PNG and different JPEG compression ratios. The FID scores under the images are calculated between FFHQ images saved using the corresponding JPEG format and the PNG format. PSNR is com- puted with 1000 images. While the images are perceptually similar, this induces changes in the Inception-V3 activations, resulting in large FID scores.

Limitations and Future Work

The paper primarily focuses on metrics that rely on the Inception-V3 feature space (FID, KID, Inception Score, and Perceptual Path Length). While the signal processing arguments are universal, the quantitative impact might vary with other feature extractors. The authors note that any future evaluation metric deriving statistics from processed images will remain susceptible to these low-level subtleties, suggesting that standardizing the entire data curation and evaluation pipeline remains an ongoing necessity for the community.

Summary updated

BibTeX
@inproceedings{parmar2022aliased,
  author = {Gaurav Parmar and Richard Zhang and Jun-Yan Zhu},
  title = {{On Aliased Resizing and Surprising Subtleties in GAN Evaluation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
  doi = {10.1109/cvpr52688.2022.01112},
}
Figure