我有一个Keras顺序模型,我正在使用:

model.compile(optimizer="adam", loss="categorical_crossentropy", metrics=["accuracy"])

当我使用Keras fit() 函数训练模型时,我可以看到打印的训练精度 .


我需要使用Estimator API来训练模型,我使用 model_to_estimator 将模型转换为估算器 . 然后我使用 train_and_evaluate() 来训练模型 .

但是我没有在Tensorboard中看到准确度图表 . 只有一个准确度值(来自评估),因此图表只是一个点 .

我需要的是训练中的精确度图,如下所示:https://www.tensorflow.org/guide/custom_estimators#tensorboard


我查看了这些示例,我所能找到的是他们使用Estimator API构建模型并使用以下代码来定义摘要标量的示例 .

# Compute evaluation metrics.
accuracy = tf.metrics.accuracy(labels=labels,
                               predictions=predicted_classes,
                               name='acc_op')
metrics = {'accuracy': accuracy}
tf.summary.scalar('accuracy', accuracy[1])

有没有人知道如何使用从Keras转换的模型?

我正在使用Tensorflow版本r1.10 .