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

Replace default YuNet with the one of fixed input shape to avoid 'parseShape' error #44

Closed
fengyuentau opened this issue Mar 31, 2022 · 0 comments · Fixed by #45
Closed
Assignees
Labels
bug Something isn't working

Comments

@fengyuentau
Copy link
Member

fengyuentau commented Mar 31, 2022

Related bug report: opencv/opencv#21340 (comment)

OpenCV does not support ONNX models that have dyanmic input shape and the 'Shape' operator for now. So running YuNet demo will get the following error message although the results are correct:

$ python demo.py
[ERROR:[email protected]] global /Users/xperience/actions-runner/_work/opencv-python/opencv-python/opencv/modules/dnn/src/onnx/onnx_importer.cpp (2516) parseShape DNN/ONNX(Shape): dynamic 'zero' shapes are not supported, input 243 [ 0 0 0 51 ]
[ERROR:[email protected]] global /Users/xperience/actions-runner/_work/opencv-python/opencv-python/opencv/modules/dnn/src/onnx/onnx_importer.cpp (2516) parseShape DNN/ONNX(Shape): dynamic 'zero' shapes are not supported, input 250 [ 0 0 0 34 ]
[ERROR:[email protected]] global /Users/xperience/actions-runner/_work/opencv-python/opencv-python/opencv/modules/dnn/src/onnx/onnx_importer.cpp (2516) parseShape DNN/ONNX(Shape): dynamic 'zero' shapes are not supported, input 257 [ 0 0 0 34 ]
[ERROR:[email protected]] global /Users/xperience/actions-runner/_work/opencv-python/opencv-python/opencv/modules/dnn/src/onnx/onnx_importer.cpp (2516) parseShape DNN/ONNX(Shape): dynamic 'zero' shapes are not supported, input 264 [ 0 0 0 51 ]
[ERROR:[email protected]] global /Users/xperience/actions-runner/_work/opencv-python/opencv-python/opencv/modules/dnn/src/onnx/onnx_importer.cpp (2516) parseShape DNN/ONNX(Shape): dynamic 'zero' shapes are not supported, input 297 [ 0 -4 ]

A patch is made to use YuNet of fixed input shape to bypass the error: opencv/opencv#21607. Although the input shape of ONNX model is fixed, OpenCV DNN infers on the actual input shape.

@fengyuentau fengyuentau added the bug Something isn't working label Mar 31, 2022
@fengyuentau fengyuentau self-assigned this Mar 31, 2022
@fengyuentau fengyuentau linked a pull request Mar 31, 2022 that will close this issue
fengyuentau added a commit that referenced this issue Apr 1, 2022
* replace with yunet of fixed input shape

* update quantized yunet

* update yunet filename used in scripts

* add a note message for #44
fengyuentau added a commit that referenced this issue Jun 8, 2023
* replace with yunet of fixed input shape

* update quantized yunet

* update yunet filename used in scripts

* add a note message for #44
@fengyuentau fengyuentau added this to the 4.9.0 (first release) milestone Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant