From 2ab934a9d2253c9cf1f7b98c20e74754c3152f16 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Tue, 25 Mar 2025 13:19:24 -0600 Subject: [PATCH] Handle color and gray landmark detection --- frigate/data_processing/common/face/model.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frigate/data_processing/common/face/model.py b/frigate/data_processing/common/face/model.py index a11bf1cb98..e81e0e4078 100644 --- a/frigate/data_processing/common/face/model.py +++ b/frigate/data_processing/common/face/model.py @@ -43,8 +43,14 @@ class FaceRecognizer(ABC): output_width: int, output_height: int, ) -> np.ndarray: + # landmark is run on grayscale images + if image.ndim == 3: + land_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) + else: + land_image = image + _, lands = self.landmark_detector.fit( - image, np.array([(0, 0, image.shape[1], image.shape[0])]) + land_image, np.array([(0, 0, land_image.shape[1], land_image.shape[0])]) ) landmarks: np.ndarray = lands[0][0]