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