tensorflow - 从 tensorboard 中提取直方图值并用 matplotlib 绘制它
问题描述
我想自己从张量板上绘制直方图,以发布它。我编写了这个提取函数来获取直方图值:
def _load_hist_from_tfboard(path):
event_acc = event_accumulator.EventAccumulator(path)
event_acc.Reload()
vec_dict = {}
for tag in sorted(event_acc.Tags()["distributions"]):
hist_dict = {}
for hist_event in event_acc.Histograms(tag):
hist_dict.update({hist_event.step: (hist_event.histogram_value.bucket_limit,
hist_event.histogram_value.bucket)})
vec_dict[tag] = hist_dict
return vec_dict
该函数收集事件文件的所有直方图。一个bucket_limit和bucket的输出如下:
[0.0, 1e-12, 0.0005418219168477906, 0.0005960041085325697, 0.0020575678275470133, 0.0022633246103017147, 0.004009617609950718, 0.00441057937094579, 0.005336801038844407, 0.005870481142728848, 0.007813610400972098, 0.008594971441069308, 0.022293142370048362, 0.0245224566070532, 0.026974702267758523, 0.035903328718386605, 0.03949366159022527, 0.043443027749247805, 0.04778733052417259, 0.052566063576589855, 0.057822669934248845, 0.06360493692767373, 0.06996543062044111, 0.07696197368248522, 0.24153964213356663, 0.2656936063469233, 0.29226296698161564, 0.3214892636797772, 0.35363819004775493, 0.38900200905253046, 0.42790220995778355, 0.47069243095356195, 0.5177616740489182, 0.56953784145381, 0.6264916255991911, 0.6891407881591103, 0.7580548669750213, 0.8338603536725235, 0.917246389039776, 1.0089710279437536]
[0.0, 3999936.0, 0.0, 4.0, 0.0, 4.0, 0.0, 4.0, 0.0, 4.0, 0.0, 4.0, 0.0, 4.0, 4.0, 0.0, 8.0, 8.0, 0.0, 4.0, 4.0, 0.0, 8.0, 4.0, 0.0, 9.0, 45.0, 50.0, 48.0, 85.0, 100.0, 109.0, 114.0, 15908.0, 74.0, 15856.0, 11908.0, 3973.0, 42.0, 7951679.0]
有人可以帮我将这些数字解释为直方图吗?
解决方案
推荐阅读
- ruby-on-rails - 如何在创建方面运算符的数组上查找 id
- node.js - ExpiresIn 与 maxAge
- conditional-formatting - 使用 Epplus 读取电子表格并确定所有单元格的样式,包括条件格式
- batch-file - 使用批处理打开和关闭excel而不丢失数据
- php - 试图弄清楚如何使用 Curl_multi 进行异步 GET 请求。代码没有返回预期的东西,但也没有给出错误
- c# - HTML 敏捷包如何找到文本的某些部分
- jquery - 更改选择框字体大小影响选项项长度
- javascript - 数组中的对象并没有真正按预期工作
- ios - 用整个单词而不是一个字符来分割字符串
- python - 如何使用从 CSV 文件中提取的 OrderedDict 为 DB 构建表