Increase frequency of updates when internal face detection is used

This commit is contained in:
Nicolas Mowen 2025-03-26 06:12:51 -06:00
parent b30de96525
commit 0a0880c21f
2 changed files with 12 additions and 2 deletions

View File

@ -53,6 +53,14 @@ class CameraState:
self.callbacks = defaultdict(list) self.callbacks = defaultdict(list)
self.ptz_autotracker_thread = ptz_autotracker_thread self.ptz_autotracker_thread = ptz_autotracker_thread
self.prev_enabled = self.camera_config.enabled 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={}): def get_current_frame(self, draw_options={}):
with self.current_frame_lock: with self.current_frame_lock:
@ -283,11 +291,11 @@ class CameraState:
updated_obj.last_updated = frame_time 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 # and the last update is greater than the last publish or
# the object has changed significantly # the object has changed significantly
if ( 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 and updated_obj.last_updated > updated_obj.last_published
) or significant_update: ) or significant_update:
# call event handlers # call event handlers

View File

@ -243,6 +243,8 @@ class ArcFaceRecognizer(FaceRecognizer):
for name, embs in face_embeddings_map.items(): for name, embs in face_embeddings_map.items():
self.mean_embs[name] = stats.trim_mean(embs, 0.15) self.mean_embs[name] = stats.trim_mean(embs, 0.15)
logger.debug("Finished building ArcFace model")
def similarity_to_confidence( def similarity_to_confidence(
self, cosine_similarity: float, median=0.3, range_width=0.6, slope_factor=12 self, cosine_similarity: float, median=0.3, range_width=0.6, slope_factor=12
): ):