Use Keras Model inside TF Object Detection

Viewed 116

I'm trying to use my Keras model alongside my TF object detection model. But I am getting this error:

ValueError: Calling `Model.predict` in graph mode is not supported when the `Model` instance was constructed with eager mode enabled. Please construct your `Model` instance in graph mode or call `Model.predict` with eager mode enabled.

It errors on print(np.around(model1.predict(datatest)))

I believe it is because with TF object detection I have to run it within

with detection_graph.as_default():
  with tf.compat.v1.Session(graph=detection_graph) as sess:
    

I'm not trying to run my Keras model in graph mode. Any idea around this?

1 Answers

I had initially loaded the model outside the with statements, but loading within the with statements seems to fix the issue.

Related