While the canonical OpenAI implementation of "Inception Score" for the evaluation of generative models is no longer compatible with new releases of Tensorflow, a new implementation of it is provided. Also, a bug raised in openai/improved-gan#29 is fixed.
numpy
andtensorflow-gpu
- Fast, easy-to-use and memory-efficient, written in a way that is similar to the original implementation
- No prior knowledge about Tensorflow is necessary to use this code
- Makes use of TFGAN
- Downloads InceptionV1 automatically
- Compatible with both Python 2 and Python 3
- Call
get_inception_score(images, splits=10)
, whereimages
is a numpy array with values ranging from 0 to 255 and shape in the form[N, 3, HEIGHT, WIDTH]
whereN
,HEIGHT
andWIDTH
can be arbitrary.dtype
of the images is recommended to benp.uint8
to save CPU memory. - A smaller
BATCH_SIZE
reduces GPU memory usage, but at the cost of a slight slowdown. - If you want to compute a general "Classifier Score" with probabilities
preds
from another classifier, callpreds2score(preds, splits=10)
.preds
can be a numpy array of arbitrary shape[N, num_classes]
.
- The Inception Score was proposed in the paper Improved Techniques for Training GANs
- Code for the Fréchet Inception Distance