Skip to content

face_detection_yunet #31

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

Closed
donaldlee2008 opened this issue Dec 12, 2021 · 17 comments
Closed

face_detection_yunet #31

donaldlee2008 opened this issue Dec 12, 2021 · 17 comments
Assignees
Labels
question It is not an issue but rather a user question

Comments

@donaldlee2008
Copy link

os:windows
python: 3.6
opecv-python:4.5.4
face_detection_yunet/demo.py
cmd: python demo.py -i 3.jpg
error:
onnx_importer.cpp:203: error: (-210:Unsupported format or combination of formats) Failed to parse ONNX model: face_detection_yunet_2021sep.onnx in function 'cv::dnn::dnn4_v20211004::ONNXImporter::ONNXImporter'

@fengyuentau
Copy link
Member

fengyuentau commented Dec 13, 2021

Did you test on WIndows CMD or WSL?

Solution: Follow the instructions in README to install git-lfs to pull models.

@fengyuentau fengyuentau self-assigned this Dec 13, 2021
@fengyuentau fengyuentau added the bug Something isn't working label Dec 13, 2021
@donaldlee2008
Copy link
Author

Did you test on WIndows CMD or WSL?

WIndows CMD

@bwmcin
Copy link

bwmcin commented Apr 6, 2022

Opened face_detection_yunet_2022mar.onnx in notepad+ and got this...

version https://git-lfs.github.com/spec/v1
oid sha256:50ef07f702a31741ca46a4c0d947773b64143b9362780237bf0d427d6c79bab7
size 345478

....and nothing else. Also, the file size is very small.

face_detection_yunet_2022_mar-act_int8-wt_int8-quantized.onnx has similar issue.

@fengyuentau
Copy link
Member

@bwmcin You need to install git-lfs from https://git-lfs.github.com/ and run

cd your/opencv_zoo
git lfs install
git pull

Or clone a fresh copy of opencv_zoo after you install git-lfs:

git lfs install
git clone https://github.com/opencv/opencv_zoo

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

zihaomu commented Jul 20, 2022

Hi @donaldlee2008, does git lfs install solve your problem?

@deepti-pushpak
Copy link

deepti-pushpak commented Aug 9, 2022

cv2.error: OpenCV(4.6.0) /io/opencv/modules/dnn/src/onnx/onnx_importer.cpp:260: error: (-210:Unsupported format or combination of formats) Failed to parse ONNX model: face_detection_yunet_2022mar.onnx in function 'ONNXImporter'

I am having the same issue on my ubuntu 20.04.4. Could anyone resolve this?

@fengyuentau
Copy link
Member

@deepti-pushpak Follow the instructions in README to install git-lfs to pull models.

@fengyuentau fengyuentau added question It is not an issue but rather a user question and removed bug Something isn't working help wanted Extra attention is needed platform: Windows labels Aug 10, 2022
@deepti-pushpak
Copy link

deepti-pushpak commented Aug 10, 2022

@deepti-pushpak Follow the instructions in README to install git-lfs to pull models.

@fengyuentau I can't thank you enough. Your suggestion works! I am able to run the detection code now, that utilises onnx model file. Thank you for saving me tons of work.
Also, I have an inquisitive query. 3 months ago, I was able to simply clone this repository from GitHub and used to run the code on my system without any further ado, but yesterday when I tried the same code it threw errors that I have already mentioned. After trying your suggestion, it works well now. However, could you please briefly explain, what is it that "git-lfs pull" did that my code works now?
Thank you.

@Radeeshp
Copy link

I am not able to run this line :
detector = cv2.FaceDetectorYN.create("face_detection_yunet_2023mar.onnx", "", (640, 480))
i have tried it with others files too.
This is the error i get when i try to run this line

[ WARN:0@1.646] global loadsave.cpp:244 cv::findDecoder imread_('face_detection_yunet_2023mar.onnx'): can't open/read file: check file path/integrity
Error: Unable to open file.
Traceback (most recent call last):
File "f:\EDUCATION\PROJECTS\FACE DETECTION\Face_detection_Yunet\Yunet_Code.py", line 21, in
detector = cv2.FaceDetectorYN.create("face_detection_yunet_2023mar.onnx", "", (640, 480))
cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:270: error: (-5:Bad argument) Can't read ONNX file: face_detection_yunet_2023mar.onnx in function 'cv::dnn::dnn4_v20221220::ONNXImporter::ONNXImporter'

@JefferyChia
Copy link

I follow the instructions in README to install git-lfs to pull models and re-run my model. However, the error still persists.

cv2.error: OpenCV(4.8.1) /io/opencv/modules/dnn/src/onnx/onnx_importer.cpp:279: error: (-210:Unsupported format or combination of formats) Failed to parse ONNX model: face_detection_yunet_2023mar.onnx in function 'ONNXImporter'

onnx model: face_detection_yunet_2023mar.onnx

can someone help?

@fengyuentau
Copy link
Member

@JefferyChia Please doublecheck whether you correctly installed git-lfs and pulled the models with the following commands:

$ git lfs status

It prints git: 'lfs' is not a git command. See 'git --help'. if git-lfs is not installed.

$ echo "8f2383e4dd3cfbb4553ea8718107fc0423210dc964f9f4280604804ed2552fa4  face_detection_yunet_2023mar.onnx" | shasum -a 256 -c

It prints OK if face_detection_yunet_2023mar.onnx is pulled correctly.

@JefferyChia
Copy link

@fengyuentau I checked the status of git-lfs and the output is this:

On branch main
Git LFS objects to be pushed to origin/main:

Git LFS objects to be committed:

Git LFS objects not staged for commit:

However, I got an error when I type in the echo command:

shasum: face_detection_yunet_2023mar.onnx: No such file or directory
face_detection_yunet_2023mar.onnx: FAILED open or read
shasum: WARNING: 1 listed file could not be read

Can you help me?

@fengyuentau
Copy link
Member

You need to run demo and my commands in models/face_detection_yunet.

@JefferyChia
Copy link

JefferyChia commented Nov 9, 2023

Hey @fengyuentau, I think it runs well. However, now I have a new error:

Traceback (most recent call last):
File "demo.py", line 101, in
print('{} faces detected.'.format(results.shape[0]))
AttributeError: 'NoneType' object has no attribute 'shape'

Is there an issue that I can refer on this?

@fengyuentau
Copy link
Member

That means no faces are detected. It returns none in this case.

@JefferyChia
Copy link

@fengyuentau my input is a face, however, I am not sure why the error persists. Do I need to reshape the size of the image or is it unnecessary?

python3 demo.py -i human_faces.jpg

Human_faces

@fengyuentau
Copy link
Member

These faces are way too big to be able to be detected by this model. Try to shrink this image to 1/4 of its original size and I can get the follow result,

result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question It is not an issue but rather a user question
Projects
None yet
Development

No branches or pull requests

7 participants