Rework save attempts option

This commit is contained in:
Nicolas Mowen 2025-03-18 16:08:10 -06:00
parent cd972fd36a
commit 07481bebde
2 changed files with 3 additions and 4 deletions

View File

@ -70,8 +70,8 @@ class FaceRecognitionConfig(FrigateBaseModel):
min_area: int = Field(
default=500, title="Min area of face box to consider running face recognition."
)
save_attempts: bool = Field(
default=True, title="Save images of face detections for training."
save_attempts: int = Field(
default=100, ge=0, title="Number of face attempts to save in the train tab."
)
blur_confidence_filter: bool = Field(
default=True, title="Apply blur quality filter to face confidence."

View File

@ -28,7 +28,6 @@ logger = logging.getLogger(__name__)
MAX_DETECTION_HEIGHT = 1080
MAX_FACE_ATTEMPTS = 100
MIN_MATCHING_FACES = 2
@ -512,7 +511,7 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
)
# delete oldest face image if maximum is reached
if len(files) > MAX_FACE_ATTEMPTS:
if len(files) > self.config.face_recognition.save_attempts:
os.unlink(os.path.join(folder, files[-1]))
def expire_object(self, object_id: str):