mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-09 15:05:26 +03:00
Set maximum number of face images to be kept
This commit is contained in:
parent
ff8e145b90
commit
102a7230c6
@ -28,6 +28,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
MAX_DETECTION_HEIGHT = 1080
|
MAX_DETECTION_HEIGHT = 1080
|
||||||
|
MAX_FACE_ATTEMPTS = 100
|
||||||
MIN_MATCHING_FACES = 2
|
MIN_MATCHING_FACES = 2
|
||||||
|
|
||||||
|
|
||||||
@ -482,6 +483,16 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
|
|||||||
)
|
)
|
||||||
shutil.move(current_file, new_file)
|
shutil.move(current_file, new_file)
|
||||||
|
|
||||||
|
files = sorted(
|
||||||
|
os.listdir(folder),
|
||||||
|
key=lambda f: os.path.getctime(os.path.join(folder, f)),
|
||||||
|
reverse=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
# delete oldest face image if maximum is reached
|
||||||
|
if len(files) > MAX_FACE_ATTEMPTS:
|
||||||
|
os.unlink(os.path.join(folder, files[-1]))
|
||||||
|
|
||||||
def expire_object(self, object_id: str):
|
def expire_object(self, object_id: str):
|
||||||
if object_id in self.detected_faces:
|
if object_id in self.detected_faces:
|
||||||
self.detected_faces.pop(object_id)
|
self.detected_faces.pop(object_id)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user