diff --git a/frigate/config.py b/frigate/config.py index c210713a2..67ba468be 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -199,6 +199,11 @@ class DetectConfig(FrigateBaseModel): default_factory=StationaryConfig, title="Stationary objects config.", ) + stationary_threshold: Optional[int] = Field( + default=10, + title="Number of frames without a position change for an object to be considered stationary", + ge=1, + ) class FilterConfig(FrigateBaseModel): diff --git a/frigate/objects.py b/frigate/objects.py index 7b66536c2..c366a25c3 100644 --- a/frigate/objects.py +++ b/frigate/objects.py @@ -78,9 +78,9 @@ class ObjectTracker: } return False - # if there are less than 10 entries for the position, add the bounding box + # if there are less than stationary_threshold entries for the position, add the bounding box # and recompute the position box - if len(position["xmins"]) < 10: + if len(position["xmins"]) < self.detect_config.stationary_threshold: position["xmins"].append(xmin) position["ymins"].append(ymin) position["xmaxs"].append(xmax) diff --git a/frigate/video.py b/frigate/video.py index 26b99176f..8ae0271f1 100755 --- a/frigate/video.py +++ b/frigate/video.py @@ -507,8 +507,8 @@ def process_frames( stationary_object_ids = [ obj["id"] for obj in object_tracker.tracked_objects.values() - # if there hasn't been motion for 10 frames - if obj["motionless_count"] >= 10 + # if there hasn't been motion for N frames + if obj["motionless_count"] >= detect_config.stationary_threshold # and it isn't due for a periodic check and ( detect_config.stationary.interval == 0