-
Notifications
You must be signed in to change notification settings - Fork 643
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
Error when loading in RTMDet ONNX file in OpenCV [Bug] #2048
Comments
@cozeybozey hi, sorry for the trouble. Actually, we did not tested the produced onnx model in OpenCV framework. If you use a deploy config with onnxruntime backend, you could go to the visualized output results and check if they are ok at first. |
When running deploy.py with the same configs and model I get the following error:
Also I sort of need this to work for RTMDet specifically and in the link you send I don't see RTMDet in the list. However according to this issue (#1662) it should be able to export RTMDet models to ONNX files right? Finally I get a ton of warnings. I get the same warnings when running torch2onnx. Could you maybe give some insight into whether those warnings are problematic and if so, why they are occurring? |
@cozeybozey Hi
|
I deleted my entire conda environment to remake it with onnxruntime instead of onnxruntime-gpu. But I am following the get started guide and now it is saying that I don't have onnxruntime installed. Shouldn't the following code snippet in the get started section also contain "pip install onnxruntime"? After installing "pip install onnxruntime" the deploy script does run successfully. Unfortunately though, I still get the same OpenCV error. |
@cozeybozey hi, as mentioned before, we only make sure the produced onnx models from mmdeploy can be used in onnxruntime, tensorrt and other backends. OpenCV is not included. |
I see, well thanks for the help anyway! |
Checklist
Describe the bug
I get an "Inconsistent shape for ConcatLayer" error when I am trying to load in the produced ONNX file in OpenCV. I have tried to use opset 12 and 11, but both led to the same error. I also tried to use main branch in MMDeploy and the dev-1.x branch, but again they both resulted in the same error. Finally I tried simplifying the ONNX file via https://convertmodel.com/#input=onnx&output=onnx, but this did not help either. Thanks in advance for your help!
Reproduction
python tools/torch2onnx.py segmentation_onnxruntime_dynamic-100x100-300x300.py model_config.py model.pth img.bmp
The config file looks like:
base = ["../mmdet/instance-seg/instance-seg_onnxruntime_dynamic.py"]
onnx_config = dict(
opset_version=12,
save_file='rtmdet.onnx'
)
Finally the script that loads in the model into OpenCV looks like:
import onnx
import cv2
Check whether ONNX is correct
onnx_path = "./rtmdet.onnx"
onnx_model = onnx.load(onnx_path)
onnx.checker.check_model(onnx_model)
net = cv2.dnn.readNetFromONNX(onnx_path)
print("OpenCV model was successfully read. Layer IDs: \n", net.getLayerNames())
Environment
Error traceback
The text was updated successfully, but these errors were encountered: