From 170688cc4ce55912388c8a1e811521e03a99f5d3 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 12 May 2025 07:32:30 -0600 Subject: [PATCH] Apply face area check to cv2 face detection --- frigate/data_processing/real_time/face.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frigate/data_processing/real_time/face.py b/frigate/data_processing/real_time/face.py index 6936e3ea1..2b6239742 100644 --- a/frigate/data_processing/real_time/face.py +++ b/frigate/data_processing/real_time/face.py @@ -221,6 +221,13 @@ class FaceRealTimeProcessor(RealTimeProcessorApi): max(0, face_box[0]) : min(frame.shape[1], face_box[2]), ] + # check that face is correct size + if area(face_box) < self.config.cameras[camera].face_recognition.min_area: + logger.debug( + f"Detected face that is smaller than the min_area {face} < {self.config.cameras[camera].face_recognition.min_area}" + ) + return + try: face_frame = cv2.cvtColor(face_frame, cv2.COLOR_RGB2BGR) except Exception: