← all repositories
mseitzer/pytorch-fid

FID score calculation finally speaks PyTorch natively

It ports the standard Fréchet Inception Distance evaluator from TensorFlow to PyTorch, letting GAN researchers benchmark image quality without switching frameworks.

3.9k stars Python LLMOps · EvalML Frameworks
pytorch-fid
Not currently ranked — collecting fresh signals.
star history

What it does

This project computes Fréchet Inception Distance (FID) scores between two image datasets, the de facto standard for judging whether a generative model’s output looks convincingly real. It fits Gaussians to features extracted by an Inception network and measures the distance between them. The code is a direct PyTorch translation of the official TensorFlow implementation, carrying over the exact same model weights.

The interesting bit

The port is almost obsessively faithful: the author validated it to within roughly 0.08 absolute error on LSUN ProGAN images against the original. The remaining drift comes from mundane differences in image interpolation and library backends, not from the model itself.

Key highlights

  • Runs the standard FID metric entirely inside the PyTorch ecosystem.
  • Uses the official Inception weights, tested to match the TensorFlow reference within hundredths of a point.
  • Supports swapping in lower-level Inception feature layers for datasets smaller than the usual 2048-image minimum.
  • Can cache reference dataset statistics to an .npz archive to avoid reprocessing the same baseline images repeatedly.
  • GPU evaluation is supported.

Caveats

  • Scores differ slightly from the official TensorFlow implementation due to image interpolation and backend discrepancies; the README explicitly warns that papers requiring exact comparability should stick with the original.
  • Using alternative feature layers changes the score magnitude and may no longer correlate with human visual quality, so those numbers cannot be compared against standard 2048-dimensional results.

Verdict

PyTorch GAN researchers who want a framework-native FID calculator without TensorFlow baggage will find this useful; teams publishing benchmarks that must be exactly comparable to prior TensorFlow-based work should verify whether the minor numerical drift is acceptable.

Frequently asked

What is mseitzer/pytorch-fid?
It ports the standard Fréchet Inception Distance evaluator from TensorFlow to PyTorch, letting GAN researchers benchmark image quality without switching frameworks.
Is pytorch-fid open source?
Yes — mseitzer/pytorch-fid is open source, released under the Apache-2.0 license.
What language is pytorch-fid written in?
mseitzer/pytorch-fid is primarily written in Python.
How popular is pytorch-fid?
mseitzer/pytorch-fid has 3.9k stars on GitHub.
Where can I find pytorch-fid?
mseitzer/pytorch-fid is on GitHub at https://github.com/mseitzer/pytorch-fid.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.