Skip to content

BUG ONNXImporter::handleNode MatMul #22713

@Compaile

Description

@Compaile

System Information

OpenCV version: current Master branch
Operating System / Platform: Windows 11
Compiler & compiler version: MSVC 16

Detailed description

When trying to parse the onnx file (exported from https://github.com/baudm/parseq and simplified with https://github.com/daquexian/onnx-simplifier as recommended in the opencv doku) i get following error:

ERROR:0@0.145] global X:\ThirdPartySource\opencv_cuda\opencv\modules\dnn\src\onnx\onnx_importer.cpp (1050) cv::dnn::dnn4_v20220524::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 2 inputs and 1 outputs: [MatMul]:(onnx_node!MatMul_859) from domain='ai.onnx'
OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.6.0-dev) Error: Unspecified error (> Node [MatMul@ai.onnx]:(onnx_node!MatMul_859) parse error: OpenCV(4.6.0-dev) X:\ThirdPartySource\opencv_cuda\opencv\modules\core\src\matrix_transform.cpp:245: error: (-215:Assertion failed) _src.dims() <= 2 && esz <= 32 in function 'cv::transpose'
) in cv::dnn::dnn4_v20220524::ONNXImporter::handleNode, file X:\ThirdPartySource\opencv_cuda\opencv\modules\dnn\src\onnx\onnx_importer.cpp, line 1069

The onnx it self is valid and can be used with the onnx runtime itself.
i also checked it via https://netron.app/

there seems to be 2 issues in MatMul_859 first i think opencv expect another order of the inputs.
But even if i change them i get another error here i am :)

Steps to reproduce

auto detector = cv::dnn::readNetFromONNX("ocr-sim.onnx");

weetransfer for the onnx file:

https://wetransfer.com/downloads/46d0dc6287c0d1ed000924a036400bbe20221028095359/f7770d3acc028f8006a96bced82790c920221028095418/e4e0a6

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

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions