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()
Baca Juga
- Performing 1d Convolution Using 2d Kernel In Keras
- Uncaught Error: Error When Checking : Expected Conv2d_input To Have 4 Dimension(s), But Got Array With Shape [275,183,3]
- Input 0 Of Layer Max_pooling2d Is Incompatible With The Layer: Expected Ndim=4, Found Ndim=5. Full Shape Received: [none, 4, 10, 8, 32]
Post a Comment for "How Can I Integrate Tensorboard Visualization To Tf.estimator?"