mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-05 13:07:44 +03:00
Adjust min_score config to unknown_score
This commit is contained in:
parent
fc7f9cd1a8
commit
a7ff79f063
@ -54,8 +54,8 @@ class FaceRecognitionConfig(FrigateBaseModel):
|
||||
model_size: str = Field(
|
||||
default="small", title="The size of the embeddings model used."
|
||||
)
|
||||
min_score: float = Field(
|
||||
title="Minimum face distance score required to save the attempt.",
|
||||
unknown_score: float = Field(
|
||||
title="Minimum face distance score required to be marked as a potential match.",
|
||||
default=0.8,
|
||||
gt=0.0,
|
||||
le=1.0,
|
||||
|
||||
@ -164,9 +164,7 @@ class LBPHRecognizer(FaceRecognizer):
|
||||
return
|
||||
|
||||
self.recognizer: cv2.face.LBPHFaceRecognizer = (
|
||||
cv2.face.LBPHFaceRecognizer_create(
|
||||
radius=2, threshold=(1 - self.config.face_recognition.min_score) * 1000
|
||||
)
|
||||
cv2.face.LBPHFaceRecognizer_create(radius=2, threshold=400)
|
||||
)
|
||||
self.recognizer.train(faces, np.array(labels))
|
||||
|
||||
@ -304,7 +302,4 @@ class ArcFaceRecognizer(FaceRecognizer):
|
||||
score = confidence
|
||||
label = name
|
||||
|
||||
if score < self.config.face_recognition.min_score:
|
||||
return None
|
||||
|
||||
return label, round(score * blur_factor, 2)
|
||||
|
||||
@ -241,6 +241,9 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
|
||||
|
||||
sub_label, score = res
|
||||
|
||||
if score < self.face_config.unknown_score:
|
||||
sub_label = "unknown"
|
||||
|
||||
logger.debug(
|
||||
f"Detected best face for person as: {sub_label} with probability {score}"
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user