Inception score

From HandWiki

The Inception Score (IS) is an algorithm used to assess the quality of images created by a generative image model such as a generative adversarial network (GAN).[1] The score is calculated based on the output of a separate, pretrained Inceptionv3 image classification model applied to a sample of (typically around 30,000) images generated by the generative model. The Inception Score is maximized when the following conditions are true:

  1. The entropy of the distribution of labels predicted by the Inceptionv3 model for the generated images is minimized. In other words, the classification model confidently predicts a single label for each image. Intuitively, this corresponds to the desideratum of generated images being "sharp" or "distinct".
  2. The predictions of the classification model are evenly distributed across all possible labels. This corresponds to the desideratum that the output of the generative model is "diverse".[2]

It has been somewhat superseded by the related Fréchet inception distance.[3] While the Inception Score only evaluates the distribution of generated images, the FID compares the distribution of generated images with the distribution of a set of real images ("ground truth").

Definition

Let there be two spaces, the space of images ΩX and the space of labels ΩY. The space of labels is finite.

Let pgen be a probability distribution over ΩX that we wish to judge.

Let a discriminator be a function of type pdis:ΩXM(ΩY)where M(ΩY) is the set of all probability distributions on ΩY. For any image x, and any label y, let pdis(y|x) be the probability that image x has label y, according to the discriminator. It is usually implemented as an Inception-v3 network trained on ImageNet.

The Inception Score of pgen relative to pdis isIS(pgen,pdis):=exp(𝔼xpgen[DKL(pdis(|x)pdis(|x)pgen(x)dx)])Equivalent rewrites includelnIS(pgen,pdis):=𝔼xpgen[DKL(pdis(|x)𝔼xpgen[pdis(|x)])]lnIS(pgen,pdis):=H[𝔼xpgen[pdis(|x)]]𝔼xpgen[H[pdis(|x)]]lnIS is nonnegative by Jensen's inequality.

Pseudocode:

INPUT discriminator pdis.

INPUT generator g.

Sample images xi from generator.

Compute pdis(|xi), the probability distribution over labels conditional on image xi.

Sum up the results to obtain p^, an empirical estimate of pdis(|x)pgen(x)dx.

Sample more images xi from generator, and for each, compute DKL(pdis(|xi)p^).

Average the results, and take its exponential.

RETURN the result.

Interpretation

A higher inception score is interpreted as "better", as it means that pgen is a "sharp and distinct" collection of pictures.

lnIS(pgen,pdis)[0,lnN], where N is the total number of possible labels.

lnIS(pgen,pdis)=0 iff for almost all xpgenpdis(|x)=pdis(|x)pgen(x)dxThat means pgen is completely "indistinct". That is, for any image x sampled from pgen, discriminator returns exactly the same label predictions pdis(|x).

The highest inception score N is achieved if and only if the two conditions are both true:

  • For almost all xpgen, the distribution pdis(y|x) is concentrated on one label. That is, Hy[pdis(y|x)]=0. That is, every image sampled from pgen is exactly classified by the discriminator.
  • For every label y, the proportion of generated images labelled as y is exactly 𝔼xpgen[pdis(y|x)]=1N. That is, the generated images are equally distributed over all labels.

References

  1. Salimans, Tim; Goodfellow, Ian; Zaremba, Wojciech; Cheung, Vicki; Radford, Alec; Chen, Xi; Chen, Xi (2016). "Improved Techniques for Training GANs". Advances in Neural Information Processing Systems (Curran Associates, Inc.) 29. https://proceedings.neurips.cc/paper/2016/hash/8a3363abe792db2d8761d6403605aeb7-Abstract.html. 
  2. Frolov, Stanislav; Hinz, Tobias; Raue, Federico; Hees, Jörn; Dengel, Andreas (December 2021). "Adversarial text-to-image synthesis: A review". Neural Networks 144: 187–209. doi:10.1016/j.neunet.2021.07.019. PMID 34500257. 
  3. Borji, Ali (2022). "Pros and cons of GAN evaluation measures: New developments" (in en). Computer Vision and Image Understanding 215: 103329. doi:10.1016/j.cviu.2021.103329. https://linkinghub.elsevier.com/retrieve/pii/S1077314221001685.