From 454d0a048e73f547377b62f2a68536da8557466c Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 2 Feb 2024 07:26:02 -0700 Subject: [PATCH] Add config for inactivity threshold --- frigate/config.py | 3 +++ frigate/output.py | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/frigate/config.py b/frigate/config.py index fbbf9fefa..22718fb1f 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -546,6 +546,9 @@ class BirdseyeConfig(FrigateBaseModel): ge=1, le=31, ) + inactivity_threshold: int = Field( + default=30, title="Birdseye Inactivity Threshold", gt=0 + ) mode: BirdseyeModeEnum = Field( default=BirdseyeModeEnum.objects, title="Tracking mode." ) diff --git a/frigate/output.py b/frigate/output.py index 1d5af1ed6..465c07786 100644 --- a/frigate/output.py +++ b/frigate/output.py @@ -287,6 +287,7 @@ class BirdsEyeFrameManager: self.canvas = Canvas(width, height, config.birdseye.layout.scaling_factor) self.stop_event = stop_event self.camera_metrics = camera_metrics + self.inactivity_threshold = config.birdseye.inactivity_threshold if config.birdseye.layout.max_cameras: self.last_refresh_time = 0 @@ -395,13 +396,14 @@ class BirdsEyeFrameManager: def update_frame(self): """Update to a new frame for birdseye.""" - # determine how many cameras are tracking objects within the last 30 seconds + # determine how many cameras are tracking objects within the last inactivity_threshold seconds active_cameras: set[str] = set( [ cam for cam, cam_data in self.cameras.items() if cam_data["last_active_frame"] > 0 - and cam_data["current_frame"] - cam_data["last_active_frame"] < 30 + and cam_data["current_frame"] - cam_data["last_active_frame"] + < self.inactivity_threshold ] )