python - 如何导出张量板数据?

标签 python tensorboard

在 tensorborad 的 README.md 中,它要求我这样做:

如何从 TensorBoard 导出数据?

如果您想导出数据以在其他地方可视化(例如 iPython Notebook), 那也是可能的。您可以直接依赖于底层类 TensorBoard 用于加载数据:python/summary/event_accumulator.py(用于 从单次运行中加载数据)或 python/summary/event_multiplexer.py(对于 从多次运行中加载数据,并保持其组织性)。这些类加载 事件文件组,丢弃因 TensorFlow 崩溃而“孤立”的数据, 并按标签组织数据。

我按照它在 tensorflow 中的 mnist 示例中所说的那样进行操作。 但是我无法从原始数据中获取任何事件,而它正常显示在张量板上。

下面是我的代码:

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

结果如下:

{'标量':[],'直方图':[],'run_metadata':[],'图像':[],'图形':假,'音频':[],'元图': False, 'compressedHistograms': []}

我无法从原始数据中获取任何标记或事件。但是,当我打开张量板时。一切看起来都很好。

最佳答案

根据 EventAccumulator 的文档,path arg 是指向包含 tf 事件文件或单个 tf 事件文件的目录的文件路径。 因此,在您的情况下,您应该实例化 EventAccumulator 实例:

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

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

关于python - 如何导出张量板数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41082908/

相关文章:

python - python中两个以上矩阵的快速内积

python - 将字符串响应中的特定数据分配给变量

python - 带元组键的字典 : All tuples with the same first element

python - 继续使用使用 tf.reset_default_graph() 之前创建的张量

python - python中的多线程网络请求—— 'Name or service not known'

python - 有没有办法只复制 Pandas DataFrame 的结构(而不​​是数据)?

python - Colab 中的 Tensorboard : No dashboards are active for the current data set

api - 使用 TensorFlow 的数据集 API 进行图像摘要

tensorflow - 如何在张量板上显示多次运行的平均值

python - 无法使用 torch.utils.tensorboard.SummaryWriter.add_graph 方法加载保存的图形