How Can I Integrate Tensorboard Visualization To Tf.Estimator?
I have classical TensorFlow code for recognizing handwritten digits https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py
Solution 1:
Generally, You just need to specify tf.summary.scalar()
, tf.summary.histogram()
or tf.summary.image()
anywhere in the code. You can use histogram summary in the following way to capture all weights and biases
for value in tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES):
tf.summary.histogram(value.name, value)
As for updatable metrics summary, e.g. accuracy of f1 score, you need to wrap it in eval_metric_ops
and pass to tf.estimator.EstimatorSpec
accuracy = tf.metrics.accuracy(labels=labels, predictions=predictions)
eval_metric_ops = {'accuracy': accuracy}
- You can just call tensorboard with the same dir you specified during training.
- You don't need to use
tf.summary.merge_all()
Post a Comment for "How Can I Integrate Tensorboard Visualization To Tf.Estimator?"