mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-25 21:29:01 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9a54d1bc4 |
@@ -90,7 +90,7 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
||||
uses: actions/setup-python@v5.4.0
|
||||
uses: actions/setup-python@v7.0.0
|
||||
with:
|
||||
python-version: ${{ env.DEFAULT_PYTHON }}
|
||||
- name: Install requirements
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
SQLITE_VEC_VERSION="0.1.9"
|
||||
SQLITE_VEC_VERSION="0.1.3"
|
||||
|
||||
source /etc/os-release
|
||||
|
||||
|
||||
@@ -34,13 +34,12 @@ edgeTPU:
|
||||
type: edgetpu
|
||||
device: usb
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize of the model, typically 320
|
||||
height: 320 # <--- should match the imgsize of the model, typically 320
|
||||
path: /config/model_cache/yolov9-s-relu6-best_320_int8_edgetpu.tflite
|
||||
labelmap_path: /config/labels-coco17.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize of the model, typically 320
|
||||
height: 320 # <--- should match the imgsize of the model, typically 320
|
||||
path: /config/model_cache/yolov9-s-relu6-best_320_int8_edgetpu.tflite
|
||||
labelmap_path: /config/labels-coco17.txt
|
||||
hailo8l:
|
||||
title: Hailo-8/Hailo-8L
|
||||
models:
|
||||
@@ -68,28 +67,27 @@ hailo8l:
|
||||
type: hailo8l
|
||||
device: PCIe
|
||||
|
||||
models:
|
||||
default:
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: rgb
|
||||
input_dtype: int
|
||||
model_type: yolo-generic
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: rgb
|
||||
input_dtype: int
|
||||
model_type: yolo-generic
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
|
||||
# The detector automatically selects the default model based on your hardware:
|
||||
# - For Hailo-8 hardware: YOLOv6n (default: yolov6n.hef)
|
||||
# - For Hailo-8L hardware: YOLOv6n (default: yolov6n.hef)
|
||||
#
|
||||
# Optionally, you can specify a local model path to override the default.
|
||||
# If a local path is provided and the file exists, it will be used instead of downloading.
|
||||
# Example:
|
||||
# path: /config/model_cache/hailo/yolov6n.hef
|
||||
#
|
||||
# You can also override using a custom URL:
|
||||
# path: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.14.0/hailo8/yolov6n.hef
|
||||
# just make sure to give it the write configuration based on the model
|
||||
# The detector automatically selects the default model based on your hardware:
|
||||
# - For Hailo-8 hardware: YOLOv6n (default: yolov6n.hef)
|
||||
# - For Hailo-8L hardware: YOLOv6n (default: yolov6n.hef)
|
||||
#
|
||||
# Optionally, you can specify a local model path to override the default.
|
||||
# If a local path is provided and the file exists, it will be used instead of downloading.
|
||||
# Example:
|
||||
# path: /config/model_cache/hailo/yolov6n.hef
|
||||
#
|
||||
# You can also override using a custom URL:
|
||||
# path: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.14.0/hailo8/yolov6n.hef
|
||||
# just make sure to give it the write configuration based on the model
|
||||
- key: ssd
|
||||
label: SSD MobileNet v1
|
||||
recommended: false
|
||||
@@ -113,19 +111,18 @@ hailo8l:
|
||||
type: hailo8l
|
||||
device: PCIe
|
||||
|
||||
models:
|
||||
default:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: rgb
|
||||
model_type: ssd
|
||||
# Specify the local model path (if available) or URL for SSD MobileNet v1.
|
||||
# Example with a local path:
|
||||
# path: /config/model_cache/h8l_cache/ssd_mobilenet_v1.hef
|
||||
#
|
||||
# Or override using a custom URL:
|
||||
# path: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.14.0/hailo8l/ssd_mobilenet_v1.hef
|
||||
model:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: rgb
|
||||
model_type: ssd
|
||||
# Specify the local model path (if available) or URL for SSD MobileNet v1.
|
||||
# Example with a local path:
|
||||
# path: /config/model_cache/h8l_cache/ssd_mobilenet_v1.hef
|
||||
#
|
||||
# Or override using a custom URL:
|
||||
# path: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.14.0/hailo8l/ssd_mobilenet_v1.hef
|
||||
openvino:
|
||||
title: OpenVINO
|
||||
models:
|
||||
@@ -174,15 +171,14 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU # or NPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: ssd
|
||||
label: SSDLite MobileNet v2
|
||||
recommended: false
|
||||
@@ -206,14 +202,13 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU # Or NPU
|
||||
|
||||
models:
|
||||
default:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
model:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
- key: yolo-legacy
|
||||
label: YOLO (v3, v4, v7)
|
||||
recommended: false
|
||||
@@ -245,15 +240,14 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU # or NPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: yolonas
|
||||
label: YOLO-NAS
|
||||
recommended: false
|
||||
@@ -286,15 +280,14 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolonas
|
||||
width: 320 # <--- should match whatever was set in notebook
|
||||
height: 320 # <--- should match whatever was set in notebook
|
||||
input_tensor: nchw
|
||||
input_pixel_format: bgr
|
||||
path: /config/yolo_nas_s.onnx
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolonas
|
||||
width: 320 # <--- should match whatever was set in notebook
|
||||
height: 320 # <--- should match whatever was set in notebook
|
||||
input_tensor: nchw
|
||||
input_pixel_format: bgr
|
||||
path: /config/yolo_nas_s.onnx
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: yolox
|
||||
label: YOLOX
|
||||
recommended: false
|
||||
@@ -315,11 +308,10 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolox
|
||||
path: /config/model_cache/yolox.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolox
|
||||
path: /config/model_cache/yolox.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: rfdetr
|
||||
label: RF-DETR
|
||||
recommended: false
|
||||
@@ -358,14 +350,13 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: rfdetr
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/rfdetr.onnx # use the filename you generated above
|
||||
model:
|
||||
model_type: rfdetr
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/rfdetr.onnx # use the filename you generated above
|
||||
- key: dfine
|
||||
label: D-FINE / DEIMv2
|
||||
recommended: false
|
||||
@@ -457,15 +448,14 @@ openvino:
|
||||
type: openvino
|
||||
device: CPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: dfine
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/dfine-s.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: dfine
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/dfine-s.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
appleSilicon:
|
||||
title: Apple Silicon
|
||||
models:
|
||||
@@ -514,15 +504,14 @@ appleSilicon:
|
||||
type: zmq
|
||||
endpoint: tcp://host.docker.internal:5555
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: yolo-legacy
|
||||
label: YOLO (v3, v4, v7)
|
||||
recommended: false
|
||||
@@ -554,15 +543,14 @@ appleSilicon:
|
||||
type: zmq
|
||||
endpoint: tcp://host.docker.internal:5555
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
onnx:
|
||||
title: ONNX
|
||||
models:
|
||||
@@ -610,15 +598,14 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: rfdetr
|
||||
label: RF-DETR
|
||||
recommended: false
|
||||
@@ -656,14 +643,13 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: rfdetr
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/rfdetr.onnx # use the filename you generated above
|
||||
model:
|
||||
model_type: rfdetr
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/rfdetr.onnx # use the filename you generated above
|
||||
- key: yolonas
|
||||
label: YOLO-NAS
|
||||
recommended: false
|
||||
@@ -695,15 +681,14 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolonas
|
||||
width: 320 # <--- should match whatever was set in notebook
|
||||
height: 320 # <--- should match whatever was set in notebook
|
||||
input_pixel_format: bgr
|
||||
input_tensor: nchw
|
||||
path: /config/yolo_nas_s.onnx
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolonas
|
||||
width: 320 # <--- should match whatever was set in notebook
|
||||
height: 320 # <--- should match whatever was set in notebook
|
||||
input_pixel_format: bgr
|
||||
input_tensor: nchw
|
||||
path: /config/yolo_nas_s.onnx
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: yolox
|
||||
label: YOLOX
|
||||
recommended: false
|
||||
@@ -726,15 +711,14 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolox
|
||||
width: 416 # <--- should match the imgsize set during model export
|
||||
height: 416 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float_denorm
|
||||
path: /config/model_cache/yolox_tiny.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolox
|
||||
width: 416 # <--- should match the imgsize set during model export
|
||||
height: 416 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float_denorm
|
||||
path: /config/model_cache/yolox_tiny.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: dfine
|
||||
label: D-FINE / DEIMv2
|
||||
recommended: false
|
||||
@@ -825,15 +809,14 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: dfine
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/dfine_m_obj2coco.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: dfine
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/dfine_m_obj2coco.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: yolo-legacy
|
||||
label: YOLO (v3, v4, v7)
|
||||
recommended: false
|
||||
@@ -864,15 +847,14 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
cpu:
|
||||
title: CPU
|
||||
models:
|
||||
@@ -946,19 +928,18 @@ memryx:
|
||||
type: memryx
|
||||
device: PCIe:0
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolonas
|
||||
width: 320 # (Can be set to 640 for higher resolution)
|
||||
height: 320 # (Can be set to 640 for higher resolution)
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolonas.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolonas.dfp (a file ending with .dfp)
|
||||
# └── yolonas_post.onnx (optional; only if the model includes a cropped post-processing network)
|
||||
model:
|
||||
model_type: yolonas
|
||||
width: 320 # (Can be set to 640 for higher resolution)
|
||||
height: 320 # (Can be set to 640 for higher resolution)
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolonas.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolonas.dfp (a file ending with .dfp)
|
||||
# └── yolonas_post.onnx (optional; only if the model includes a cropped post-processing network)
|
||||
- key: yolov9
|
||||
label: YOLOv9
|
||||
recommended: false
|
||||
@@ -984,18 +965,17 @@ memryx:
|
||||
type: memryx
|
||||
device: PCIe:0
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # (Can be set to 640 for higher resolution)
|
||||
height: 320 # (Can be set to 640 for higher resolution)
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolov9.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolov9.dfp (a file ending with .dfp)
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # (Can be set to 640 for higher resolution)
|
||||
height: 320 # (Can be set to 640 for higher resolution)
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolov9.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolov9.dfp (a file ending with .dfp)
|
||||
- key: yolox
|
||||
label: YOLOX
|
||||
recommended: false
|
||||
@@ -1021,18 +1001,17 @@ memryx:
|
||||
type: memryx
|
||||
device: PCIe:0
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolox
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float_denorm
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolox.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolox.dfp (a file ending with .dfp)
|
||||
model:
|
||||
model_type: yolox
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float_denorm
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolox.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolox.dfp (a file ending with .dfp)
|
||||
- key: ssd
|
||||
label: SSDLite MobileNet v2
|
||||
recommended: false
|
||||
@@ -1058,19 +1037,18 @@ memryx:
|
||||
type: memryx
|
||||
device: PCIe:0
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: ssd
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/ssdlite_mobilenet.zip
|
||||
# The .zip file must contain:
|
||||
# ├── ssdlite_mobilenet.dfp (a file ending with .dfp)
|
||||
# └── ssdlite_mobilenet_post.onnx (optional; only if the model includes a cropped post-processing network)
|
||||
model:
|
||||
model_type: ssd
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/ssdlite_mobilenet.zip
|
||||
# The .zip file must contain:
|
||||
# ├── ssdlite_mobilenet.dfp (a file ending with .dfp)
|
||||
# └── ssdlite_mobilenet_post.onnx (optional; only if the model includes a cropped post-processing network)
|
||||
tensorrt:
|
||||
title: TensorRT
|
||||
models:
|
||||
@@ -1109,14 +1087,13 @@ tensorrt:
|
||||
type: tensorrt
|
||||
device: 0 #This is the default, select the first GPU
|
||||
|
||||
models:
|
||||
default:
|
||||
path: /config/model_cache/tensorrt/yolov7-320.trt # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
input_tensor: nchw
|
||||
input_pixel_format: rgb
|
||||
width: 320 # MUST match the chosen model i.e yolov7-320 -> 320, yolov4-416 -> 416
|
||||
height: 320 # MUST match the chosen model i.e yolov7-320 -> 320 yolov4-416 -> 416
|
||||
model:
|
||||
path: /config/model_cache/tensorrt/yolov7-320.trt # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
input_tensor: nchw
|
||||
input_pixel_format: rgb
|
||||
width: 320 # MUST match the chosen model i.e yolov7-320 -> 320, yolov4-416 -> 416
|
||||
height: 320 # MUST match the chosen model i.e yolov7-320 -> 320 yolov4-416 -> 416
|
||||
synaptics:
|
||||
title: Synaptics
|
||||
models:
|
||||
@@ -1284,15 +1261,14 @@ axengine:
|
||||
axengine:
|
||||
type: axengine
|
||||
|
||||
models:
|
||||
default:
|
||||
path: frigate-yolov9-tiny
|
||||
model_type: yolo-generic
|
||||
width: 320
|
||||
height: 320
|
||||
input_dtype: int
|
||||
input_pixel_format: bgr
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
path: frigate-yolov9-tiny
|
||||
model_type: yolo-generic
|
||||
width: 320
|
||||
height: 320
|
||||
input_dtype: int
|
||||
input_pixel_format: bgr
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
degirumAiServer:
|
||||
title: DeGirum AI Server
|
||||
models:
|
||||
|
||||
@@ -11,8 +11,6 @@ It is not recommended to copy this full configuration file. Only specify values
|
||||
|
||||
:::
|
||||
|
||||
Sections marked `# NOTE: Can be overridden at the camera level` can be set globally and then adjusted per camera. See [Global and Camera-Level Configuration](../config_overrides.md) for how that works.
|
||||
|
||||
```yaml
|
||||
mqtt:
|
||||
# Optional: Enable mqtt server (default: shown below)
|
||||
@@ -157,51 +155,43 @@ auth:
|
||||
- front_door
|
||||
- back_yard
|
||||
|
||||
# Optional: named object detection models (default: a single model named "default")
|
||||
# Each entry defines a model; cameras choose which model to use with detect.model.
|
||||
# Detectors that support multiple models (openvino, onnx, tensorrt, cpu, rknn) run
|
||||
# one instance per model in use. Detectors that only support a single model
|
||||
# (edgetpu, hailo8l, memryx, and others) are assigned to models round robin, so at
|
||||
# least as many of those detectors as models are required when no multi-model
|
||||
# capable detector is configured.
|
||||
# Optional: model modifications
|
||||
# NOTE: The default values are for the EdgeTPU detector.
|
||||
# Other detectors will require the model config to be set.
|
||||
models:
|
||||
default:
|
||||
# Required: path to the model. Frigate+ models use plus://<model_id> (default: automatic based on detector)
|
||||
path: /edgetpu_model.tflite
|
||||
# Required: path to the labelmap (default: shown below)
|
||||
labelmap_path: /labelmap.txt
|
||||
# Required: Object detection model input width (default: shown below)
|
||||
width: 320
|
||||
# Required: Object detection model input height (default: shown below)
|
||||
height: 320
|
||||
# Required: Object detection model input colorspace
|
||||
# Valid values are rgb, bgr, or yuv. (default: shown below)
|
||||
input_pixel_format: rgb
|
||||
# Required: Object detection model input tensor format
|
||||
# Valid values are nhwc, nchw, hwnc, or hwcn (default: shown below)
|
||||
input_tensor: nhwc
|
||||
# Optional: Data type of the model input tensor
|
||||
# Valid values are float, float_denorm, or int (default: shown below)
|
||||
input_dtype: int
|
||||
# Required: Object detection model architecture, used by detectors that support more
|
||||
# than one model type (openvino, onnx, rknn, memryx, axengine, synaptics, and others)
|
||||
# Valid values are ssd, yolox, yolonas, yolo-generic, rfdetr, dfine (default: shown below)
|
||||
model_type: ssd
|
||||
# Required: Label name modifications. These are merged into the standard labelmap.
|
||||
labelmap:
|
||||
2: vehicle
|
||||
# Optional: Map of object labels to their attribute labels (default: depends on model)
|
||||
attributes_map:
|
||||
person:
|
||||
- amazon
|
||||
- face
|
||||
car:
|
||||
- amazon
|
||||
- fedex
|
||||
- license_plate
|
||||
- ups
|
||||
model:
|
||||
# Required: path to the model. Frigate+ models use plus://<model_id> (default: automatic based on detector)
|
||||
path: /edgetpu_model.tflite
|
||||
# Required: path to the labelmap (default: shown below)
|
||||
labelmap_path: /labelmap.txt
|
||||
# Required: Object detection model input width (default: shown below)
|
||||
width: 320
|
||||
# Required: Object detection model input height (default: shown below)
|
||||
height: 320
|
||||
# Required: Object detection model input colorspace
|
||||
# Valid values are rgb, bgr, or yuv. (default: shown below)
|
||||
input_pixel_format: rgb
|
||||
# Required: Object detection model input tensor format
|
||||
# Valid values are nhwc or nchw (default: shown below)
|
||||
input_tensor: nhwc
|
||||
# Optional: Data type of the model input tensor
|
||||
# Valid values are float, float_denorm, or int (default: shown below)
|
||||
input_dtype: int
|
||||
# Required: Object detection model type, currently only used with the OpenVINO detector
|
||||
# Valid values are ssd, yolox, yolonas (default: shown below)
|
||||
model_type: ssd
|
||||
# Required: Label name modifications. These are merged into the standard labelmap.
|
||||
labelmap:
|
||||
2: vehicle
|
||||
# Optional: Map of object labels to their attribute labels (default: depends on model)
|
||||
attributes_map:
|
||||
person:
|
||||
- amazon
|
||||
- face
|
||||
car:
|
||||
- amazon
|
||||
- fedex
|
||||
- license_plate
|
||||
- ups
|
||||
|
||||
# Optional: Audio Events Configuration
|
||||
# NOTE: Can be overridden at the camera level
|
||||
@@ -309,9 +299,6 @@ ffmpeg:
|
||||
detect:
|
||||
# Optional: enables detection for the camera (default: shown below)
|
||||
enabled: False
|
||||
# Optional: name of the model (key under models) used by this camera
|
||||
# (default: the only defined model, or the model named "default")
|
||||
model: default
|
||||
# Optional: width of the frame for the input with the detect role (default: use native stream resolution)
|
||||
width: 1280
|
||||
# Optional: height of the frame for the input with the detect role (default: use native stream resolution)
|
||||
@@ -481,8 +468,8 @@ review:
|
||||
detections: False
|
||||
# Optional: Activity Context Prompt to give context to the GenAI what activity is and is not suspicious.
|
||||
# It is important to be direct and detailed. See documentation for the default prompt structure.
|
||||
activity_context_prompt: |
|
||||
Define what is and is not suspicious
|
||||
activity_context_prompt: """Define what is and is not suspicious
|
||||
"""
|
||||
# Optional: Image source for GenAI (default: preview)
|
||||
# Options: "preview" (uses cached preview frames at ~180p) or "recordings" (extracts frames from recordings at 480p)
|
||||
# Using "recordings" provides better image quality but uses more tokens per image.
|
||||
@@ -826,8 +813,7 @@ classification:
|
||||
cameras:
|
||||
camera_name:
|
||||
# Required: Crop of image frame on this camera to run classification on
|
||||
# [x1, y1, x2, y2] as decimals between 0 and 1, relative to the detect resolution
|
||||
crop: [0.0, 0.25, 0.3, 0.85]
|
||||
crop: [0, 180, 220, 400]
|
||||
# Optional: If classification should be run when motion is detected in the crop (default: shown below)
|
||||
motion: False
|
||||
# Optional: Interval to run classification on in seconds (default: shown below)
|
||||
|
||||
@@ -192,13 +192,12 @@ Navigate to <NavPath path="Settings > System > Detectors and model" /> and open
|
||||
|
||||
```yaml
|
||||
# Optional: model config
|
||||
models:
|
||||
default:
|
||||
path: /path/to/model
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: "nhwc"
|
||||
input_pixel_format: "bgr"
|
||||
model:
|
||||
path: /path/to/model
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: "nhwc"
|
||||
input_pixel_format: "bgr"
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -215,16 +214,15 @@ If the labelmap is customized then the labels used for alerts will need to be ad
|
||||
The labelmap can be customized to your needs. A common reason to do this is to combine multiple object types that are easily confused when you don't need to be as granular such as car/truck. By default, truck is renamed to car because they are often confused. You cannot add new object types, but you can change the names of existing objects in the model.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
default:
|
||||
labelmap:
|
||||
2: vehicle
|
||||
3: vehicle
|
||||
5: vehicle
|
||||
7: vehicle
|
||||
15: animal
|
||||
16: animal
|
||||
17: animal
|
||||
model:
|
||||
labelmap:
|
||||
2: vehicle
|
||||
3: vehicle
|
||||
5: vehicle
|
||||
7: vehicle
|
||||
15: animal
|
||||
16: animal
|
||||
17: animal
|
||||
```
|
||||
|
||||
Note that if you rename objects in the labelmap, you will also need to update your `objects -> track` list as well.
|
||||
@@ -337,7 +335,7 @@ For example:
|
||||
```
|
||||
services:
|
||||
frigate:
|
||||
image: ghcr.io/blakeblackshear/frigate:stable
|
||||
image: blakeblackshear/frigate:latest
|
||||
environment:
|
||||
- FRIGATE_BASE_PATH=/frigate
|
||||
```
|
||||
|
||||
@@ -272,7 +272,7 @@ If you have CUDA hardware, you can experiment with the `large` `whisper` model o
|
||||
|
||||
#### Transcription and translation of `speech` audio events
|
||||
|
||||
Any `speech` events in Explore can be transcribed and/or translated through the Transcribe button (the microphone icon) in the Tracked Object Details pane.
|
||||
Any `speech` events in Explore can be transcribed and/or translated through the Transcribe button in the Tracked Object Details pane.
|
||||
|
||||
In order to use transcription and translation for past events, you must enable audio detection and define `speech` as an audio type to listen for. To have `speech` events translated into the language of your choice, set the `language` config parameter with the correct [language code](https://github.com/openai/whisper/blob/main/whisper/tokenizer.py#L10).
|
||||
|
||||
@@ -294,7 +294,7 @@ Recorded `speech` events will always use a `whisper` model, regardless of the `m
|
||||
|
||||
Because transcription is **serialized (one event at a time)** and speech events can be generated far faster than they can be processed, an auto-transcribe toggle would very quickly create an ever-growing backlog and degrade core functionality. For the amount of engineering and risk involved, it adds **very little practical value** for the majority of deployments, which are often on low-powered, edge hardware.
|
||||
|
||||
If you hear speech that's actually important and worth saving/indexing for the future, **just press the transcribe button (the microphone icon) in Explore** on that specific `speech` event - that keeps things explicit, reliable, and under your control.
|
||||
If you hear speech that's actually important and worth saving/indexing for the future, **just press the transcribe button in Explore** on that specific `speech` event - that keeps things explicit, reliable, and under your control.
|
||||
|
||||
Other options are being considered for future versions of Frigate to add transcription options that support external `whisper` Docker containers. A single transcription service could then be shared by Frigate and other applications (for example, Home Assistant Voice), and run on more powerful machines when available.
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ Settings are organized into two scopes:
|
||||
- **Global configuration**: values under <NavPath path="Settings > Global configuration" /> apply to every camera by default. This is where you set the baseline behavior for object detection, recording, snapshots, motion, and so on.
|
||||
- **Camera configuration**: values under <NavPath path="Settings > Camera configuration" /> apply to a single camera. Use the camera selector button at the top of these pages to choose which camera you are editing.
|
||||
|
||||
When a camera-level section is left untouched, the camera simply inherits the global values. Changing a value on a camera page **overrides** the global value for that camera only: the global setting and every other camera are unaffected. This mirrors how the YAML works, where a value set under `cameras.<name>` takes precedence over the same value set at the top level. See [Global and Camera-Level Configuration](./config_overrides.md) for the full details, including how lists and maps are handled and which settings must be enabled globally first.
|
||||
When a camera-level section is left untouched, the camera simply inherits the global values. Changing a value on a camera page **overrides** the global value for that camera only: the global setting and every other camera are unaffected. This mirrors how the YAML works, where a value set under `cameras.<name>` takes precedence over the same value set at the top level.
|
||||
|
||||
To undo an override and go back to inheriting from the parent scope, use the reset button at the bottom of the section:
|
||||
|
||||
@@ -130,8 +130,7 @@ go2rtc:
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
api_key: "{FRIGATE_GENAI_API_KEY}"
|
||||
api_key: "{FRIGATE_GENAI_API_KEY}"
|
||||
```
|
||||
|
||||
## Common configuration examples
|
||||
@@ -334,14 +333,13 @@ detectors:
|
||||
type: openvino
|
||||
device: AUTO
|
||||
|
||||
models:
|
||||
default:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
model:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
|
||||
record:
|
||||
enabled: True
|
||||
|
||||
@@ -1,244 +0,0 @@
|
||||
---
|
||||
id: config_overrides
|
||||
title: Global and Camera-Level Configuration
|
||||
---
|
||||
|
||||
import ConfigTabs from "@site/src/components/ConfigTabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import NavPath from "@site/src/components/NavPath";
|
||||
|
||||
Most of Frigate's configuration can be set once for all cameras and then adjusted for individual cameras. The global value acts as the default for every camera, and any camera can override it.
|
||||
|
||||
This page explains how that inheritance works. For a tour of the Settings UI itself, see [Frigate Configuration](./config.md).
|
||||
|
||||
## The basics
|
||||
|
||||
Set a value globally and every camera uses it. Set the same value on a camera and that camera uses its own value instead.
|
||||
|
||||
<ConfigTabs>
|
||||
<TabItem value="ui">
|
||||
|
||||
1. Navigate to <NavPath path="Settings > Global configuration > Object detection" /> and set **Detect FPS** to `5`. Every camera now detects at 5 fps.
|
||||
2. Navigate to <NavPath path="Settings > Camera configuration > Object detection" />, select the `driveway` camera, and set **Detect FPS** to `10`.
|
||||
|
||||
The `driveway` camera now detects at 10 fps. Every other camera still uses the global value of 5.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yaml">
|
||||
|
||||
```yaml
|
||||
detect:
|
||||
fps: 5 # every camera detects at 5 fps
|
||||
|
||||
cameras:
|
||||
front_door:
|
||||
ffmpeg: ...
|
||||
driveway:
|
||||
ffmpeg: ...
|
||||
detect:
|
||||
fps: 10 # except this one
|
||||
```
|
||||
|
||||
`front_door` inherits `fps: 5`, and `driveway` uses `10`.
|
||||
|
||||
</TabItem>
|
||||
</ConfigTabs>
|
||||
|
||||
## Overrides apply per value, not per section
|
||||
|
||||
Overriding one value in a section does not detach the rest of that section. Everything you don't set on the camera still comes from the global configuration.
|
||||
|
||||
<ConfigTabs>
|
||||
<TabItem value="ui">
|
||||
|
||||
If you set a camera's **Motion threshold** but leave **Contour area** alone, only the threshold is overridden. The contour area continues to follow <NavPath path="Settings > Global configuration > Motion detection" />, and changing it there still affects that camera.
|
||||
|
||||
Open a section to see which values are overridden: the section header indicates how many fields differ from the global configuration.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yaml">
|
||||
|
||||
```yaml
|
||||
motion:
|
||||
threshold: 30
|
||||
contour_area: 10
|
||||
|
||||
cameras:
|
||||
driveway:
|
||||
motion:
|
||||
threshold: 40
|
||||
```
|
||||
|
||||
The `driveway` camera ends up with `threshold: 40` and `contour_area: 10`. Only the value you wrote was overridden.
|
||||
|
||||
</TabItem>
|
||||
</ConfigTabs>
|
||||
|
||||
## Returning a camera to the global value
|
||||
|
||||
<ConfigTabs>
|
||||
<TabItem value="ui">
|
||||
|
||||
A camera section that has its own values shows an **Overridden** badge. To remove the override and go back to inheriting, use the **Reset to Global** button at the bottom of the section.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yaml">
|
||||
|
||||
Frigate treats a camera value as an override because it is written in the config file, not because it differs from the global value. Repeating the global value under a camera still creates an override:
|
||||
|
||||
```yaml
|
||||
snapshots:
|
||||
enabled: true
|
||||
|
||||
cameras:
|
||||
driveway:
|
||||
snapshots:
|
||||
enabled: true # this is an override, even though it matches
|
||||
```
|
||||
|
||||
If you later change the global `snapshots.enabled` to `false`, `driveway` keeps saving snapshots, because it has its own value. To make a camera follow the global value again, delete the key from the camera rather than setting it to match.
|
||||
|
||||
</TabItem>
|
||||
</ConfigTabs>
|
||||
|
||||
## Lists replace, maps merge
|
||||
|
||||
This is the distinction that surprises people most.
|
||||
|
||||
**Lists are replaced entirely.** A camera's list does not add to the global list, it takes its place.
|
||||
|
||||
<ConfigTabs>
|
||||
<TabItem value="ui">
|
||||
|
||||
The camera page shows the objects the camera is currently tracking, starting from the global list. Changing that selection under <NavPath path="Settings > Camera configuration > Objects" /> replaces the list for that camera, so make sure every object you want tracked is selected, not just the ones you are adding.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yaml">
|
||||
|
||||
```yaml
|
||||
objects:
|
||||
track:
|
||||
- person
|
||||
- car
|
||||
|
||||
cameras:
|
||||
backyard:
|
||||
objects:
|
||||
track:
|
||||
- dog # backyard tracks ONLY dog, not person or car
|
||||
```
|
||||
|
||||
To track `dog` in addition to the global objects, list all of them on the camera.
|
||||
|
||||
</TabItem>
|
||||
</ConfigTabs>
|
||||
|
||||
An empty list is a valid override, and is the normal way to opt a camera out of something:
|
||||
|
||||
```yaml
|
||||
review:
|
||||
alerts:
|
||||
labels:
|
||||
- person
|
||||
|
||||
cameras:
|
||||
street:
|
||||
review:
|
||||
alerts:
|
||||
labels: [] # this camera never creates alerts
|
||||
```
|
||||
|
||||
**Maps are merged key by key.** A camera can add an entry without redeclaring the others.
|
||||
|
||||
<ConfigTabs>
|
||||
<TabItem value="ui">
|
||||
|
||||
Adding a filter for one object under <NavPath path="Settings > Camera configuration > Objects" /> does not remove the filters inherited from <NavPath path="Settings > Global configuration > Objects" />. The camera keeps both.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yaml">
|
||||
|
||||
```yaml
|
||||
objects:
|
||||
filters:
|
||||
person:
|
||||
min_area: 5000
|
||||
|
||||
cameras:
|
||||
driveway:
|
||||
objects:
|
||||
filters:
|
||||
car:
|
||||
min_area: 10000
|
||||
```
|
||||
|
||||
The `driveway` camera ends up with both the `car` filter it defined and the `person` filter from the global configuration.
|
||||
|
||||
</TabItem>
|
||||
</ConfigTabs>
|
||||
|
||||
## Which settings can be overridden
|
||||
|
||||
Most, but not all. The [full reference config](./advanced/reference.md) is the authoritative source: sections that support camera-level overrides are marked with the comment `# NOTE: Can be overridden at the camera level`. In the UI, a setting can be overridden if it appears under both <NavPath path="Settings > Global configuration" /> and <NavPath path="Settings > Camera configuration" />.
|
||||
|
||||
A few things worth knowing beyond that:
|
||||
|
||||
- Some sections are **global only** and have no camera-level equivalent, including `go2rtc`, `genai` providers, `classification`, `telemetry`, `camera_groups`, and `ui`.
|
||||
- Some sections exist **only at the camera level**, such as `zones` and `onvif`.
|
||||
- Some sections are **partially overridable**, meaning a camera accepts only a few of the keys available globally. `face_recognition`, `lpr`, and `audio_transcription` work this way, and the reference config notes which keys apply.
|
||||
|
||||
## Enrichments that must be enabled globally first
|
||||
|
||||
License plate recognition and face recognition are special: the global setting is not just a default, it is a switch that must be on before any camera can use the feature. Enabling one on a camera while it is disabled globally is a configuration error, and Frigate will refuse to start:
|
||||
|
||||
```
|
||||
Camera driveway has lpr enabled but lpr is disabled at the global level of the config. You must enable lpr at the global level.
|
||||
```
|
||||
|
||||
Enable the feature globally, then turn it off on the cameras that don't need it.
|
||||
|
||||
<ConfigTabs>
|
||||
<TabItem value="ui">
|
||||
|
||||
1. Navigate to <NavPath path="Settings > Global configuration > License plate recognition" /> and enable **LPR**.
|
||||
2. Navigate to <NavPath path="Settings > Camera configuration > License plate recognition" />, select each camera that should not run LPR, and disable the **Enable LPR** toggle.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yaml">
|
||||
|
||||
```yaml
|
||||
lpr:
|
||||
enabled: true
|
||||
|
||||
cameras:
|
||||
driveway:
|
||||
ffmpeg: ... # inherits lpr, enabled
|
||||
backyard:
|
||||
ffmpeg: ...
|
||||
lpr:
|
||||
enabled: false # opted out
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</ConfigTabs>
|
||||
|
||||
:::note
|
||||
|
||||
This applies only to `lpr` and `face_recognition`, because the global setting controls whether the supporting background process starts at all. Other features do not work this way. Audio transcription, for example, can be enabled on a single camera without being enabled globally.
|
||||
|
||||
:::
|
||||
|
||||
## Profiles
|
||||
|
||||
[Profiles](./profiles.md) add a further layer on top of everything described above. A profile is a named set of camera overrides that you can switch on and off while Frigate is running, for example to change detection and recording behavior when you leave the house.
|
||||
|
||||
Profiles are applied on top of a camera's already-resolved configuration, so a profile value wins over both the camera and the global value while that profile is active. Profiles cover a subset of the camera sections and do not modify your config file.
|
||||
|
||||
## Summary
|
||||
|
||||
- A camera inherits every value you don't set on it.
|
||||
- Overriding one value does not detach the rest of the section.
|
||||
- Writing a value on a camera overrides it, even if it matches the global value. Remove it to inherit again.
|
||||
- Lists replace the global list. Maps merge into it.
|
||||
- An empty list is an override, not an omission.
|
||||
- `lpr` and `face_recognition` must be enabled globally before a camera can use them.
|
||||
@@ -73,13 +73,9 @@ classification:
|
||||
interval: 10 # also run every N seconds (optional)
|
||||
cameras:
|
||||
front:
|
||||
# [x1, y1, x2, y2] as decimals between 0 and 1, relative to the
|
||||
# camera's detect resolution
|
||||
crop: [0.0, 0.25, 0.3, 0.85]
|
||||
crop: [0, 180, 220, 400]
|
||||
```
|
||||
|
||||
Crop coordinates are normalized: each value is a fraction of the camera's `detect` width or height, not a pixel value. Drawing the crop in the UI wizard writes these values for you.
|
||||
|
||||
An optional config, `save_attempts`, can be set as a key under the model name. This defines the number of classification attempts to save in the Recent Classifications tab. For state classification models, the default is 100.
|
||||
|
||||
</TabItem>
|
||||
|
||||
@@ -232,21 +232,7 @@ Once front-facing images are performing well, start choosing slightly off-angle
|
||||
|
||||
Start with the [Usage](#usage) section and re-read the [Model Requirements](#model-requirements) above.
|
||||
|
||||
1. Enable debug logs to see exactly what Frigate is doing.
|
||||
- Enable debug logs for face recognition by adding `frigate.data_processing.real_time.face: debug` to your `logger` configuration. Restart Frigate after this change.
|
||||
|
||||
```yaml
|
||||
logger:
|
||||
default: info
|
||||
logs:
|
||||
# highlight-next-line
|
||||
frigate.data_processing.real_time.face: debug
|
||||
```
|
||||
|
||||
- These logs report where the pipeline stopped for each `person` object, such as no face being found within the person's bounding box, the detected face being smaller than `min_area`, or a face being recognized but scoring too low.
|
||||
- If you see no face-related messages at all, also add `frigate.embeddings.maintainer: debug` to confirm that the face processor was created at startup and that `person` updates are reaching it.
|
||||
|
||||
2. Ensure `person` is being _detected_. A `person` will automatically be scanned by Frigate for a face. Any detected faces will appear in the Recent Recognitions tab in the Frigate UI's Face Library.
|
||||
1. Ensure `person` is being _detected_. A `person` will automatically be scanned by Frigate for a face. Any detected faces will appear in the Recent Recognitions tab in the Frigate UI's Face Library.
|
||||
|
||||
If you are using a Frigate+ or `face` detecting model:
|
||||
- Watch the [debug view](/usage/live#the-single-camera-view) to ensure that `face` is being detected along with `person`.
|
||||
@@ -256,7 +242,7 @@ Start with the [Usage](#usage) section and re-read the [Model Requirements](#mod
|
||||
- Check your `detect` stream resolution and ensure it is sufficiently high enough to capture face details on `person` objects.
|
||||
- You may need to lower your `detection_threshold` if faces are not being detected.
|
||||
|
||||
3. Any detected faces will then be _recognized_.
|
||||
2. Any detected faces will then be _recognized_.
|
||||
- Make sure you have trained at least one face per the recommendations above.
|
||||
- Adjust `recognition_threshold` settings per the suggestions [above](#advanced-configuration).
|
||||
|
||||
|
||||
@@ -9,27 +9,9 @@ import NavPath from "@site/src/components/NavPath";
|
||||
|
||||
## Configuration
|
||||
|
||||
A Generative AI provider can be configured in the global config, which will make the Generative AI features available for use. There are currently 5 native providers available to integrate with Frigate. Other providers that support the OpenAI standard API can also be used. See the OpenAI-Compatible section below.
|
||||
A Generative AI provider can be configured in the global config, which will make the Generative AI features available for use. There are currently 4 native providers available to integrate with Frigate. Other providers that support the OpenAI standard API can also be used. See the OpenAI-Compatible section below.
|
||||
|
||||
`genai` is a map of named providers. Each key under `genai` is a name you choose, and its value is that provider's settings:
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider: # any name you like
|
||||
provider: ollama
|
||||
base_url: http://localhost:11434
|
||||
model: qwen3-vl:4b
|
||||
roles:
|
||||
- descriptions
|
||||
- embeddings
|
||||
- chat
|
||||
```
|
||||
|
||||
The examples on this page all use `my_provider`, but the name is arbitrary and is only used to reference the provider elsewhere in the config (for example, `semantic_search.model`).
|
||||
|
||||
Each provider handles one or more **roles**: `chat`, `descriptions`, and `embeddings`. A provider handles all three by default, and each role may be assigned to exactly one provider. Define a single provider if you want it to do everything, or split the roles across several providers using the `roles` option.
|
||||
|
||||
If the provider you choose requires an API key, you may either directly paste it in your configuration, or store it in an environment variable prefixed with `FRIGATE_`.
|
||||
To use Generative AI, you must define a single provider at the global level of your Frigate configuration. If the provider you choose requires an API key, you may either directly paste it in your configuration, or store it in an environment variable prefixed with `FRIGATE_`.
|
||||
|
||||
## Local Providers
|
||||
|
||||
@@ -96,26 +78,23 @@ All llama.cpp native options can be passed through `provider_options`, including
|
||||
- Set **Provider** to `llamacpp`
|
||||
- Set **Base URL** to your llama.cpp server address (e.g., `http://localhost:8080`)
|
||||
- Set **Model** to the name of your model
|
||||
- Optionally, under **Provider Options**, set `context_size` to override the context size Frigate detects from the server
|
||||
- Under **Provider Options**, set `context_size` to tell Frigate your context size so it can send the appropriate amount of information
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yaml">
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
provider: llamacpp
|
||||
base_url: http://localhost:8080
|
||||
model: your-model-name
|
||||
provider_options:
|
||||
context_size: 16000 # Optional, overrides the context size reported by the server.
|
||||
provider: llamacpp
|
||||
base_url: http://localhost:8080
|
||||
model: your-model-name
|
||||
provider_options:
|
||||
context_size: 16000 # Tell Frigate your context size so it can send the appropriate amount of information.
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</ConfigTabs>
|
||||
|
||||
Frigate queries the llama.cpp server for the model's context size at startup and logs it along with the other detected capabilities. If `context_size` is set in `provider_options`, that value is always used instead, even when the server reports its own.
|
||||
|
||||
### Ollama
|
||||
|
||||
[Ollama](https://ollama.com/) allows you to self-host large language models and keep everything running locally. It is highly recommended to host this server on a machine with an Nvidia graphics card, or on a Apple silicon Mac for best performance.
|
||||
@@ -148,14 +127,13 @@ Note that Frigate will not automatically download the model you specify in your
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
provider: ollama
|
||||
base_url: http://localhost:11434
|
||||
model: qwen3-vl:4b
|
||||
provider_options: # other Ollama client options can be defined
|
||||
keep_alive: -1
|
||||
options:
|
||||
num_ctx: 8192 # make sure the context matches other services that are using ollama
|
||||
provider: ollama
|
||||
base_url: http://localhost:11434
|
||||
model: qwen3-vl:4b
|
||||
provider_options: # other Ollama client options can be defined
|
||||
keep_alive: -1
|
||||
options:
|
||||
num_ctx: 8192 # make sure the context matches other services that are using ollama
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -171,12 +149,11 @@ For OpenAI-compatible servers (such as llama.cpp) that don't expose the configur
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
provider: openai
|
||||
base_url: http://your-llama-server
|
||||
model: your-model-name
|
||||
provider_options:
|
||||
context_size: 8192 # Specify the configured context size
|
||||
provider: openai
|
||||
base_url: http://your-llama-server
|
||||
model: your-model-name
|
||||
provider_options:
|
||||
context_size: 8192 # Specify the configured context size
|
||||
```
|
||||
|
||||
This ensures Frigate uses the correct context window size when generating prompts.
|
||||
@@ -199,11 +176,10 @@ This ensures Frigate uses the correct context window size when generating prompt
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
provider: openai
|
||||
base_url: http://your-server:port
|
||||
api_key: your-api-key # May not be required for local servers
|
||||
model: your-model-name
|
||||
provider: openai
|
||||
base_url: http://your-server:port
|
||||
api_key: your-api-key # May not be required for local servers
|
||||
model: your-model-name
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -241,21 +217,19 @@ Ollama also supports [cloud models](https://ollama.com/cloud), where model infer
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
provider: ollama
|
||||
base_url: http://localhost:11434
|
||||
model: cloud-model-name
|
||||
provider: ollama
|
||||
base_url: http://localhost:11434
|
||||
model: cloud-model-name
|
||||
```
|
||||
|
||||
or when using Ollama Cloud directly
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
provider: ollama
|
||||
base_url: https://ollama.com
|
||||
model: cloud-model-name
|
||||
api_key: your-api-key
|
||||
provider: ollama
|
||||
base_url: https://ollama.com
|
||||
model: cloud-model-name
|
||||
api_key: your-api-key
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -293,10 +267,9 @@ To start using Gemini, you must first get an API key from [Google AI Studio](htt
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
provider: gemini
|
||||
api_key: "{FRIGATE_GEMINI_API_KEY}"
|
||||
model: gemini-2.5-flash
|
||||
provider: gemini
|
||||
api_key: "{FRIGATE_GEMINI_API_KEY}"
|
||||
model: gemini-2.5-flash
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -306,13 +279,12 @@ genai:
|
||||
|
||||
To use a different Gemini-compatible API endpoint, set the `provider_options` with the `base_url` key to your provider's API URL. For example:
|
||||
|
||||
```yaml {5,6}
|
||||
```yaml {4,5}
|
||||
genai:
|
||||
my_provider:
|
||||
provider: gemini
|
||||
...
|
||||
provider_options:
|
||||
base_url: https://...
|
||||
provider: gemini
|
||||
...
|
||||
provider_options:
|
||||
base_url: https://...
|
||||
```
|
||||
|
||||
Other HTTP options are available, see the [python-genai documentation](https://github.com/googleapis/python-genai).
|
||||
@@ -346,10 +318,9 @@ To start using OpenAI, you must first [create an API key](https://platform.opena
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
provider: openai
|
||||
api_key: "{FRIGATE_OPENAI_API_KEY}"
|
||||
model: gpt-4o
|
||||
provider: openai
|
||||
api_key: "{FRIGATE_OPENAI_API_KEY}"
|
||||
model: gpt-4o
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -365,14 +336,13 @@ To use a different OpenAI-compatible API endpoint, set the `OPENAI_BASE_URL` env
|
||||
|
||||
For OpenAI-compatible servers (such as llama.cpp) that don't expose the configured context size in the API response, you can manually specify the context size in `provider_options`:
|
||||
|
||||
```yaml {6,7}
|
||||
```yaml {5,6}
|
||||
genai:
|
||||
my_provider:
|
||||
provider: openai
|
||||
base_url: http://your-llama-server
|
||||
model: your-model-name
|
||||
provider_options:
|
||||
context_size: 8192 # Specify the configured context size
|
||||
provider: openai
|
||||
base_url: http://your-llama-server
|
||||
model: your-model-name
|
||||
provider_options:
|
||||
context_size: 8192 # Specify the configured context size
|
||||
```
|
||||
|
||||
This ensures Frigate uses the correct context window size when generating prompts.
|
||||
@@ -407,11 +377,10 @@ To start using Azure OpenAI, you must first [create a resource](https://learn.mi
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
provider: azure_openai
|
||||
base_url: https://instance.cognitiveservices.azure.com/openai/responses?api-version=2025-04-01-preview
|
||||
model: gpt-5-mini
|
||||
api_key: "{FRIGATE_OPENAI_API_KEY}"
|
||||
provider: azure_openai
|
||||
base_url: https://instance.cognitiveservices.azure.com/openai/responses?api-version=2025-04-01-preview
|
||||
model: gpt-5-mini
|
||||
api_key: "{FRIGATE_OPENAI_API_KEY}"
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
@@ -52,10 +52,9 @@ You can define custom prompts at the global level and per-object type. To config
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider:
|
||||
provider: ollama
|
||||
base_url: http://localhost:11434
|
||||
model: qwen3-vl:8b-instruct
|
||||
provider: ollama
|
||||
base_url: http://localhost:11434
|
||||
model: qwen3-vl:8b-instruct
|
||||
|
||||
objects:
|
||||
genai:
|
||||
|
||||
@@ -196,7 +196,7 @@ services:
|
||||
|
||||
:::
|
||||
|
||||
See [go2rtc WebRTC docs](https://github.com/AlexxIT/go2rtc/tree/v1.9.14#module-webrtc) for more information about this.
|
||||
See [go2rtc WebRTC docs](https://github.com/AlexxIT/go2rtc/tree/v1.8.3#module-webrtc) for more information about this.
|
||||
|
||||
### Two way talk
|
||||
|
||||
|
||||
@@ -91,41 +91,6 @@ The best detection accuracy comes from a model trained on images that look like
|
||||
|
||||
:::
|
||||
|
||||
### Running multiple models
|
||||
|
||||
Models are defined as named entries under `models`, and each camera selects the model it uses with `detect.model`. This makes it possible to run different models for different groups of cameras, for example a dedicated model for indoor cameras, outdoor cameras, or thermal cameras.
|
||||
|
||||
```yaml
|
||||
detectors:
|
||||
ov:
|
||||
type: openvino
|
||||
device: GPU
|
||||
|
||||
models:
|
||||
indoor:
|
||||
path: /config/model_cache/indoor-model.xml
|
||||
model_type: yolo-generic
|
||||
width: 320
|
||||
height: 320
|
||||
outdoor:
|
||||
path: plus://<your_model_id>
|
||||
|
||||
cameras:
|
||||
living_room:
|
||||
detect:
|
||||
model: indoor
|
||||
driveway:
|
||||
detect:
|
||||
model: outdoor
|
||||
```
|
||||
|
||||
When only one model is defined, all cameras use it automatically. With multiple models, cameras use the model named `default` unless `detect.model` selects another one; `detect.model` can also be set globally and overridden per camera.
|
||||
|
||||
How detectors handle multiple models depends on the hardware:
|
||||
|
||||
- **Detectors that support multiple models** (`openvino`, `onnx`, `tensorrt`, `cpu`, `rknn`): a single detector entry is automatically expanded into one instance per model in use. For example, detector `ov` with models `indoor` and `outdoor` runs as `ov_indoor` and `ov_outdoor`, and each instance appears separately in the System Metrics page. Keep in mind that each instance loads its own copy of the model, which increases GPU memory usage.
|
||||
- **Detectors that only support a single model** (`edgetpu`, `hailo8l`, `memryx`, and other single-session hardware): each detector entry serves exactly one model. Detector entries are assigned to models round robin, so running two models on Coral hardware requires two Corals. If these are the only detectors configured and there are fewer of them than models in use, Frigate will fail to start with an error explaining the options.
|
||||
|
||||
# Officially Supported Detectors
|
||||
|
||||
Frigate provides a number of builtin detector types. By default, Frigate will use a single CPU detector. Other detectors may require additional configuration as described below. When using multiple detectors they will run in dedicated processes, but pull from a common queue of detection requests from across all cameras.
|
||||
@@ -824,12 +789,11 @@ You can set it to:
|
||||
- A path to some model.json.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
default:
|
||||
path: ./mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1 # directory to model .json and file
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
model:
|
||||
path: ./mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1 # directory to model .json and file
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
```
|
||||
|
||||
#### Local Inference
|
||||
@@ -845,12 +809,11 @@ It is also possible to eliminate the need for an AI server and run the hardware
|
||||
Once `degirum_detector` is setup, you can choose a model through 'model' section in the `config.yml` file.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
default:
|
||||
path: mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
model:
|
||||
path: mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
```
|
||||
|
||||
#### AI Hub Cloud Inference
|
||||
@@ -866,12 +829,11 @@ If you do not possess whatever hardware you want to run, there's also the option
|
||||
Once `degirum_detector` is setup, you can choose a model through 'model' section in the `config.yml` file.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
default:
|
||||
path: mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
model:
|
||||
path: mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
```
|
||||
|
||||
## AXERA
|
||||
|
||||
@@ -163,8 +163,8 @@ genai:
|
||||
model: your-model-name
|
||||
roles:
|
||||
- embeddings
|
||||
- descriptions
|
||||
- chat
|
||||
- vision
|
||||
- tools
|
||||
|
||||
semantic_search:
|
||||
enabled: True
|
||||
|
||||
@@ -228,14 +228,13 @@ detectors: # <---- add detectors
|
||||
device: GPU
|
||||
|
||||
# We will use the default MobileNet_v2 model from OpenVINO.
|
||||
models:
|
||||
default:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
model:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
|
||||
cameras:
|
||||
name_of_your_camera:
|
||||
|
||||
@@ -281,7 +281,7 @@ For advanced usecases, this behavior can be changed with the [RTSP URL
|
||||
template](#options) option. When set, this string will override the default stream
|
||||
address that is derived from the default behavior described above. This option supports
|
||||
[jinja2 templates](https://jinja.palletsprojects.com/) and has the `camera` dict
|
||||
variables from [Frigate API](/integrations/api/frigate-http-api)
|
||||
variables from [Frigate API](../integrations/api)
|
||||
available for the template. Note that no Home Assistant state is available to the
|
||||
template, only the camera dict from Frigate.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ MQTT requires a network connection to your broker. This is typically local, but
|
||||
### `frigate/available`
|
||||
|
||||
Designed to be used as an availability topic with Home Assistant. Possible message are:
|
||||
"online": published once Frigate is running and has published its initial state. Note that this is published on every connection to the broker, so it is republished if the broker restarts or the connection drops and recovers, without Frigate itself restarting.
|
||||
"online": published when Frigate is running (on startup)
|
||||
"stopped": published when Frigate is stopped normally
|
||||
"offline": published automatically by the MQTT broker if Frigate disconnects unexpectedly (via MQTT Will Message)
|
||||
|
||||
|
||||
@@ -64,9 +64,8 @@ You can either choose the new model from the <NavPath path="Settings > System >
|
||||
```yaml
|
||||
detectors: ...
|
||||
|
||||
models:
|
||||
default:
|
||||
path: plus://<your_model_id>
|
||||
model:
|
||||
path: plus://<your_model_id>
|
||||
```
|
||||
|
||||
:::note
|
||||
@@ -80,11 +79,10 @@ Models are downloaded into the `/config/model_cache` folder and only downloaded
|
||||
If needed, you can override the labelmap for Frigate+ models. This is not recommended as renaming labels will break the Submit to Frigate+ feature if the labels are not available in Frigate+.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
default:
|
||||
path: plus://<your_model_id>
|
||||
labelmap:
|
||||
3: animal
|
||||
4: animal
|
||||
5: animal
|
||||
model:
|
||||
path: plus://<your_model_id>
|
||||
labelmap:
|
||||
3: animal
|
||||
4: animal
|
||||
5: animal
|
||||
```
|
||||
|
||||
@@ -38,9 +38,8 @@ Navigate to <NavPath path="Settings > System > Detectors and model" />. In the *
|
||||
```yaml
|
||||
detectors: ...
|
||||
|
||||
models:
|
||||
default:
|
||||
path: plus://<your_model_id>
|
||||
model:
|
||||
path: plus://<your_model_id>
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
@@ -1,234 +0,0 @@
|
||||
---
|
||||
id: common_errors
|
||||
title: Common Error Messages
|
||||
---
|
||||
|
||||
import FaqItem from "@site/src/components/FaqItem";
|
||||
|
||||
This page is an index of error messages you might see in Frigate's logs, what each one means, and where to go next. It is organized by the kind of problem, not by which component logged the message.
|
||||
|
||||
Two things to know before you start:
|
||||
|
||||
- **Many of these messages come from FFmpeg, go2rtc, GPU drivers, or the operating system, not from Frigate itself.** Frigate captures and re-logs their output, so the log level shown in the Frigate UI does not always reflect the original severity.
|
||||
- **Wrapped errors put the real cause on the next line.** When Frigate logs a generic message like `Error occurred when attempting to maintain recording cache`, the actual exception is logged immediately after it. When a camera's FFmpeg process exits, Frigate logs `The following ffmpeg logs include the last 100 lines prior to exit` and dumps that camera's FFmpeg output. Always read those lines, they are where the answer usually is.
|
||||
|
||||
## Camera connection and streams
|
||||
|
||||
<FaqItem id="connection-refused-no-route-to-host-401-404" question="Connection refused / No route to host / 401 Unauthorized / 404 Not Found">
|
||||
|
||||
These are FFmpeg errors about reaching the camera (or the go2rtc restream). `Connection refused` and `No route to host` mean nothing is listening at that address or the host is unreachable; `401 Unauthorized` is wrong credentials; `404 Not Found` is a wrong stream path (or a `restream` input pointing at a go2rtc stream name that does not exist). A camera that has hit its concurrent-connection limit can also return `refused` or `401` on a URL that works in VLC.
|
||||
|
||||
See [go2rtc troubleshooting](/troubleshooting/go2rtc#1-read-the-go2rtc-logs) for how to isolate the stream.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="no-frames-received-in-20-seconds" question="No frames received from <camera> in 20 seconds. Exiting ffmpeg...">
|
||||
|
||||
FFmpeg is running but has stopped delivering video for 20 seconds, so Frigate's camera watchdog restarts it. The stream connected at least once, then went quiet: a camera reboot, a network drop, the camera evicting the connection, or a stalled decoder. If it repeats on a loop, the stream is unstable.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="ffmpeg-process-crashed-unexpectedly" question="Ffmpeg process crashed unexpectedly for <camera>">
|
||||
|
||||
The detect FFmpeg process exited on its own. This message is only the notification; the cause is in the 100 FFmpeg log lines Frigate dumps right after it (look for a `Failed to sync surface`, `Connection refused`, codec, or audio error in that block). Related watchdog messages include `<camera> exceeded fps limit`, which means the camera is delivering frames faster than `detect.fps` (usually a camera whose real frame rate differs from what is configured).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="non-monotonically-increasing-dts" question="Application provided invalid, non monotonically increasing dts to muxer">
|
||||
|
||||
An FFmpeg message meaning the camera sent packets with out-of-order timestamps. Because recordings are copied without re-encoding, FFmpeg cannot fix them, and the segment muxer often splits early, producing one-second segments and a cache backlog. The usual cause is a camera "Smart Codec" / H.264+ / H.265+ mode or a camera clock that jumps.
|
||||
|
||||
See [Recordings: segments are only 1 second long](/troubleshooting/recordings#segments-are-only-1-second-long).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="bad-cseq" question="RTP: PT=xx: bad cseq (packet loss / reordering)">
|
||||
|
||||
An FFmpeg message meaning RTP packets arrived out of sequence, which almost always means the stream is using UDP transport. Frigate's RTSP presets force TCP, so seeing this points at a custom `input_args`, `preset-rtsp-udp`, or a go2rtc source that is not using TCP. Switch to TCP unless your camera is [UDP-only](/configuration/camera_specific#udp-only-cameras).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="error-while-decoding-mb-non-existing-pps" question="error while decoding MB / non-existing PPS referenced (corrupt frames)">
|
||||
|
||||
FFmpeg decoder messages meaning the received video bitstream was incomplete or damaged. A few of these at every stream start are normal (the decoder connected before the first keyframe) and Frigate discards them. A continuous stream of them means real packet loss, from Wi-Fi or a saturated link, an overloaded camera, or an FFmpeg restart loop caused by another problem. Fix the underlying instability rather than the message.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="could-not-find-codec-parameters" question="Could not find codec parameters for stream ... unspecified size">
|
||||
|
||||
An FFmpeg message meaning it probed the stream but never saw enough decodable video to determine the frame size, often because the probe window ended before the first keyframe on a long-GOP stream, or because the stream is not delivering usable video. If it is a Reolink HTTP stream, use `preset-http-reolink`, which raises the probe size for exactly this case.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
## Recording
|
||||
|
||||
<FaqItem id="no-new-recording-segments" question="No new recording segments were created for <camera> in the last 120s">
|
||||
|
||||
Frigate's record watchdog is restarting the record FFmpeg process because no valid segment has reached the cache. This means the record stream is not connecting or the segments are being rejected (see the audio-codec entry below).
|
||||
|
||||
See [Recordings: the record stream isn't connecting](/troubleshooting/recordings#the-record-stream-isnt-connecting).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="invalid-or-missing-video-stream-in-segment" question="Invalid or missing video stream in segment. Discarding.">
|
||||
|
||||
A cached recording segment failed validation (no readable video stream) and was deleted. The most common cause is a segment that was truncated because the record FFmpeg process was killed mid-write, so this often appears alongside, and as a consequence of, the record-stream restarts above. A segment containing only audio triggers it too.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="incompatible-audio-codec" question="Recordings silently fail to save (incompatible audio codec)">
|
||||
|
||||
Some camera audio codecs (G.711 variants such as `pcm_alaw` and `pcm_mulaw`) cannot be stored in an MP4 container, so segments never finalize even though live view works.
|
||||
|
||||
See [Recordings: incompatible audio codec](/troubleshooting/recordings#incompatible-audio-codec-recordings-silently-fail-to-save) for the FFmpeg preset that transcodes the audio to AAC.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="error-maintaining-recording-cache" question="Error occurred when attempting to maintain recording cache">
|
||||
|
||||
A generic wrapper; the real exception is on the next log line. Frequently it is `[Errno 28] No space left on device` or `[Errno 17] File exists` on a network share.
|
||||
|
||||
See [Recordings cache warnings and errors](/troubleshooting/recordings#i-see-the-message-error--error-occurred-when-attempting-to-maintain-recording-cache), which covers this message and the common `Errno` cases.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
## Hardware acceleration
|
||||
|
||||
<FaqItem id="failed-to-sync-surface" question="Failed to sync surface / Failed to download frame: -5 / Error while filtering">
|
||||
|
||||
A VAAPI/QSV hardware frame-sync failure between FFmpeg and the GPU driver, not a Frigate bug. It usually appears when the detect stream is being scaled or decoded on the GPU.
|
||||
|
||||
See [GPU: Failed to download frame: -5](/troubleshooting/gpu#failed-to-download-frame--5), which lists the fixes in order (switch VAAPI/QSV preset, change `LIBVA_DRIVER_NAME`, use an H.264 substream, match detect resolution and fps to the stream).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="no-decoder-surfaces-left" question="No decoder surfaces left / Can't allocate a surface">
|
||||
|
||||
Both mean the GPU ran out of decode surfaces: `No decoder surfaces left` is NVIDIA NVDEC, `Can't allocate a surface` is Intel QSV. This is surface-pool exhaustion, typically from too many concurrent hardware-decoded cameras on one GPU (consumer NVIDIA cards have a driver-enforced limit on simultaneous decode sessions). Reduce the number of cameras decoding on that GPU, decode some on the CPU, or move to hardware without the session cap.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="nvidia-container-cli-nvml-error" question="nvidia-container-cli: nvml error: driver not loaded">
|
||||
|
||||
This comes from the NVIDIA container runtime while starting the container, not from Frigate, and the container never starts. The NVIDIA driver is not loaded on the host. Confirm `nvidia-smi` works on the host itself (not inside the container) before troubleshooting Frigate. In a VM or LXC, the driver must be available inside the guest. See [Hardware: Nvidia GPU](/configuration/hardware_acceleration_video).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
## Detectors and models
|
||||
|
||||
<FaqItem id="illegal-instruction" question="Illegal instruction (core dumped)">
|
||||
|
||||
The process was killed by the CPU for executing an unsupported instruction. There are two distinct causes in Frigate:
|
||||
|
||||
- **A Coral EdgeTPU** on a newer kernel with an outdated gasket driver. See [EdgeTPU: Illegal instruction](/troubleshooting/edgetpu#attempting-to-load-tpu-as-pci--fatal-python-error-illegal-instruction).
|
||||
- **A CPU without AVX/AVX2**, when enabling semantic search, face recognition, license plate recognition, classification, or audio transcription. These features use libraries compiled with AVX and crash immediately on CPUs that lack it (commonly Intel Celeron/Pentium before the 2020 Tiger Lake generation). See the [CPU requirements](/frigate/planning_setup#cpu).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="onnx-invalidprotobuf" question="ONNX Runtime InvalidProtobuf / failed to load model">
|
||||
|
||||
ONNX Runtime could not parse the model file. The file exists but its contents are not a valid ONNX model, usually a corrupted or interrupted download in `model_cache`, or the wrong file pointed at by `model.path`. Delete the cached model file so Frigate re-downloads it, and confirm `model.path` points at an actual `.onnx` model. See [ONNX detector configuration](/configuration/object_detectors#onnx).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="cuda-failure-999-901" question="CUDA failure 999 / CUDA failure 901">
|
||||
|
||||
ONNX Runtime CUDA errors. `999` (`cudaErrorUnknown`) is a general, unrecoverable CUDA context failure, usually a driver/runtime version mismatch between the host and the container or a GPU in a bad state. `901` is a CUDA-graph capture error, which points at a custom model whose operations are not capture-safe. For `999`, align the host driver with the container's CUDA version and confirm the GPU is healthy.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="openvino-no-supported-devices" question="Can't get OPTIMIZATION_CAPABILITIES property as no supported devices found">
|
||||
|
||||
OpenVINO could not find the configured device (usually `GPU` or `NPU`). Most often the `/dev/dri` render node is not passed into the container, or the wrong render node is mapped when an iGPU and a discrete GPU coexist.
|
||||
|
||||
See [GPU: no supported devices found](/troubleshooting/gpu#cant-get-optimization_capabilities-property-as-no-supported-devices-found).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
## Memory and storage
|
||||
|
||||
<FaqItem id="fatal-python-error-bus-error" question="Fatal Python error: Bus error">
|
||||
|
||||
Frigate ran out of shared memory (`/dev/shm`). The container's `shm_size` is too small for the number and resolution of your detect streams, or you added cameras after startup without increasing it.
|
||||
|
||||
See [Calculating required shm-size](/frigate/installation#calculating-required-shm-size). If you cannot increase `shm_size`, lowering the `SHM_MAX_FRAMES` environment variable reduces how many frames Frigate buffers per camera.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="errno-28-no-space-left" question="[Errno 28] No space left on device">
|
||||
|
||||
A filesystem is full: the recordings volume (`/media/frigate`), the cache tmpfs (`/tmp/cache`), or `/dev/shm`. Check which one, and note that inode exhaustion can produce this while `df -h` still shows free space.
|
||||
|
||||
See [Recordings: No space left on device](/troubleshooting/recordings#i-see-the-message-error--error-occurred-when-attempting-to-maintain-recording-cache).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="container-exits-with-no-logs" question="The container exits or restarts with no error in the logs">
|
||||
|
||||
A silent exit is usually the host or container out-of-memory killer. Because `/dev/shm` and `/tmp/cache` are memory-backed, they count against the container's memory limit, so aggressive shm or cache sizing can trigger it. Give the container more memory, or reduce shm/cache sizing, and check the host's OOM messages (`dmesg`).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
## Database
|
||||
|
||||
<FaqItem id="database-is-locked" question="database is locked">
|
||||
|
||||
SQLite could not acquire the write lock. Frigate's timeout already scales with camera count, so under normal local-disk operation this essentially only happens when the database is on a network share (SMB/NFS), where file locking is unreliable, or when two instances point at the same file.
|
||||
|
||||
See [Database is locked](/troubleshooting/faqs#error-database-is-locked).
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="database-disk-image-is-malformed" question="database disk image is malformed">
|
||||
|
||||
The SQLite database file is corrupted, typically after hard power loss, a network-share database, or a filesystem with unsafe write semantics. Frigate does not repair it automatically, but the database can usually be recovered by hand.
|
||||
|
||||
**Stop Frigate first**, then work on the database file directly (by default `/config/frigate.db`). Start by checking what is actually wrong:
|
||||
|
||||
```bash
|
||||
sqlite3 frigate.db "PRAGMA integrity_check;"
|
||||
```
|
||||
|
||||
If the only problems reported are index-related (lines such as `row 14 missing from index recordings_path` or `non-unique entry in index ...`), rebuilding the indexes is usually enough and is the least destructive fix:
|
||||
|
||||
```bash
|
||||
sqlite3 frigate.db "REINDEX;"
|
||||
```
|
||||
|
||||
If the integrity check reports page or byte-level corruption instead (for example `Multiple uses for byte 2706 of page 142272`), dump the readable contents into a new database:
|
||||
|
||||
```bash
|
||||
# dump what can still be read
|
||||
sqlite3 frigate.db .dump > frigate.dump
|
||||
|
||||
# keep the corrupt file, then rebuild from the dump
|
||||
mv frigate.db frigate.db.bak
|
||||
cat frigate.dump | sqlite3 frigate.db
|
||||
|
||||
# confirm the rebuilt database is clean, this should print "ok"
|
||||
sqlite3 frigate.db "PRAGMA integrity_check;"
|
||||
```
|
||||
|
||||
Rows stored in the corrupted pages cannot be recovered, so expect to lose some tracked objects, review items, or thumbnails. Recordings themselves are files on disk and are not affected.
|
||||
|
||||
As a last resort, stop Frigate, delete `frigate.db`, and restart. Frigate recreates it, but existing recordings lose all of their metadata. If a `backup.db` exists next to your database, Frigate wrote it before the last schema migration and restoring it recovers everything up to that point.
|
||||
|
||||
Repeat corruption usually points at the underlying storage: move the database off a network share, and on Raspberry Pi check power delivery and the SD card or SSD.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
## Startup and web access
|
||||
|
||||
<FaqItem id="unable-to-start-frigate-in-safe-mode" question="Unable to start Frigate in safe mode / Starting Frigate in safe mode">
|
||||
|
||||
When your config fails validation at startup, Frigate prints the validation errors (with line numbers), then starts in **safe mode**: a minimal configuration with no cameras and MQTT disabled, so the UI stays reachable. In safe mode the only available page is the Config Editor, which shows the validation errors so you can fix them, then save and restart. Note that recording retention and storage cleanup do **not** run while in safe mode, so do not leave a low-disk system sitting in it.
|
||||
|
||||
`Unable to start Frigate in safe mode` means even the minimal config failed, which points at an error in your `auth`, `proxy`, or `database` section, or a config file that is not valid YAML at all. Safe mode is not sticky; fix the config and restart and Frigate returns to normal.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="502-bad-gateway" question="502 Bad Gateway / connection refused to 127.0.0.1:5001">
|
||||
|
||||
The web server is up but the Frigate backend (port 5001) is not answering yet. By far the most common reason is that the page was loaded during startup: the API binds last, after database migrations (which can take minutes on a large database), model downloads, and process startup, while the web server is already serving. Wait for startup to finish. If it persists, the backend has failed to start, and the reason is earlier in the logs. This also explains a `connection refused to 127.0.0.1:5001` seen while loading `/ws`, because every authenticated request first makes an auth subrequest to that port.
|
||||
|
||||
</FaqItem>
|
||||
@@ -30,7 +30,6 @@ const sidebars: SidebarsConfig = {
|
||||
],
|
||||
Configuration: [
|
||||
"configuration/config",
|
||||
"configuration/config_overrides",
|
||||
{
|
||||
type: "category",
|
||||
label: "Detectors",
|
||||
@@ -166,7 +165,6 @@ const sidebars: SidebarsConfig = {
|
||||
],
|
||||
Troubleshooting: [
|
||||
"troubleshooting/faqs",
|
||||
"troubleshooting/common_errors",
|
||||
"troubleshooting/go2rtc",
|
||||
"troubleshooting/recordings",
|
||||
"troubleshooting/dummy-camera",
|
||||
|
||||
+25
-37
@@ -372,40 +372,31 @@ def config(request: Request):
|
||||
config["go2rtc"]["streams"][stream_name] = cleaned
|
||||
|
||||
config["plus"] = {"enabled": request.app.frigate_config.plus_api.is_active()}
|
||||
config["model"]["colormap"] = config_obj.model.colormap
|
||||
config["model"]["all_attributes"] = config_obj.model.all_attributes
|
||||
config["model"]["non_logo_attributes"] = config_obj.model.non_logo_attributes
|
||||
|
||||
for model_key, model in config_obj.models.items():
|
||||
model_dict = config["models"][model_key]
|
||||
model_dict["colormap"] = model.colormap
|
||||
model_dict["all_attributes"] = model.all_attributes
|
||||
model_dict["non_logo_attributes"] = model.non_logo_attributes
|
||||
# Add model plus data if plus is enabled
|
||||
if config["plus"]["enabled"]:
|
||||
model_path = config.get("model", {}).get("path")
|
||||
if model_path:
|
||||
model_json_path = FilePath(model_path).with_suffix(".json")
|
||||
try:
|
||||
with open(model_json_path) as f:
|
||||
model_plus_data = json.load(f)
|
||||
config["model"]["plus"] = model_plus_data
|
||||
except FileNotFoundError:
|
||||
config["model"]["plus"] = None
|
||||
except json.JSONDecodeError:
|
||||
config["model"]["plus"] = None
|
||||
else:
|
||||
config["model"]["plus"] = None
|
||||
|
||||
# Add model plus data if plus is enabled
|
||||
if config["plus"]["enabled"]:
|
||||
model_plus_data = None
|
||||
|
||||
if model.path:
|
||||
model_json_path = FilePath(model.path).with_suffix(".json")
|
||||
try:
|
||||
with open(model_json_path) as f:
|
||||
model_plus_data = json.load(f)
|
||||
except (FileNotFoundError, json.JSONDecodeError):
|
||||
model_plus_data = None
|
||||
|
||||
model_dict["plus"] = model_plus_data
|
||||
|
||||
# legacy single-model block kept for frontend compatibility, remove
|
||||
# once the UI is fully multi-model aware
|
||||
default_model_key = (
|
||||
"default" if "default" in config_obj.models else next(iter(config_obj.models))
|
||||
)
|
||||
config["model"] = config["models"][default_model_key]
|
||||
|
||||
# use each detector's assigned merged labelmap
|
||||
for key, detector_config in config["detectors"].items():
|
||||
if config_obj.detectors[key].model:
|
||||
detector_config["model"]["labelmap"] = config_obj.detectors[
|
||||
key
|
||||
].model.merged_labelmap
|
||||
# use merged labelamp
|
||||
for detector_config in config["detectors"].values():
|
||||
detector_config["model"]["labelmap"] = (
|
||||
request.app.frigate_config.model.merged_labelmap
|
||||
)
|
||||
|
||||
return JSONResponse(content=config)
|
||||
|
||||
@@ -1332,11 +1323,8 @@ def plusModels(request: Request, filterByCurrentModelDetector: bool = False):
|
||||
|
||||
modelList = models["list"]
|
||||
|
||||
# current model type, based on the default model until the UI is
|
||||
# fully multi-model aware
|
||||
config_models = request.app.frigate_config.models
|
||||
default_model = config_models.get("default") or next(iter(config_models.values()))
|
||||
modelType = default_model.model_type
|
||||
# current model type
|
||||
modelType = request.app.frigate_config.model.model_type
|
||||
|
||||
# current detectorType for comparing to supportedDetectors
|
||||
detectorType = list(request.app.frigate_config.detectors.values())[0].type
|
||||
|
||||
+10
-15
@@ -1538,18 +1538,15 @@ async def set_description(
|
||||
event.data["description"] = new_description
|
||||
event.save()
|
||||
|
||||
context: EmbeddingsContext | None = request.app.embeddings
|
||||
|
||||
if context is not None:
|
||||
# If semantic search is enabled, update the index
|
||||
if request.app.frigate_config.semantic_search.enabled:
|
||||
context: EmbeddingsContext = request.app.embeddings
|
||||
if len(new_description) > 0:
|
||||
# If semantic search is enabled, update the index
|
||||
if request.app.frigate_config.semantic_search.enabled:
|
||||
context.update_description(
|
||||
event_id,
|
||||
new_description,
|
||||
)
|
||||
context.update_description(
|
||||
event_id,
|
||||
new_description,
|
||||
)
|
||||
else:
|
||||
# embeddings are always cleaned up so they don't outlive their description
|
||||
context.db.delete_embeddings_description(event_ids=[event_id])
|
||||
|
||||
response_message = (
|
||||
@@ -1678,11 +1675,9 @@ async def delete_single_event(event_id: str, request: Request) -> dict:
|
||||
event.delete_instance()
|
||||
Timeline.delete().where(Timeline.source_id == event_id).execute()
|
||||
|
||||
# embeddings are always cleaned up, even when semantic search is disabled,
|
||||
# so that they don't outlive their events
|
||||
context: EmbeddingsContext | None = request.app.embeddings
|
||||
|
||||
if context is not None:
|
||||
# If semantic search is enabled, update the index
|
||||
if request.app.frigate_config.semantic_search.enabled:
|
||||
context: EmbeddingsContext = request.app.embeddings
|
||||
context.db.delete_embeddings_thumbnail(event_ids=[event_id])
|
||||
context.db.delete_embeddings_description(event_ids=[event_id])
|
||||
|
||||
|
||||
@@ -813,7 +813,7 @@ async def event_snapshot(
|
||||
timestamp_style=request.app.frigate_config.cameras[
|
||||
event.camera
|
||||
].timestamp_style,
|
||||
colormap=request.app.frigate_config.model_for_camera(event.camera).colormap,
|
||||
colormap=request.app.frigate_config.model.colormap,
|
||||
)
|
||||
except DoesNotExist:
|
||||
# see if the object is currently being tracked
|
||||
|
||||
+18
-20
@@ -97,9 +97,7 @@ class FrigateApp:
|
||||
self.metrics_manager = manager
|
||||
self.audio_process: mp.Process | None = None
|
||||
self.stop_event = stop_event
|
||||
self.detection_queues: dict[str, Queue] = {
|
||||
model_key: mp.Queue() for model_key in config.models
|
||||
}
|
||||
self.detection_queue: Queue = mp.Queue()
|
||||
self.detectors: dict[str, ObjectDetectProcess] = {}
|
||||
self.detection_shms: list[mp.shared_memory.SharedMemory] = []
|
||||
self.log_queue: Queue = mp.Queue()
|
||||
@@ -272,7 +270,7 @@ class FrigateApp:
|
||||
10
|
||||
* len([c for c in self.config.cameras.values() if c.enabled_in_config]),
|
||||
),
|
||||
load_vec_extension=True,
|
||||
load_vec_extension=self.config.semantic_search.enabled,
|
||||
)
|
||||
models = [
|
||||
Event,
|
||||
@@ -365,14 +363,20 @@ class FrigateApp:
|
||||
)
|
||||
|
||||
def start_detectors(self) -> None:
|
||||
for name, camera_config in self.config.cameras.items():
|
||||
camera_model = self.config.models[camera_config.detect.model]
|
||||
|
||||
for name in self.config.cameras.keys():
|
||||
try:
|
||||
largest_frame = max(
|
||||
[
|
||||
det.model.height * det.model.width * 3
|
||||
if det.model is not None
|
||||
else 320
|
||||
for det in self.config.detectors.values()
|
||||
]
|
||||
)
|
||||
shm_in = UntrackedSharedMemory(
|
||||
name=name,
|
||||
create=True,
|
||||
size=camera_model.height * camera_model.width * 3,
|
||||
size=largest_frame,
|
||||
)
|
||||
except FileExistsError:
|
||||
shm_in = UntrackedSharedMemory(name=name)
|
||||
@@ -387,16 +391,11 @@ class FrigateApp:
|
||||
self.detection_shms.append(shm_in)
|
||||
self.detection_shms.append(shm_out)
|
||||
|
||||
for name, detector_config in self.config.detector_instances.items():
|
||||
cameras_using_model = [
|
||||
camera_name
|
||||
for camera_name, camera_config in self.config.cameras.items()
|
||||
if camera_config.detect.model == detector_config.model_key
|
||||
]
|
||||
for name, detector_config in self.config.detectors.items():
|
||||
self.detectors[name] = ObjectDetectProcess(
|
||||
name,
|
||||
self.detection_queues[detector_config.model_key],
|
||||
cameras_using_model,
|
||||
self.detection_queue,
|
||||
list(self.config.cameras.keys()),
|
||||
self.config,
|
||||
detector_config,
|
||||
self.stop_event,
|
||||
@@ -431,7 +430,7 @@ class FrigateApp:
|
||||
def start_camera_processor(self) -> None:
|
||||
self.camera_maintainer = CameraMaintainer(
|
||||
self.config,
|
||||
self.detection_queues,
|
||||
self.detection_queue,
|
||||
self.detected_frames_queue,
|
||||
self.camera_metrics,
|
||||
self.ptz_metrics,
|
||||
@@ -686,9 +685,8 @@ class FrigateApp:
|
||||
for detector in self.detectors.values():
|
||||
detector.stop()
|
||||
|
||||
for detection_queue in self.detection_queues.values():
|
||||
empty_and_close_queue(detection_queue)
|
||||
logger.info("Detection queues closed")
|
||||
empty_and_close_queue(self.detection_queue)
|
||||
logger.info("Detection queue closed")
|
||||
|
||||
self.detected_frames_processor.join()
|
||||
empty_and_close_queue(self.detected_frames_queue)
|
||||
|
||||
@@ -178,7 +178,7 @@ class CameraActivityManager:
|
||||
return
|
||||
|
||||
for label in camera_config.objects.track:
|
||||
if label in self.config.model_for_camera(camera).non_logo_attributes:
|
||||
if label in self.config.model.non_logo_attributes:
|
||||
continue
|
||||
|
||||
new_count = all_objects[label]
|
||||
|
||||
@@ -29,7 +29,7 @@ class CameraMaintainer(threading.Thread):
|
||||
def __init__(
|
||||
self,
|
||||
config: FrigateConfig,
|
||||
detection_queues: dict[str, Queue],
|
||||
detection_queue: Queue,
|
||||
detected_frames_queue: Queue,
|
||||
camera_metrics: DictProxy,
|
||||
ptz_metrics: dict[str, PTZMetrics],
|
||||
@@ -38,7 +38,7 @@ class CameraMaintainer(threading.Thread):
|
||||
):
|
||||
super().__init__(name="camera_processor")
|
||||
self.config = config
|
||||
self.detection_queues = detection_queues
|
||||
self.detection_queue = detection_queue
|
||||
self.detected_frames_queue = detected_frames_queue
|
||||
self.stop_event = stop_event
|
||||
self.camera_metrics = camera_metrics
|
||||
@@ -79,11 +79,10 @@ class CameraMaintainer(threading.Thread):
|
||||
# create or update region grids for each camera
|
||||
for camera in self.config.cameras.values():
|
||||
assert camera.name is not None
|
||||
camera_model = self.config.models[camera.detect.model]
|
||||
self.region_grids[camera.name] = get_camera_regions_grid(
|
||||
camera.name,
|
||||
camera.detect,
|
||||
max(camera_model.width, camera_model.height),
|
||||
max(self.config.model.width, self.config.model.height),
|
||||
)
|
||||
|
||||
def __calculate_shm_frame_count(self) -> int:
|
||||
@@ -116,8 +115,6 @@ class CameraMaintainer(threading.Thread):
|
||||
|
||||
camera_stop_event = self.__ensure_camera_stop_event(name)
|
||||
|
||||
camera_model = self.config.models[config.detect.model]
|
||||
|
||||
if runtime:
|
||||
self.camera_metrics[name] = CameraMetrics(self.metrics_manager)
|
||||
self.ptz_metrics[name] = PTZMetrics(
|
||||
@@ -126,24 +123,32 @@ class CameraMaintainer(threading.Thread):
|
||||
self.region_grids[name] = get_camera_regions_grid(
|
||||
name,
|
||||
config.detect,
|
||||
max(camera_model.width, camera_model.height),
|
||||
max(self.config.model.width, self.config.model.height),
|
||||
)
|
||||
|
||||
try:
|
||||
largest_frame = max(
|
||||
[
|
||||
det.model.height * det.model.width * 3
|
||||
if det.model is not None
|
||||
else 320
|
||||
for det in self.config.detectors.values()
|
||||
]
|
||||
)
|
||||
UntrackedSharedMemory(name=f"out-{name}", create=True, size=20 * 6 * 4)
|
||||
UntrackedSharedMemory(
|
||||
name=name,
|
||||
create=True,
|
||||
size=camera_model.height * camera_model.width * 3,
|
||||
size=largest_frame,
|
||||
)
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
camera_process = CameraTracker(
|
||||
config,
|
||||
camera_model,
|
||||
camera_model.merged_labelmap,
|
||||
self.detection_queues[config.detect.model],
|
||||
self.config.model,
|
||||
self.config.model.merged_labelmap,
|
||||
self.detection_queue,
|
||||
self.detected_frames_queue,
|
||||
self.camera_metrics[name],
|
||||
self.ptz_metrics[name],
|
||||
|
||||
@@ -40,7 +40,6 @@ class CameraState:
|
||||
self.name = name
|
||||
self.config = config
|
||||
self.camera_config = config.cameras[name]
|
||||
self.model_config = config.model_for_camera(name)
|
||||
self.frame_manager = frame_manager
|
||||
self.best_objects: dict[str, TrackedObject] = {}
|
||||
self.tracked_objects: dict[str, TrackedObject] = {}
|
||||
@@ -102,7 +101,7 @@ class CameraState:
|
||||
thickness = 1
|
||||
else:
|
||||
thickness = 2
|
||||
color = self.model_config.colormap.get(
|
||||
color = self.config.model.colormap.get(
|
||||
obj["label"], (255, 255, 255)
|
||||
)
|
||||
else:
|
||||
@@ -126,7 +125,7 @@ class CameraState:
|
||||
and obj["frame_time"] == frame_time
|
||||
):
|
||||
thickness = 5
|
||||
color = self.model_config.colormap.get(
|
||||
color = self.config.model.colormap.get(
|
||||
obj["label"], (255, 255, 255)
|
||||
)
|
||||
|
||||
@@ -262,7 +261,7 @@ class CameraState:
|
||||
if draw_options.get("paths"):
|
||||
for obj in tracked_objects.values():
|
||||
if obj["frame_time"] == frame_time and obj["path_data"]:
|
||||
color = self.model_config.colormap.get(
|
||||
color = self.config.model.colormap.get(
|
||||
obj["label"], (255, 255, 255)
|
||||
)
|
||||
|
||||
@@ -367,7 +366,7 @@ class CameraState:
|
||||
for id in new_ids:
|
||||
logger.debug(f"{self.name}: New tracked object ID: {id}")
|
||||
new_obj = tracked_objects[id] = TrackedObject(
|
||||
self.model_config,
|
||||
self.config.model,
|
||||
self.camera_config,
|
||||
self.config.ui,
|
||||
self.frame_cache,
|
||||
@@ -511,7 +510,7 @@ class CameraState:
|
||||
sub_label = None
|
||||
|
||||
if obj.obj_data.get("sub_label"):
|
||||
if obj.obj_data["sub_label"][0] in self.model_config.all_attributes:
|
||||
if obj.obj_data["sub_label"][0] in self.config.model.all_attributes:
|
||||
label = obj.obj_data["sub_label"][0]
|
||||
else:
|
||||
label = f"{object_type}-verified"
|
||||
|
||||
@@ -156,11 +156,10 @@ class Dispatcher:
|
||||
if camera not in self.config.cameras:
|
||||
return None
|
||||
|
||||
camera_model = self.config.model_for_camera(camera)
|
||||
grid = get_camera_regions_grid(
|
||||
camera,
|
||||
self.config.cameras[camera].detect,
|
||||
max(camera_model.width, camera_model.height),
|
||||
max(self.config.model.width, self.config.model.height),
|
||||
)
|
||||
return grid
|
||||
|
||||
|
||||
@@ -50,11 +50,6 @@ class DetectConfig(FrigateBaseModel):
|
||||
title="Enable object detection",
|
||||
description="Enable or disable object detection for all cameras; can be overridden per-camera.",
|
||||
)
|
||||
model: str | None = Field(
|
||||
default=None,
|
||||
title="Detection model name",
|
||||
description="Name of the model (key under `models`) used by this camera. Defaults to the only defined model, or the model named 'default'.",
|
||||
)
|
||||
height: int | None = Field(
|
||||
default=None,
|
||||
title="Detect height",
|
||||
|
||||
+33
-155
@@ -4,7 +4,6 @@ import io
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from typing import Any, Self
|
||||
|
||||
import numpy as np
|
||||
@@ -12,7 +11,6 @@ from pydantic import (
|
||||
BaseModel,
|
||||
ConfigDict,
|
||||
Field,
|
||||
PrivateAttr,
|
||||
TypeAdapter,
|
||||
ValidationInfo,
|
||||
field_validator,
|
||||
@@ -21,11 +19,7 @@ from pydantic import (
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
from frigate.const import REGEX_JSON
|
||||
from frigate.detectors import (
|
||||
DetectorConfig,
|
||||
ModelConfig,
|
||||
assign_detector_instances,
|
||||
)
|
||||
from frigate.detectors import DetectorConfig, ModelConfig
|
||||
from frigate.detectors.detector_config import BaseDetectorConfig
|
||||
from frigate.plus import PlusApi
|
||||
from frigate.util.builtin import (
|
||||
@@ -115,7 +109,7 @@ DEFAULT_CONFIG = f"""
|
||||
mqtt:
|
||||
enabled: False
|
||||
|
||||
{_render_default_yaml({"detectors": NEW_CONFIG_DETECTORS, "models": {"default": DEFAULT_MODEL}})}
|
||||
{_render_default_yaml({"detectors": NEW_CONFIG_DETECTORS, "model": DEFAULT_MODEL})}
|
||||
cameras: {{}} # No cameras defined, UI wizard should be used
|
||||
version: {CURRENT_CONFIG_VERSION}
|
||||
"""
|
||||
@@ -509,10 +503,10 @@ class FrigateConfig(FrigateBaseModel):
|
||||
title="Detector hardware",
|
||||
description="Configuration for object detectors (CPU, GPU, ONNX backends) and any detector-specific model settings.",
|
||||
)
|
||||
models: dict[str, ModelConfig] = Field(
|
||||
default_factory=lambda: {"default": ModelConfig()},
|
||||
title="Detection models",
|
||||
description="Named object detection models. Cameras select a model with detect.model; detectors are assigned to models automatically.",
|
||||
model: ModelConfig = Field(
|
||||
default_factory=ModelConfig,
|
||||
title="Detection model",
|
||||
description="Settings to configure a custom object detection model and its input shape.",
|
||||
)
|
||||
|
||||
# GenAI config (named provider configs: name -> GenAIConfig)
|
||||
@@ -627,37 +621,11 @@ class FrigateConfig(FrigateBaseModel):
|
||||
)
|
||||
|
||||
_plus_api: PlusApi
|
||||
_detector_instances: dict[str, BaseDetectorConfig] = PrivateAttr(
|
||||
default_factory=dict
|
||||
)
|
||||
|
||||
@property
|
||||
def plus_api(self) -> PlusApi:
|
||||
return self._plus_api
|
||||
|
||||
@property
|
||||
def detector_instances(self) -> dict[str, BaseDetectorConfig]:
|
||||
"""Runtime detector instances expanded per assigned model."""
|
||||
return self._detector_instances
|
||||
|
||||
def model_for_camera(self, camera_name: str) -> ModelConfig:
|
||||
"""Return the detection model config used by the given camera."""
|
||||
return self.models[self.cameras[camera_name].detect.model]
|
||||
|
||||
@field_validator("models")
|
||||
@classmethod
|
||||
def validate_model_names(cls, v: dict[str, ModelConfig]):
|
||||
if not v:
|
||||
raise ValueError("At least one model must be defined under models")
|
||||
|
||||
for name in v.keys():
|
||||
if not re.match(r"^[a-zA-Z0-9_-]+$", name):
|
||||
raise ValueError(
|
||||
f"Invalid model name '{name}'. Model names can only contain letters, numbers, underscores, and hyphens"
|
||||
)
|
||||
|
||||
return v
|
||||
|
||||
@model_validator(mode="after")
|
||||
def post_validation(self, info: ValidationInfo) -> Self:
|
||||
# Load plus api from context, if possible.
|
||||
@@ -672,7 +640,7 @@ class FrigateConfig(FrigateBaseModel):
|
||||
# set notifications state
|
||||
self.notifications.enabled_in_config = self.notifications.enabled
|
||||
|
||||
# validate genai: each role (chat, descriptions, embeddings) at most once
|
||||
# validate genai: each role (tools, vision, embeddings) at most once
|
||||
role_to_name: dict[GenAIRoleEnum, str] = {}
|
||||
for name, genai_cfg in self.genai.items():
|
||||
for role in genai_cfg.roles:
|
||||
@@ -703,12 +671,7 @@ class FrigateConfig(FrigateBaseModel):
|
||||
)
|
||||
|
||||
# set default min_score for object attributes
|
||||
all_model_attributes = {
|
||||
attribute
|
||||
for model in self.models.values()
|
||||
for attribute in model.all_attributes
|
||||
}
|
||||
for attribute in sorted(all_model_attributes):
|
||||
for attribute in self.model.all_attributes:
|
||||
existing = self.objects.filters.get(attribute)
|
||||
if existing is None:
|
||||
self.objects.filters[attribute] = FilterConfig(min_score=0.7)
|
||||
@@ -758,18 +721,8 @@ class FrigateConfig(FrigateBaseModel):
|
||||
exclude_unset=True,
|
||||
)
|
||||
|
||||
# capture raw model dumps before plus models are loaded so detector
|
||||
# instances can run their own detector-specific plus validation
|
||||
raw_model_dumps = {
|
||||
name: model.model_dump(exclude_unset=True, warnings="none")
|
||||
for name, model in self.models.items()
|
||||
}
|
||||
|
||||
for model in self.models.values():
|
||||
model.check_and_load_plus_model(self.plus_api)
|
||||
|
||||
adapter = TypeAdapter(DetectorConfig)
|
||||
for key, detector in self.detectors.items():
|
||||
adapter = TypeAdapter(DetectorConfig)
|
||||
model_dict = (
|
||||
detector
|
||||
if isinstance(detector, dict)
|
||||
@@ -784,6 +737,27 @@ class FrigateConfig(FrigateBaseModel):
|
||||
)
|
||||
detector_config.model = None
|
||||
|
||||
model_config = self.model.model_dump(exclude_unset=True, warnings="none")
|
||||
|
||||
if detector_config.model_path:
|
||||
model_config["path"] = detector_config.model_path
|
||||
|
||||
if "path" not in model_config:
|
||||
if detector_config.type == "cpu" or detector_config.type.endswith(
|
||||
"_tfl"
|
||||
):
|
||||
model_config["path"] = "/cpu_model.tflite"
|
||||
elif detector_config.type == "edgetpu":
|
||||
model_config["path"] = "/edgetpu_model.tflite"
|
||||
elif detector_config.type == "openvino":
|
||||
for default_key, default_value in DEFAULT_MODEL.items():
|
||||
model_config.setdefault(default_key, default_value)
|
||||
|
||||
model = ModelConfig.model_validate(model_config)
|
||||
model.check_and_load_plus_model(self.plus_api, detector_config.type)
|
||||
model.compute_model_hash()
|
||||
labelmap_objects = model.merged_labelmap.values()
|
||||
detector_config.model = model
|
||||
self.detectors[key] = detector_config
|
||||
|
||||
for name, camera in self.cameras.items():
|
||||
@@ -811,21 +785,6 @@ class FrigateConfig(FrigateBaseModel):
|
||||
{"name": name, **merged_config}
|
||||
)
|
||||
|
||||
# resolve which named model this camera uses
|
||||
if camera_config.detect.model is not None:
|
||||
if camera_config.detect.model not in self.models:
|
||||
raise ValueError(
|
||||
f"Camera {name} references model '{camera_config.detect.model}' which is not defined under models. Defined models: {', '.join(self.models.keys())}"
|
||||
)
|
||||
elif len(self.models) == 1:
|
||||
camera_config.detect.model = next(iter(self.models))
|
||||
elif "default" in self.models:
|
||||
camera_config.detect.model = "default"
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Camera {name} does not specify detect.model and multiple models are defined. Set detect.model on the camera or globally, or name one of the models 'default'."
|
||||
)
|
||||
|
||||
if camera_config.ffmpeg.hwaccel_args == "auto":
|
||||
camera_config.ffmpeg.hwaccel_args = self.ffmpeg.hwaccel_args
|
||||
|
||||
@@ -1046,10 +1005,7 @@ class FrigateConfig(FrigateBaseModel):
|
||||
verify_profile_overrides_match_base(camera_config)
|
||||
verify_autotrack_zones(camera_config)
|
||||
verify_motion_and_detect(camera_config)
|
||||
verify_objects_track(
|
||||
camera_config,
|
||||
self.models[camera_config.detect.model].merged_labelmap.values(),
|
||||
)
|
||||
verify_objects_track(camera_config, labelmap_objects)
|
||||
verify_lpr_and_face(self, camera_config)
|
||||
|
||||
# Validate camera profiles reference top-level profile definitions
|
||||
@@ -1066,11 +1022,8 @@ class FrigateConfig(FrigateBaseModel):
|
||||
config.name = name
|
||||
|
||||
self.objects.parse_all_objects(self.cameras)
|
||||
for model in self.models.values():
|
||||
model.create_colormap(sorted(self.objects.all_objects))
|
||||
|
||||
# expand detectors into per-model runtime instances
|
||||
self.__build_detector_instances(raw_model_dumps)
|
||||
self.model.create_colormap(sorted(self.objects.all_objects))
|
||||
self.model.check_and_load_plus_model(self.plus_api)
|
||||
|
||||
# Check audio transcription and audio detection requirements
|
||||
if self.audio_transcription.enabled:
|
||||
@@ -1101,81 +1054,6 @@ class FrigateConfig(FrigateBaseModel):
|
||||
|
||||
return self
|
||||
|
||||
def __build_detector_instances(
|
||||
self, raw_model_dumps: dict[str, dict[str, Any]]
|
||||
) -> None:
|
||||
"""Expand detector entries into runtime instances, one per assigned model."""
|
||||
used_models = list(
|
||||
dict.fromkeys(camera.detect.model for camera in self.cameras.values())
|
||||
) or list(self.models.keys())
|
||||
|
||||
unused_models = set(self.models.keys()) - set(used_models)
|
||||
if unused_models:
|
||||
logger.warning(
|
||||
f"Models {', '.join(sorted(unused_models))} are defined but not used by any camera, no detector instances will be created for them"
|
||||
)
|
||||
|
||||
assignments = assign_detector_instances(
|
||||
{key: detector.type for key, detector in self.detectors.items()},
|
||||
used_models,
|
||||
)
|
||||
|
||||
models_per_detector: dict[str, int] = {}
|
||||
for _, detector_key, _ in assignments:
|
||||
models_per_detector[detector_key] = (
|
||||
models_per_detector.get(detector_key, 0) + 1
|
||||
)
|
||||
|
||||
instances: dict[str, BaseDetectorConfig] = {}
|
||||
|
||||
for instance_name, detector_key, model_key in assignments:
|
||||
instance = self.detectors[detector_key].model_copy(deep=True)
|
||||
instance.model_key = model_key
|
||||
|
||||
model_dict = raw_model_dumps[model_key].copy()
|
||||
|
||||
if instance.model_path:
|
||||
if models_per_detector[detector_key] > 1:
|
||||
logger.warning(
|
||||
f"Detector {detector_key} runs multiple models, its model_path will be ignored"
|
||||
)
|
||||
else:
|
||||
model_dict["path"] = instance.model_path
|
||||
|
||||
if "path" not in model_dict:
|
||||
if instance.type == "cpu" or instance.type.endswith("_tfl"):
|
||||
model_dict["path"] = "/cpu_model.tflite"
|
||||
elif instance.type == "edgetpu":
|
||||
model_dict["path"] = "/edgetpu_model.tflite"
|
||||
elif instance.type == "openvino":
|
||||
for default_key, default_value in DEFAULT_MODEL.items():
|
||||
model_dict.setdefault(default_key, default_value)
|
||||
|
||||
model = ModelConfig.model_validate(model_dict)
|
||||
|
||||
try:
|
||||
model.check_and_load_plus_model(self.plus_api, instance.type)
|
||||
except ValueError as e:
|
||||
raise ValueError(f"Model '{model_key}': {e}") from e
|
||||
|
||||
model.compute_model_hash()
|
||||
instance.model = model
|
||||
instances[instance_name] = instance
|
||||
logger.log(
|
||||
logging.INFO if len(used_models) > 1 else logging.DEBUG,
|
||||
f"Detector instance {instance_name} ({instance.type}) will run model '{model_key}'",
|
||||
)
|
||||
|
||||
# populate user-facing detector entries with their first assigned
|
||||
# model for display purposes
|
||||
for instance_name, detector_key, model_key in assignments:
|
||||
detector = self.detectors[detector_key]
|
||||
if detector.model is None:
|
||||
detector.model = instances[instance_name].model
|
||||
detector.model_key = model_key
|
||||
|
||||
self._detector_instances = instances
|
||||
|
||||
@field_validator("cameras")
|
||||
@classmethod
|
||||
def ensure_zones_and_cameras_have_different_names(cls, v: dict[str, CameraConfig]):
|
||||
|
||||
@@ -72,10 +72,9 @@ class LicensePlateProcessingMixin:
|
||||
# Object config
|
||||
self.lp_objects: list[str] = []
|
||||
|
||||
for model in self.config.models.values():
|
||||
for obj, attributes in model.attributes_map.items():
|
||||
if "license_plate" in attributes and obj not in self.lp_objects:
|
||||
self.lp_objects.append(obj)
|
||||
for obj, attributes in self.config.model.attributes_map.items():
|
||||
if "license_plate" in attributes:
|
||||
self.lp_objects.append(obj)
|
||||
|
||||
# Detection specific parameters
|
||||
self.min_size = 8
|
||||
|
||||
@@ -231,12 +231,8 @@ class ReviewDescriptionProcessor(PostProcessorApi):
|
||||
final_data,
|
||||
thumbs,
|
||||
camera_config.review.genai,
|
||||
list(
|
||||
self.config.model_for_camera(
|
||||
camera_config.name
|
||||
).merged_labelmap.values()
|
||||
),
|
||||
self.config.model_for_camera(camera_config.name).all_attributes,
|
||||
list(self.config.model.merged_labelmap.values()),
|
||||
self.config.model.all_attributes,
|
||||
),
|
||||
).start()
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import logging
|
||||
import sqlite3
|
||||
from typing import Any
|
||||
|
||||
import regex
|
||||
from playhouse.sqliteq import SqliteQueueDatabase
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
REGEXP_TIMEOUT_SECONDS = 1.0
|
||||
|
||||
|
||||
@@ -31,14 +28,8 @@ class SqliteVecQueueDatabase(SqliteQueueDatabase):
|
||||
|
||||
def _load_vec_extension(self, conn: sqlite3.Connection) -> None:
|
||||
conn.enable_load_extension(True)
|
||||
|
||||
try:
|
||||
conn.load_extension(self.sqlite_vec_path)
|
||||
except conn.OperationalError:
|
||||
logger.error("Unable to load the sqlite-vec extension")
|
||||
self.load_vec_extension = False
|
||||
finally:
|
||||
conn.enable_load_extension(False)
|
||||
conn.load_extension(self.sqlite_vec_path)
|
||||
conn.enable_load_extension(False)
|
||||
|
||||
def _register_regexp(self, conn: sqlite3.Connection) -> None:
|
||||
def regexp(expr: str, item: str | None) -> bool:
|
||||
@@ -53,33 +44,13 @@ class SqliteVecQueueDatabase(SqliteQueueDatabase):
|
||||
|
||||
conn.create_function("REGEXP", 2, regexp)
|
||||
|
||||
def _delete_embeddings(self, table: str, event_ids: list[str]) -> None:
|
||||
"""Delete embeddings for the given events, if the table exists.
|
||||
|
||||
Embeddings outlive the events they belong to when semantic search is
|
||||
disabled, so deletes are attempted regardless of the current config.
|
||||
"""
|
||||
if not event_ids or not self.load_vec_extension:
|
||||
return
|
||||
|
||||
# the embeddings tables are only created once semantic search has run
|
||||
cursor = self.execute_sql(
|
||||
"SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",
|
||||
(table,),
|
||||
)
|
||||
|
||||
if cursor.fetchone() is None:
|
||||
logger.debug("Skipping %s cleanup, table does not exist", table)
|
||||
return
|
||||
|
||||
ids = ",".join(["?" for _ in event_ids])
|
||||
self.execute_sql(f"DELETE FROM {table} WHERE id IN ({ids})", event_ids)
|
||||
|
||||
def delete_embeddings_thumbnail(self, event_ids: list[str]) -> None:
|
||||
self._delete_embeddings("vec_thumbnails", event_ids)
|
||||
ids = ",".join(["?" for _ in event_ids])
|
||||
self.execute_sql(f"DELETE FROM vec_thumbnails WHERE id IN ({ids})", event_ids)
|
||||
|
||||
def delete_embeddings_description(self, event_ids: list[str]) -> None:
|
||||
self._delete_embeddings("vec_descriptions", event_ids)
|
||||
ids = ",".join(["?" for _ in event_ids])
|
||||
self.execute_sql(f"DELETE FROM vec_descriptions WHERE id IN ({ids})", event_ids)
|
||||
|
||||
def drop_embeddings_tables(self) -> None:
|
||||
self.execute_sql("""
|
||||
|
||||
@@ -1,69 +1,11 @@
|
||||
import logging
|
||||
|
||||
from .detector_config import InputTensorEnum, ModelConfig, PixelFormatEnum # noqa: F401
|
||||
from .detector_types import ( # noqa: F401
|
||||
DetectorConfig,
|
||||
DetectorTypeEnum,
|
||||
api_types,
|
||||
detector_supports_multiple_models,
|
||||
)
|
||||
from .detector_types import DetectorConfig, DetectorTypeEnum, api_types # noqa: F401
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def assign_detector_instances(
|
||||
detector_types: dict[str, str],
|
||||
used_models: list[str],
|
||||
) -> list[tuple[str, str, str]]:
|
||||
"""Assign detector entries to models.
|
||||
|
||||
Detector types that support multiple models get one instance per model.
|
||||
Single-model detector entries are round-robin assigned across the models,
|
||||
wrapping around so that every detector entry is assigned.
|
||||
|
||||
Args:
|
||||
detector_types: Detector key to detector type, in config order
|
||||
used_models: Ordered model keys in use by cameras
|
||||
|
||||
Returns:
|
||||
List of (instance_name, detector_key, model_key) assignments
|
||||
"""
|
||||
multi = [
|
||||
key
|
||||
for key, type_key in detector_types.items()
|
||||
if detector_supports_multiple_models(type_key)
|
||||
]
|
||||
single = [key for key in detector_types if key not in multi]
|
||||
|
||||
if not multi and len(single) < len(used_models):
|
||||
single_types = sorted({detector_types[key] for key in single})
|
||||
raise ValueError(
|
||||
f"Detectors {', '.join(single)} (types: {', '.join(single_types)}) can each only run a single model, "
|
||||
f"but {len(used_models)} models are in use ({', '.join(used_models)}). "
|
||||
"Add more detectors, use a detector type that supports multiple models, or reduce the number of models assigned to cameras."
|
||||
)
|
||||
|
||||
assignments: list[tuple[str, str, str]] = []
|
||||
|
||||
for key in multi:
|
||||
for model_key in used_models:
|
||||
instance_name = key if len(used_models) == 1 else f"{key}_{model_key}"
|
||||
assignments.append((instance_name, key, model_key))
|
||||
|
||||
for i, key in enumerate(single):
|
||||
assignments.append((key, key, used_models[i % len(used_models)]))
|
||||
|
||||
instance_names = [name for name, _, _ in assignments]
|
||||
duplicates = {name for name in instance_names if instance_names.count(name) > 1}
|
||||
if duplicates:
|
||||
raise ValueError(
|
||||
f"Detector instance names collide: {', '.join(sorted(duplicates))}. "
|
||||
"Rename the conflicting detectors or models so that expanded instance names (detector_model) are unique."
|
||||
)
|
||||
|
||||
return assignments
|
||||
|
||||
|
||||
def create_detector(detector_config):
|
||||
if detector_config.type == DetectorTypeEnum.cpu:
|
||||
logger.warning(
|
||||
|
||||
@@ -11,10 +11,6 @@ logger = logging.getLogger(__name__)
|
||||
class DetectionApi(ABC):
|
||||
type_key: str
|
||||
supported_models: list[ModelTypeEnum]
|
||||
# whether this detector type can run multiple model instances concurrently
|
||||
# on the same hardware (one detector config entry can be expanded to an
|
||||
# instance per model); single-model detectors serve exactly one model each
|
||||
supports_multiple_models: bool = False
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self, detector_config: BaseDetectorConfig):
|
||||
|
||||
@@ -93,7 +93,7 @@ class ModelConfig(BaseModel):
|
||||
model_type: ModelTypeEnum = Field(
|
||||
default=ModelTypeEnum.ssd,
|
||||
title="Object Detection Model Type",
|
||||
description="Detector model architecture type (ssd, yolox, yolonas, yolo-generic, rfdetr, dfine) used by some detectors for optimization.",
|
||||
description="Detector model architecture type (ssd, yolox, yolonas) used by some detectors for optimization.",
|
||||
)
|
||||
_merged_labelmap: dict[int, str] | None = PrivateAttr()
|
||||
_colormap: dict[int, tuple[int, int, int]] = PrivateAttr()
|
||||
@@ -250,11 +250,6 @@ class BaseDetectorConfig(BaseModel):
|
||||
title="Detector specific model path",
|
||||
description="File path to the detector model binary if required by the chosen detector.",
|
||||
)
|
||||
model_key: str | None = Field(
|
||||
default=None,
|
||||
title="Assigned model name",
|
||||
description="Name of the model (key under `models`) this detector instance serves. Set automatically at runtime, users should not set this.",
|
||||
)
|
||||
model_config = ConfigDict(
|
||||
extra="allow", arbitrary_types_allowed=True, protected_namespaces=()
|
||||
)
|
||||
|
||||
@@ -29,12 +29,6 @@ for _, name, _ in _included_modules:
|
||||
api_types = {det.type_key: det for det in DetectionApi.__subclasses__()}
|
||||
|
||||
|
||||
def detector_supports_multiple_models(type_key: str) -> bool:
|
||||
"""Return whether the given detector type can run multiple model instances."""
|
||||
detector = api_types.get(type_key)
|
||||
return bool(detector and getattr(detector, "supports_multiple_models", False))
|
||||
|
||||
|
||||
class StrEnum(str, Enum):
|
||||
pass
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ class CpuDetectorConfig(BaseDetectorConfig):
|
||||
|
||||
class CpuTfl(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
|
||||
def __init__(self, detector_config: CpuDetectorConfig):
|
||||
# Suppress TFLite delegate creation messages that bypass Python logging
|
||||
|
||||
@@ -41,7 +41,6 @@ class ONNXDetectorConfig(BaseDetectorConfig):
|
||||
|
||||
class ONNXDetector(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
|
||||
def __init__(self, detector_config: ONNXDetectorConfig):
|
||||
super().__init__(detector_config)
|
||||
|
||||
@@ -36,7 +36,6 @@ class OvDetectorConfig(BaseDetectorConfig):
|
||||
|
||||
class OvDetector(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
supported_models = [
|
||||
ModelTypeEnum.dfine,
|
||||
ModelTypeEnum.rfdetr,
|
||||
|
||||
@@ -47,7 +47,6 @@ class RknnDetectorConfig(BaseDetectorConfig):
|
||||
|
||||
class Rknn(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
|
||||
def __init__(self, config: RknnDetectorConfig):
|
||||
super().__init__(config)
|
||||
|
||||
@@ -30,7 +30,6 @@ class TeflonDetectorConfig(BaseDetectorConfig):
|
||||
|
||||
class TeflonTfl(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
|
||||
def __init__(self, detector_config: TeflonDetectorConfig):
|
||||
# Location in Debian's mesa-teflon-delegate
|
||||
|
||||
@@ -82,7 +82,6 @@ class HostDeviceMem:
|
||||
|
||||
class TensorRtDetector(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
|
||||
def _load_engine(self, model_path):
|
||||
try:
|
||||
|
||||
@@ -366,10 +366,9 @@ class EventCleanup(threading.Thread):
|
||||
logger.debug(f"Deleting {len(chunk)} events from the database")
|
||||
Event.delete().where(Event.id << chunk).execute()
|
||||
|
||||
# embeddings are always cleaned up, even when semantic search
|
||||
# is disabled, so that they don't outlive their events
|
||||
self.db.delete_embeddings_description(event_ids=chunk)
|
||||
self.db.delete_embeddings_thumbnail(event_ids=chunk)
|
||||
logger.debug(f"Deleted {len(chunk)} embeddings")
|
||||
if self.config.semantic_search.enabled:
|
||||
self.db.delete_embeddings_description(event_ids=chunk)
|
||||
self.db.delete_embeddings_thumbnail(event_ids=chunk)
|
||||
logger.debug(f"Deleted {len(ids_to_delete)} embeddings")
|
||||
|
||||
logger.info("Exiting event cleanup...")
|
||||
|
||||
@@ -159,16 +159,7 @@ class EventProcessor(threading.Thread):
|
||||
if width is None or height is None:
|
||||
return
|
||||
|
||||
# find a detector instance running this camera's model so the
|
||||
# event records the model that produced it
|
||||
camera_detector = next(
|
||||
(
|
||||
detector
|
||||
for detector in self.config.detector_instances.values()
|
||||
if detector.model_key == camera_config.detect.model
|
||||
),
|
||||
list(self.config.detectors.values())[0],
|
||||
)
|
||||
first_detector = list(self.config.detectors.values())[0]
|
||||
|
||||
start_time = event_data["start_time"]
|
||||
end_time = (
|
||||
@@ -238,13 +229,13 @@ class EventProcessor(threading.Thread):
|
||||
Event.thumbnail: event_data.get("thumbnail"),
|
||||
Event.has_clip: event_data["has_clip"],
|
||||
Event.has_snapshot: event_data["has_snapshot"],
|
||||
Event.model_hash: camera_detector.model.model_hash
|
||||
if camera_detector.model
|
||||
Event.model_hash: first_detector.model.model_hash
|
||||
if first_detector.model
|
||||
else None,
|
||||
Event.model_type: camera_detector.model.model_type
|
||||
if camera_detector.model
|
||||
Event.model_type: first_detector.model.model_type
|
||||
if first_detector.model
|
||||
else None,
|
||||
Event.detector_type: camera_detector.type,
|
||||
Event.detector_type: first_detector.type,
|
||||
Event.data: {
|
||||
"box": box,
|
||||
"region": region,
|
||||
|
||||
@@ -192,7 +192,7 @@ class LlamaCppClient(GenAIClient):
|
||||
logger.info(
|
||||
"llama.cpp model '%s' initialized — context: %s, vision: %s, audio: %s, tools: %s, reasoning: %s",
|
||||
configured_model,
|
||||
self.get_context_size(),
|
||||
self._context_size or "unknown",
|
||||
self._supports_vision,
|
||||
self._supports_audio,
|
||||
self._supports_tools,
|
||||
|
||||
@@ -159,8 +159,6 @@ class FFMpegConverter(threading.Thread):
|
||||
f"duration {self.frame_times[t_idx + 1] - self.frame_times[t_idx]}"
|
||||
)
|
||||
|
||||
Path(self.path).parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
try:
|
||||
p = sp.run(
|
||||
self.ffmpeg_cmd.split(" "),
|
||||
|
||||
@@ -436,10 +436,7 @@ class ReviewSegmentMaintainer(threading.Thread):
|
||||
|
||||
if not object["sub_label"]:
|
||||
segment.detections[object["id"]] = object["label"]
|
||||
elif (
|
||||
object["sub_label"][0]
|
||||
in self.config.model_for_camera(segment.camera).all_attributes
|
||||
):
|
||||
elif object["sub_label"][0] in self.config.model.all_attributes:
|
||||
segment.detections[object["id"]] = object["sub_label"][0]
|
||||
else:
|
||||
segment.detections[object["id"]] = f"{object['label']}-verified"
|
||||
@@ -577,10 +574,7 @@ class ReviewSegmentMaintainer(threading.Thread):
|
||||
for object in activity.get_all_objects():
|
||||
if not object["sub_label"]:
|
||||
detections[object["id"]] = object["label"]
|
||||
elif (
|
||||
object["sub_label"][0]
|
||||
in self.config.model_for_camera(camera).all_attributes
|
||||
):
|
||||
elif object["sub_label"][0] in self.config.model.all_attributes:
|
||||
detections[object["id"]] = object["sub_label"][0]
|
||||
else:
|
||||
detections[object["id"]] = f"{object['label']}-verified"
|
||||
|
||||
+9
-181
@@ -86,7 +86,7 @@ class TestConfig(unittest.TestCase):
|
||||
},
|
||||
},
|
||||
# needs to be a file that will exist, doesn't matter what
|
||||
"models": {"default": {"path": "/etc/hosts", "width": 512}},
|
||||
"model": {"path": "/etc/hosts", "width": 512},
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**(deep_merge(config, self.minimal)))
|
||||
@@ -103,7 +103,7 @@ class TestConfig(unittest.TestCase):
|
||||
assert frigate_config.detectors["edgetpu"].device is None
|
||||
assert frigate_config.detectors["openvino"].device is None
|
||||
|
||||
assert frigate_config.models["default"].path == "/etc/hosts"
|
||||
assert frigate_config.model.path == "/etc/hosts"
|
||||
assert frigate_config.detectors["cpu"].model.path == "/cpu_model.tflite"
|
||||
assert frigate_config.detectors["edgetpu"].model.path == "/edgetpu_model.tflite"
|
||||
assert frigate_config.detectors["openvino"].model.path == "/etc/hosts"
|
||||
@@ -956,7 +956,7 @@ class TestConfig(unittest.TestCase):
|
||||
def test_merge_labelmap(self):
|
||||
config = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"models": {"default": {"labelmap": {7: "truck"}}},
|
||||
"model": {"labelmap": {7: "truck"}},
|
||||
"cameras": {
|
||||
"back": {
|
||||
"ffmpeg": {
|
||||
@@ -977,7 +977,7 @@ class TestConfig(unittest.TestCase):
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.models["default"].merged_labelmap[7] == "truck"
|
||||
assert frigate_config.model.merged_labelmap[7] == "truck"
|
||||
|
||||
def test_default_labelmap_empty(self):
|
||||
config = {
|
||||
@@ -1002,12 +1002,12 @@ class TestConfig(unittest.TestCase):
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.models["default"].merged_labelmap[0] == "person"
|
||||
assert frigate_config.model.merged_labelmap[0] == "person"
|
||||
|
||||
def test_default_labelmap(self):
|
||||
config = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"models": {"default": {"width": 320, "height": 320}},
|
||||
"model": {"width": 320, "height": 320},
|
||||
"cameras": {
|
||||
"back": {
|
||||
"ffmpeg": {
|
||||
@@ -1028,7 +1028,7 @@ class TestConfig(unittest.TestCase):
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.models["default"].merged_labelmap[0] == "person"
|
||||
assert frigate_config.model.merged_labelmap[0] == "person"
|
||||
|
||||
def test_plus_labelmap(self):
|
||||
with open(os.path.join(MODEL_CACHE_DIR, "test"), "w") as f:
|
||||
@@ -1039,7 +1039,7 @@ class TestConfig(unittest.TestCase):
|
||||
config = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"detectors": {"cpu": {"type": "cpu"}},
|
||||
"models": {"default": {"path": "plus://test"}},
|
||||
"model": {"path": "plus://test"},
|
||||
"cameras": {
|
||||
"back": {
|
||||
"ffmpeg": {
|
||||
@@ -1060,7 +1060,7 @@ class TestConfig(unittest.TestCase):
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.models["default"].merged_labelmap[0] == "amazon"
|
||||
assert frigate_config.model.merged_labelmap[0] == "amazon"
|
||||
|
||||
def test_fails_on_invalid_role(self):
|
||||
config = {
|
||||
@@ -1765,177 +1765,5 @@ class TestAttributeFilterDefaults(unittest.TestCase):
|
||||
self.assertEqual(face_filter.min_score, 0.3)
|
||||
|
||||
|
||||
class TestMultiModelConfig(unittest.TestCase):
|
||||
"""Tests for named models and detector instance assignment."""
|
||||
|
||||
def setUp(self):
|
||||
self.base = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"models": {
|
||||
"indoor": {"width": 320, "height": 320},
|
||||
"outdoor": {"width": 640, "height": 640},
|
||||
},
|
||||
"cameras": {
|
||||
"living_room": self._camera("indoor"),
|
||||
"driveway": self._camera("outdoor"),
|
||||
},
|
||||
}
|
||||
|
||||
def _camera(self, model=None):
|
||||
camera = {
|
||||
"ffmpeg": {
|
||||
"inputs": [{"path": "rtsp://10.0.0.1:554/video", "roles": ["detect"]}]
|
||||
},
|
||||
"detect": {"height": 1080, "width": 1920, "fps": 5},
|
||||
}
|
||||
|
||||
if model:
|
||||
camera["detect"]["model"] = model
|
||||
|
||||
return camera
|
||||
|
||||
def test_single_model_resolves_implicitly(self):
|
||||
config = FrigateConfig(
|
||||
mqtt={"host": "mqtt"},
|
||||
models={"custom": {"width": 320, "height": 320}},
|
||||
cameras={"back": self._camera()},
|
||||
)
|
||||
assert config.cameras["back"].detect.model == "custom"
|
||||
|
||||
def test_multiple_models_resolve_to_default(self):
|
||||
config = FrigateConfig(
|
||||
mqtt={"host": "mqtt"},
|
||||
models={
|
||||
"default": {"width": 320, "height": 320},
|
||||
"outdoor": {"width": 640, "height": 640},
|
||||
},
|
||||
cameras={"back": self._camera()},
|
||||
)
|
||||
assert config.cameras["back"].detect.model == "default"
|
||||
|
||||
def test_multiple_models_without_default_requires_selection(self):
|
||||
config = self.base.copy()
|
||||
config["cameras"] = {"back": self._camera()}
|
||||
self.assertRaises(ValidationError, lambda: FrigateConfig(**config))
|
||||
|
||||
def test_camera_references_missing_model(self):
|
||||
config = self.base.copy()
|
||||
config["cameras"] = {"back": self._camera("thermal")}
|
||||
self.assertRaises(ValidationError, lambda: FrigateConfig(**config))
|
||||
|
||||
def test_global_detect_model_inherited_and_overridden(self):
|
||||
config = self.base.copy()
|
||||
config["detect"] = {"model": "indoor"}
|
||||
config["cameras"] = {
|
||||
"living_room": self._camera(),
|
||||
"driveway": self._camera("outdoor"),
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.cameras["living_room"].detect.model == "indoor"
|
||||
assert frigate_config.cameras["driveway"].detect.model == "outdoor"
|
||||
|
||||
def test_invalid_model_name(self):
|
||||
config = self.base.copy()
|
||||
config["models"] = {"bad name!": {"width": 320, "height": 320}}
|
||||
self.assertRaises(ValidationError, lambda: FrigateConfig(**config))
|
||||
|
||||
def test_multi_model_detector_expands_instances(self):
|
||||
config = self.base.copy()
|
||||
config["detectors"] = {
|
||||
"ov0": {"type": "openvino", "device": "GPU"},
|
||||
"ov1": {"type": "openvino", "device": "GPU.1"},
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert sorted(frigate_config.detector_instances.keys()) == [
|
||||
"ov0_indoor",
|
||||
"ov0_outdoor",
|
||||
"ov1_indoor",
|
||||
"ov1_outdoor",
|
||||
]
|
||||
assert frigate_config.detector_instances["ov0_indoor"].model_key == "indoor"
|
||||
assert frigate_config.detector_instances["ov0_indoor"].model.width == 320
|
||||
assert frigate_config.detector_instances["ov0_outdoor"].model.width == 640
|
||||
|
||||
def test_multi_model_detector_single_model_keeps_name(self):
|
||||
config = self.base.copy()
|
||||
config["models"] = {"default": {"width": 320, "height": 320}}
|
||||
config["cameras"] = {"back": self._camera()}
|
||||
config["detectors"] = {"ov": {"type": "openvino", "device": "GPU"}}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert list(frigate_config.detector_instances.keys()) == ["ov"]
|
||||
assert frigate_config.detector_instances["ov"].model_key == "default"
|
||||
|
||||
def test_single_model_detectors_round_robin(self):
|
||||
config = self.base.copy()
|
||||
config["detectors"] = {
|
||||
"coral0": {"type": "edgetpu", "device": "usb:0"},
|
||||
"coral1": {"type": "edgetpu", "device": "usb:1"},
|
||||
"coral2": {"type": "edgetpu", "device": "usb:2"},
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assignments = {
|
||||
key: instance.model_key
|
||||
for key, instance in frigate_config.detector_instances.items()
|
||||
}
|
||||
assert assignments == {
|
||||
"coral0": "indoor",
|
||||
"coral1": "outdoor",
|
||||
"coral2": "indoor",
|
||||
}
|
||||
|
||||
def test_single_model_detectors_insufficient_coverage(self):
|
||||
config = self.base.copy()
|
||||
config["detectors"] = {"coral": {"type": "edgetpu", "device": "usb"}}
|
||||
self.assertRaises(ValidationError, lambda: FrigateConfig(**config))
|
||||
|
||||
def test_single_model_detector_with_multi_model_detector(self):
|
||||
config = self.base.copy()
|
||||
config["detectors"] = {
|
||||
"coral": {"type": "edgetpu", "device": "usb"},
|
||||
"ov": {"type": "openvino", "device": "GPU"},
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.detector_instances["coral"].model_key == "indoor"
|
||||
assert frigate_config.detector_instances["ov_indoor"].model_key == "indoor"
|
||||
assert frigate_config.detector_instances["ov_outdoor"].model_key == "outdoor"
|
||||
|
||||
def test_unused_model_gets_no_instances(self):
|
||||
config = self.base.copy()
|
||||
config["models"] = {
|
||||
**config["models"],
|
||||
"thermal": {"width": 320, "height": 320},
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
model_keys = {
|
||||
instance.model_key
|
||||
for instance in frigate_config.detector_instances.values()
|
||||
}
|
||||
assert "thermal" not in model_keys
|
||||
|
||||
def test_model_path_ignored_when_detector_runs_multiple_models(self):
|
||||
config = self.base.copy()
|
||||
config["detectors"] = {
|
||||
"cpu": {"type": "cpu", "model_path": "/custom_model.tflite"}
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert (
|
||||
frigate_config.detector_instances["cpu_indoor"].model.path
|
||||
== "/cpu_model.tflite"
|
||||
)
|
||||
|
||||
def test_model_path_applied_when_detector_runs_one_model(self):
|
||||
config = self.base.copy()
|
||||
config["models"] = {"default": {"width": 320, "height": 320}}
|
||||
config["cameras"] = {"back": self._camera()}
|
||||
config["detectors"] = {
|
||||
"cpu": {"type": "cpu", "model_path": "/custom_model.tflite"}
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert (
|
||||
frigate_config.detector_instances["cpu"].model.path
|
||||
== "/custom_model.tflite"
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
"""Tests for config file migration functions."""
|
||||
|
||||
import unittest
|
||||
|
||||
from frigate.util.config import migrate_019_0
|
||||
|
||||
|
||||
class TestMigrate019(unittest.TestCase):
|
||||
def test_migrates_model_to_named_models(self):
|
||||
config = {
|
||||
"version": "0.18-0",
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"model": {"path": "/config/model.tflite", "width": 320, "height": 320},
|
||||
}
|
||||
new_config = migrate_019_0(config)
|
||||
assert "model" not in new_config
|
||||
assert new_config["models"] == {
|
||||
"default": {"path": "/config/model.tflite", "width": 320, "height": 320}
|
||||
}
|
||||
assert new_config["version"] == "0.19-0"
|
||||
|
||||
def test_no_model_defined(self):
|
||||
config = {"version": "0.18-0", "mqtt": {"host": "mqtt"}}
|
||||
new_config = migrate_019_0(config)
|
||||
assert "model" not in new_config
|
||||
assert "models" not in new_config
|
||||
assert new_config["version"] == "0.19-0"
|
||||
|
||||
def test_existing_models_not_overwritten(self):
|
||||
config = {
|
||||
"version": "0.18-0",
|
||||
"model": {"width": 320},
|
||||
"models": {"custom": {"width": 640}},
|
||||
}
|
||||
new_config = migrate_019_0(config)
|
||||
assert "model" not in new_config
|
||||
assert new_config["models"] == {"custom": {"width": 640}}
|
||||
assert new_config["version"] == "0.19-0"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
@@ -491,34 +491,6 @@ class TestLlamaCppProvider(unittest.TestCase):
|
||||
final = _final_message(self._run_with_lines(client, lines, MULTIMODAL_MESSAGES))
|
||||
self.assertEqual(final["content"], "ok")
|
||||
|
||||
def _validated_client(self, server_context_size, provider_options=None):
|
||||
"""Build a client as if the server reported the given context size."""
|
||||
cfg = GenAIConfig(
|
||||
provider="llamacpp",
|
||||
model="m",
|
||||
base_url="http://localhost:9999",
|
||||
provider_options=provider_options or {},
|
||||
)
|
||||
info = {
|
||||
"context_size": server_context_size,
|
||||
"supports_vision": False,
|
||||
"supports_audio": False,
|
||||
"supports_tools": False,
|
||||
"supports_reasoning": False,
|
||||
"media_marker": "<__media__>",
|
||||
}
|
||||
cls = PROVIDERS[GenAIProviderEnum.llamacpp]
|
||||
with patch.object(cls, "_get_model_info", return_value=info):
|
||||
return cls(cfg, timeout=5)
|
||||
|
||||
def test_server_context_size_used_without_override(self):
|
||||
client = self._validated_client(4096)
|
||||
self.assertEqual(client.get_context_size(), 4096)
|
||||
|
||||
def test_provider_options_context_size_overrides_server(self):
|
||||
client = self._validated_client(4096, {"context_size": 32768})
|
||||
self.assertEqual(client.get_context_size(), 32768)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
"""Tests for embedding cleanup on the main Frigate database.
|
||||
|
||||
Embeddings are deleted whether or not semantic search is currently enabled, so
|
||||
the delete path has to tolerate databases where the vec0 tables were never
|
||||
created and installs where the sqlite-vec extension is unavailable.
|
||||
"""
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from frigate.db.sqlitevecq import SqliteVecQueueDatabase
|
||||
|
||||
|
||||
class TestDeleteEmbeddings(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.tmp_dir = tempfile.TemporaryDirectory()
|
||||
self.db = SqliteVecQueueDatabase(os.path.join(self.tmp_dir.name, "test.db"))
|
||||
self.db.start()
|
||||
# the extension is not available to tests, so stand in for a database
|
||||
# that has it loaded and use a plain table for the deletes
|
||||
self.db.load_vec_extension = True
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.db.stop()
|
||||
self.db.close()
|
||||
self.tmp_dir.cleanup()
|
||||
|
||||
def _flush_writes(self) -> None:
|
||||
# writes are queued and applied by a worker thread, and the queue is
|
||||
# FIFO, so awaiting a later write means the earlier ones are done
|
||||
self.db.execute_sql("PRAGMA user_version = 0").fetchall()
|
||||
|
||||
def _create_thumbnails_table(self) -> None:
|
||||
self.db.execute_sql("CREATE TABLE vec_thumbnails (id TEXT PRIMARY KEY)")
|
||||
self.db.execute_sql("INSERT INTO vec_thumbnails (id) VALUES ('a'), ('b')")
|
||||
self._flush_writes()
|
||||
|
||||
def _thumbnail_ids(self) -> list[str]:
|
||||
return [row[0] for row in self.db.execute_sql("SELECT id FROM vec_thumbnails")]
|
||||
|
||||
def test_delete_without_tables_does_not_raise(self) -> None:
|
||||
# semantic search was never enabled, so event cleanup has nothing to do
|
||||
self.db.delete_embeddings_thumbnail(event_ids=["1700000000.0-abc"])
|
||||
self.db.delete_embeddings_description(event_ids=["1700000000.0-abc"])
|
||||
|
||||
def test_delete_removes_embeddings(self) -> None:
|
||||
self._create_thumbnails_table()
|
||||
|
||||
self.db.delete_embeddings_thumbnail(event_ids=["a"])
|
||||
self._flush_writes()
|
||||
|
||||
self.assertEqual(self._thumbnail_ids(), ["b"])
|
||||
|
||||
def test_delete_skipped_without_extension(self) -> None:
|
||||
self._create_thumbnails_table()
|
||||
self.db.load_vec_extension = False
|
||||
|
||||
self.db.delete_embeddings_thumbnail(event_ids=["a"])
|
||||
self._flush_writes()
|
||||
|
||||
# the vec0 tables cannot be written without the extension
|
||||
self.assertEqual(self._thumbnail_ids(), ["a", "b"])
|
||||
@@ -209,10 +209,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
if obj.obj_data.get("sub_label"):
|
||||
sub_label = obj.obj_data["sub_label"][0]
|
||||
|
||||
if (
|
||||
sub_label
|
||||
in self.config.model_for_camera(camera).all_attribute_logos
|
||||
):
|
||||
if sub_label in self.config.model.all_attribute_logos:
|
||||
self.dispatcher.publish(
|
||||
f"{camera}/{sub_label}/snapshot",
|
||||
jpg_bytes,
|
||||
|
||||
+1
-29
@@ -20,7 +20,7 @@ from frigate.util.services import get_video_properties
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
CURRENT_CONFIG_VERSION = "0.19-0"
|
||||
CURRENT_CONFIG_VERSION = "0.18-0"
|
||||
DEFAULT_CONFIG_FILE = os.path.join(CONFIG_DIR, "config.yml")
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_014(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.14"
|
||||
|
||||
logger.info("Migrating export file names...")
|
||||
@@ -118,7 +117,6 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_015_0(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.15-0"
|
||||
|
||||
if previous_version < "0.15-1":
|
||||
@@ -126,7 +124,6 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_015_1(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.15-1"
|
||||
|
||||
if previous_version < "0.16-0":
|
||||
@@ -134,7 +131,6 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_016_0(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.16-0"
|
||||
|
||||
if previous_version < "0.17-0":
|
||||
@@ -142,7 +138,6 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_017_0(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.17-0"
|
||||
|
||||
if previous_version < "0.18-0":
|
||||
@@ -150,17 +145,8 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_018_0(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.18-0"
|
||||
|
||||
if previous_version < "0.19-0":
|
||||
logger.info(f"Migrating frigate config from {previous_version} to 0.19-0...")
|
||||
new_config = migrate_019_0(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.19-0"
|
||||
|
||||
logger.info("Finished frigate config migration...")
|
||||
|
||||
|
||||
@@ -672,20 +658,6 @@ def migrate_018_0(config: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]
|
||||
return new_config
|
||||
|
||||
|
||||
def migrate_019_0(config: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]]:
|
||||
"""Handle migrating frigate config to 0.19-0"""
|
||||
new_config = config.copy()
|
||||
|
||||
# Migrate the single model config to named models
|
||||
model = new_config.pop("model", None)
|
||||
|
||||
if model is not None and "models" not in new_config:
|
||||
new_config["models"] = {"default": model}
|
||||
|
||||
new_config["version"] = "0.19-0"
|
||||
return new_config
|
||||
|
||||
|
||||
def get_relative_coordinates(
|
||||
mask: str | list | None,
|
||||
frame_shape: tuple[int, int],
|
||||
|
||||
@@ -326,7 +326,7 @@ def get_ort_providers(
|
||||
{
|
||||
"device_id": device_id,
|
||||
"trt_fp16_enable": requires_fp16
|
||||
and os.environ.get("USE_FP16", "True") != "False",
|
||||
and os.environ.get("USE_FP_16", "True") != "False",
|
||||
"trt_timing_cache_enable": True,
|
||||
"trt_engine_cache_enable": True,
|
||||
"trt_timing_cache_path": os.path.join(
|
||||
|
||||
@@ -1 +1 @@
|
||||
[{"id": "case-001", "name": "Package Theft Investigation", "description": "Review of suspicious activity near the front porch", "created_at": 1784761296.1184616, "updated_at": 1784836896.1184616}]
|
||||
[{"id": "case-001", "name": "Package Theft Investigation", "description": "Review of suspicious activity near the front porch", "created_at": 1780597809.365581, "updated_at": 1780673409.365581}]
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
[{"id": "event-person-001", "label": "person", "sub_label": null, "camera": "front_door", "start_time": 1784840496.1184616, "end_time": 1784840526.1184616, "false_positive": false, "zones": ["front_yard"], "thumbnail": null, "has_clip": true, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "abc123", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.92, "score": 0.92, "region": [0.1, 0.1, 0.5, 0.8], "box": [0.2, 0.15, 0.45, 0.75], "area": 0.18, "ratio": 0.6, "type": "object", "description": "A person walking toward the front door", "average_estimated_speed": 1.2, "velocity_angle": 45.0, "path_data": [[[0.2, 0.5], 0.0], [[0.3, 0.5], 1.0]]}}, {"id": "event-car-001", "label": "car", "sub_label": null, "camera": "backyard", "start_time": 1784836896.1184616, "end_time": 1784836941.1184616, "false_positive": false, "zones": ["driveway"], "thumbnail": null, "has_clip": true, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "def456", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.87, "score": 0.87, "region": [0.3, 0.2, 0.9, 0.7], "box": [0.35, 0.25, 0.85, 0.65], "area": 0.2, "ratio": 1.25, "type": "object", "description": "A car parked in the driveway", "average_estimated_speed": 0.0, "velocity_angle": 0.0, "path_data": []}}, {"id": "event-person-002", "label": "person", "sub_label": null, "camera": "garage", "start_time": 1784833296.1184616, "end_time": 1784833316.1184616, "false_positive": false, "zones": [], "thumbnail": null, "has_clip": false, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "ghi789", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.78, "score": 0.78, "region": [0.0, 0.0, 0.6, 0.9], "box": [0.1, 0.05, 0.5, 0.85], "area": 0.32, "ratio": 0.5, "type": "object", "description": null, "average_estimated_speed": 0.5, "velocity_angle": 90.0, "path_data": [[[0.1, 0.4], 0.0]]}}]
|
||||
[{"id": "event-person-001", "label": "person", "sub_label": null, "camera": "front_door", "start_time": 1780677009.365581, "end_time": 1780677039.365581, "false_positive": false, "zones": ["front_yard"], "thumbnail": null, "has_clip": true, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "abc123", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.92, "score": 0.92, "region": [0.1, 0.1, 0.5, 0.8], "box": [0.2, 0.15, 0.45, 0.75], "area": 0.18, "ratio": 0.6, "type": "object", "description": "A person walking toward the front door", "average_estimated_speed": 1.2, "velocity_angle": 45.0, "path_data": [[[0.2, 0.5], 0.0], [[0.3, 0.5], 1.0]]}}, {"id": "event-car-001", "label": "car", "sub_label": null, "camera": "backyard", "start_time": 1780673409.365581, "end_time": 1780673454.365581, "false_positive": false, "zones": ["driveway"], "thumbnail": null, "has_clip": true, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "def456", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.87, "score": 0.87, "region": [0.3, 0.2, 0.9, 0.7], "box": [0.35, 0.25, 0.85, 0.65], "area": 0.2, "ratio": 1.25, "type": "object", "description": "A car parked in the driveway", "average_estimated_speed": 0.0, "velocity_angle": 0.0, "path_data": []}}, {"id": "event-person-002", "label": "person", "sub_label": null, "camera": "garage", "start_time": 1780669809.365581, "end_time": 1780669829.365581, "false_positive": false, "zones": [], "thumbnail": null, "has_clip": false, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "ghi789", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.78, "score": 0.78, "region": [0.0, 0.0, 0.6, 0.9], "box": [0.1, 0.05, 0.5, 0.85], "area": 0.32, "ratio": 0.5, "type": "object", "description": null, "average_estimated_speed": 0.5, "velocity_angle": 90.0, "path_data": [[[0.1, 0.4], 0.0]]}}]
|
||||
@@ -1 +1 @@
|
||||
[{"id": "export-001", "camera": "front_door", "name": "Front Door - Person Alert", "date": 1784844096.1184616, "video_path": "/exports/export-001.mp4", "thumb_path": "/exports/export-001-thumb.jpg", "in_progress": false, "export_case_id": null}, {"id": "export-002", "camera": "backyard", "name": "Backyard - Car Detection", "date": 1784836896.1184616, "video_path": "/exports/export-002.mp4", "thumb_path": "/exports/export-002-thumb.jpg", "in_progress": false, "export_case_id": "case-001"}, {"id": "export-003", "camera": "garage", "name": "Garage - In Progress", "date": 1784845896.1184616, "video_path": "/exports/export-003.mp4", "thumb_path": "/exports/export-003-thumb.jpg", "in_progress": true, "export_case_id": null}]
|
||||
[{"id": "export-001", "camera": "front_door", "name": "Front Door - Person Alert", "date": 1780680609.365581, "video_path": "/exports/export-001.mp4", "thumb_path": "/exports/export-001-thumb.jpg", "in_progress": false, "export_case_id": null}, {"id": "export-002", "camera": "backyard", "name": "Backyard - Car Detection", "date": 1780673409.365581, "video_path": "/exports/export-002.mp4", "thumb_path": "/exports/export-002-thumb.jpg", "in_progress": false, "export_case_id": "case-001"}, {"id": "export-003", "camera": "garage", "name": "Garage - In Progress", "date": 1780682409.365581, "video_path": "/exports/export-003.mp4", "thumb_path": "/exports/export-003-thumb.jpg", "in_progress": true, "export_case_id": null}]
|
||||
@@ -102,17 +102,11 @@ def generate_config():
|
||||
snapshot = config.model_dump()
|
||||
|
||||
# Runtime-computed fields not in the Pydantic dump
|
||||
for model_dict in snapshot.get("models", {}).values():
|
||||
all_attrs = set()
|
||||
for attrs in model_dict.get("attributes_map", {}).values():
|
||||
all_attrs.update(attrs)
|
||||
model_dict["all_attributes"] = sorted(all_attrs)
|
||||
model_dict["colormap"] = {}
|
||||
|
||||
# legacy single-model block mirrors the default model, matching /api/config
|
||||
models = snapshot.get("models", {})
|
||||
default_key = "default" if "default" in models else next(iter(models))
|
||||
snapshot["model"] = models[default_key]
|
||||
all_attrs = set()
|
||||
for attrs in snapshot.get("model", {}).get("attributes_map", {}).values():
|
||||
all_attrs.update(attrs)
|
||||
snapshot["model"]["all_attributes"] = sorted(all_attrs)
|
||||
snapshot["model"]["colormap"] = {}
|
||||
|
||||
return snapshot
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"2026-07-23": {"day": "2026-07-23", "reviewed_alert": 1, "reviewed_detection": 0, "total_alert": 2, "total_detection": 2}, "2026-07-22": {"day": "2026-07-22", "reviewed_alert": 3, "reviewed_detection": 2, "total_alert": 3, "total_detection": 4}}
|
||||
{"2026-06-05": {"day": "2026-06-05", "reviewed_alert": 1, "reviewed_detection": 0, "total_alert": 2, "total_detection": 2}, "2026-06-04": {"day": "2026-06-04", "reviewed_alert": 3, "reviewed_detection": 2, "total_alert": 3, "total_detection": 4}}
|
||||
@@ -1 +1 @@
|
||||
[{"id": "review-alert-001", "camera": "front_door", "start_time": "2026-07-23T21:01:36.118462", "end_time": "2026-07-23T21:02:06.118462", "has_been_reviewed": false, "severity": "alert", "thumb_path": "/clips/front_door/review-alert-001-thumb.jpg", "data": {"audio": [], "detections": ["person-abc123"], "objects": ["person"], "sub_labels": [], "significant_motion_areas": [], "zones": ["front_yard"]}}, {"id": "review-alert-002", "camera": "backyard", "start_time": "2026-07-23T20:01:36.118462", "end_time": "2026-07-23T20:02:21.118462", "has_been_reviewed": true, "severity": "alert", "thumb_path": "/clips/backyard/review-alert-002-thumb.jpg", "data": {"audio": [], "detections": ["car-def456"], "objects": ["car"], "sub_labels": [], "significant_motion_areas": [], "zones": ["driveway"]}}, {"id": "review-detect-001", "camera": "garage", "start_time": "2026-07-23T19:01:36.118462", "end_time": "2026-07-23T19:01:56.118462", "has_been_reviewed": false, "severity": "detection", "thumb_path": "/clips/garage/review-detect-001-thumb.jpg", "data": {"audio": [], "detections": ["person-ghi789"], "objects": ["person"], "sub_labels": [], "significant_motion_areas": [], "zones": []}}, {"id": "review-detect-002", "camera": "front_door", "start_time": "2026-07-23T18:01:36.118462", "end_time": "2026-07-23T18:01:51.118462", "has_been_reviewed": false, "severity": "detection", "thumb_path": "/clips/front_door/review-detect-002-thumb.jpg", "data": {"audio": [], "detections": ["car-jkl012"], "objects": ["car"], "sub_labels": [], "significant_motion_areas": [], "zones": ["front_yard"]}}]
|
||||
[{"id": "review-alert-001", "camera": "front_door", "start_time": "2026-06-05T11:30:09.365581", "end_time": "2026-06-05T11:30:39.365581", "has_been_reviewed": false, "severity": "alert", "thumb_path": "/clips/front_door/review-alert-001-thumb.jpg", "data": {"audio": [], "detections": ["person-abc123"], "objects": ["person"], "sub_labels": [], "significant_motion_areas": [], "zones": ["front_yard"]}}, {"id": "review-alert-002", "camera": "backyard", "start_time": "2026-06-05T10:30:09.365581", "end_time": "2026-06-05T10:30:54.365581", "has_been_reviewed": true, "severity": "alert", "thumb_path": "/clips/backyard/review-alert-002-thumb.jpg", "data": {"audio": [], "detections": ["car-def456"], "objects": ["car"], "sub_labels": [], "significant_motion_areas": [], "zones": ["driveway"]}}, {"id": "review-detect-001", "camera": "garage", "start_time": "2026-06-05T09:30:09.365581", "end_time": "2026-06-05T09:30:29.365581", "has_been_reviewed": false, "severity": "detection", "thumb_path": "/clips/garage/review-detect-001-thumb.jpg", "data": {"audio": [], "detections": ["person-ghi789"], "objects": ["person"], "sub_labels": [], "significant_motion_areas": [], "zones": []}}, {"id": "review-detect-002", "camera": "front_door", "start_time": "2026-06-05T08:30:09.365581", "end_time": "2026-06-05T08:30:24.365581", "has_been_reviewed": false, "severity": "detection", "thumb_path": "/clips/front_door/review-detect-002-thumb.jpg", "data": {"audio": [], "detections": ["car-jkl012"], "objects": ["car"], "sub_labels": [], "significant_motion_areas": [], "zones": ["front_yard"]}}]
|
||||
@@ -1,129 +0,0 @@
|
||||
/**
|
||||
* Semantic Search settings tests -- MEDIUM tier.
|
||||
*
|
||||
* Focuses on the model_size field, which is unused when a GenAI embeddings
|
||||
* provider is selected as the semantic search model. The resolved config always
|
||||
* reports model_size (it has a schema default of "small"), even when the YAML
|
||||
* file has no such key. Clearing model_size for a provider used to run
|
||||
* unconditionally, which falsely marked the section dirty on load and asked the
|
||||
* backend to delete a key that wasn't in the config file (KeyError: 'model_size').
|
||||
*/
|
||||
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { test, expect } from "../../fixtures/frigate-test";
|
||||
import type { Page } from "@playwright/test";
|
||||
import { configFactory } from "../../fixtures/mock-data/config";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const CONFIG_SCHEMA = JSON.parse(
|
||||
readFileSync(
|
||||
resolve(__dirname, "../../fixtures/mock-data/config-schema.json"),
|
||||
"utf-8",
|
||||
),
|
||||
);
|
||||
|
||||
const PROVIDER = "llama_cpp";
|
||||
const SETTINGS_URL = "/settings?page=integrationSemanticSearch";
|
||||
const NOT_APPLICABLE = "Not applicable for GenAI providers";
|
||||
const UNSAVED = "You have unsaved changes";
|
||||
|
||||
type SemanticSearch = {
|
||||
enabled?: boolean;
|
||||
model?: string;
|
||||
model_size?: string;
|
||||
};
|
||||
|
||||
async function installRoutes(page: Page, semanticSearch: SemanticSearch) {
|
||||
const config = configFactory({
|
||||
genai: { [PROVIDER]: { provider: PROVIDER, roles: ["embeddings"] } },
|
||||
semantic_search: semanticSearch,
|
||||
});
|
||||
|
||||
let lastSavedConfig: unknown = null;
|
||||
|
||||
await page.route("**/api/config/schema.json", (route) =>
|
||||
route.fulfill({ json: CONFIG_SCHEMA }),
|
||||
);
|
||||
await page.route("**/api/config", (route) => {
|
||||
if (route.request().method() === "GET") {
|
||||
return route.fulfill({ json: config });
|
||||
}
|
||||
return route.fulfill({ json: { success: true } });
|
||||
});
|
||||
await page.route("**/api/config/set", async (route) => {
|
||||
lastSavedConfig = route.request().postDataJSON();
|
||||
await route.fulfill({ json: { success: true, require_restart: false } });
|
||||
});
|
||||
await page.route("**/api/config/raw_paths", (route) =>
|
||||
route.fulfill({ json: { semantic_search: semanticSearch } }),
|
||||
);
|
||||
|
||||
return { capturedConfig: () => lastSavedConfig };
|
||||
}
|
||||
|
||||
test.describe("semantic search model_size @medium", () => {
|
||||
test("a provider with a defaulted model_size is not dirty on load", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// model_size stays at its schema default ("small"), i.e. it is not present
|
||||
// in the YAML. This mirrors the reported bug: selecting a GenAI provider and
|
||||
// returning to the page.
|
||||
await installRoutes(frigateApp.page, {
|
||||
enabled: true,
|
||||
model: PROVIDER,
|
||||
});
|
||||
await frigateApp.goto(SETTINGS_URL);
|
||||
|
||||
// The provider path is active: model_size shows "Not applicable".
|
||||
await expect(frigateApp.page.getByText(NOT_APPLICABLE)).toBeVisible();
|
||||
|
||||
// Give any clearing effect time to fire, then confirm the section stayed
|
||||
// clean (no phantom unsaved-changes banner, Save disabled).
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
await expect(frigateApp.page.getByText(UNSAVED)).toBeHidden();
|
||||
await expect(
|
||||
frigateApp.page.getByRole("button", { name: "Save", exact: true }),
|
||||
).toBeDisabled();
|
||||
});
|
||||
|
||||
test("switching from a configured non-default model_size clears it", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// A genuinely configured non-default model_size ("large") can only come from
|
||||
// the YAML, so switching to a provider must still remove it.
|
||||
const capture = await installRoutes(frigateApp.page, {
|
||||
enabled: true,
|
||||
model: "jinav2",
|
||||
model_size: "large",
|
||||
});
|
||||
await frigateApp.goto(SETTINGS_URL);
|
||||
|
||||
// Starts clean on a Jina model.
|
||||
await expect(frigateApp.page.getByText(UNSAVED)).toBeHidden();
|
||||
|
||||
// Switch the model to the GenAI provider.
|
||||
await frigateApp.page
|
||||
.getByRole("combobox", { name: /Semantic search model/ })
|
||||
.click();
|
||||
await frigateApp.page.getByRole("option", { name: PROVIDER }).click();
|
||||
|
||||
// The change is now dirty and model_size is no longer applicable.
|
||||
await expect(frigateApp.page.getByText(NOT_APPLICABLE)).toBeVisible();
|
||||
await expect(frigateApp.page.getByText(UNSAVED)).toBeVisible();
|
||||
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: "Save", exact: true })
|
||||
.click();
|
||||
|
||||
// The saved payload removes model_size (empty string = "remove" key).
|
||||
await expect
|
||||
.poll(() => capture.capturedConfig(), { timeout: 5_000 })
|
||||
.toMatchObject({
|
||||
config_data: {
|
||||
semantic_search: { model: PROVIDER, model_size: "" },
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -86,10 +86,6 @@
|
||||
"label": "Enable object detection",
|
||||
"description": "Enable or disable object detection for this camera."
|
||||
},
|
||||
"model": {
|
||||
"label": "Detection model name",
|
||||
"description": "Name of the model (key under `models`) used by this camera. Defaults to the only defined model, or the model named 'default'."
|
||||
},
|
||||
"height": {
|
||||
"label": "Detect height",
|
||||
"description": "Height (pixels) of frames used for the detect stream; leave empty to use the native stream resolution."
|
||||
|
||||
@@ -322,17 +322,13 @@
|
||||
},
|
||||
"model_type": {
|
||||
"label": "Object Detection Model Type",
|
||||
"description": "Detector model architecture type (ssd, yolox, yolonas, yolo-generic, rfdetr, dfine) used by some detectors for optimization."
|
||||
"description": "Detector model architecture type (ssd, yolox, yolonas) used by some detectors for optimization."
|
||||
}
|
||||
},
|
||||
"model_path": {
|
||||
"label": "Detector specific model path",
|
||||
"description": "File path to the detector model binary if required by the chosen detector."
|
||||
},
|
||||
"model_key": {
|
||||
"label": "Assigned model name",
|
||||
"description": "Name of the model (key under `models`) this detector instance serves. Set automatically at runtime, users should not set this."
|
||||
},
|
||||
"axengine": {
|
||||
"label": "AXEngine NPU",
|
||||
"description": "AXERA AX650N/AX8850N NPU detector running compiled .axmodel files via the AXEngine runtime."
|
||||
@@ -458,9 +454,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models": {
|
||||
"label": "Detection models",
|
||||
"description": "Named object detection models. Cameras select a model with detect.model; detectors are assigned to models automatically.",
|
||||
"model": {
|
||||
"label": "Detection model",
|
||||
"description": "Settings to configure a custom object detection model and its input shape.",
|
||||
"path": {
|
||||
"label": "Custom object detector model path",
|
||||
"description": "Path to a custom detection model file (or plus://<model_id> for Frigate+ models)."
|
||||
@@ -499,7 +495,7 @@
|
||||
},
|
||||
"model_type": {
|
||||
"label": "Object Detection Model Type",
|
||||
"description": "Detector model architecture type (ssd, yolox, yolonas, yolo-generic, rfdetr, dfine) used by some detectors for optimization."
|
||||
"description": "Detector model architecture type (ssd, yolox, yolonas) used by some detectors for optimization."
|
||||
}
|
||||
},
|
||||
"genai": {
|
||||
@@ -629,10 +625,6 @@
|
||||
"label": "Enable object detection",
|
||||
"description": "Enable or disable object detection for all cameras; can be overridden per-camera."
|
||||
},
|
||||
"model": {
|
||||
"label": "Detection model name",
|
||||
"description": "Name of the model (key under `models`) used by this camera. Defaults to the only defined model, or the model named 'default'."
|
||||
},
|
||||
"height": {
|
||||
"label": "Detect height",
|
||||
"description": "Height (pixels) of frames used for the detect stream; leave empty to use the native stream resolution."
|
||||
|
||||
@@ -1936,8 +1936,7 @@
|
||||
"inputDimensionsNotDetectResolution": "Model input width and height are the input dimensions of the object detection model, not your camera's detect resolution. They should match the dimensions of the model you're using — typically a square size like 320x320 or 640x640."
|
||||
},
|
||||
"ffmpeg": {
|
||||
"hwaccelManualNotRecommended": "Manual hardware acceleration arguments are not recommended. Unless a specific requirement exists, select the preset that matches your hardware.",
|
||||
"inputsMissingGo2rtcStream": "An input below points at a go2rtc restream that no longer exists. Select an existing restream or enter the camera's URL manually, otherwise this camera will fail to connect."
|
||||
"hwaccelManualNotRecommended": "Manual hardware acceleration arguments are not recommended. Unless a specific requirement exists, select the preset that matches your hardware."
|
||||
},
|
||||
"objects": {
|
||||
"genaiNoDescriptionsProvider": "You must configure a GenAI provider with the 'descriptions' role for descriptions to be generated."
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { parseRestreamStreamName } from "../theme/fields/streamSource";
|
||||
import type { SectionConfigOverrides } from "./types";
|
||||
|
||||
const arrayAsTextWidget = {
|
||||
@@ -43,29 +42,6 @@ const ffmpeg: SectionConfigOverrides = {
|
||||
return false;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: "inputs-missing-go2rtc-stream",
|
||||
field: "inputs",
|
||||
position: "before",
|
||||
messageKey: "configMessages.ffmpeg.inputsMissingGo2rtcStream",
|
||||
severity: "warning",
|
||||
docLink: "/configuration/restream",
|
||||
condition: (ctx) => {
|
||||
const streams = ctx.fullConfig?.go2rtc?.streams;
|
||||
const inputs = ctx.formData?.inputs;
|
||||
if (!Array.isArray(inputs)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return inputs.some((input) => {
|
||||
const path = (input as { path?: unknown } | null)?.path;
|
||||
const streamName = parseRestreamStreamName(
|
||||
typeof path === "string" ? path : undefined,
|
||||
);
|
||||
return streamName !== undefined && !(streamName in (streams ?? {}));
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
fieldDocs: {
|
||||
hwaccel_args: "/configuration/ffmpeg_presets#hwaccel-presets",
|
||||
|
||||
@@ -74,7 +74,6 @@ const SECTIONS_WITHOUT_OVERRIDE_BADGE = new Set([
|
||||
"birdseye",
|
||||
"detectors",
|
||||
"model",
|
||||
"models",
|
||||
]);
|
||||
|
||||
type CameraEntryProps = {
|
||||
|
||||
@@ -170,12 +170,6 @@ export function CameraInputsField(props: FieldProps) {
|
||||
[go2rtcStreamNames],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setSourceModeByIndex((previous) =>
|
||||
Object.keys(previous).length > 0 ? {} : previous,
|
||||
);
|
||||
}, [formContext?.cameraName]);
|
||||
|
||||
useEffect(() => {
|
||||
setOpenByIndex((previous) => {
|
||||
const next: Record<number, boolean> = {};
|
||||
@@ -228,12 +222,18 @@ export function CameraInputsField(props: FieldProps) {
|
||||
const handleSourceModeChange = useCallback(
|
||||
(index: number, nextMode: StreamSourceMode) => {
|
||||
const input = inputs[index];
|
||||
const currentPath =
|
||||
typeof input?.path === "string" ? input.path : undefined;
|
||||
|
||||
// Only revert the preset we set ourselves; never clobber custom args.
|
||||
// The path is left alone until a stream is picked, so switching modes
|
||||
// never discards a typed URL or empties a required field.
|
||||
if (nextMode === "manual" && input?.input_args === RESTREAM_PRESET) {
|
||||
handleFieldValuesChange(index, { input_args: undefined });
|
||||
if (nextMode === "manual") {
|
||||
// Only revert the preset we set ourselves; never clobber custom args.
|
||||
if (input?.input_args === RESTREAM_PRESET) {
|
||||
handleFieldValuesChange(index, { input_args: undefined });
|
||||
}
|
||||
} else if (!parseRestreamStreamName(currentPath)) {
|
||||
// Entering restream with a non-restream path: clear it so the dropdown
|
||||
// shows its placeholder until a stream is chosen.
|
||||
handleFieldValuesChange(index, { path: undefined });
|
||||
}
|
||||
|
||||
setSourceModeByIndex((previous) => ({ ...previous, [index]: nextMode }));
|
||||
|
||||
@@ -24,19 +24,15 @@ export function SemanticSearchModelSizeWidget(props: WidgetProps) {
|
||||
model !== "jinav1" &&
|
||||
model !== "jinav2";
|
||||
|
||||
// model_size is unused on a GenAI provider. Only clear it (which the backend
|
||||
// treats as "remove") for a non-default value, which can only come from the
|
||||
// config file. A defaulted value is indistinguishable from unset in the
|
||||
// resolved config, so clearing it would falsely dirty the field and delete a
|
||||
// YAML key that isn't there. Restore the default when returning to a Jina model.
|
||||
// Clear model_size while on a provider (buildOverrides converts to ""
|
||||
// which the backend treats as "remove"). Restore the schema default
|
||||
// when returning to a Jina model so the field isn't left empty.
|
||||
const { value, onChange, schema } = props;
|
||||
const schemaDefault = schema?.default as string | undefined;
|
||||
useEffect(() => {
|
||||
if (isProvider) {
|
||||
if (value !== undefined && value !== schemaDefault) {
|
||||
onChange(undefined);
|
||||
}
|
||||
} else if (value === undefined && schemaDefault) {
|
||||
if (isProvider && value !== undefined) {
|
||||
onChange(undefined);
|
||||
} else if (!isProvider && value === undefined && schemaDefault) {
|
||||
onChange(schemaDefault);
|
||||
}
|
||||
}, [isProvider, value, onChange, schemaDefault]);
|
||||
|
||||
@@ -70,17 +70,7 @@ export function extractSectionSchema(
|
||||
// For global level, get from root properties
|
||||
if (schemaObj.properties) {
|
||||
const props = schemaObj.properties;
|
||||
let sectionProp = props[sectionPath];
|
||||
|
||||
// the model editor edits a single entry of the `models` map, so
|
||||
// resolve the map value schema since there is no root `model` property
|
||||
if (!sectionProp && sectionPath === "model") {
|
||||
const modelsProp = props["models"] as SchemaWithDefinitions | undefined;
|
||||
const additional = modelsProp?.additionalProperties;
|
||||
if (additional && typeof additional === "object") {
|
||||
sectionProp = additional as RJSFSchema;
|
||||
}
|
||||
}
|
||||
const sectionProp = props[sectionPath];
|
||||
|
||||
if (sectionProp && typeof sectionProp === "object") {
|
||||
if ("$ref" in sectionProp && typeof sectionProp.$ref === "string") {
|
||||
|
||||
@@ -59,7 +59,6 @@ export interface CameraConfig {
|
||||
height: number;
|
||||
max_disappeared: number;
|
||||
min_initialized: number;
|
||||
model: string;
|
||||
stationary: {
|
||||
interval: number;
|
||||
max_frames: {
|
||||
@@ -395,30 +394,6 @@ export type GenAIAgentConfig = {
|
||||
runtime_options?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export interface ModelConfig {
|
||||
height: number;
|
||||
input_pixel_format: string;
|
||||
input_tensor: string;
|
||||
labelmap: Record<string, unknown>;
|
||||
labelmap_path: string | null;
|
||||
model_type: string;
|
||||
path: string | null;
|
||||
width: number;
|
||||
colormap: { [key: string]: [number, number, number] };
|
||||
attributes_map: { [key: string]: string[] };
|
||||
all_attributes: string[];
|
||||
plus?: {
|
||||
name: string;
|
||||
id: string;
|
||||
trainDate: string;
|
||||
baseModel: string;
|
||||
isBaseModel: boolean;
|
||||
supportedDetectors: string[];
|
||||
width: number;
|
||||
height: number;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface FrigateConfig {
|
||||
version: string;
|
||||
safe_mode: boolean;
|
||||
@@ -471,7 +446,6 @@ export interface FrigateConfig {
|
||||
height: number | null;
|
||||
max_disappeared: number | null;
|
||||
min_initialized: number | null;
|
||||
model: string | null;
|
||||
stationary: {
|
||||
interval: number | null;
|
||||
max_frames: {
|
||||
@@ -538,10 +512,29 @@ export interface FrigateConfig {
|
||||
logs: Record<string, string>;
|
||||
};
|
||||
|
||||
// legacy single-model block, mirrors the default entry of `models`
|
||||
model: ModelConfig;
|
||||
|
||||
models: { [modelKey: string]: ModelConfig };
|
||||
model: {
|
||||
height: number;
|
||||
input_pixel_format: string;
|
||||
input_tensor: string;
|
||||
labelmap: Record<string, unknown>;
|
||||
labelmap_path: string | null;
|
||||
model_type: string;
|
||||
path: string | null;
|
||||
width: number;
|
||||
colormap: { [key: string]: [number, number, number] };
|
||||
attributes_map: { [key: string]: string[] };
|
||||
all_attributes: string[];
|
||||
plus?: {
|
||||
name: string;
|
||||
id: string;
|
||||
trainDate: string;
|
||||
baseModel: string;
|
||||
isBaseModel: boolean;
|
||||
supportedDetectors: string[];
|
||||
width: number;
|
||||
height: number;
|
||||
} | null;
|
||||
};
|
||||
|
||||
motion: Record<string, unknown> | null;
|
||||
|
||||
|
||||
@@ -115,10 +115,8 @@ const STATUS_BAR_KEY = "detectors_and_model";
|
||||
const EMPTY_PENDING: Record<string, ConfigSectionData> = {};
|
||||
|
||||
const deriveInitialState = (config: FrigateConfig): PageState => {
|
||||
// this view edits the default model; other named models are untouched
|
||||
const defaultModel = config.models?.default ?? config.model;
|
||||
const plusModelId = defaultModel?.plus?.id;
|
||||
const modelPath = defaultModel?.path;
|
||||
const plusModelId = config.model?.plus?.id;
|
||||
const modelPath = config.model?.path;
|
||||
const plusEnabled = Boolean(config.plus?.enabled);
|
||||
|
||||
// The reliable signal that a Plus model is currently active is the
|
||||
@@ -138,8 +136,10 @@ const deriveInitialState = (config: FrigateConfig): PageState => {
|
||||
modelTab = "custom";
|
||||
}
|
||||
|
||||
const { plus: _plus, ...modelWithoutPlus } = (defaultModel ??
|
||||
{}) as unknown as Record<string, unknown>;
|
||||
const { plus: _plus, ...modelWithoutPlus } = (config.model ?? {}) as Record<
|
||||
string,
|
||||
unknown
|
||||
>;
|
||||
// If a Plus model is active, the resolved `model.path` is auto-derived from
|
||||
// `plus.id` — drop it so the Custom tab starts clean and doesn't silently
|
||||
// re-save the same Plus model when the user thinks they switched modes.
|
||||
@@ -476,7 +476,7 @@ export default function DetectorsAndModelSettingsView({
|
||||
try {
|
||||
await axios.put("config/set", {
|
||||
requires_restart: 0,
|
||||
config_data: { detectors: null, models: { default: null } },
|
||||
config_data: { detectors: null, model: null },
|
||||
});
|
||||
preCleared = true;
|
||||
} catch {
|
||||
@@ -488,7 +488,7 @@ export default function DetectorsAndModelSettingsView({
|
||||
requires_restart: 0,
|
||||
config_data: {
|
||||
detectors: sanitizedDetectors,
|
||||
models: { default: modelPayload },
|
||||
model: modelPayload,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -541,7 +541,7 @@ export default function DetectorsAndModelSettingsView({
|
||||
snapshot.detectors,
|
||||
detectorHiddenFields,
|
||||
),
|
||||
models: { default: restoreModel },
|
||||
model: restoreModel,
|
||||
},
|
||||
});
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user