title: Tensorflow Confusion Matrix in TensorBoard
body: <p>I want to have a visual of confusion matrix in tensorboard. To do this, I am modifying Evaluation example of Tensorflow Slim: <a href="https://github.com/tensorflow/models/blob/master/slim/eval_image_classifier.py" rel="noreferrer">https://github.com/tensorflow/models/blob/master/slim/eval_image_classifier.py</a></p>
  
  <p>In this example code, Accuracy already provided but it is not possible to add "confusion matrix" metric directly because it is not streaming. </p>
  
  <p><strong>What is difference between streaming metrics and non-streaming ones?</strong></p>
  
  <p>Therefore, I tried to add it like this:</p>
  
  <pre><code>c_matrix = slim.metrics.confusion_matrix(predictions, labels)
  
  #These operations needed for image summary
  c_matrix = tf.cast(c_matrix, uint8)
  c_matrix = tf.expand_dims(c_matrix, 2)
  c_matrix = tf.expand_dims(c_matrix, 0)
  
  op = tf.image_summary("confusion matrix", c_matrix, collections=[])
  tf.add_to_collection(tf.GraphKeys.SUMMARIES, op)
  </code></pre>
  
  <p>This creates an image in tensorboard but probably there is a formatting problem. Matrix should be normalized between 0-1 so that It produces meaningful image.</p>
  
  <p><strong>How can I produce a meaningful confusion matrix? How can I deal with multi batch evaluation process?</strong></p>