Member-only story
Evaluation of Image Generation
2 min readDec 4, 2024
FID, LPIPS, SSIM, KID…
1. Frechet Inception Distance (FID):
- Purpose: Measures the similarity between the PAIR of real and generated images regarding feature distributions.
- How it Works:
Extract features from images using a pre-trained Inception network.
Calculate the mean and covariance of these features for both real and generated images.
Compute the Wasserstein-2 distance between these distributions.
Lower FID indicates higher similarity (better quality). - Strengths:
Captures both fidelity and diversity.
Sensitive to mode collapse. - Weaknesses:
Computationally expensive.
Assumes Gaussian feature distribution.
!pip install torchmetrics[image]
from torchmetrics.image.fid import FrechetInceptionDistance
fid = FrechetInceptionDistance(normalize=True)
fid.update(real_images, real=True)
fid.update(fake_images, real=False)2. Learned Perceptual Image Patch Similarity (LPIPS):
- Purpose: Measures perceptual similarity between image pairs.
- How it Works:
Compare images at the feature level using a pre-trained deep network (e.g., VGG).
Compute differences in feature maps and aggregate them spatially.
Lower LPIPS indicates higher similarity (better perceptual quality). - Strengths:
Correlates well with human perception.
Can be used to evaluate paired or unpaired datasets.







