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

KeyError: 'content-type' when extracting face with dlib #769

Closed
hungpham3112 opened this issue Jun 4, 2023 · 9 comments
Closed

KeyError: 'content-type' when extracting face with dlib #769

hungpham3112 opened this issue Jun 4, 2023 · 9 comments
Labels
question Further information is requested

Comments

@hungpham3112
Copy link

Today is the first time I use this package, I want to extract the face from the image.

Here is my code:
detected_face = DeepFace.extract_faces("./obama.jpg", detector_backend = 'dlib')

But then the issue appeared:
image

image

It seems that deepface was trying to download the model but it can't

OS: Pop-OS 22.04
Env: conda
Editor: jupyter notebook

@serengil
Copy link
Owner

serengil commented Jun 4, 2023

This is covered here: https://github.com/serengil/deepface/blob/master/deepface/basemodels/DlibResNet.py#LL30C21-L30C43

And the target url is http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2

It is still alive. It seems you cannot access that url. Check your firewall or proxy.

@serengil serengil closed this as completed Jun 4, 2023
@serengil serengil added the question Further information is requested label Jun 4, 2023
@hungpham3112
Copy link
Author

This is covered here: https://github.com/serengil/deepface/blob/master/deepface/basemodels/DlibResNet.py#LL30C21-L30C43

And the target url is http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2

It is still alive. It seems you cannot access that url. Check your firewall or proxy.

The problem is http, I downloaded with firefox and it blocked. Is there any way to handle that with Python?

image

@serengil
Copy link
Owner

serengil commented Jun 4, 2023

This is not happening in my env. Sorry.

@hungpham3112
Copy link
Author

This is not happening in my env. Sorry.

Can you provide more information about your environment? Are you using Linux or Windows?

@serengil
Copy link
Owner

serengil commented Jun 4, 2023

Tested it on mac & debian.

@hungpham3112
Copy link
Author

I found the problem and can fix this with PR

@serengil
Copy link
Owner

serengil commented Jun 4, 2023

PRs are of course welcome but this is because of your env, not a bug.

@kennedyjosh
Copy link

I am also experiencing this issue on MacOS. I am able to download from the link in my browser, but not through the code. The PR from @hungpham3112 fixed the issue – what is the harm in accepting his approach, as this 'Content-Type' field does not seem to be guaranteed?

@hungpham3112
Copy link
Author

@kennedyjosh Can you look at the PR wkentaro/gdown#302 if it solve downloading problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants