NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Merge remote-tracking branch 'origin/master' into dev
Blake Blackshear6a2b914b10f9
diff --cc docs/docs/configuration/object_detectors.mdindex 2821fb7a27,4a0f014d49..7519f8e8f5--- a/docs/docs/configuration/object_detectors.md+++ b/docs/docs/configuration/object_detectors.md@@@ -705,14 -462,11 +705,14 @@@ modelpath: /config/model_cache/rfdetr.onnx```+</TabItem>+</ConfigTabs>+</details>- #### D-FINE+ #### D-FINE / DEIMv2- [D-FINE](https://github.com/Peterande/D-FINE) is a DETR based model. The ONNX exported models are supported, but not included by default. See [the models section](#downloading-d-fine-model) for more information on downloading the D-FINE model for use in Frigate.+ [D-FINE](https://github.com/Peterande/D-FINE) and [DEIMv2](https://github.com/Intellindust-AI-Lab/DEIMv2) are DETR based models that share the same ONNX input/output format. The ONNX exported models are supported, but not included by default. See the models section for downloading [D-FINE](#downloading-d-fine-model) or [DEIMv2](#downloading-deimv2-model) for use in Frigate.:::warning@@@ -1210,14 -845,11 +1235,14 @@@ modelpath: /config/model_cache/rfdetr.onnx```+</TabItem>+</ConfigTabs>+</details>- #### D-FINE+ #### D-FINE / DEIMv2- [D-FINE](https://github.com/Peterande/D-FINE) is a DETR based model. The ONNX exported models are supported, but not included by default. See [the models section](#downloading-d-fine-model) for more information on downloading the D-FINE model for use in Frigate.+ [D-FINE](https://github.com/Peterande/D-FINE) and [DEIMv2](https://github.com/Intellindust-AI-Lab/DEIMv2) are DETR based models that share the same ONNX input/output format. The ONNX exported models are supported, but not included by default. See the models section for downloading [D-FINE](#downloading-d-fine-model) or [DEIMv2](#downloading-deimv2-model) for use in Frigate.<details><summary>D-FINE Setup & Config</summary>@@@ -1257,11 -871,30 +1282,33 @@@ modellabelmap_path: /labelmap/coco-80.txt```+</TabItem>+</ConfigTabs>+</details>+ <details>+ <summary>DEIMv2 Setup & Config</summary>++ After placing the downloaded onnx model in your `config/model_cache` folder, you can use the following configuration:++ ```yaml+ detectors:+ onnx:+ type: onnx++ model:+ model_type: dfine+ width: 640+ height: 640+ input_tensor: nchw+ input_dtype: float+ path: /config/model_cache/deimv2_hgnetv2_n.onnx+ labelmap_path: /labelmap/coco-80.txt+ ```++ </details>+Note that the labelmap uses a subset of the complete COCO label set that has only 80 objects.## CPU Detector (not recommended)@@@ -1454,12 -1026,9 +1501,12 @@@ model# └── yolonas_post.onnx (optional; only if the model includes a cropped post-processing network)```+</TabItem>+</ConfigTabs>+#### YOLOv9- The YOLOv9s model included in this detector is downloaded from [the original GitHub](https://github.com/WongKinYiu/yolov9) like in the [Models Section](#yolov9-1) and compiled to DFP with [mx_nc](https://developer.memryx.com/tools/neural_compiler.html#usage).+ The YOLOv9s model included in this detector is downloaded from [the original GitHub](https://github.com/WongKinYiu/yolov9) like in the [Models Section](#yolov9-1) and compiled to DFP with [mx_nc](https://developer.memryx.com/2p1/tools/neural_compiler.html#usage).##### Configuration@@@ -1596,24 -1108,41 +1643,44 @@@ model# └── ssdlite_mobilenet_post.onnx (optional; only if the model includes a cropped post-processing network)```+</TabItem>+</ConfigTabs>+#### Using a Custom Model- To use your own model:+ To use your own custom model, first compile it into a [.dfp](https://developer.memryx.com/2p1/specs/files.html#dataflow-program) file, which is the format used by MemryX.++ #### Compile the Model++ Custom models must be compiled using **MemryX SDK 2.1**.++ Before compiling your model, install the MemryX Neural Compiler tools from the+ [Install Tools](https://developer.memryx.com/2p1/get_started/install_tools.html) page on the **host**.++ > **Note:** It is recommended to compile the model on the host machine, or on another separate machine, rather than inside the Frigate Docker container. Installing the compiler inside Docker may conflict with container packages. It is recommended to create a Python virtual environment and install the compiler there.++ Once the SDK 2.1 environment is set up, follow the+ [MemryX Compiler](https://developer.memryx.com/2p1/tools/neural_compiler.html#usage) documentation to compile your model.++ Example:++ ```bash+ mx_nc -m yolonas.onnx -c 4 --autocrop -v --dfp_fname yolonas.dfp+ ```- 1. Package your compiled model into a `.zip` file.+ For detailed instructions on compiling models, refer to the [MemryX Compiler](https://developer.memryx.com/2p1/tools/neural_compiler.html#usage) docs and [Tutorials](https://developer.memryx.com/2p1/tutorials/tutorials.html).- 2. The `.zip` must contain the compiled `.dfp` file.+ #### Package the Compiled Model- 3. Depending on the model, the compiler may also generate a cropped post-processing network. If present, it will be named with the suffix `_post.onnx`.+ 1. Package your compiled model into a `.zip` file.- 4. Bind-mount the `.zip` file into the container and specify its path using `model.path` in your config.+ 2. The `.zip` file must contain the compiled `.dfp` file.- 5. Update the `labelmap_path` to match your custom model's labels.+ 3. Depending on the model, the compiler may also generate a cropped post-processing network. If present, it will be named with the suffix `_post.onnx`.- For detailed instructions on compiling models, refer to the [MemryX Compiler](https://developer.memryx.com/tools/neural_compiler.html#usage) docs and [Tutorials](https://developer.memryx.com/tutorials/tutorials.html).+ 4. Bind-mount the `.zip` file into the container and specify its path using `model.path` in your config.++ 5. Update `labelmap_path` to match your custom model's labels.```yaml# The detector automatically selects the default model if nothing is provided in the config.diff --cc docs/docs/configuration/record.mdindex 614beafed7,e805cc2d7d..3d5ef35ba1--- a/docs/docs/configuration/record.md+++ b/docs/docs/configuration/record.md@@@ -120,82 -66,9 +120,82 @@@ recordmode: motion```+</TabItem>+</ConfigTabs>++## Pre-capture and Post-capture++The `pre_capture` and `post_capture` settings control how many seconds of video are included before and after an alert or detection. These can be configured independently for alerts and detections, and can be set globally or overridden per camera.++<ConfigTabs>+<TabItem value="ui">++Navigate to <NavPath path="Settings > Global configuration > Recording" /> for global defaults, or <NavPath path="Settings > Camera configuration > (select camera) > Recording" /> to override for a specific camera.++| Field | Description |+| ---------------------------------------------- | ---------------------------------------------------- |+| **Alert retention > Pre-capture seconds** | Seconds of video to include before an alert event |+| **Alert retention > Post-capture seconds** | Seconds of video to include after an alert event |+| **Detection retention > Pre-capture seconds** | Seconds of video to include before a detection event |+| **Detection retention > Post-capture seconds** | Seconds of video to include after a detection event |++</TabItem>+<TabItem value="yaml">++```yaml+record:+ enabled: True+ alerts:+ pre_capture: 5 # seconds before the alert to include+ post_capture: 5 # seconds after the alert to include+ detections:+ pre_capture: 5 # seconds before the detection to include+ post_capture: 5 # seconds after the detection to include+```++</TabItem>+</ConfigTabs>++- **Default**: 5 seconds for both pre and post capture.+- **Pre-capture maximum**: 60 seconds.+- These settings apply per review category (alerts and detections), not per object type.++### How pre/post capture interacts with retention mode++The `pre_capture` and `post_capture` values define the **time window** around a review item, but only recording segments that also match the configured **retention mode** are actually kept on disk.++- **`mode: all`** — Retains every segment within the capture window, regardless of whether motion was detected.+- **`mode: motion`** (default) — Only retains segments within the capture window that contain motion. This includes segments with active tracked objects, since object motion implies motion. Segments without any motion are discarded even if they fall within the pre/post capture range.+- **`mode: active_objects`** — Only retains segments within the capture window where tracked objects were actively moving. Segments with general motion but no active objects are discarded.++This means that with the default `motion` mode, you may see less footage than the configured pre/post capture duration if parts of the capture window had no motion.++To guarantee the full pre/post capture duration is always retained:++```yaml+record:+ enabled: True+ alerts:+ pre_capture: 10+ post_capture: 10+ retain:+ days: 30+ mode: all # retains all segments within the capture window+```++:::note++Because recording segments are written in 10 second chunks, pre-capture timing depends on segment boundaries. The actual pre-capture footage may be slightly shorter or longer than the exact configured value.++:::++### Where to view pre/post capture footage++Pre and post capture footage is included in the **recording timeline**, visible in the History view. Note that pre/post capture settings only affect which recording segments are **retained on disk** — they do not change the start and end points shown in the UI. The History view will still center on the review item's actual time range, but you can scrub backward and forward through the retained pre/post capture footage on the timeline. The Explore view shows object-specific clips that are trimmed to when the tracked object was actually visible, so pre/post capture time will not be reflected there.+## Will Frigate delete old recordings if my storage runs out?- As of Frigate 0.12 if there is less than an hour left of storage, the oldest 2 hours of recordings will be deleted.+ If there is less than an hour left of storage, the oldest hour of recordings will be deleted and a message will be printed in the Frigate logs. This emergency cleanup deletes the oldest recordings first regardless of retention settings to reclaim space as quickly as possible.## Configuring Recording Retentiondiff --cc docs/docs/configuration/restream.mdindex af4d635c6e,5955770a22..d488c54104--- a/docs/docs/configuration/restream.md+++ b/docs/docs/configuration/restream.md@@@ -236,7 -208,7 +236,7 @@@ Enabling arbitrary exec sources allows## Advanced Restream Configurations- The [exec](https://github.com/AlexxIT/go2rtc/tree/v1.9.13#source-exec) source in go2rtc can be used for custom ffmpeg commands. An example is below:-The [exec](https://github.com/AlexxIT/go2rtc/tree/v1.9.10#source-exec) source in go2rtc can be used for custom ffmpeg commands and other applications. An example is below:++The [exec](https://github.com/AlexxIT/go2rtc/tree/v1.9.13#source-exec) source in go2rtc can be used for custom ffmpeg commands and other applications. An example is below::::warning