【问题标题】:Extract Tensorboard Histogram data提取 Tensorboard 直方图数据
【发布时间】:2019-10-16 23:57:28
【问题描述】:

the tutorial之后,我得到了Tensorflow的直方图,

import tensorflow as tf

k = tf.placeholder(tf.float32)

# Make a normal distribution, with a shifting mean
mean_moving_normal = tf.random_normal(shape=[1000], mean=(5*k), stddev=1)
# Record that distribution into a histogram summary
tf.summary.histogram("normal/moving_mean", mean_moving_normal)

# Setup a session and summary writer
sess = tf.Session()
writer = tf.summary.FileWriter("/tmp/histogram_example")

summaries = tf.summary.merge_all()

# Setup a loop and write the summaries to disk
N = 400
for step in range(N):
  k_val = step/float(N)
  summ = sess.run(summaries, feed_dict={k: k_val})
  writer.add_summary(summ, global_step=step)

下一步,我想使用Tensorboard的API提取直方图数据,我的代码在这里

from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
event_acc = EventAccumulator(summary_path)
event_acc.Reload()
# Show all tags in the log file
tags = event_acc.Tags()
hist_dict = {}
for hist_event in event_acc.Histograms('normal/moving_mean'):
    hist_dict.update({hist_event.step: (hist_event.histogram_value.bucket_limit,
                                        hist_event.histogram_value.bucket)})

但是,它只返回了最后一个输出。如何获取所有数据?

【问题讨论】:

    标签: tensorflow tensorflow-serving


    【解决方案1】:

    将“size_guidance”传递给EventAccumulator 构造函数时,您可以开始了。比如:

    event_acc = EventAccumulator(path, size_guidance={
            'histograms': REAL_STEP_COUNT,
    })
    

    【讨论】:

    • 找到了解决方案。忘记我原来的帖子。
    • 我编辑了这篇文章。在我指出 CompressedHistogram 函数返回所有步骤之前。有人认为这个提示很糟糕,可以否决。您在此处看到的内容实际上是有效的。
    • 每一步的形状如果1000,但我只有139。你能给出详细的工作解决方案吗?
    猜你喜欢
    • 2016-06-04
    • 2017-07-24
    • 2017-07-07
    • 2017-09-26
    • 2016-07-23
    • 2016-10-07
    • 1970-01-01
    • 2010-12-18
    • 1970-01-01
    相关资源
    最近更新 更多