Image Generation Metrics: FID, IS, KID, LPIPS, and CLIPScore
How do you score images with no ground truth? You compare distributions and use learned perceptual models: Inception Score, Fréchet Inception Distance, KID, LPIPS, and CLIPScore for prompt fidelity, on one running cat-generator example, with the equations, the catches, and torchmetrics.
Every metric so far compared a prediction to a known answer. Generative models break that: there’s no single “correct” image for “a cat in a spacesuit.” So we measure differently, comparing distributions of real vs generated images, and leaning on learned perceptual networks. We’ll score one toy cat generator every way that matters, with numbers you can move.
Every earlier chapter had a per-sample target: a label for classification, a box for detection, a mask for segmentation, an identity for tracking. Generation has none. A good metric has to capture three things: fidelity (do images look real?), diversity (is the model just memorizing a few?), and for text-to-image, alignment (does it match the prompt?).
The running example: CatGen, a cat-image generator
CatGen invents pictures of cats. We can’t check each one against a “right answer,”
so instead we compare the distribution of CatGen’s images to the distribution of
real cats. The real metrics describe each image by the 2048 numbers that come out of
the last pooling layer of an ImageNet-trained Inception-v3 network [2] (that is
what feature=2048 selects in the code below). To keep the arithmetic visible, imagine
that network squashes each image to a single “cattiness” feature: real cats land around with
spread ; CatGen’s outputs land around , . The closer
those two bell curves, the better CatGen is.
Inception Score (IS)
IS rewards two things at once: each image is confidently one kind of thing (sharp), and across the batch you see many kinds (diverse). The classifier’s per-image class probabilities are the same softmax output as in the multiclass chapter.
The first widely-used one [1]: the KL divergence between each image’s label distribution and the overall marginal :
Fréchet Inception Distance (FID): the headline
Put the real and generated features side by side as two bell curves and measure the distance between them: same place and same spread give a distance of 0.
FID [2] models each set as a Gaussian and takes the Fréchet distance:
Now you try
Drag CatGen’s mean and spread and watch the blue curve slide onto the green real-cat curve as FID falls toward 0. Confirm the two ways to score badly: a shifted mean (wrong kind of cats) and a wrong spread (too samey, or too chaotic) each push FID up on their own.
Kernel Inception Distance (KID)
KID measures the same real-vs-generated gap with an estimator that stays honest on small samples. KID [3] is the squared Maximum Mean Discrepancy between the two sets of Inception features, using the cubic polynomial kernel
instead of FID’s Gaussian assumption. A cubic kernel compares skewness as well as mean and variance, and KID has an unbiased estimator. FID’s estimator is biased upward: on small sample sets it reads artificially high, and it keeps falling as you add samples (Bińkowski et al. show it still decreasing at 10,000 CIFAR-10 images) [3]. KID is also lower-is-better, so the FID playground above is the right mental model; it estimates that distance more honestly when you only have a few hundred images.
LPIPS: perceptual distance between two images
LPIPS asks whether two specific images look alike to a human, and answers in deep-feature space rather than in pixels.
When you have a pair to compare (a reconstruction, a paired translation, or two samples for diversity), LPIPS [4] gives a perceptual distance from network features that tracks human similarity far better than pixel MSE or SSIM. Lower = more similar (illustratively, two near-duplicate cat frames might score ~0.05, a cat vs a couch ~0.7). The common flip: report higher mean LPIPS among samples as a diversity signal.
CLIPScore: does the image match the prompt?
Alignment here is the angle between the image’s embedding and the prompt’s embedding: vectors that point the same way score high.
For text-to-image, none of the above checks prompt fidelity. CLIPScore [6] does, via the cosine similarity of CLIP’s image and text embeddings, clipped at zero and rescaled by a constant :
Hessel et al. set : real CLIP cosines between an image and a caption sit
roughly between 0 and 0.4, and the factor stretches that range toward [6].
TorchMetrics uses instead, so its CLIPScore prints values on a 0 to 100
scale [9]. Always say which scale a quoted CLIPScore is on.
Now you try
Drag the image vector toward the prompt vector and watch the cosine climb to 1; swing it 90° away and the clipped cosine falls to 0. CLIPScore is that clipped cosine times the constant .
Beyond these, improved precision & recall for generative models [5] disentangle fidelity (precision: do samples fall on the real manifold?) from coverage (recall: does the model span real diversity?), useful when FID alone is ambiguous.
In code (torchmetrics)
TorchMetrics 1.9.0 implements all three [9]:
# torchmetrics==1.9.0 (FID/KID also need torch-fidelity; CLIPScore needs transformers)
import torch
from torchmetrics.image.fid import FrechetInceptionDistance
from torchmetrics.image.kid import KernelInceptionDistance
from torchmetrics.multimodal.clip_score import CLIPScore
# FID: feed real and generated separately. normalize=True => float images in [0,1].
fid = FrechetInceptionDistance(feature=2048, normalize=True)
real = torch.rand(64, 3, 299, 299)
fake = torch.rand(64, 3, 299, 299)
fid.update(real, real=True)
fid.update(fake, real=False)
print("FID", fid.compute().item()) # lower is better; fix the sample count
kid = KernelInceptionDistance(subset_size=50, normalize=True)
kid.update(real, real=True); kid.update(fake, real=False)
print("KID mean/std", kid.compute()) # better for small sample sets
# CLIPScore: prompt fidelity (images uint8 in [0,255]).
clip = CLIPScore(model_name_or_path="openai/clip-vit-base-patch16")
imgs = (torch.rand(2, 3, 224, 224) * 255).to(torch.uint8)
print("CLIPScore", clip(imgs, ["a cat in a spacesuit", "a red bicycle"]).item()) # 0-100 scale (w = 100)
Caveats & common pitfalls
- FID is a biased estimator. It shrinks as you add samples, so a number means something only at a stated sample count: compare runs at the same N (10k–50k). Even at equal N the bias can differ between models, enough to flip which one looks better [3]. On small sets, prefer KID, which is unbiased [3].
- Implementation details move the number. FID/KID inherit Inception’s ImageNet bias, and Parmar et al. show that the resizing filter alone (an aliased resize in a common library versus a properly antialiased one) and compression applied to the images both shift FID noticeably [8]. Report the toolkit and settings, and don’t compare across papers with different pipelines.
- A metric moved to a problem it wasn’t built for still prints a number. The Marigold V2 quantization post shows a depth metric built for strictly positive depth (AbsRel) reading “14% wrong” on relative depth centred near zero, where RMSE and correlation show the two maps agree. Check that a score’s assumptions hold for your comparison before you trust it.
- CLIPScore can be gamed. It rewards embedding alignment, not correctness or aesthetics, and the six-legged cat still scores well [6].
- Automated metrics are proxies. For generation, human evaluation still settles ties; distribution metrics measure quality+diversity in aggregate, never a single image [7].
Takeaways
- No ground truth → compare distributions (FID, KID, IS) and use learned perceptual models (LPIPS, CLIPScore).
- FID is the headline (lower better, captures quality + diversity; CatGen = 1.25), but biased by sample count, so always compare at equal N; KID is the small-sample-safe alternative.
- IS is legacy. No real reference (CatGen’s max was just 2.0 = its class count), ImageNet-biased.
- LPIPS for perceptual pair distance / diversity; CLIPScore (CatGen’s cosine 0.80, so 2.0 on Hessel’s scale) for text-to-image prompt fidelity.
- Automated metrics are proxies. Human evaluation still settles ties.
That closes the series. Back to the start: Classification metrics: the foundations.
Further reading
- Go deeper: Goodfellow et al., Deep Learning ch. 20, on the generative models these metrics are built to evaluate.
- Why your FID may be wrong: Parmar, Zhang & Zhu, On Aliased Resizing and Surprising Subtleties in GAN Evaluation (CVPR 2022) [8], on how resizing bugs silently corrupt FID scores. Implementation: clean-fid.
- Related on CondadosAI: back to where precision/recall began, in classification foundations.
References
[1] Salimans, T., Goodfellow, I., Zaremba, W., Cheung, V., Radford, A., & Chen, X. (2016). Improved Techniques for Training GANs. NeurIPS. arXiv:1606.03498. (Inception Score.)
[2] Heusel, M., Ramsauer, H., Unterthiner, T., Nessler, B., & Hochreiter, S. (2017). GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium. NeurIPS. arXiv:1706.08500. (FID.)
[3] Bińkowski, M., Sutherland, D. J., Arbel, M., & Gretton, A. (2018). Demystifying MMD GANs. ICLR. arXiv:1801.01401. (KID.)
[4] Zhang, R., Isola, P., Efros, A. A., Shechtman, E., & Wang, O. (2018). The Unreasonable Effectiveness of Deep Features as a Perceptual Metric. CVPR. arXiv:1801.03924. (LPIPS.)
[5] Kynkäänniemi, T., Karras, T., Laine, S., Lehtinen, J., & Aila, T. (2019). Improved Precision and Recall Metric for Assessing Generative Models. NeurIPS. arXiv:1904.06991.
[6] Hessel, J., Holtzman, A., Forbes, M., Le Bras, R., & Choi, Y. (2021). CLIPScore: A Reference-free Evaluation Metric for Image Captioning. EMNLP. arXiv:2104.08718.
[7] Goodfellow, I., Bengio, Y., & Courville, A. (2016). Deep Learning, ch. 20 (deep generative models). MIT Press. Free online.
[8] Parmar, G., Zhang, R., & Zhu, J.-Y. (2022). On Aliased Resizing and Surprising Subtleties in GAN Evaluation. CVPR. arXiv:2104.11222, DOI:10.1109/CVPR52688.2022.01112. Implementation: clean-fid.
[9] TorchMetrics 1.9.0 documentation (stable, accessed 27 Sep 2026): FrechetInceptionDistance, KernelInceptionDistance, CLIPScore (defined there as ).