栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

您如何以编程方式读取Tensorboard文件?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

您如何以编程方式读取Tensorboard文件?

您可以使用TensorBoard的Python类或脚本来提取数据:

如何从TensorBoard导出数据?

如果您想导出数据以在其他地方可视化(例如iPython
Notebook),那也是可能的。您可以直接依赖TensorBoard用来加载数据的基础类:(用于

python/summary/event_accumulator.py
从一次运行
python/summary/event_multiplexer.py
中加载数据)或(用于从多个运行中加载数据并保持其组织化)。这些类加载事件文件组,丢弃由TensorFlow崩溃“孤立”的数据,并按标记组织数据。

另一种选择是,有一个脚本(

tensorboard/scripts/serialize_tensorboard.py
)可以像TensorBoard一样加载日志目录,但是将所有数据作为json写入磁盘,而不是启动服务器。设置该脚本是为了制作“假TensorBoard后端”进行测试,因此其边缘有些粗糙。

使用

EventAccumulator

# In [1]: from tensorflow.python.summary import event_accumulator  # deprecatedIn [1]: from tensorboard.backend.event_processing import event_accumulatorIn [2]: ea = event_accumulator.EventAccumulator('events.out.tfevents.x.ip-x-x-x-x',   ...:  size_guidance={ # see below regarding this argument   ...:      event_accumulator.COMPRESSED_HISTOGRAMS: 500,   ...:      event_accumulator.IMAGES: 4,   ...:      event_accumulator.AUDIO: 4,   ...:      event_accumulator.SCALARS: 0,   ...:      event_accumulator.HISTOGRAMS: 1,   ...:  })In [3]: ea.Reload() # loads events from fileOut[3]: <tensorflow.python.summary.event_accumulator.EventAccumulator at 0x7fdbe5ff59e8>In [4]: ea.Tags()Out[4]: {'audio': [], 'compressedHistograms': [], 'graph': True, 'histograms': [], 'images': [], 'run_metadata': [], 'scalars': ['Loss', 'Epsilon', 'Learning_rate']}In [5]: ea.Scalars('Loss')Out[5]: [ScalarEvent(wall_time=1481232633.080754, step=1, value=1.6365480422973633), ScalarEvent(wall_time=1481232633.2001867, step=2, value=1.2162202596664429), ScalarEvent(wall_time=1481232633.3877788, step=3, value=1.4660096168518066), ScalarEvent(wall_time=1481232633.5749283, step=4, value=1.2405034303665161), ScalarEvent(wall_time=1481232633.7419815, step=5, value=0.897326648235321), ...]

size_guidance

size_guidance: Information on how much data the EventAccumulator should  store in memory. The DEFAULT_SIZE_GUIDANCE tries not to store too much  so as to avoid OOMing the client. The size_guidance should be a map  from a `tagType` string to an integer representing the number of  items to keep per tag for items of that `tagType`. If the size is 0,  all events are stored.


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/633885.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号