mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-07-26 13:47:03 +02:00
Make detection threhsold configurable (#17136)
This commit is contained in:
parent
c93b82d6e1
commit
8d05e7c5b9
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user