need to Deploy Object detection models to tensorflow servings.
I need to convert Model trained on Object detection API to tensorflow servings.
The folder structure I get from saving a Object Detection model is ::
model
--checkpoint
--frozen_inference_graph.pb
--model.ckpt.data-00000-of-00001
--model.ckpt.index
--model.ckpt.meta
--pipeline.config
--saved_model
--saved_model.pb
--variables
--(empty)
I need to convert above to tensorflow serving model structure
Hi Aashish - I wrote a post around deploying object detection models using TF Serving. It might help you.
https://medium.freecodecamp.org/how-to-deploy-an-object-detection-model-with-tensorflow-serving-d6436e65d1d9
@gauravkaila is this post up to date? it was written in 2017 so I imagine a lot has changed.
@austinmw I am not maintaining the post anymore, though the content of the post is still very relevant in terms of how TF-Serving works. You might want to refer to the TF Serving docs by TF (https://www.tensorflow.org/tfx/serving/serving_basic) which is (now) very well written.
@gauravkaila thanks. I ask because my object detection job directly outputed export/Servo/ with variables contents already. I successfully launched a server running the model, but now I'm stuck on the last step of figuring out what the default input format should be to convert an image and send it to the server. It seems that it's looking for a string input type.
@austinmw how do you fix the problem: folder of variables is empty. rewrite the method of _write_saved_model ,but does not work out.
@w279805299 use the method of rewriting write_saved_model inside exporter.py, but instead of creating a new script to call exporter.py, run export_inference_graph.py from the command line which ends up calling exporter.py. Trying to use exporter.py directly gave me tf session issues.
TF obj det will automatically call export_inference_graph.py at the end of training, but the input type they use is tf_example instead of what you probably want with input_tensor
Also don't just completely overwrite exporter.py with the example from that page, just replace the parts that are needed.
@austinmw can you share the modified export.py you used? I modified the write_saved_model inside exporter.py , used export_inference_graph.py to export, it resulted in below error:
_File "C:\Anaconda3\lib\site-packages\tensorflow\python\framework\importer.py", line 94, in ProcessGraphDefParam raise TypeError('graph_def must be a GraphDef proto.') TypeError: graph_def must be a GraphDef proto.
I am not able to figure its cause, if possible could please share your modified exporter.py.
Hi There, We are checking to see if you still need help on this, as this seems to be an old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing. If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.
@gauravkaila The latest scipts seem to save the variables and assets etc. Not tested but it should work out of the box then right. Did you happen to test it out ?