Skip to content
Advertisement

How do you read Tensorboard files programmatically?

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=...?

Advertisement

Answer

You can use TensorBoard’s Python classes or script to extract the data:

How can I export data from TensorBoard?

If you’d like to export data to visualize elsewhere (e.g. iPython Notebook), that’s possible too. You can directly depend on the underlying classes that TensorBoard uses for loading data: python/summary/event_accumulator.py (for loading data from a single run) or python/summary/event_multiplexer.py (for loading data from multiple runs, and keeping it organized). These classes load groups of event files, discard data that was “orphaned” by TensorFlow crashes, and organize the data by tag.

As another option, there is a script (tensorboard/scripts/serialize_tensorboard.py) which will load a logdir just like TensorBoard does, but write all of the data out to disk as json instead of starting a server. This script is setup to make “fake TensorBoard backends” for testing, so it is a bit rough around the edges.

Using EventAccumulator:

JavaScript

size_guidance:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement