The Fréchet inception distance (FID) is a metric used to assess the quality of images created by a generative model, like a generative adversarial network (GAN).[1] Unlike the earlier inception score (IS), which evaluates only the distribution of generated images, the FID compares the distribution of generated images with the distribution of a set of real images ("ground truth").[1] The FID metric does not completely replace the IS metric. Classifiers that achieve the best (lowest) FID score tend to have greater sample variety while classifiers achieving the best (highest) IS score tend to have better quality within individual images.[2]
The FID metric was introduced in 2017,[1] and is the current standard metric for assessing the quality of generative models as of 2020. It has been used to measure the quality of many recent models including the high-resolution StyleGAN1[3] and StyleGAN2[4] networks and the Classifier-Free Diffusion Model.[2]
For any two probability distributions over having finite mean and variances, their Fréchet distance is[5]
where is the set of all measures on with marginals and on the first and second factors respectively. (The set is also called the set of all couplings of and .). In other words, it is the 2-Wasserstein distance on .
For two multidimensional Gaussian distributions and , it is explicitly solvable as[6]
This allows us to define the FID in pseudocode form:
INPUT a function .
INPUT two datasets .
Compute .
Fit two gaussian distributions , respectively for .
RETURN .
In most practical uses of the FID, is the space of images, and is an Inception v3 model trained on the ImageNet, but without its final classification layer. Technically, it is the 2048-dimensional activation vector of its last pooling layer. Of the two datasets , one of them is a reference dataset, which could be the ImageNet itself, and the other is a set of images generated by a generative model, such as GAN, or diffusion model.[1]
Interpretation
Rather than directly comparing images pixel by pixel (for example, as done by the L2 norm), the FID compares the mean and standard deviation of the deepest layer in Inception v3. These layers are closer to output nodes that correspond to real-world objects such as a specific breed of dog or an airplane, and further from the shallow layers near the input image.
Chong and Forsyth[10] showed FID to be statistically biased, in the sense that their expected value over a finite data is not their true value.
Also, because FID measured the Wasserstein distance towards the ground-truth distribution, it is inadequate for evaluating the quality of generators in domain adaptation setups, or in zero-shot generation.
Finally, while FID is more consistent with human judgement than previously used inception score,
there are cases where FID is inconsistent with human judgment (e.g. Figure 3,5 in Liu et al.).[11]