ShiqiYu / libfacedetection

An open source library for face detection in images. The face detection speed can reach 1000FPS.
Other
12.27k stars 3.05k forks source link

How to use the python script in opencv_dnn/ with yunet.onnx #358

Closed StoreBlank closed 1 year ago

StoreBlank commented 1 year ago

Hello, I'm a university student who want to try out this projection. I followed the instructions in opencv_dnn/README.md, and downloaded yunet.onnx from https://github.com/ShiqiYu/libfacedetection.train/blob/a61a428929148171b488f024b5d6774f93cdbc13/tasks/task1/onnx/yunet.onnx.

But when I tried the following command: python detect.py --model=model/yunet.onnx --input=../../images/cnnresult.png --vis false --save yes I encountered this error:

[ERROR:0@0.006] global onnx_importer.cpp:2629 parseShape DNN/ONNX(Shape): dynamic 'zero' shapes are not supported, input 243 [ 0 0 0 51 ]

From relative message I know that it's because opencv doesn't support dynamic input shape for onnx model, but I wander how I can fix it so that the code can run. Thanks!

fengyuentau commented 1 year ago

Please use this instead: https://github.com/opencv/opencv_zoo/tree/master/models/face_detection_yunet.

OpenCV does not have a good support for dynamic input shape, thats why it failed.

StoreBlank commented 1 year ago

Thanks for the reply, it helps.