diff --git a/frigate/data_processing/real_time/face.py b/frigate/data_processing/real_time/face.py index 08b1db3e9..fdbda48aa 100644 --- a/frigate/data_processing/real_time/face.py +++ b/frigate/data_processing/real_time/face.py @@ -33,7 +33,8 @@ logger = logging.getLogger(__name__) MAX_DETECTION_HEIGHT = 1080 -MIN_MATCHING_FACES = 2 +MAX_FACES_ATTEMPTS_AFTER_REC = 6 +MAX_FACE_ATTEMPTS = 12 class FaceRealTimeProcessor(RealTimeProcessorApi): @@ -170,6 +171,23 @@ class FaceRealTimeProcessor(RealTimeProcessorApi): ) return + # check if we have hit limits + if ( + id in self.person_face_history + and len(self.person_face_history[id]) > MAX_FACES_ATTEMPTS_AFTER_REC + ): + # if we are at max attempts after rec and we have a rec + if obj_data.get("sub_label"): + logger.debug( + "Not processing due to hitting max attempts after true recognition." + ) + return + + # if we don't have a rec and are at max attempts + if len(self.person_face_history[id]) > MAX_FACE_ATTEMPTS: + logger.debug("Not processing due to hitting max rec attempts.") + return + face: Optional[dict[str, any]] = None if self.requires_face_detection: