Training accuracy graph with model_to_estimator

Viewed 378

I have a Keras sequential model and I'm using:

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

I can see the training accuracy printed when I use Keras fit() function to train the model.


I need to use Estimator API to train the model and I'm using model_to_estimator to convert the model to estimator. Then I use train_and_evaluate() to train the model.

However I don't see the accuracy graph in Tensorboard. There's only one accuracy value (from evaluation), so the graph is just a dot.

What I need is the accuracy graph from training like the one shown here: https://www.tensorflow.org/guide/custom_estimators#tensorboard


I checked the examples and all I could find were ones where they use Estimator API to build the model and use following code to define a summary scalar.

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

Does anyone know how to use this with models converted from Keras?

I'm using Tensorflow version r1.10.

0 Answers
Related