|View source on GitHub|
Classifier score for evaluating a conditional generative model.
tf.contrib.gan.eval.classifier_score( images, classifier_fn, num_batches=1 )
This is based on the Inception Score, but for an arbitrary classifier.
This technique is described in detail in https://arxiv.org/abs/1606.03498. In summary, this function calculates
exp( E[ KL(p(y|x) || p(y)) ] )
which captures how different the network's classification prediction is from the prior distribution over classes.
NOTE: This function consumes images, computes their logits, and then computes the classifier score. If you would like to precompute many logits for large batches, use classifier_score_from_logits(), which this method also uses.
images: Images to calculate the classifier score for.
classifier_fn: A function that takes images and produces logits based on a classifier.
num_batches: Number of batches to split
generated_imagesin to in order to efficiently run them through the classifier network.
The classifier score. A floating-point scalar of the same type as the output