I train a convolutional neural network (CNN) with TensorFlow. When the training is finished I calculate the accuracy with the following code:
...
correct = tf.equal(tf.argmax(prediction, 1), tf.argmax(y, 1))
accuracy = tf.reduce_mean(tf.cast(correct, tf.float32))
eval_batch_size = 1
good = 0
total = 0
for i in range(int(mnist.test.num_examples/eval_batch_size)):
testSet = mnist.test.next_batch(eval_batch_size, shuffle=False)
good += accuracy.eval(feed_dict={ x: testSet[0], y: testSet[1]})
total += testSet[0].shape[0]
accuracy_eval = good/total
For “good” I get the value 1.0 when the test image is correct detected and the value 0.0 if not.
I want get the values for all ten output-nodes. For example, I evaluate a test-image with a handwritten “8” so maybe the output-node for the number “8” is 0.6 and for the number “3” is 0.3 and for “5” is 0.05 and the last 0.05 spread out over the seven other output-nodes.
So how I get all this ten values for each test image in TensorFlow?