如何以编程方式读取张量板文件并查看所有标量值(丢失和指标)?我的问题与this question on how to read data from tensorboard files。
有关按照@ user1501961的方法并使用function combine(acc, curr) {
for (var key in acc) {
switch (typeof(acc[key])) {
case "number":
acc[key] += curr[key];
break;
case "object":
combine(acc[key], curr[key]);
break;
}
}
}
var json1 =
{
"201809": 2,
"metric": "headcount",
"quarter1": 60,
"careerLevelsGroups": [{
"201809": 2,
"quarter1": 60,
"careerLevels": [{
"201809": 2,
"careerId": "careerId1",
"quarter1": 60,
},
{
"201809": 2,
"careerId": "careerId2",
"quarter1": 50,
}
]
}]
};
var json2 =
{
"201809": 3,
"metric": "headcount",
"quarter1": 100,
"careerLevelsGroups": [{
"201809": 7,
"quarter1": 40,
"careerLevels": [{
"201809": 9,
"careerId": "careerId1",
"quarter1": 30,
},
{
"201809": 8,
"careerId": "careerId2",
"quarter1": 30,
}
]
}]
};
var res = json1;
combine(res, json2);
console.log(JSON.stringify(json1, undefined, 2));
,我可以读取培训的损失。但是,我还没有想出看到评估损失的方法。由于评估丢失出现在tensorboard中,因此数据应以某种方式隐藏在日志目录中。
以下是我的脚本的一部分,其中包含培训损失:
tensorboard.backend.event_processing.event_accumulator.EventAccumulator
如果重要的话,我会使用In [1]: from tensorboard.backend.event_processing import event_accumulator
In [2]: ea = event_accumulator.EventAccumulator('PATH_TO_LOGGING_DIR', size_guidance={event_accumulator.SCALARS:0});
In [3]: ea.Reload();
In [4]: ea.scalars.Keys()
Out[4]:
['enqueue_input/queue/enqueue_input/random_shuffle_queuefraction_over_250_of_750_full',
'loss',
'global_step/sec']
In [5]: ea.Scalars('loss') # only training loss is read.
Out[5]:
[ScalarEvent(wall_time=1524534430.8867674, step=1, value=0.7076440453529358),
ScalarEvent(wall_time=1524534523.8320634, step=101, value=0.6497592926025391),
ScalarEvent(wall_time=1524534554.9782603, step=201, value=0.6366756558418274),
ScalarEvent(wall_time=1524534586.3355439, step=301, value=0.504106879234314),
...
来保存损失和其他指标。
答案 0 :(得分:1)