Skip to content

Commit 6dd2505

Browse files
authored
Merge pull request serengil#790 from Vincent-Stragier/use_original_ultralytics_dependency
Use original utralytics module for YOLO (close serengil#787)
2 parents 0b8e5ca + 80d4dbb commit 6dd2505

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

deepface/detectors/YoloWrapper.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ def detect_face(face_detector, img, align=False):
4848
detected_face = img[y: y + h, x: x + w].copy()
4949

5050
if align:
51-
# Extract landmarks
52-
left_eye, right_eye, _, _, _ = result.keypoints.tolist()
51+
# Tuple of x,y and confidence for left eye
52+
left_eye = result.keypoints.xy[0][0], result.keypoints.conf[0][0]
53+
# Tuple of x,y and confidence for right eye
54+
right_eye = result.keypoints.xy[0][1], result.keypoints.conf[0][1]
55+
5356
# Check the landmarks confidence before alignment
54-
if (left_eye[2] > LANDMARKS_CONFIDENCE_THRESHOLD and
55-
right_eye[2] > LANDMARKS_CONFIDENCE_THRESHOLD):
57+
if (left_eye[1] > LANDMARKS_CONFIDENCE_THRESHOLD and
58+
right_eye[1] > LANDMARKS_CONFIDENCE_THRESHOLD):
5659
detected_face = FaceDetector.alignment_procedure(
57-
detected_face, left_eye[:2], right_eye[:2]
60+
detected_face, left_eye[0].cpu(), right_eye[0].cpu()
5861
)
59-
6062
resp.append((detected_face, [x, y, w, h], confidence))
6163

6264
return resp

requirements_additional.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
opencv-contrib-python>=4.3.0.36
22
mediapipe>=0.8.7.3
33
dlib>=19.20.0
4-
ultralytics @ git+https://github.com/derronqi/yolov8-face.git@b623989575bdb78601b5ca717851e3d63ca9e01c
4+
ultralytics>=8.0.122

0 commit comments

Comments
 (0)