diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index 80eb3fef8..a929d8363 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -162,8 +162,8 @@ detect: # Optional: Frequency for running detection on stationary objects (default: shown below) # When set to 0, object detection will never be run on stationary objects. If set to 10, it will be run on every 10th frame. stationary_interval: 0 - # Optional: Number of frames without a position change for an object to be considered stationary (default: shown below) - stationary_threshold: 10 + # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s) + stationary_threshold: 50 # Optional: Object configuration # NOTE: Can be overridden at the camera level diff --git a/frigate/config.py b/frigate/config.py index f7f82e91d..3bfda8c55 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -178,7 +178,6 @@ class DetectConfig(FrigateBaseModel): ge=0, ) stationary_threshold: Optional[int] = Field( - default=10, title="Number of frames without a position change for an object to be considered stationary", ge=1, ) @@ -771,6 +770,11 @@ class FrigateConfig(FrigateBaseModel): if camera_config.detect.max_disappeared is None: camera_config.detect.max_disappeared = max_disappeared + # Default stationary_threshold configuration + stationary_threshold = camera_config.detect.fps * 10 + if camera_config.detect.stationary_threshold is None: + camera_config.detect.stationary_threshold = stationary_threshold + # FFMPEG input substitution for input in camera_config.ffmpeg.inputs: input.path = input.path.format(**FRIGATE_ENV_VARS) diff --git a/frigate/objects.py b/frigate/objects.py index 1711ed4f4..7adf421d9 100644 --- a/frigate/objects.py +++ b/frigate/objects.py @@ -78,9 +78,9 @@ class ObjectTracker: } return False - # if there are less than stationary_threshold entries for the position, add the bounding box + # if there are less than 10 entries for the position, add the bounding box # and recompute the position box - if len(position["xmins"]) < self.detect_config.stationary_threshold: + if len(position["xmins"]) < 10: position["xmins"].append(xmin) position["ymins"].append(ymin) position["xmaxs"].append(xmax) diff --git a/frigate/video.py b/frigate/video.py index 2d419cc1d..cb201fd22 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 N frames - if obj["motionless_count"] >= detect_config.stationary_threshold + # if there hasn't been motion for 10 frames + if obj["motionless_count"] >= 10 # and it isn't due for a periodic check and ( detect_config.stationary_interval == 0