Fréchet Inception Distance (FID)
Fréchet Inception Distance (FID) scores generated images by comparing their Inception feature statistics with real photos. How it is computed and compared.
Fréchet Inception Distance (FID) is a metric that scores a generative image model by comparing the statistics of its generated images with those of real images. Both sets pass through a pretrained Inception v3 network, each set's features are summarized as a multivariate Gaussian with a mean and a covariance, and FID is the Fréchet distance between the two Gaussians. Lower is better, and a score of zero means the two sets of features have identical means and covariances. Martin Heusel and colleagues at Johannes Kepler University Linz introduced FID in 2017 in the paper GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium, and it quickly replaced the Inception Score as the standard metric for generative adversarial networks (GANs) and later diffusion models.
How FID Is Calculated#
- Generate a large sample of images, conventionally 50,000, and collect a reference set of real images, usually the training set.
- Resize every image to 299 x 299 pixels and pass it through Inception v3, a convolutional neural network trained for image classification on ImageNet, keeping the 2,048-dimensional output of its final pooling layer as the image's embedding.
- Compute the mean vector and covariance matrix of the real embeddings and of the generated embeddings.
- Combine them: FID = (squared distance between the two means) + trace(C_real + C_gen - 2 x sqrt(C_real x C_gen)), where sqrt is the matrix square root.
The first term grows when generated images differ from real ones on average, for example through a color cast or the wrong mix of content. The second term grows when their variety is off, as in mode collapse, the GAN failure in which the generator produces only a few kinds of output. One number therefore reflects both fidelity and diversity, which is why FID became the default score for text-to-image systems such as Stable Diffusion.
The same calculation in NumPy, on simulated 64-dimensional feature vectors:
import numpy as np
rng = np.random.default_rng(0)
# Simulated 64-D feature vectors for 5,000 real and 5,000 generated images
real = rng.normal(0.0, 1.0, size=(5000, 64))
generated = rng.normal(0.3, 0.8, size=(5000, 64)) # shifted mean, less variety
# Summarize each set as a Gaussian: a mean vector and a covariance matrix
mu_r, mu_g = real.mean(axis=0), generated.mean(axis=0)
cov_r, cov_g = np.cov(real, rowvar=False), np.cov(generated, rowvar=False)
# Trace of the matrix square root of cov_r @ cov_g, via its eigenvalues
tr_covmean = np.sqrt(np.linalg.eigvals(cov_r @ cov_g)).real.sum()
# FID = squared distance between means + covariance mismatch
fid = ((mu_r - mu_g) ** 2).sum() + np.trace(cov_r) + np.trace(cov_g) - 2 * tr_covmean
print(f"FID: {fid:.2f}")The script prints an FID of 8.78. The shifted mean contributes about 5.8 and the narrower spread about 2.6, and the remaining half point comes from estimating the statistics from a finite sample, which always pushes FID upward. For real evaluations, libraries such as TorchMetrics FID compute the features with the original TensorFlow Inception weights released with the metric. Torchvision's ImageNet-trained Inception v3 has different weights, and its scores cannot be compared with published results.
Reading and Comparing FID Scores#
FID values are comparable only under identical conditions: the same reference set, image resolution, sample count, and preprocessing. Resizing images with a different library or saving them as JPEG can shift the score by several points, a problem that motivated the Clean-FID implementation. Because small samples inflate the score, the original authors recommend at least 10,000 images, and a score computed from 5,000 samples is not comparable with one from 50,000.
For scale, StyleGAN2 reached an FID of 2.84 on 1024 x 1024 face images from the FFHQ dataset, and on zero-shot text-to-image generation over 30,000 MS-COCO captions, Google's Imagen scored 7.27 against 10.39 for DALL-E 2.
Other Generative Image Metrics#
- Inception Score (IS): Rates generated images alone, by how confidently and how diversely Inception classifies them. It never looks at real data, so it cannot detect a model that produces sharp images of the wrong kind.
- Kernel Inception Distance (KID): Compares the same Inception features with an unbiased kernel estimator, which makes it more reliable for small sample sizes.
- CLIP score: Measures how well an image matches its text prompt, which FID does not capture, so text-to-image models usually report both.
- Precision and recall for generative models: Split FID's single number into fidelity, the share of generated images that look real, and coverage, the share of real variety the model reproduces.
- FD-DINOv2: Computes the same Fréchet distance on features from DINOv2, a self-supervised vision transformer. George Stein and colleagues proposed it in 2023 after a large human study found that FID failed to reflect how realistic people rated diffusion-model images.
Video models use the same idea with Fréchet Video Distance, and suites such as VBench split video quality into separate dimensions instead of a single distance.
FID for Synthetic Training Data#
FID also screens synthetic data before it is used to train a detector. Scoring generated images of rare scenes, such as night driving for automotive vision or specific product flaws for defect detection, against real photos from the deployment camera exposes a domain gap before any training time is spent. The final check is downstream accuracy: train Ultralytics YOLO26 with and without the synthetic images and compare mean average precision (mAP) on the same real held-out images in validation mode.










