如何导出张量板数据? [英] How to export tensor board data?
问题描述
在 tensorborad 的 README.md 中,它要求我这样做:
In the tensorborad's README.md, it ask me to do like this:
如果您想导出数据以在其他地方进行可视化(例如 iPython Notebook),这也是可能的.您可以直接依赖于TensorBoard 用于加载数据:python/summary/event_accumulator.py
(对于从单次运行加载数据)或 python/summary/event_multiplexer.py
(对于从多次运行中加载数据,并保持组织有序).这些类加载事件文件组,丢弃由 TensorFlow 崩溃孤立"的数据,并按标签组织数据.
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.
我按照它在 tensorflow 中的 mnist 示例中所说的去做.但是我无法从原始数据中获取任何事件,而它通常显示在张量板上.
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.
下面是我的代码:
x = EventAccumulator(path="/tmp/tensorflow/mnist/logs/mnist_with_summaries/")
x.Reload()
print(x.Tags())
x.FirstEventTimestamp()
print(x.Tags())
结果如下:
{'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.
推荐答案
根据 EventAccumulator
的文档,path
arg 是包含 tf 事件的目录的文件路径文件,或单个 tf 事件文件.因此,在您的情况下,您应该使用以下命令实例化 EventAccumulator
实例:
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")
或
x = EventAccumulator(path="/tmp/tensorflow/mnist/logs/mnist_with_summaries/test")
这篇关于如何导出张量板数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!