FID IS KID Score Generated Images
FID and KID price how far generated features sit from real ones, while IS prices confidence plus variety on generated images alone without any real set.
Why Does This Exist?
Pixel comparisons cannot judge fresh images with no paired truth, yet generators still need scores for fidelity plus coverage. FID fits one Gaussian to real Inception features and one to generated features, then reports their Frechet distance, so shifted means or collapsed variety both raise the number. IS skips reals entirely and scores classifier sharpness plus label spread on generated images alone, while KID replaces the Gaussian fit with a cubic-kernel mean discrepancy that stays unbiased on small sets. Face and diffusion teams report them together because each blinds a different failure.
The general generation setup lives in image generation, the model behind the scores lives in stable diffusion, and the paired-image counterparts live in PSNR SSIM LPIPS.
Think of It Like This
Two galleries judged by one critic
Real photos hang in one gallery and generated pictures in another, and a critic reduces each picture to a taste vector. FID measures how far apart the two crowds stand, KID does the same count with fairer small-crowd math, and IS never visits the real room: it asks whether generated pictures look decisively like something and cover many styles.
Distance versus applause on the same opening night. Where it stops: a critic who loves one style applauds a gallery of identical sunsets, just as IS rewards a collapsed generator that FID and KID would expose against reals.
How It Actually Works
FID is on feature means and covariances , where lower is better. IS is , where sharp per-image labels plus a uniform aggregate push it higher. KID is a squared maximum mean discrepancy with a cubic polynomial kernel, lower is better and unbiased for small . All three demand identical preprocessing, backbone weights, and sample sizes, or the comparison misleads by points.
Worked example
Take one-dimensional features with real mean , generated mean , and unit variances . The mean term is and the trace term is , so the toy FID is . Closing the mean gap to drops the score to , showing mean shift dominates here. A collapsed generator with identical means but zero variance would still score through the trace term, which is why fidelity and diversity read together.
Code
The point of this snippet is the mean-term arithmetic, not a metric library: pure Python recomputes both worked scores with the standard library only.
def toy_fid(mr, mg): return round((mr - mg) ** 2, 3) # trace cancels at unit variance
print(toy_fid(0.0, 2.0), toy_fid(0.0, 0.5))# -> 4.0 0.25A mean gap of 2 gives 4.0 and a gap of 0.5 gives 0.25, exactly the numbers the prose derived by hand.
Watch Out For
Comparing FIDs across different setups
The symptom is a leaderboard claim that vanishes on rerun because backbone, resize, compression, or sample count shifted the score by points. Fix it by freezing implementation, preprocessing, and before comparing any two numbers.
Reading IS alone as image quality
The symptom is a high IS on a generator that repeats one crisp image per class, since sharpness plus spread never checks against reals. Fix it by pairing every IS with FID or KID, which penalize the missing coverage the applause metric cannot see.
The Quick Version
- FID is the Frechet distance between real and generated feature Gaussians, lower is better.
- IS exponentiates label sharpness plus spread on generated images alone, higher is better.
- KID is an unbiased kernel distance, lower is better on small sample sizes.
- Toy means 0 versus 2 at unit variance give FID , narrowing to 0.5 gives .
- Match code, preprocessing, and sample size before comparing any scores.