On Aliased Resizing and Surprising Subtleties in GAN Evaluation

Gaurav Parmar, Richard Zhang, Jun-Yan Zhu

Abstract

Standard metrics for evaluating Generative Adversarial Networks (GANs), such as the Fréchet Inception Distance (FID), are surprisingly sensitive to low-level image processing choices. This paper reveals that common deep learning libraries like PyTorch and TensorFlow employ resizing methods that introduce significant aliasing artifacts. These artifacts lead to inconsistent and inflated FID scores, complicating fair model comparison. We propose Clean-FID, a standardized evaluation pipeline that adheres to signal processing principles to ensure robust and reproducible GAN assessment.

Introduction: The Hidden Sensitivity of FID

In generative modeling, the Fréchet Inception Distance (FID) is the primary metric for quantifying the quality and diversity of synthesized images. FID calculates the distance between feature distributions of real and generated images extracted from a pre-trained InceptionV3 network.

A critical but often overlooked step in this process is image resizing. InceptionV3 requires a fixed input resolution of 299x299 pixels. Consequently, high-resolution datasets (e.g., FFHQ at 1024x1024) must be downsampled. We observed that researchers using different libraries—such as OpenCV, PyTorch, or TensorFlow—obtained varying FID scores for identical models. This discrepancy stems from aliasing.

Visualizing aliasing artifacts across different deep learning libraries.

According to the Nyquist-Shannon sampling theorem, downsampling requires a low-pass filter to remove high-frequency components that cannot be represented at the lower resolution. While libraries like PIL correctly scale their "prefilter" width based on the downsampling ratio, others often use fixed-width filters, resulting in jagged artifacts that the Inception network interprets as meaningful features.

Methodology: Auditing the Preprocessing Pipeline

We conducted a systematic audit of image preprocessing implementations:

  1. Resizing Analysis: We compared mathematical implementations of bilinear, bicubic, and Lanczos kernels across PIL, OpenCV, PyTorch, and TensorFlow.
  2. Feature Map Sensitivity: We analyzed how these resizing choices affect the internal activation maps of InceptionV3.
  3. Clean-FID Implementation: We developed a reference pipeline utilizing PIL’s antialiased bicubic resizing, avoiding unnecessary quantization or lossy compression.
  4. Controlled Experiments: We evaluated state-of-the-art models (e.g., StyleGAN2) across various benchmarks including FFHQ, AFHQ-Cats, and MetFaces.

Key Insights: The "Dirty" Metric and Library Inconsistency

Our analysis revealed several troubling properties of the standard FID calculation:

  • The Baseline Error: Comparing a set of real images against themselves using different resizing libraries can yield an FID as high as 7.4, rather than the expected zero. This suggests the metric often measures the "signature" of the library rather than image quality.
  • Feature Map Divergence: PyTorch’s F.interpolate and TensorFlow’s default resize produce distinct feature maps for the same input image. This inconsistency makes it impossible to compare FID scores across different framework implementations.
Inception V3 activation maps vary significantly based on the resizing library used.
  • The JPEG Paradox: Models trained on JPEG-compressed data may show "improved" FID scores if the generated images are also compressed before evaluation. The model learns to mimic compression artifacts; matching these artifacts during evaluation "cheats" the metric by aligning the noise distributions.

Results and Impact on Model Selection

The choice of resizing method has tangible consequences for research:

  • Quantifying the Gap: Non-adaptive filters introduce a baseline error of ~4.3 to 7.5 FID points. Given that the difference between state-of-the-art models is often only 1-2 points, this error is substantial.
  • Signal Preservation: Images processed with adaptive filters (like PIL-Bicubic) exhibit significantly higher PSNR, indicating better preservation of the original signal compared to fixed-width filters.
  • Checkpoint Selection: Preprocessing quirks can shift which training checkpoint is identified as "best," potentially leading researchers to optimize for library-specific artifacts rather than actual synthesis quality.

Conclusion and Recommendations

To ensure fair and reproducible GAN evaluation, we strongly recommend the adoption of antialiased, adaptive resizing and the avoidance of JPEG compression during the evaluation phase. Our proposed Clean-FID library provides a one-line drop-in replacement to standardize these practices across 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