首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何用自定义tf.Estimator在tensorboard events文件中只创建一份图形?

如何用自定义tf.Estimator在tensorboard events文件中只创建一份图形?
EN

Stack Overflow用户
提问于 2019-02-25 17:41:10
回答 1查看 1.1K关注 0票数 40

我正在使用一个自定义的tf. Estimator对象来训练神经网络。问题出在训练后事件文件的大小上--它太大了。我已经通过使用tf.Dataset.from_generator()解决了将数据集的一部分保存为常量的问题。但是,大小仍然很大,在启动tensorboard时,我收到了这样的消息

W0225 10:38:07.443567 140693578311424 tf_logging.py:120] Found more than one metagraph event per run. Overwriting the metagraph with the newest event.

所以,我想,我在这个事件文件中创建并保存了许多不同的图形。是否可以关闭此保存,或者如何仅保存第一个副本?

要知道,我找到了删除所有默认日志的唯一方法,那就是用

代码语言:javascript
复制
list(map(os.remove, glob.glob(os.path.join(runtime_params['model_dir'], 'events.out.tfevents*'))))

然而,这对我来说是一个糟糕的解决方案,因为我更喜欢保留摘要,理想情况下,是图形的one副本。

从文档中,我可以看到

Estimators 自动将以下内容写入磁盘:

文件检查点,是在training.

  • event

  • 期间创建的模型版本,其中包含TensorBoard用于创建可视化效果的信息。这是一种关闭写入events file

的方法吗

EN

回答 1

Stack Overflow用户

发布于 2021-07-07 03:48:23

您需要使用TensorBoard工具来可视化摘要日志的内容。

可以读取和使用事件文件日志。您可以看到此link中的示例提供了有关如何读取写入事件文件的事件的信息。

代码语言:javascript
复制
# This example supposes that the events file contains summaries with a
# summary value tag 'loss'.  These could have been added by calling
# `add_summary()`, passing the output of a scalar summary op created with
# with: `tf.compat.v1.summary.scalar('loss', loss_tensor)`.
for e in tf.compat.v1.train.summary_iterator(path to events file):
    for v in e.summary.value:
        if v.tag == 'loss':
            print(v.simple_value)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54863255

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档