python - 清理 tensorflow 摘要

标签 python tensorflow tensorboard

我训练了一个模型很长时间(200 000 次迭代)。在每次迭代中,我都通过 tf.summary.FileWriter() 类保存了大量数据,例如损失、准确度、权重等。是的,我知道:那是愚蠢的。结果,我生成了一个将近 50 GB 的巨大摘要。现在我想删除大部分信息并保留,比如说,每 50 行一行。这将使我能够节省大量硬盘空间并加快 tensorboard 可视化速度,同时不会对摘要的质量产生重大影响。有可能吗?

最佳答案

允许您读取事件文件(存储摘要的地方)的函数是 tf.train.summary_iterator .你可以尝试这样的事情:

import tensorflow as tf

tfevents_filepath = path_to_existing_event_file
tfevents_folder_new = path_to_new_event_file_folder

writer = tf.summary.FileWriter(tfevents_folder_new)
for e in tf.train.summary_iterator(tfevents_filepath):
  if e.step == 0 or e.step % 50 == 0: # or any other criterion but make sure
                                      # you keep events from step 0
    writer.add_event(e)
writer.close()

关于python - 清理 tensorflow 摘要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50566040/

相关文章:

tensorflow - 在 tensorflow 中多次运行训练操作

python - 属性错误 : module 'tensorflow.contrib.learn' has no attribute 'TensorFlowDNNClassifier'

python - KerasClassifier 无法拟合模型,尽管一切正常

tensorflow - Tensorflow 对象检测 API 中的过拟合

python - Python 中 Perl 的 BEGIN{} block

python - Python 列表理解中的多个语句?

python - Pandas ,将多列的多个功能应用于groupby对象

neural-network - 任何监控神经网络训练的pytorch工具?

TensorFlow 不写事件

python - 如何对 pandas 中的字符串中的数字进行排序?