How to edit a saved Tensorboard Summary?

妖精的绣舞 提交于 2020-07-10 09:19:12

问题


I would like to shift all the step-values of a specific saved tensorboard summary run by a certain amount. For example: The results start at step 1.000.001 and I want the results to show a start at 1 again, shifting all the values by 1.000.000.

How can I best do this?


回答1:


I found the solution myself:

You can just read it in again using a summary_iterator. and then for every event, save the values to a new summary. So in my case, I needed something like this:

summary_writer = tf.summary.FileWriter("someName")

for event in tf.train.summary_iterator("somePath"):
    if (event.step > 1000000):
        summary = tf.Summary()
        shifted_step = event.step - 1000000
        for value in event.summary.value:
            print(value.tag)
            if (value.HasField('simple_value')):
                print(value.simple_value)
                summary.value.add(tag='{}'.format(value.tag),simple_value=value.simple_value)

        summary_writer.add_summary(summary, shifted_step)
        summary_writer.flush()


来源:https://stackoverflow.com/questions/54987749/how-to-edit-a-saved-tensorboard-summary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!