Awesome
Inception Score
Tensorflow implementation of the "Inception Score" (IS) for the evaluation of generative models, with a bug raised in https://github.com/openai/improved-gan/issues/29 fixed.
Major Dependencies
tensorflow==1.14
or (tensorflow==1.15
andtensorflow-gan==1.0.0.dev0
) or (tensorflow>=2
andtensorflow-gan>=2.0.0
)
Features
- 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 if your are using CPUs or GPUs
- Makes use of TF-GAN
- Downloads InceptionV1 automatically
- Compatible with both Python 2 and Python 3
Usage
- If you are working with GPUs, use
inception_score.py
; if you are working with TPUs, useinception_score_tpu.py
and pass a Tensorflow Session and a TPUStrategy as additional arguments. - 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/TPU 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]
.
Examples
Links
- The Inception Score was proposed in the paper Improved Techniques for Training GANs
- Code for the Fréchet Inception Distance