How to export tensor board data?

2019-03-30 10:38发布

In the tensorborad's README.md, it ask me to do like this:

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.

And I do it as what it sayid with the mnist example in tensorflow. But I can't get any event from the original data whereas it shows on the tensorboard normally.

below is my code:

x = EventAccumulator(path="/tmp/tensorflow/mnist/logs/mnist_with_summaries/")
x.Reload()
print(x.Tags())
x.FirstEventTimestamp()
print(x.Tags())

And the result showed like below:

{'scalars': [], 'histograms': [], 'run_metadata': [], 'images': [], 'graph': False, 'audio': [], 'meta_graph': False, 'compressedHistograms': []}

I can't get any tag or event from the original data. However, when I open the tensorboard. Everything just look fine.

1条回答
狗以群分
2楼-- · 2019-03-30 11:07

According to the docs for EventAccumulator a path arg is a file path to a directory containing tf events files, or a single tf events file. So in your case you should instantiate EventAccumulator instance with:

x = EventAccumulator(path="/tmp/tensorflow/mnist/logs/mnist_with_summaries/train")

or

x = EventAccumulator(path="/tmp/tensorflow/mnist/logs/mnist_with_summaries/test")
查看更多
登录 后发表回答