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

can not reproduction acc with lfw dataset #220

Closed
Ruanlt opened this issue Apr 29, 2021 · 4 comments
Closed

can not reproduction acc with lfw dataset #220

Ruanlt opened this issue Apr 29, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@Ruanlt
Copy link

Ruanlt commented Apr 29, 2021

I try to reproduction acc with lfw dataset, but error occur.

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2772, in fromarray
mode, rawmode = _fromarray_typemap[typekey]
KeyError: ((1, 1, 3), '<f4')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "deepface_test.py", line 33, in
obj = DeepFace.verify(img1, img2, model_name = 'Dlib', model = dlib_model, enforce_detection=False, distance_metric = 'euclidean')
File "/usr/local/lib/python3.6/dist-packages/deepface/DeepFace.py", line 152, in verify
, detector_backend = detector_backend)
File "/usr/local/lib/python3.6/dist-packages/deepface/commons/functions.py", line 454, in preprocess_face
img = align_face(img = img, detector_backend = detector_backend)
File "/usr/local/lib/python3.6/dist-packages/deepface/commons/functions.py", line 437, in align_face
img = alignment_procedure(img, left_eye, right_eye)
File "/usr/local/lib/python3.6/dist-packages/deepface/commons/functions.py", line 360, in alignment_procedure
img = Image.fromarray(img)
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2774, in fromarray
raise TypeError("Cannot handle this data type: %s, %s" % typekey) from e
TypeError: Cannot handle this data type: (1, 1, 3), <f4

What shoud I do?

@serengil
Copy link
Owner

serengil commented Apr 29, 2021

what exactly image pairs in your experiment? could you share your whole code?

you got same error when you test it for another model, e.g. Facenet?

@Ruanlt
Copy link
Author

Ruanlt commented Apr 30, 2021

what exactly image pairs in your experiment? could you share your whole code?

you got same error when you test it for another model, e.g. Facenet?

I copy the code from here(https://github.com/serengil/tensorflow-101/blob/master/python/LFW.ipynb), and use Facenet got same error.

@serengil
Copy link
Owner

serengil commented May 1, 2021

it seems mtcnn causes an error. You can skip the error if you set the detector backend to different to mtcnn.

DeepFace.verify(img1, img2, detector_backend = 'opencv', enforce_detection = False)

I will study why mtcnn causes this error

@serengil
Copy link
Owner

serengil commented May 1, 2021

yes, mtcnn find facial area in a scale of 1, 1, 3 that's not true. It seems mtcnn related error. The best way is using different detector.

@serengil serengil closed this as completed May 1, 2021
@serengil serengil added the bug Something isn't working label May 18, 2021
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

No branches or pull requests

2 participants