serengil / deepface

A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python
https://www.youtube.com/watch?v=WnUVYQP4h44&list=PLsS_1RYmYQQFdWqxQggXHynP1rqaYXv_E&index=1
MIT License
14.31k stars 2.2k forks source link

getting error while choosing detector as retinaface #300

Closed nbhupendra closed 3 years ago

nbhupendra commented 3 years ago

getting error while choosing detector as retinaface

TypeError('alignment_procedure() takes 3 positional arguments but 4 were given',)

serengil commented 3 years ago

I need more details.

Which function you are calling? Which arguments you are passing? Which version of deepface you are using? Could you share the all error message?

nbhupendra commented 3 years ago

Hi,

PFB details.

DeepFace.verify( image1, image2, distance_metric='euclidean', model_name='Facenet512', detector_backend='retinaface')

Deep face version is latest. Version: 0.0.65

serengil commented 3 years ago

I also need all error message to understand which line causes the error.

nbhupendra commented 3 years ago

I also need all error message to understand which line causes the error.

File "/Users/test_user/FaceRecog/deepface-master/deepface/DeepFace.py", line 164, in verify , align = align) File "/Users/test_user/FaceRecog/deepface-master/deepface/DeepFace.py", line 742, in represent , align = align) File "/Users/test_user/FaceRecog/deepface-master/deepface/commons/functions.py", line 113, in preprocess_face img, region = detect_face(img = img, detector_backend = detector_backend, grayscale = grayscale, enforce_detection = enforce_detection, align = align) File "/Users/test_user/FaceRecog/deepface-master/deepface/commons/functions.py", line 96, in detect_face detected_face, img_region = FaceDetector.detect_face(face_detector, detector_backend, img, align) File "/Users/test_user/FaceRecog/deepface-master/deepface/detectors/FaceDetector.py", line 36, in detect_face obj = detect_faces(face_detector, detector_backend, img, align) File "/Users/test_user/FaceRecog/deepface-master/deepface/detectors/FaceDetector.py", line 59, in detect_faces obj = detect_face(face_detector, img, align) File "/Users/test_user/FaceRecog/deepface-master/deepface/detectors/RetinaFaceWrapper.py", line 58, in detect_face detected_face = postprocess.alignment_procedure(detected_face, right_eye, left_eye, nose) TypeError: alignment_procedure() takes 3 positional arguments but 4 were given test_user@LTtest_user-MAC deepface-master % python3 face_recognition.py Traceback (most recent call last): File "face_recognition.py", line 21, in distance_metric=metrics[2], model_name=models[1], detector_backend=backends[4]) File "/Users/test_user/FaceRecog/deepface-master/deepface/DeepFace.py", line 164, in verify , align = align) File "/Users/test_user/FaceRecog/deepface-master/deepface/DeepFace.py", line 742, in represent , align = align) File "/Users/test_user/FaceRecog/deepface-master/deepface/commons/functions.py", line 113, in preprocess_face img, region = detect_face(img = img, detector_backend = detector_backend, grayscale = grayscale, enforce_detection = enforce_detection, align = align) File "/Users/test_user/FaceRecog/deepface-master/deepface/commons/functions.py", line 96, in detect_face detected_face, img_region = FaceDetector.detect_face(face_detector, detector_backend, img, align) File "/Users/test_user/FaceRecog/deepface-master/deepface/detectors/FaceDetector.py", line 36, in detect_face obj = detect_faces(face_detector, detector_backend, img, align) File "/Users/test_user/FaceRecog/deepface-master/deepface/detectors/FaceDetector.py", line 59, in detect_faces obj = detect_face(face_detector, img, align) File "/Users/test_user/FaceRecog/deepface-master/deepface/detectors/RetinaFaceWrapper.py", line 58, in detect_face detected_face = postprocess.alignment_procedure(detected_face, right_eye, left_eye, nose) TypeError: alignment_procedure() takes 3 positional arguments but 4 were given

serengil commented 3 years ago

That's very interesting. My test results are below. I made some modifications and publish it in the next couple of days as 0.0.66. You can still use it now.

Use the latest code unpublished in pip:

git clone https://github.com/serengil/deepface.git
cd deepface
pip install -e .

code:

DeepFace.verify("deepface/tests/dataset/img1.jpg", 
     "deepface/tests/dataset/img2.jpg", 
     distance_metric='euclidean', 
     model_name='Facenet512', 
     detector_backend='retinaface')

result:

{"verified": true, 
"distance": 16.250792736923742, 
"max_threshold_to_verify": 23.56, 
"model": "Facenet512", 
"similarity_metric": "euclidean"}