Issue
I'm trying to use my trained tensorflow model for object detection in Java. I exported the model (trained with Python) with this script export_inference_graph. This generated a frozen_inference_graph.pb file as well as a saved_model.pb file.
My understanding is that the best way to use this model in Java is to use to load the model via SavedModelBundle.load(). However, when I try this with the saved_model.pb file, I get the error SavedModel not found in export directory:
. Is there a better way to load the model in Java for object detection?
Please let me know if you have any suggestions! I suspect that I'm doing something wrong in the process.
Solution
The SavedModel format encodes all model information in a directory, not a file. So you want to provide the directory containing the saved_model.pb
file to SavedModelBundle.load()
, and not the file itself.
You may find the official sample to be instructive too.
Hope that helps.
Answered By - ash
Answer Checked By - Katrina (JavaFixing Volunteer)