From 97459d0c355efd9dcf237a45ef06e0c6ea57e790 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Sun, 24 Mar 2024 15:49:17 +0000 Subject: [PATCH] get the centers of right and left eye --- deepface/detectors/Dlib.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/deepface/detectors/Dlib.py b/deepface/detectors/Dlib.py index 55eeabe..be1922e 100644 --- a/deepface/detectors/Dlib.py +++ b/deepface/detectors/Dlib.py @@ -87,8 +87,15 @@ class DlibClient(Detector): w = int(min(right, img.shape[1]) - x) shape = self.model["sp"](img, detection) - left_eye = (shape.part(2).x, shape.part(2).y) - right_eye = (shape.part(0).x, shape.part(0).y) + + left_eye = ( + int((shape.part(2).x + shape.part(3).x) // 2), + int((shape.part(2).y + shape.part(3).y) // 2), + ) + right_eye = ( + int((shape.part(0).x + shape.part(1).x) // 2), + int((shape.part(0).y + shape.part(1).y) // 2), + ) # never saw confidence higher than +3.5 github.com/davisking/dlib/issues/761 confidence = scores[idx]