Skip to content

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

Kernel Inception Distance

Uses an unbiased squared MMD estimator with a polynomial kernel on Inception features.

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

Uses an unbiased squared MMD estimator with a polynomial kernel on Inception features.

Question / hypotheses

Do real and generated image features differ in the moments represented by the chosen kernel?

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

Feature extraction and preprocessing must match across systems. Independent samples are needed for the standard unbiased estimator. Subset sampling must be reported.

Formula / computational definition

k(x,y)=(xTy/d+1)3,KID=MMD^u2(k).k(x,y)=(x^Ty/d+1)^3,\qquad KID=\widehat{MMD}_u^2(k).

Parameters and notation

d is feature dimension. Feature network, subset size, number of subsets, and random seed control the implementation. The polynomial kernel should not be casually substituted while retaining the same benchmark label.

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

Use fixed feature extraction and multiple random subsets with uncertainty estimates. Compare with FID and conditional-quality evaluation.

Example application

Compare small-sample image generation experiments where FID estimation bias is particularly consequential.

Interpretation / pitfalls

Watch out

An unbiased estimator can be negative. KID is not automatically a calibrated two-sample test; it requires an appropriate null procedure if used for significance. It does not prove perceptual or conditional fidelity.

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
x=np.array([[0.,1.],[1.,0.],[1.,1.]]); y=x+.2; d=x.shape[1]
K=(x@x.T/d+1)**3; L=(y@y.T/d+1)**3; C=(x@y.T/d+1)**3
print((K.sum()-np.trace(K))/6+(L.sum()-np.trace(L))/6-2*C.mean())
R

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

x <- rbind(c(0,1),c(1,0),c(1,1)); y <- x+.2; d <- ncol(x)
K <- (x%*%t(x)/d+1)^3; L <- (y%*%t(y)/d+1)^3; C <- (x%*%t(y)/d+1)^3
print((sum(K)-sum(diag(K)))/6+(sum(L)-sum(diag(L)))/6-2*mean(C))

Sources

From the CodeSplash reference, entry EVA022.