Back
How can you write a python script to read Tensorboard log files, extracting the loss and accuracy and other numerical data, without launching the GUI tensorboard --logdir=...?
tensorboard --logdir=...
To read a TFEvent you can get a Python iterator that yields Event protocol buffers.
# This example supposes that the events file contains summaries with a# summary value tag 'loss'. These could have been added by calling# `add_summary()`, passing the output of a scalar summary op created with# with: `tf.scalar_summary(['loss'], loss_tensor)`.for e in tf.train.summary_iterator(path_to_events_file): for v in e.summary.value: if v.tag == 'loss' or v.tag == 'accuracy': print(v.simple_value)
# This example supposes that the events file contains summaries with a
# summary value tag 'loss'. These could have been added by calling
# `add_summary()`, passing the output of a scalar summary op created with
# with: `tf.scalar_summary(['loss'], loss_tensor)`.
for e in tf.train.summary_iterator(path_to_events_file):
for v in e.summary.value:
if v.tag == 'loss' or v.tag == 'accuracy':
print(v.simple_value)
more info: summary_iterator.
For more details on Tensorboard, Machine Learning Course and Tensorflow Tutorials.
31k questions
32.8k answers
501 comments
693 users