skillfed

clean-fid

FID calculation in PyTorch with proper image resizing and quantization steps

clean-fid v0.1.35 407.0K downloads/30d#6,891 on PyPI1,168
Permissive license AGING released

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-fid

uv

uv add clean-fid

poetry

poetry add clean-fid

Installing 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

License :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

FID score calculationgenerative model evaluationimage quality metricsGAN evaluationinception distance
gan-evaluationimage-metricsgenerative-models

More Artificial Intelligence packages