Skip to content

Evaluation, diagnostics, benchmarks, and additional tests · Evaluation, diagnostics, benchmarks, and additional hypothesis tests · EVA021 · Metric

Fréchet Inception Distance

Compares Gaussian approximations to real and generated image-feature distributions.

Needs a data type CodeSplash doesn't load yet Complete calculation CodeSplash's run and the reference's record

In CodeSplash

Running this needs images, audio, video, graphs or another data type CodeSplash doesn't load yet.

Availability
Needs a data type CodeSplash doesn't load yet
Code example
Complete calculation
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Compares Gaussian approximations to real and generated image-feature distributions.

Question / hypotheses

How far apart are the means and covariances of fixed Inception features? Lower is better under this representation.

Architecture / computational structure

A fixed pretrained feature/evaluation model followed by the named aggregation rule. The feature extractor is part of the metric specification.

Assumptions

Use the same feature extractor, preprocessing, image resolution convention, and sample sizes. FID assumes only a Gaussian summary of features, not that image distributions themselves are Gaussian.

Formula / computational definition

FID=∥μr−μg∥2+tr⁡(Σr+Σg−2(Σr1/2ΣgΣr1/2)1/2).FID=\|\mu_r-\mu_g\|^2+\operatorname{tr}(\Sigma_r+\Sigma_g-2(\Sigma_r^{1/2}\Sigma_g\Sigma_r^{1/2})^{1/2}).

Parameters and notation

mu and Sigma are empirical feature moments. Encoder version, layer, preprocessing, sample count, and numerical square-root stabilization are evaluation hyperparameters; there is no FID model to fine-tune.

Fitting, fine-tuning, and adaptation

There is no model fine-tuning step for this evaluation procedure. Freeze the evaluated systems and evaluator before the final test. Select evaluation settings on development data; if a learned evaluator or calibration model is adapted, use separate fitting data, version it, and reassess its validity.

How to use and calibrate

Generate an independently sampled, fixed-size evaluation set and use a reference implementation. Report uncertainty across seeds or resamples and audit precision/recall separately.

Example application

Compare two image generators at the same resolution with identical feature extraction.

Interpretation / pitfalls

Watch out

Finite-sample bias makes scores at different sample sizes hard to compare. FID can miss memorization, conditional failure, and errors outside encoder sensitivity. The toy below uses diagonal synthetic features and is not an image benchmark.

Python and R code examples

Scope: Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.

Validation: Python — Executed successfully on synthetic inputs. R — reviewed but not executed in this environment. Python dependencies are explicit imports; R uses base R unless a package/bridge is explicitly named.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline. · needs numpy

import numpy as np
mr=np.array([0.,1.]); mg=np.array([.2,.8]); vr=np.array([1.,2.]); vg=np.array([1.5,1.])
print(np.sum((mr-mg)**2)+np.sum(vr+vg-2*np.sqrt(vr*vg)))
R

Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.

mr <- c(0,1); mg <- c(.2,.8); vr <- c(1,2); vg <- c(1.5,1)
print(sum((mr-mg)^2)+sum(vr+vg-2*sqrt(vr*vg)))

Sources

From the CodeSplash reference, entry EVA021.