From 0a0880c21fcde7c387806cf61083009698487785 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 26 Mar 2025 06:12:51 -0600 Subject: [PATCH] Increase frequency of updates when internal face detection is used --- frigate/camera/state.py | 12 ++++++++++-- frigate/data_processing/common/face/model.py | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/frigate/camera/state.py b/frigate/camera/state.py index 98f808bf6..7ff617bf5 100644 --- a/frigate/camera/state.py +++ b/frigate/camera/state.py @@ -53,6 +53,14 @@ class CameraState: self.callbacks = defaultdict(list) self.ptz_autotracker_thread = ptz_autotracker_thread self.prev_enabled = self.camera_config.enabled + self.max_update_frequency = ( + 1 + if ( + self.config.face_recognition.enabled + and "face" not in self.config.objects.all_objects + ) + else 5 + ) def get_current_frame(self, draw_options={}): with self.current_frame_lock: @@ -283,11 +291,11 @@ class CameraState: updated_obj.last_updated = frame_time - # if it has been more than 5 seconds since the last thumb update + # if it has been more than max_update_frequency seconds since the last thumb update # and the last update is greater than the last publish or # the object has changed significantly if ( - frame_time - updated_obj.last_published > 5 + frame_time - updated_obj.last_published > self.max_update_frequency and updated_obj.last_updated > updated_obj.last_published ) or significant_update: # call event handlers diff --git a/frigate/data_processing/common/face/model.py b/frigate/data_processing/common/face/model.py index a006734ce..35777074a 100644 --- a/frigate/data_processing/common/face/model.py +++ b/frigate/data_processing/common/face/model.py @@ -243,6 +243,8 @@ class ArcFaceRecognizer(FaceRecognizer): for name, embs in face_embeddings_map.items(): self.mean_embs[name] = stats.trim_mean(embs, 0.15) + logger.debug("Finished building ArcFace model") + def similarity_to_confidence( self, cosine_similarity: float, median=0.3, range_width=0.6, slope_factor=12 ):