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

Getting Error at 6th Cell of LFW.ipynb #19

Closed
FahimT5 opened this issue Mar 21, 2021 · 2 comments
Closed

Getting Error at 6th Cell of LFW.ipynb #19

FahimT5 opened this issue Mar 21, 2021 · 2 comments
Labels

Comments

@FahimT5
Copy link

FahimT5 commented Mar 21, 2021

I'm getting a value error at the 6th cell of LFW.ipynb. I'm getting this error both in google colab and my local machine. Please solve this issue.

The error is:

ValueError Traceback (most recent call last)
in
11
12 #obj = DeepFace.verify(img1, img2, model_name = 'VGG-Face', model = vgg_model)
---> 13 obj = DeepFace.verify(img1, img2, model_name = 'Dlib', model = dlib_model, distance_metric = 'euclidean')
14 prediction = obj["verified"]
15 predictions.append(prediction)

~/.local/lib/python3.8/site-packages/deepface/DeepFace.py in verify(img1_path, img2_path, model_name, distance_metric, model, enforce_detection, detector_backend)
152 , detector_backend = detector_backend)
153
--> 154 img2 = functions.preprocess_face(img=img2_path
155 , target_size=(input_shape_y, input_shape_x)
156 , enforce_detection = enforce_detection

~/.local/lib/python3.8/site-packages/deepface/commons/functions.py in preprocess_face(img, target_size, grayscale, enforce_detection, detector_backend)
454
455 if enforce_detection == True:
--> 456 raise ValueError("Detected face shape is ", img.shape,". Consider to set enforce_detection argument to False.")
457 else: #restore base image
458 img = base_img.copy()

ValueError: ('Detected face shape is ', (0, 92, 3), '. Consider to set enforce_detection argument to False.')

@FahimT5 FahimT5 changed the title Getting Error at 6th Cell Getting Error at 6th Cell of LFW.ipynb Mar 21, 2021
@serengil
Copy link
Owner

No face found on one of your face pair. Getting this error is totally normal. Why don't you set the enforce_detection argument to False as mentioned in the message?

obj = DeepFace.verify(img1, img2, model_name = 'Dlib', model = dlib_model, distance_metric = 'euclidean', enforce_detection = False)

This will solve your issue but setting enforce_detection to False will decrease the accuracy dramatically. Try to feed high resolution images.

@FahimT5
Copy link
Author

FahimT5 commented Mar 23, 2021

Thanks for your suggestion. Now after putting enforce_detection = False, new error appears.

Now showing TypeError: Cannot handle this data type: (1, 1, 3), <f4.

How can I feed high-resolution images? Is there any way to filter out small images? As this is a fixed dataset by scikit learn. Can I manually select my dataset folder or any other way?

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

No branches or pull requests

2 participants