W3cubDocs

/TensorFlow Python

tf.contrib.gan.eval.classifier_score

Aliases:

  • tf.contrib.gan.eval.classifier_metrics.classifier_score
  • tf.contrib.gan.eval.classifier_score
tf.contrib.gan.eval.classifier_score(
    images,
    classifier_fn,
    num_batches=1
)

Defined in tensorflow/contrib/gan/python/eval/python/classifier_metrics_impl.py.

Classifier score for evaluating a conditional generative model.

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.

Args:

  • 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_images in to in order to efficiently run them through the classifier network.

Returns:

The classifier score. A floating-point scalar of the same type as the output of classifier_fn.

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/gan/eval/classifier_score