clean-fid
FID calculation in PyTorch with proper image resizing and quantization steps
What it is and what it does
Clean-fid is a library for computing FID and KID metrics used to evaluate the quality of images generated by generative models like GANs. The core problem it solves is that different implementations of FID use different image resizing and quantization methods, leading to inconsistent scores across papers and groups. This library standardizes those operations—particularly addressing aliasing issues in resizing functions and JPEG compression effects—so that FID scores become comparable.
The package wraps PyTorch and provides a simple API to compute FID between two image folders, between a folder and precomputed dataset statistics (for datasets like CIFAR-10, FFHQ, and LSUN), or between a generative function and precomputed statistics. It also supports KID computation and CLIP-based FID variants. Its main dependencies are torch, torchvision, numpy, scipy, pillow, requests, and tqdm.
Use it for:
- Evaluate a trained GAN or diffusion model against standard benchmarks like FFHQ or CIFAR-10 using precomputed statistics.
- Compare FID scores across different generative models or training runs with consistent resizing and quantization.
- Compute KID scores for few-shot generation tasks on smaller datasets like AFHQ or BreCaHAD.
- Debug image generation quality by computing FID between generated and real image folders with controlled resizing methods.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes Fréchet Inception Distance (FID) and Kernel Inception Distance (KID) scores for evaluating generative models, with corrected image resizing and quantization to ensure consistent results across implementations.
Yes, if you are actively evaluating generative models and need reproducible FID/KID scores. The library solves a real standardization problem in GAN evaluation. However, consider that maintenance is aging (last release December 2022); verify compatibility with your current PyTorch version before relying on it for new research, and monitor the repository for updates or consider alternatives if critical bugs emerge.
Install
clean-fid on PyPI
pip
pip install clean-fiduv
uv add clean-fidpoetry
poetry add clean-fidInstalling clean-fid
Before you install
Low install friction with a pure Python wheel. Maintenance is aging—last release was 2022-12-18 and the repository has not been updated since 2025-08-02, though it remains unarchived and has moderate community interest (1168 stars).
License in practice
BSD License (permissive) allows commercial and private use with minimal restrictions.
Quickstart
pip install clean-fid
from cleanfid import fid
score = fid.compute_fid(fdir1, fdir2)
# or with precomputed dataset statistics:
score = fid.compute_fid(fdir1, dataset_name="FFHQ", dataset_res=1024)
Requires torch, torchvision, and their system dependencies; no explicit Python version constraint stated in the package metadata.
Verify before relying
- Whether the package works with recent PyTorch versions given the aging maintenance status.
- Whether precomputed dataset statistics are still available and up-to-date.
- Compatibility with modern Python versions beyond what the classifier 'Programming Language :: Python :: 3' implies.
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — torch, torchvision, numpy, scipy, tqdm, pillow, requests |
| Maintenance | aging — 1,335 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 406,980/month — #6,891 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: clean_fid-0.1.35-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
pytorch-fidComputes Fréchet Inception Distance (FID), a…
permissive · top 15,000 on PyPI
pyiqaPyIQA provides a PyTorch-based toolbox for…
noncommercial · top 15,000 on PyPI
piqPIQ provides a collection of image quality…
permissive · top 15,000 on PyPI
clip-benchmarkEvaluates CLIP-like vision-language models on…
permissive · top 15,000 on PyPI
k-diffusionk-diffusion is a PyTorch library implementing…
permissive · top 15,000 on PyPI
gfpganGFPGAN restores and enhances degraded faces in…
permissive · top 15,000 on PyPI
resize-rightResizes images or tensors in NumPy or PyTorch…
permissive · top 15,000 on PyPI
lpipsComputes perceptual similarity between image…
permissive · top 5,000 on PyPI
effdetPyTorch implementation of EfficientDet object…
permissive · top 15,000 on PyPI