NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Make detection threhsold configurable (#17136)
Nicolas Mowen8d05e7c5b90f
diff --git a/frigate/config/classification.py b/frigate/config/classification.pyindex 07d986d7d1..30cd12b7cb 100644--- a/frigate/config/classification.py+++ b/frigate/config/classification.py@@ -55,7 +55,13 @@ class FaceRecognitionConfig(FrigateBaseModel):gt=0.0,le=1.0,)- threshold: float = Field(+ detection_threshold: float = Field(+ default=0.7,+ title="Minimum face detection score required to be considered a face.",+ gt=0.0,+ le=1.0,+ )+ recognition_threshold: float = Field(default=0.9,title="Minimum face distance score required to be considered a match.",gt=0.0,diff --git a/frigate/data_processing/real_time/face.py b/frigate/data_processing/real_time/face.pyindex c88aae0272..7d97f85868 100644--- a/frigate/data_processing/real_time/face.py+++ b/frigate/data_processing/real_time/face.py@@ -88,7 +88,7 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):os.path.join(MODEL_CACHE_DIR, "facedet/facedet.onnx"),config="",input_size=(320, 320),- score_threshold=0.8,+ score_threshold=self.face_config.detection_threshold,nms_threshold=0.3,)self.landmark_detector = cv2.face.createFacemarkLBF()@@ -367,9 +367,9 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):os.makedirs(folder, exist_ok=True)cv2.imwrite(file, face_frame)- if score < self.config.face_recognition.threshold:+ if score < self.config.face_recognition.recognition_threshold:logger.debug(- f"Recognized face distance {score} is less than threshold {self.config.face_recognition.threshold}"+ f"Recognized face distance {score} is less than threshold {self.config.face_recognition.recognition_threshold}")self.__update_metrics(datetime.datetime.now().timestamp() - start)return