Skip to content
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

image_classification_mobilenet: cannot load models #55

Closed
ukoehler opened this issue May 17, 2022 · 4 comments
Closed

image_classification_mobilenet: cannot load models #55

ukoehler opened this issue May 17, 2022 · 4 comments
Labels
help wanted Extra attention is needed platform: Windows

Comments

@ukoehler
Copy link

Hi, I have been playing round with the model examples provided and face_detection_yunet and human_segmentation_pphumanseg worked quite well.

I am using an up-to-date version of the opencv_zoo and OpenCV4.5.5 installed via pip on Windows

When running the demo.py example for image_classification_mobilenet I get the following error for all models, however

[ERROR:0@0.089] global D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\o
nnx\onnx_importer.cpp (909) cv::dnn::dnn4_v20211220::ONNXImporter::handleNode DN
N/ONNX: ERROR during processing node with 3 inputs and 1 outputs: [Clip]:(317) f
rom domain='ai.onnx'
Traceback (most recent call last):
File "D:\Local\devel\Python\OpenCV\image_classification_mobilenet\demo.py", li
ne 41, in
'v2': MobileNetV2(modelPath='./image_classification_mobilenetv2_2022apr.onnx
', labelPath=args.label, backendId=args.backend, targetId=args.target),
File "D:\Local\devel\Python\OpenCV\image_classification_mobilenet\mobilenet_v2
.py", line 11, in init
self.model = cv.dnn.readNet(self.model_path)
cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src
\onnx\onnx_importer.cpp:928: error: (-2:Unspecified error) in function 'cv::dnn:
:dnn4_v20211220::ONNXImporter::handleNode'

Node [Clip@ai.onnx]:(317) parse error: OpenCV(4.5.5) D:\a\opencv-python\opencv
-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1613: error: (-2:Unspecifi
ed error) in function 'void __cdecl cv::dnn::dnn4_v20211220::ONNXImporter::parse
Clip(class cv::dnn::dnn4_v20211220::LayerParams &,const class opencv_onnx::NodeP
roto &)'

(expected: 'node_proto.input_size() == 1'), where
'node_proto.input_size()' is 3
must be equal to
'1' is 1

Can anybody point me to a solution, please?

@fengyuentau fengyuentau added help wanted Extra attention is needed platform: Windows labels May 18, 2022
@ukoehler
Copy link
Author

ukoehler commented May 18, 2022

Hmmm, I finally setup a different venv with onnx and
onnx.checker.check_model
shows that the model is valid. This looks decidedly like an OpenCV bug.

@fengyuentau
Copy link
Member

Hello @ukoehler , models in opencv_zoo have been well tested on Linux. We will try to reproduce your issue on Windows.

@ukoehler
Copy link
Author

Hi @fengyuentau, I managed to re-write the example to use OpenCV for image preparation and onnx runtime for model execution. That works quiet well. The model is not the problem, but the reading by OpenCV. I will submit a new bug there.

@fengyuentau
Copy link
Member

This issue is fixed at opencv/opencv#22100, get the nightly OpenCV and it should work well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed platform: Windows
Projects
None yet
Development

No branches or pull requests

2 participants