Skip to content

OpenCV fails to import ONNX model: of type "Where" #22541

Closed
@ukoehler

Description

@ukoehler
  • OpenCV => Python opencv-python-rolling-5.0.0.20220903
  • Operating System / Platform Windows 10 64 bit
  • Python =>3.10.4
Detailed description

I converted a model to ONNX and tried to load it with OpenCV 5.6 Windows 10 (Python) and got the same error message. Find the model here:
https://drive.google.com/file/d/15wdXCiS1Yr7a4wFTUb7jQB_GjbkB_a-G/view?usp=sharing
Original model from here: https://github.com/clovaai/rexnet

I checked the ONNX using Pythin and onnx, as well as onnxruntime. Both claim that the model is OK. OpenCV, however, reports:

[ERROR:0@0.104] global D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp (1044) cv::dnn::dnn5_v20220821::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 3 inputs and 1 outputs: [Where]:(onnx_node!Where_46) from domain='ai.onnx'
Traceback (most recent call last):
  File "d:\Local\devel\Python\OpenCV\image_classification_rexnet_lite\inference.py", line 94, in <module>
    model = cv2.dnn.readNet(model_path)
cv2.error: OpenCV(5.0.0-pre) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1063: error: (-2:Unspecified error) in function 'cv::dnn::dnn5_v20220821::ONNXImporter::handleNode'
> Node [Where@ai.onnx]:(onnx_node!Where_46) parse error: OpenCV(5.0.0-pre) d:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layer_internals.hpp:110: error: (-2:Unspecified error) Can't create layer "onnx_node!Where_46" of type "Where" in function 'cv::dnn::dnn5_v20220821::detail::LayerData::getLayerInstance'>
Steps to reproduce

model = cv2.dnn.readNet(model_path)

  • Reproducible: yes
  • Enforceable: yes
Issue submission checklist
  • I report the issue, it's not a question

  • I checked the problem with documentation, FAQ, open issues,

  • 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