-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ONNX export compatible with OpenCV #462
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
Conversation
@dkurt Hi, do you know how to export the model with prior box node. If I add the prior box node, the error will appear: |
Hi, @luoduo21, can you please show the exact source branch version to reproduce? In this PR priors are stored in the constant node. |
@dkurt the export code:
Maybe onnx doesn't support exporting constant node? |
@luoduo21, Can you please share why you need to export it as output? I mean do you want to run SSD and proposed branch not works for your model? You don't have to export raw priors+boxes+scores but you can export post-processed outputs from Detect layer (like in this PR). |
@dkurt I want to convert the onnx model to the ncnn model. I tried to add a Detect layer to export the post-processing directly,Although it can be successful,there are some problems in the process of onnx - > ncnn. So I want to export the three nodes directly。 |
@dkurt Thanks a lot for providing the code to convert the SSD model to the ONNX format. Unfortunately, I am not able to run your script Environment
Issues
|
@LucasVandroux, thanks for feedback! That looks very strage. Can you please try ONNX of version 1.6.0? |
@dkurt Thanks for your fast answer! I have the same problem with ONNX 1.6.0. Here is the full output:
The full list of python packages I am using is as follow:
And here the end of my git log:
Would some other information help you as well? |
So, I tried the following steps:
with It reports some warnings but produces Also tried
Thanks for note! So, for current state or PR you may try torch 1.4.0 only |
@dkurt thanks again for providing the code to convert the ONNX model to OpenVINO. I used it, and it worked perfectly with For future developers who would like to use this model in their application, please note that the output label index corresponds to VOC and not to COCO. |
For those who might be interested in getting directly the ONNX file and the OpenVINO files, I uploaded them here: link. |
where is the file export_to_onnx.py? I don't see it in the repository... |
@TamarVolcani as this merge request hasn't yet been merged into the original repository, you will not find it there but in the fork of the repository: https://github.com/dkurt/ssd.pytorch/blob/opencv_support/export_to_onnx.py |
Hi, thanks for your work for converting the SSD to onnx model. |
Hello, Thank you for the script to convert the model and the instructions. I am able to do the conversion to ONNX (opsets 9, 10 and 11) as well as to Intel IR formats. However, I am not able to inference the converted ONNX models (opsets 9, 10, 11) with onnxruntime. I tried both 1.4.0 and 1.6.0 versions of onnxruntime. Here is the error message that I get: Please provide your suggestions. |
@abuvaneswari, Proposed solution won't work with ONNXRuntime. It's only for OpenCV and OpenVINO. Both of them can import ONNX model directly. |
I converted this line: |
This PR has changes which let to export trained model to ONNX format compatible with OpenCV (PR opencv/opencv#16925 is required)
Convert to ONNX
Run with OpenCV
Or run with OpenVINO