TensorFlow / Keras Model Predict Error

Unexpected error: Tensor Tensor(“dense_1/BiasAdd:0”, shape=(?, 3), dtype=float32) is not an element of this graph.

To Fix:

Make sure to include the following global:

import tensorflow as tf global graph,model graph = tf.get_default_graph()

And surround the prediction as such:

with graph.as_default(): segment = self.model.predict(features)