From c9569cd540e89aec192b54be318600780f33cf38 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Sat, 10 Feb 2024 18:17:28 +0000 Subject: [PATCH] region bug for dlib sorted --- deepface/detectors/Dlib.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/deepface/detectors/Dlib.py b/deepface/detectors/Dlib.py index 9709401..c202e01 100644 --- a/deepface/detectors/Dlib.py +++ b/deepface/detectors/Dlib.py @@ -113,12 +113,14 @@ class DlibClient(Detector): top = d.top() bottom = d.bottom() - # detected_face = img[top:bottom, left:right] - detected_face = img[ - max(0, top) : min(bottom, img.shape[0]), max(0, left) : min(right, img.shape[1]) - ] + y = int(max(0, top)) + h = int(min(bottom, img.shape[0]) - y) + x = int(max(0, left)) + w = int(min(right, img.shape[1]) - x) - img_region = FacialAreaRegion(x=left, y=right, w=right - left, h=bottom - top) + detected_face = img[int(y) : int(y + h), int(x) : int(x + w)] + + img_region = FacialAreaRegion(x=x, y=y, w=w, h=h) confidence = scores[idx] if align: