Skip to content

Fail to load onnx model quantized by Intel neural-compressor #22509

@WanliZhong

Description

@WanliZhong
System information (version)
  • OpenCV => 4.6.0
  • Operating System / Platform => Windows 64 Bit
  • Compiler => Visual Studio 2019
Detailed description

When I load onnx model which was quantified by script from opencv_zoo with the Intel neural-compressor>1.10.1, it will cause an error. (This model can be run correctly by onnx_runtime)

[ERROR:0@80.629] global D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp (1021) cv::dnn::dnn4_v20220524::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 11 inputs and 1 outputs: [QLinearConcat]:(onnx_node!StatefulPartitionedCall/model/regressors/concat_quant) from domain='com.microsoft'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1040: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20220524::ONNXImporter::handleNode'
> Node [QLinearConcat@com.microsoft]:(onnx_node!StatefulPartitionedCall/model/regressors/concat_quant) parse error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:571: error: (-5:Bad argument) Blob StatefulPartitionedCall/model/regressors/concascale not found in const blobs in function 'cv::dnn::dnn4_v20220524::ONNXImporter::getBlob'

When I use Intel neural-compressor==1.10.1, the mdoel can be loaded. Several models have this problem as well.

Steps to reproduce

Demo model file: palm_detection_mediapipe_2022may-int8-quantized.onnx

Python code:

import cv2
net = cv2.dnn.readNetFromONNX("path/to/model")
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

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions