mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-12-19 19:06:16 +01:00
config option for stationary detection interval
This commit is contained in:
parent
dde0498ed3
commit
eb16de7395
@ -159,6 +159,8 @@ detect:
|
||||
enabled: True
|
||||
# Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
|
||||
max_disappeared: 25
|
||||
# Optional: Frequency for running detection on stationary objects (default: 10x the frame rate)
|
||||
stationary_interval: 50
|
||||
|
||||
# Optional: Object configuration
|
||||
# NOTE: Can be overridden at the camera level
|
||||
|
@ -22,4 +22,4 @@ record:
|
||||
|
||||
This configuration will retain recording segments that overlap with events for 10 days. Because multiple events can reference the same recording segments, this avoids storing duplicate footage for overlapping events and reduces overall storage needs.
|
||||
|
||||
When `retain_days` is set to `0`, events will have up to `max_seconds` (defaults to 5 minutes) of recordings retained. Increasing `retain_days` to `1` will allow events to exceed the `max_seconds` limitation of up to 1 day.
|
||||
When `retain_days` is set to `0`, segments will be deleted from the cache if no events are in progress
|
||||
|
@ -162,6 +162,9 @@ class DetectConfig(FrigateBaseModel):
|
||||
max_disappeared: Optional[int] = Field(
|
||||
title="Maximum number of frames the object can dissapear before detection ends."
|
||||
)
|
||||
stationary_interval: Optional[int] = Field(
|
||||
title="Frame interval for checking stationary objects."
|
||||
)
|
||||
|
||||
|
||||
class FilterConfig(FrigateBaseModel):
|
||||
@ -745,6 +748,11 @@ class FrigateConfig(FrigateBaseModel):
|
||||
if camera_config.detect.max_disappeared is None:
|
||||
camera_config.detect.max_disappeared = max_disappeared
|
||||
|
||||
# Default stationary_interval configuration
|
||||
stationary_interval = camera_config.detect.fps * 10
|
||||
if camera_config.detect.stationary_interval is None:
|
||||
camera_config.detect.stationary_interval = stationary_interval
|
||||
|
||||
# FFMPEG input substitution
|
||||
for input in camera_config.ffmpeg.inputs:
|
||||
input.path = input.path.format(**FRIGATE_ENV_VARS)
|
||||
|
@ -14,7 +14,7 @@ import numpy as np
|
||||
from cv2 import cv2
|
||||
from setproctitle import setproctitle
|
||||
|
||||
from frigate.config import CameraConfig
|
||||
from frigate.config import CameraConfig, DetectConfig
|
||||
from frigate.edgetpu import RemoteObjectDetector
|
||||
from frigate.log import LogPipe
|
||||
from frigate.motion import MotionDetector
|
||||
@ -367,6 +367,7 @@ def track_camera(
|
||||
frame_queue,
|
||||
frame_shape,
|
||||
model_shape,
|
||||
config.detect,
|
||||
frame_manager,
|
||||
motion_detector,
|
||||
object_detector,
|
||||
@ -448,6 +449,7 @@ def process_frames(
|
||||
frame_queue: mp.Queue,
|
||||
frame_shape,
|
||||
model_shape,
|
||||
detect_config: DetectConfig,
|
||||
frame_manager: FrameManager,
|
||||
motion_detector: MotionDetector,
|
||||
object_detector: RemoteObjectDetector,
|
||||
@ -502,12 +504,13 @@ def process_frames(
|
||||
motion_boxes = motion_detector.detect(frame)
|
||||
|
||||
# get stationary object ids
|
||||
# check every 10th frame for stationary objects
|
||||
# check every Nth frame for stationary objects
|
||||
# disappeared objects are not stationary
|
||||
stationary_object_ids = [
|
||||
obj["id"]
|
||||
for obj in object_tracker.tracked_objects.values()
|
||||
if obj["motionless_count"] >= 10
|
||||
and obj["motionless_count"] % 10 != 0
|
||||
and obj["motionless_count"] % detect_config.stationary_interval != 0
|
||||
and object_tracker.disappeared[obj["id"]] == 0
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user