Disable detection by default (#16980)

* Enable detection by default

* Migrate config to have detect enabled if it is not
This commit is contained in:
Nicolas Mowen 2025-03-06 07:00:29 -07:00 committed by GitHub
parent 66d5f4f3b8
commit 30acd26898
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 6 deletions

View File

@ -255,6 +255,8 @@ ffmpeg:
# Optional: Detect configuration # Optional: Detect configuration
# NOTE: Can be overridden at the camera level # NOTE: Can be overridden at the camera level
detect: detect:
# Optional: enables detection for the camera (default: shown below)
enabled: False
# Optional: width of the frame for the input with the detect role (default: use native stream resolution) # Optional: width of the frame for the input with the detect role (default: use native stream resolution)
width: 1280 width: 1280
# Optional: height of the frame for the input with the detect role (default: use native stream resolution) # Optional: height of the frame for the input with the detect role (default: use native stream resolution)
@ -262,8 +264,6 @@ detect:
# Optional: desired fps for your camera for the input with the detect role (default: shown below) # Optional: desired fps for your camera for the input with the detect role (default: shown below)
# NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera. # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
fps: 5 fps: 5
# Optional: enables detection for the camera (default: True)
enabled: True
# Optional: Number of consecutive detection hits required for an object to be initialized in the tracker. (default: 1/2 the frame rate) # Optional: Number of consecutive detection hits required for an object to be initialized in the tracker. (default: 1/2 the frame rate)
min_initialized: 2 min_initialized: 2
# Optional: Number of frames without a detection before Frigate considers an object to be gone. (default: 5x the frame rate) # Optional: Number of frames without a detection before Frigate considers an object to be gone. (default: 5x the frame rate)

View File

@ -151,8 +151,6 @@ cameras:
- path: rtsp://10.0.10.10:554/rtsp # <----- The stream you want to use for detection - path: rtsp://10.0.10.10:554/rtsp # <----- The stream you want to use for detection
roles: roles:
- detect - detect
detect:
enabled: False # <---- disable detection until you have a working camera feed
``` ```
### Step 2: Start Frigate ### Step 2: Start Frigate

View File

@ -32,6 +32,7 @@ class StationaryConfig(FrigateBaseModel):
class DetectConfig(FrigateBaseModel): class DetectConfig(FrigateBaseModel):
enabled: bool = Field(default=False, title="Detection Enabled.")
height: Optional[int] = Field( height: Optional[int] = Field(
default=None, title="Height of the stream for the detect role." default=None, title="Height of the stream for the detect role."
) )
@ -41,7 +42,6 @@ class DetectConfig(FrigateBaseModel):
fps: int = Field( fps: int = Field(
default=5, title="Number of frames per second to process through detection." default=5, title="Number of frames per second to process through detection."
) )
enabled: bool = Field(default=True, title="Detection Enabled.")
min_initialized: Optional[int] = Field( min_initialized: Optional[int] = Field(
default=None, default=None,
title="Minimum number of consecutive hits for an object to be initialized by the tracker.", title="Minimum number of consecutive hits for an object to be initialized by the tracker.",

View File

@ -300,6 +300,12 @@ def migrate_016_0(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]
"""Handle migrating frigate config to 0.16-0""" """Handle migrating frigate config to 0.16-0"""
new_config = config.copy() new_config = config.copy()
# migrate config that does not have detect -> enabled explicitly set to have it enabled
if new_config.get("detect", {}).get("enabled") is None:
detect_config = new_config.get("detect", {})
detect_config["enabled"] = True
new_config["detect"] = detect_config
for name, camera in config.get("cameras", {}).items(): for name, camera in config.get("cameras", {}).items():
camera_config: dict[str, dict[str, any]] = camera.copy() camera_config: dict[str, dict[str, any]] = camera.copy()