New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing trained model to OpenCV #149
Comments
check google object detection API , they have a couple of scripts there to convert .ckpt and .meta to .pb and .pbtxt files , you just need to tweak them to fit the input/output of kittiseg |
Thanks for the prompt reply! |
I was able to modify the demo.py script, which of course reads the model in, and save the binary protobuf via this command: |
@Bendidi I noticed you wrote on July 31st that you froze the graph. What output layer name did you use? After a lot of research online I found that "softmax" might be the case, but both |
@vincentcaux I was working on this last week. I can give you my scripts that I used to save you the trouble. I am new to this as well, so no guarantee that I'm doing this right. |
@dpattison3 thanks for your reply! Your conversion script worked with no issue. Unfortunately, I am trying to load the graph with OpenCV, and there seems to be an (at least 1) unimplimented layer of bype ExpandDims which prevents me from doing so. My solution will be to use the TensorFlow API in C++ to load and run, converting between cv::Mat and tf::Tensor as required. |
Has anybody had any success importing the trained model to opencv?
I have looked around and it seems opencv requires the inference graph and weights as protobuf files:
https://github.com/opencv/opencv/blob/3.4.0/samples/dnn/mobilenet_ssd_python.py
Some suggest that we can convert the model ckpt files to pb using freeze_graph, but I have tried and it seems to require the graph in pbtxt format, which in my case is not in the training files (in RUNS). I only have the .meta, .info, and .data files. Any help would be appreciated!
P.S. While I have a lot of experience with OpenCV, I am a beginner with tensorflow and kittiseg.
The text was updated successfully, but these errors were encountered: