使用Estimator API在评估过程中保存直方图

时间:2019-02-06 14:07:55

标签: tensorflow histogram tensorboard

在使用估算器API进行评估时是否可以保存直方图?

我找不到解决方案,因为estimator api在评估过程中没有写下任何摘要,并且只能将标量添加到评估指标中。

2 个答案:

答案 0 :(得分:1)

为了那些来这里但还没有找到解决方案的人,我将更新我使用上面的方法,并稍作修改:

    summary_writer = tf.compat.v1.summary.FileWriter(
        logdir=self.model_dir + '/eval_histograms/',
        filename_suffix='.host_call')
    summary_ops = [tf.compat.v1.summary.histogram(name=k, values=v)
                   for k, v in
                   prepare_endpoints_for_summary(endpoints).items()]
    eval_hooks = [
        tf.estimator.SummarySaverHook(save_steps=1,
                                      summary_writer=summary_writer,
                                      summary_op=summary_op)
        for summary_op in summary_ops]

效果很好! https://sforaidl.github.io/Neural-Voice-Cloning-With-Few-Samples/

答案 1 :(得分:0)

您可以使用SummarySaverHook

showPassword(e){
    this.setState( { showpassword: !this.state.showpassword }) // this is to change checkbox state
    this.setState( { type: this.state.type === 'password' ? 'text' : 'password' }) // this is to change input box type text/password change
}