Reputation: 7216
Hey I'm trying to figure out how to get the probabilities for each of the classes in the CIFAR example. Currently I can input the predicted class in the input tensor and get back a true or false, but it won't tell me the class it thinks it is (out of 10) and the probability it places on that fact. Any ideas how to get this information after sess.run()?
Upvotes: 1
Views: 646
Reputation: 126184
The CIFAR-10 example code for evaluation (in cifar10_eval.py
) produces (as an intermediate output) a logits
tensor that contains log-probabilities that a given image is in each of the classes. Passing this tensor to sess.run()
will give you the necessary information to tell you what the predicted class for an image is. If instead you compute tf.nn.softmax(logits)
and pass that to sess.run()
, you will get a probability (ranging from 0 to 1) for each class.
Upvotes: 5