Your GAN's FID score might be lying about its resizer
A CVPR 2022 library that fixes how image resizing and quantization silently corrupt generative model evaluation.

What it does
clean-fid recalculates the Fréchet Inception Distance (FID) — the standard metric for judging image generators — while actually getting the preprocessing right. It wraps the math in a one-liner API and ships pre-computed statistics for common benchmarks (FFHQ, LSUN, CIFAR-10, and others), so you can compare your model against published numbers without re-extracting features yourself.
The interesting bit
The paper behind this is essentially a long sigh about how every library implements “bicubic resize” differently. PyTorch, TensorFlow, and OpenCV all produce visibly different downscaled images from the same source; the authors measured FID swings of ≥ 6 points on FFHQ just from picking the wrong resizer. JPEG compression quality is another invisible variable — the “best” FID for LSUN Church happens at quality 87, not lossless PNG. The library hard-codes the correct PIL paths and exposes legacy_pytorch / legacy_tensorflow modes so you can reproduce old wrong numbers when reviewing baselines.
Key highlights
- One-liner API:
fid.compute_fid(fdir1, fdir2)or against cached stats withdataset_name="FFHQ" - Also computes KID and CLIP-FID (using
model_name="clip_vit_b_32") - Custom dataset statistics can be generated and cached locally
- Backwards-compatibility modes match the original PyTorch and TensorFlow implementations to within ~2e-6
- Pre-computed stats cover resolutions from 32×32 (CIFAR-10) up to 1024×1024 (FFHQ, MetFaces)
Caveats
- KID pre-computed stats only exist for three smaller datasets (AFHQ, BreCaHAD, MetFaces)
- The README notes that adding new pre-computed datasets requires contacting the authors; there’s no community submission process described
Verdict
Anyone training or benchmarking GANs, diffusion models, or other image generators should swap to this for FID reporting. If you never touch generative models, this library has nothing to offer you.