Skip to content

OpenCV cannot import ONNX model: constBlobs.find(node_proto.input(0)) == constBlobs.end() #22859

@ukoehler

Description

@ukoehler

System Information

opencv-python-rolling 4.6.0.20221112
Operating System / Platform Windows 10 64 bit
Python 3.10.4

Detailed description

I converted the GINets from PaddleSeg to ONNX:

https://github.com/PaddlePaddle/PaddleSeg/tree/release/2.6/configs/ginet

Netron loads the resulting ONNX fine. This fails to load in OpenCV 4.6 pre-release:

[ERROR:0@0.634] global D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp (1053) cv::dnn::dnn4_v20220524::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 2 inputs and 1 outputs: [MatMul]:(onnx_node!p2o.MatMul.0) from domain='ai.onnx'
Traceback (most recent call last):
  File "d:\Local\devel\Python\OpenCV\dnn_segmentation_paddle_ginet_cityscape\inference.py", 
line 131, in <module>
    model = cv2.dnn.readNet(model_path)
cv2.error: OpenCV(4.6.0-dev) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1072: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20220524::ONNXImporter::handleNode'
> Node [MatMul@ai.onnx]:(onnx_node!p2o.MatMul.0) parse error: OpenCV(4.6.0-dev) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:2039: error: (-215:Assertion failed) constBlobs.find(node_proto.input(0)) == constBlobs.end() in function 'cv::dnn::dnn4_v20220524::ONNXImporter::parseMatMul'

I get the exact same message for the Pascal VOC and ADE models.

Steps to reproduce

model = cv2.dnn.readNet(model_path)

Find the model here: https://drive.google.com/file/d/1G08J-eeqs9G1KFzwkjsFh95BrEj16-yS/view?usp=sharing

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions