From 85c817d1ce017f4a7cdcca23fc630958eefada09 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 23 Oct 2024 08:16:46 -0600 Subject: [PATCH] Simplify --- frigate/embeddings/maintainer.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frigate/embeddings/maintainer.py b/frigate/embeddings/maintainer.py index c17d653a9..38e166ca8 100644 --- a/frigate/embeddings/maintainer.py +++ b/frigate/embeddings/maintainer.py @@ -365,15 +365,20 @@ class EmbeddingMaintainer(threading.Thread): for face in best_faces: score = 1.0 - face[1] - if score < self.config.semantic_search.face_recognition.threshold: + if face[0] != sub_label: + logger.debug("Detected multiple faces, result is not valid.") return None avg_score += score avg_score = avg_score / REQUIRED_FACES - if id in self.detected_faces and avg_score <= self.detected_faces[id]: - logger.debug("Detected face does not score higher than previous face.") + if avg_score < self.config.semantic_search.face_recognition.threshold or ( + id in self.detected_faces and avg_score <= self.detected_faces[id] + ): + logger.debug( + "Detected face does not score higher than threshold / previous face." + ) return None self.detected_faces[id] = avg_score