From 5a081e4f004cab179babcb14616c0f667e288836 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sat, 24 Oct 2020 08:23:16 -0500 Subject: [PATCH] docs rewrite --- .dockerignore | 2 +- README.md | 725 +++++++++++++++++++++++--------- config/back-mask.bmp | Bin 1843256 -> 0 bytes config/config.example.yml | 234 ----------- docs/HWACCEL.md | 32 -- docs/{CAMERAS.md => cameras.md} | 2 - diagram.png => docs/diagram.png | Bin docs/frigate.png | Bin 0 -> 12157 bytes docs/how-frigate-works.md | 10 + 9 files changed, 541 insertions(+), 464 deletions(-) delete mode 100644 config/back-mask.bmp delete mode 100644 config/config.example.yml delete mode 100644 docs/HWACCEL.md rename docs/{CAMERAS.md => cameras.md} (94%) rename diagram.png => docs/diagram.png (100%) create mode 100644 docs/frigate.png create mode 100644 docs/how-frigate-works.md diff --git a/.dockerignore b/.dockerignore index d77da2b48a..0fb206db65 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ README.md -diagram.png +docs/ .gitignore debug config/ diff --git a/README.md b/README.md index 08dbd94996..3639696996 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,73 @@ +

+ logo +

+ # Frigate - NVR With Realtime Object Detection for IP Cameras Uses OpenCV and Tensorflow to perform realtime object detection locally for IP cameras. Designed for integration with HomeAssistant or others via MQTT. -Use of a [Google Coral Accelerator](https://coral.ai/products/) is optional, but highly recommended. On my Intel i7 processor, I can process 2-3 FPS with the CPU. The Coral can process 100+ FPS with very low CPU load. +Use of a [Google Coral Accelerator](https://coral.ai/products/) is optional, but highly recommended. The Coral will outperform even the best CPUs and can process 100+ FPS with very little overhead. +- Designed to minimize resource use and maximize performance by only looking for objects when and where it is necessary - Leverages multiprocessing heavily with an emphasis on realtime over processing every frame - Uses a very low overhead motion detection to determine where to run object detection -- Object detection with Tensorflow runs in a separate process -- Object info is published over MQTT for integration into HomeAssistant as a binary sensor -- An endpoint is available to view an MJPEG stream for debugging, but should not be used continuously +- Object detection with TensorFlow runs in separate processes for maximum FPS +- Communicates over MQTT for easy integration into other systems -![Diagram](diagram.png) +## Documentation +- [How Frigate Works](docs/how-frigate-works.md) +- [Recommended Hardware](#recommended-hardware) +- [Installing](#installing) +- [Configuration File](#configuration) +- [Optimizing Performance](#optimizing-performance) +- [Detectors](#detectors) +- [Object Filters](#object-filters) +- [Masks](#masks) +- [Zones](#zones) +- [Integration with HomeAssistant](#integration-with-homeassistant) +- [MQTT Topics](#mqtt-topics) +- [HTTP Endpoints](#http-endpoints) +- [Custom Models](#custom-models) +- [Troubleshooting](#troubleshooting) -## Example video (from older version) -You see multiple bounding boxes because it draws bounding boxes from all frames in the past 1 second where a person was detected. Not all of the bounding boxes were from the current frame. -[![](http://img.youtube.com/vi/nqHbCtyo4dY/0.jpg)](http://www.youtube.com/watch?v=nqHbCtyo4dY "Frigate") +## Recommended Hardware +|Name|Inference Speed|Notes| +|----|---------------|-----| +|Atomic Pi|16ms|Good option for a dedicated low power board with a small number of cameras. Can leverage Intel QuickSync for stream decoding.| +|Intel NUC NUC7i3BNK|8-10ms|Great performance. Can handle many cameras at 5fps depending on typical amounts of motion.| +|BMAX B2 Plus|10-12ms|Good balance of performance and cost. Also capable of running many other services at the same time as frigate.| +|Minisforum GK41|9-10ms|Great alternative to a NUC with dual Gigabit NICs. Easily handles several 1080p cameras.| +|Raspberry Pi 3B (32bit)|60ms|Can handle a small number of cameras, but the detection speeds are slow due to USB 2.0.| +|Raspberry Pi 4 (32bit)|15-20ms|Can handle a small number of cameras. The 2GB version runs fine.| +|Raspberry Pi 4 (64bit)|10-15ms|Can handle a small number of cameras. The 2GB version runs fine.| -## Documentation -- [Camera Specific Docs](docs/CAMERAS.md) -- [Hardware Acceleration](docs/HWACCEL.md) +[Back to top](#documentation) -## Getting Started -Run the container with -```bash -docker run --rm \ ---name frigate \ ---privileged \ ---shm-size=100m \ # only needed with large numbers of high res cameras --v /dev/bus/usb:/dev/bus/usb \ --v :/config:ro \ --v /etc/localtime:/etc/localtime:ro \ --p 5000:5000 \ --e FRIGATE_RTSP_PASSWORD='password' \ -blakeblackshear/frigate:0.7.0-amd64 -``` +## Installing + +### HassOS Addon +HassOS users can install via the addon repository. Frigate requires that an MQTT server be running. +1. Navigate to Supervisor > Add-on Store > Repositories +1. Add https://github.com/blakeblackshear/frigate-hass-addons +1. Setup your configuration in the `Configuration` tab +1. Start the addon container -Example docker-compose: +### Docker +It is recommended to run with docker-compose: ```yaml frigate: container_name: frigate restart: unless-stopped privileged: true - shm_size: '100m' # only needed with large numbers of high res cameras - image: blakeblackshear/frigate:0.7.0-amd64 + image: blakeblackshear/frigate:stable-amd64 volumes: - /dev/bus/usb:/dev/bus/usb - /etc/localtime:/etc/localtime:ro - :/config - - :/clips + - :/clips + - type: tmpfs # 1GB of memory, reduces SSD/SD Card wear + target: /cache + tmpfs: + size: 100000000 ports: - "5000:5000" environment: @@ -59,7 +80,44 @@ Example docker-compose: start_period: 3m ``` -A `config.yml` file must exist in the `config` directory. See example [here](config/config.example.yml) and camera specific info can be found [here](docs/CAMERAS.md). +If you can't use docker compose, you can run the container with: +```bash +docker run --rm \ +--name frigate \ +--privileged \ +-v /dev/bus/usb:/dev/bus/usb \ +-v :/config:ro \ +-v /etc/localtime:/etc/localtime:ro \ +-p 5000:5000 \ +-e FRIGATE_RTSP_PASSWORD='password' \ +blakeblackshear/frigate:stable-amd64 +``` + +### Kubernetes +Use the [helm chart](https://github.com/k8s-at-home/charts/tree/master/charts/frigate). + +### Virtualization +For ideal performance, Frigate needs access to underlying hardware for the Coral and GPU devices for ffmpeg decoding. Running Frigate in a VM on top of Proxmox, ESXi, Virtualbox, etc. is not recommended. The virtualization layer typically introduces a sizable amount of overhead for communication with Coral devices. + +#### Proxmox +Some people have had success running Frigate in LXC directly with the following config: +``` +arch: amd64 +cores: 2 +features: nesting=1 +hostname: FrigateLXC +memory: 4096 +net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=2E:76:AE:5A:58:48,ip=dhcp,ip6=auto,type=veth +ostype: debian +rootfs: local-lvm:vm-115-disk-0,size=12G +swap: 512 +lxc.cgroup.devices.allow: c 189:385 rwm +lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file +lxc.mount.entry: /dev/bus/usb/004/002 dev/bus/usb/004/002 none bind,optional,create=file +lxc.apparmor.profile: unconfined +lxc.cgroup.devices.allow: a +lxc.cap.drop: +``` ### Calculating shm-size The default shm-size of 64m should be fine for most setups. If you start seeing segfault errors, it could be because you have too many high resolution cameras and you need to specify a higher shm size. @@ -68,25 +126,368 @@ You can calculate the necessary shm-size for each camera with the following form ``` (width * height * 3 + 270480)/1048576 = ``` +[Back to top](#documentation) -## Recommended Hardware -|Name|Inference Speed|Notes| -|----|---------------|-----| -|Atomic Pi|16ms|Best option for a dedicated low power board with a small number of cameras.| -|Intel NUC NUC7i3BNK|8-10ms|Best possible performance. Can handle 7+ cameras at 5fps depending on typical amounts of motion.| -|BMAX B2 Plus|10-12ms|Good balance of performance and cost. Also capable of running many other services at the same time as frigate.| -|Minisforum GK41|9-10ms|Great alternative to a NUC. Easily handiles 4 1080p cameras.| -|Raspberry Pi 3B (32bit)|60ms|Can handle a small number of cameras, but the detection speeds are slow| -|Raspberry Pi 4 (32bit)|15-20ms|Can handle a small number of cameras. The 2GB version runs fine.| -|Raspberry Pi 4 (64bit)|10-15ms|Can handle a small number of cameras. The 2GB version runs fine.| +## Configuration +HassOS users can manage their configuration directly in the addon Configuration tab. For other installations, the default location for the config file is `/config/config.yml`. This can be overridden with the `CONFIG_FILE` environment variable. Camera specific ffmpeg parameters are documented [here](docs/cameras.md). + +```yaml +# Optional: port for http server (default: shown below) +web_port: 5000 + +# Optional: detectors configuration +# USB Coral devices will be auto detected with CPU fallback +detectors: + # Required: name of the detector + coral: + # Required: type of the detector + # Valid values are 'edgetpu' (requires device property below) and 'cpu'. + type: edgetpu + # Optional: device name as defined here: https://coral.ai/docs/edgetpu/multiple-edgetpu/#using-the-tensorflow-lite-python-api + device: usb + +# Required: mqtt configuration +mqtt: + # Required: host name + host: mqtt.server.com + # Optional: port (default: shown below) + port: 1883 + # Optional: topic prefix (default: shown below) + # WARNING: must be unique if you are running multiple instances + topic_prefix: frigate + # Optional: client id (default: shown below) + # WARNING: must be unique if you are running multiple instances + client_id: frigate + # Optional: user + user: mqtt_user + # Optional: password + # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}. + # eg. password: '{FRIGATE_MQTT_PASSWORD}' + password: password + +# Optional: Global configuration for saving clips +save_clips: + # Optional: Maximum length of time to retain video during long events. (default: shown below) + # NOTE: If an object is being tracked for longer than this amount of time, the cache + # will begin to expire and the resulting clip will be the last x seconds of the event. + max_seconds: 300 + # Optional: Location to save event clips. (default: shown below) + clips_dir: /clips + # Optional: Location to save cache files for creating clips. (default: shown below) + # NOTE: To reduce wear on SSDs and SD cards, use a tmpfs volume. + cache_dir: /cache + +# Optional: Global ffmpeg args +# "ffmpeg" + global_args + input_args + "-i" + input + output_args +ffmpeg: + # Optional: global ffmpeg args (default: shown below) + global_args: + - -hide_banner + - -loglevel + - panic + # Optional: global hwaccel args (default: shown below) + # NOTE: See hardware acceleration docs for your specific device + hwaccel_args: [] + # Optional: global input args (default: shown below) + input_args: + - -avoid_negative_ts + - make_zero + - -fflags + - nobuffer + - -flags + - low_delay + - -strict + - experimental + - -fflags + - +genpts+discardcorrupt + - -rtsp_transport + - tcp + - -stimeout + - '5000000' + - -use_wallclock_as_timestamps + - '1' + # Optional: global output args (default: shown below) + output_args: + - -f + - rawvideo + - -pix_fmt + - yuv420p + +# Optional: Global object filters for all cameras. +# NOTE: can be overridden at the camera level +objects: + # Optional: list of objects to track from labelmap.txt (default: shown below) + track: + - person + # Optional: filters to reduce false positives for specific object types + filters: + person: + # Optional: minimum width*height of the bounding box for the detected object (default: 0) + min_area: 5000 + # Optional: maximum width*height of the bounding box for the detected object (default: max_int) + max_area: 100000 + # Optional: minimum score for the object to initiate tracking (default: shown below) + min_score: 0.5 + # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below) + threshold: 0.85 + +# Required: configuration section for cameras +cameras: + # Required: name of the camera + back: + # Required: ffmpeg settings for the camera + ffmpeg: + # Required: Source passed to ffmpeg after the -i parameter. + # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {} + input: rtsp://viewer:{FRIGATE_RTSP_PASSWORD}@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2 + # Optional: camera specific global args (default: inherit) + global_args: + # Optional: camera specific hwaccel args (default: inherit) + hwaccel_args: + # Optional: camera specific input args (default: inherit) + input_args: + # Optional: camera specific output args (default: inherit) + output_args: + + # Optional: height of the frame + # NOTE: Recommended to set this value, but frigate will attempt to autodetect. + height: 720 + # Optional: width of the frame + # NOTE: Recommended to set this value, but frigate will attempt to autodetect. + width: 1280 + # Optional: desired fps for your camera + # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera. + # Frigate will attempt to autodetect if not specified. + fps: 5 + + # Optional: motion mask + # NOTE: see docs for more detailed info on creating masks + mask: poly,0,900,1080,900,1080,1920,0,1920 + + # Optional: timeout for highest scoring image before allowing it + # to be replaced by a newer image. (default: shown below) + best_image_timeout: 60 + + # Optional: camera specific mqtt settings + mqtt: + # Optional: crop the camera frame to the detection region of the object (default: False) + crop_to_region: True + # Optional: resize the image before publishing over mqtt + snapshot_height: 300 + + # Optional: zones for this camera + zones: + # Required: name of the zone + # NOTE: This must be different than any camera names, but can match with another zone on another + # camera. + front_steps: + # Required: List of x,y coordinates to define the polygon of the zone. + # NOTE: Coordinates can be generated at https://www.image-map.net/ + coordinates: 545,1077,747,939,788,805 + # Optional: Zone level object filters. + # NOTE: The global and camera filters are applied upstream. + filters: + person: + min_area: 5000 + max_area: 100000 + threshold: 0.8 + + # Optional: save clips configuration + # NOTE: This feature does not work if you have added "-vsync drop" in your input params. + # This will only work for camera feeds that can be copied into the mp4 container format without + # encoding such as h264. It may not work for some types of streams. + save_clips: + # Required: enables clips for the camera (default: shown below) + enabled: False + # Optional: Number of seconds before the event to include in the clips (default: shown below) + pre_capture: 30 + # Optional: Objects to save clips for. (default: all tracked objects) + objects: + - person + + # Optional: Configuration for the snapshots in the debug view and mqtt + snapshots: + # Optional: print a timestamp on the snapshots (default: shown below) + show_timestamp: True + # Optional: draw zones on the debug mjpeg feed (default: shown below) + draw_zones: False + # Optional: draw bounding boxes on the mqtt snapshots (default: shown below) + draw_bounding_boxes: True + + # Optional: Camera level object filters config. If defined, this is used instead of the global config. + objects: + track: + - person + - car + filters: + person: + min_area: 5000 + max_area: 100000 + min_score: 0.5 + threshold: 0.85 +``` +[Back to top](#documentation) -Users have reported varying success in getting frigate to run in a VM. In some cases, the virtualization layer introduces a significant delay in communication with the Coral. If running virtualized in Proxmox, pass the USB card/interface to the virtual machine not the USB ID for faster inference speed. +## Optimizing Performance +- **Google Coral**: It is strongly recommended to use a Google Coral, but Frigate will fall back to CPU in the event one is not found. Offloading TensorFlow to the Google Coral is an order of magnitude faster and will reduce your CPU load dramatically. A $60 device will outperform $2000 CPU. +- **Resolution**: Choose a camera resolution where the smallest object you want to detect barely fits inside a 300x300px square. The model used by Frigate is trained on 300x300px images, so you will get worse performance and no improvement in accuracy by using a larger resolution since Frigate resizes the area where it is looking for objects to 300x300 anyway. +- **FPS**: 5 frames per second should be adequate. Higher frame rates will require more CPU usage without improving detections or accuracy. Reducing the frame rate on your camera will have the greatest improvement on system resources. +- **Hardware Acceleration**: Make sure you configure the `hwaccel_args` for your hardware. They provide a significant reduction in CPU usage if they are available. +- **Masks**: Masks can be used to ignore motion and reduce your idle CPU load. If you have areas with regular motion such as timestamps or trees blowing in the wind, frigate will constantly try to determine if that motion is from a person or other object you are tracking. Those detections not only increase your average CPU usage, but also clog the pipeline for detecting objects elsewhere. If you are experiencing high values for `detection_fps` when no objects of interest are in the cameras, you should use masks to tell frigate to ignore movement from trees, bushes, timestamps, or any part of the image where detections should not be wasted looking for objects. -## Integration with HomeAssistant +### FFmpeg Hardware Acceleration +Frigate works on Raspberry Pi 3b/4 and x86 machines. It is recommended to update your configuration to enable hardware accelerated decoding in ffmpeg. Depending on your system, these parameters may not be compatible. -Setup a camera, binary_sensor, sensor and optionally automation as shown for each camera you define in frigate. Replace with the camera name as defined in the frigate `config.yml` (The `frigate_coral_fps` and `frigate_coral_inference` sensors only need to be defined once) +Raspberry Pi 3/4 (32-bit OS): +```yaml +ffmpeg: + hwaccel_args: + - -c:v + - h264_mmal +``` + +Raspberry Pi 3/4 (64-bit OS) +```yaml +ffmpeg: + hwaccel_args: + - -c:v + - h264_v4l2m2m +``` + +Intel-based CPUs via Quicksync (https://trac.ffmpeg.org/wiki/Hardware/QuickSync) +```yaml +ffmpeg: + hwaccel_args: + - -hwaccel + - vaapi + - -hwaccel_device + - /dev/dri/renderD128 + - -hwaccel_output_format + - yuv420p +``` + +[Back to top](#documentation) + +## Detectors +By default Frigate will look for a USB Coral device and fall back to the CPU if it cannot be found. If you have PCI or multiple Coral devices, you need to configure your detector devices in the config file. When using multiple detectors, they run in dedicated processes, but pull from a common queue of requested detections across all cameras. + +Frigate supports `edgetpu` and `cpu` as detector types. The device value should be specified according to the [Documentation for the TensorFlow Lite Python API](https://coral.ai/docs/edgetpu/multiple-edgetpu/#using-the-tensorflow-lite-python-api). + +Single USB Coral: +```yaml +detectors: + coral: + type: edgetpu + device: usb +``` + +Multiple USB Corals: +```yaml +detectors: + coral1: + type: edgetpu + device: usb:0 + coral2: + type: edgetpu + device: usb:1 +``` + +Mixing Corals: +```yaml +detectors: + coral_usb: + type: edgetpu + device: usb + coral_pci: + type: edgetpu + device: pci +``` + +CPU Detectors (not recommended): +```yaml +detectors: + cpu1: + type: cpu + cpu2: + type: cpu +``` +[Back to top](#documentation) + +## Reducing False Positives +Tune your object filters to adjust false positives: `min_area`, `max_area`, `min_score`, `threshold`. + +For object filters in your configuration, any single detection below `min_score` will be ignored as a false positive. `threshold` is based on the median of the history of scores (padded to 3 values) for a tracked object. Consider the following frames when `min_score` is set to 0.6 and threshold is set to 0.85: + +| Frame | Current Score | Score History | Computed Score | Detected Object | +| --- | --- | --- | --- | --- | +| 1 | 0.7 | 0.0, 0, 0.7 | 0.0 | No +| 2 | 0.55 | 0.0, 0.7, 0.0 | 0.0 | No +| 3 | 0.85 | 0.7, 0.0, 0.85 | 0.7 | No +| 4 | 0.90 | 0.7, 0.85, 0.95, 0.90 | 0.875 | Yes +| 5 | 0.88 | 0.7, 0.85, 0.95, 0.90, 0.88 | 0.88 | Yes +| 6 | 0.95 | 0.7, 0.85, 0.95, 0.90, 0.88, 0.95 | 0.89 | Yes + +In frame 2, the score is below the `min_score` value, so frigate ignores it and it becomes a 0.0. The computed score is the median of the score history (padding to at least 3 values), and only when that computed score crosses the `threshold` is the object marked as a true positive. That happens in frame 4 in the example. + +[Back to top](#documentation) + +## Masks +The following types of masks are supported: +- `poly`: (Recommended) List of x,y points like zone configuration +- `base64`: Base64 encoded image file +- `image`: Image file in the `/config` directory + +`base64` and `image` masks must be the same aspect ratio and resolution as your camera. +The mask in the second image would limit motion detection on this camera to only the front yard and not the street. + + + + + +To create a poly mask: +1. Download a camera snapshot image with the same resolution as the camera feed (`//latest.jpg`). +1. Upload the image to https://www.image-map.net/ +1. Select "shape" poly - start in the lowest left corner and place the first marker (point) and continue upwards and then to the right until the polygon shape covers the area that you want to mask out (ignore). +1. When you are finished with the polygon click "Show me the code!" and copy all coordinates (point), ie. `"0,461,3,0,1919,0,1919,843,1699,492,1344,458,1346,336,973,317,869,375,866,432"` +1. Adjust any -1 values to 0 and then add it all to the configuration (see the example configuration for correct indentation and placement) + +Example of a finished row corresponding to the below example image: +```yaml +mask: 'poly,0,461,3,0,1919,0,1919,843,1699,492,1344,458,1346,336,973,317,869,375,866,432' ``` + + + +[Back to top](#documentation) + +## Zones +Zones allow you to define a specific area of the frame and apply additional filters for object types so you can determine whether or not an object is within a particular area. Zones cannot have the same name as a camera. If desired, a single zone can include multiple cameras if you have multiple cameras covering the same area by configuring zones with the same name for each camera. + +During testing, `draw_zones` should be set in the config to draw the zone on the frames so you can adjust as needed. The zone line will increase in thickness when any object enters the zone. + +![Zone Example](docs/zone_example.jpg) + +[Back to top](#documentation) + +## Recording Clips +**Note**: Previous versions of frigate included `-vsync drop` in input parameters. This is not compatible with FFmpeg's segment feature and must be removed from your input parameters if you have overrides set. + +Frigate can save video clips without any CPU overhead for encoding by simply copying the stream directly with FFmpeg. It leverages FFmpeg's segment functionality to maintain a cache of video for each camera. The cache files are written to disk at `cache_dir` and do not introduce memory overhead. When an object is being tracked, it will extend the cache to ensure it can assemble a clip when the event ends. Once the event ends, it again uses FFmpeg to assemble a clip by combining the video clips without any encoding by the CPU. Assembled clips are are saved to the `clips_dir` directory along with a json file containing the current information about the tracked object. + +### Global Configuration Options +- `max_seconds`: This limits the size of the cache when an object is being tracked. If an object is stationary and being tracked for a long time, the cache files will expire and this value will be the maximum clip length for the *end* of the event. For example, if this is set to 300 seconds and an object is being tracked for 600 seconds, the clip will end up being the last 300 seconds. Defaults to 300 seconds. + +### Per-camera Configuration Options +- `pre_capture`: Defines how much time should be included in the clip prior to the beginning of the event. Defaults to 30 seconds. +- `objects`: List of object types to save clips for. Object types here must be listed for tracking at the camera or global configuration. Defaults to all tracked objects. + +[Back to top](#documentation) + +## Integration with HomeAssistant +Setup a camera, binary_sensor, sensor and optionally automation as shown for each camera you define in frigate. Replace with the camera name as defined in the frigate `config.yml` (The `frigate_coral_fps` and `frigate_coral_inference` sensors only need to be defined once) + +```yaml camera: - name: Last Person platform: mqtt @@ -150,6 +551,9 @@ automation: - url: http://:5000//person/best.jpg caption: A person was detected. ``` + +[Back to top](#documentation) + ## HTTP Endpoints A web server is available on port 5000 with the following endpoints. @@ -172,147 +576,9 @@ Example parameters: - `h=300`: resizes the image to 300 pixes tall ### `/debug/stats` -Contains some granular debug info that can be used for sensors in HomeAssistant. See details below. - -## MQTT Messages -These are the MQTT messages generated by Frigate. The default topic_prefix is `frigate`, but can be changed in the config file. - -### frigate/available -Designed to be used as an availability topic with HomeAssistant. Possible message are: -"online": published when frigate is running (on startup) -"offline": published right before frigate stops - -### frigate// -Publishes `ON` or `OFF` and is designed to be used a as a binary sensor in HomeAssistant for whether or not that object type is detected. - -### frigate///snapshot -Publishes a jpeg encoded frame of the detected object type. When the object is no longer detected, the highest confidence image is published or the original image -is published again. - -The height and crop of snapshots can be configured as shown in the example config. - -### frigate//events/start -Message published at the start of any tracked object. JSON looks as follows: -```json -{ - "label": "person", - "score": 0.87890625, - "box": [ - 95, - 155, - 581, - 1182 - ], - "area": 499122, - "region": [ - 0, - 132, - 1080, - 1212 - ], - "frame_time": 1600208805.60284, - "centroid": [ - 338, - 668 - ], - "id": "1600208805.60284-k1l43p", - "start_time": 1600208805.60284, - "top_score": 0.87890625, - "zones": [], - "score_history": [ - 0.87890625 - ], - "computed_score": 0.0, - "false_positive": true -} -``` - -### frigate//events/end -Same as `frigate//events/start`, but with an `end_time` property as well. - -### frigate// -Publishes `ON` or `OFF` and is designed to be used a as a binary sensor in HomeAssistant for whether or not that object type is detected in the zone. - -## Understanding min_score and threshold filters -`min_score` defines the minimum score for Frigate to begin tracking a detected object. Any single detection below `min_score` will be ignored as a false positive. `threshold` is based on the median of the history of scores for a tracked object. Consider the following frames when `min_score` is set to 0.6 and threshold is set to 0.85: - -| Frame | Current Score | Score History | Computed Score | Detected Object | -| --- | --- | --- | --- | --- | -| 1 | 0.7 | 0.0, 0, 0.7 | 0.0 | No -| 2 | 0.55 | 0.0, 0.7, 0.0 | 0.0 | No -| 3 | 0.85 | 0.7, 0.0, 0.85 | 0.7 | No -| 4 | 0.90 | 0.7, 0.85, 0.95, 0.90 | 0.875 | Yes -| 5 | 0.88 | 0.7, 0.85, 0.95, 0.90, 0.88 | 0.88 | Yes -| 6 | 0.95 | 0.7, 0.85, 0.95, 0.90, 0.88, 0.95 | 0.89 | Yes - -In frame 2, the score is below the `min_score` value, so frigate ignores it and it becomes a 0.0. The computed score is the median of the score history (padding to at least 3 values), and only when that computed score crosses the `threshold` is the object marked as a true positive. That happens in frame 4 in the example. - -## Using a custom model or labels -Models for both CPU and EdgeTPU (Coral) are bundled in the image. You can use your own models with volume mounts: -- CPU Model: `/cpu_model.tflite` -- EdgeTPU Model: `/edgetpu_model.tflite` -- Labels: `/labelmap.txt` - -### Customizing the Labelmap -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. You must retain the same number of labels, but you can change the names. To change: - -- Download the [COCO labelmap](https://dl.google.com/coral/canned_models/coco_labels.txt) -- Modify the label names as desired. For example, change `7 truck` to `7 car` -- Mount the new file at `/labelmap.txt` in the container with an additional volume - ``` - -v ./config/labelmap.txt:/labelmap.txt - ``` - -## Recording Clips -**Note**: Previous versions of frigate included `-vsync drop` in input parameters. This is not compatible with FFmpeg's segment feature and must be removed from your input parameters if you have overrides set. - -Frigate can save video clips without any CPU overhead for encoding by simply copying the stream directly with FFmpeg. It leverages FFmpeg's segment functionality to maintain a cache of 90 seconds of video for each camera. The cache files are written to disk at /cache and do not introduce memory overhead. When an object is being tracked, it will extend the cache to ensure it can assemble a clip when the event ends. Once the event ends, it again uses FFmpeg to assemble a clip by combining the video clips without any encoding by the CPU. Assembled clips are are saved to the /clips directory along with a json file containing the current information about the tracked object. - -### Global Configuration Options -- `max_seconds`: This limits the size of the cache when an object is being tracked. If an object is stationary and being tracked for a long time, the cache files will expire and this value will be the maximum clip length for the *end* of the event. For example, if this is set to 300 seconds and an object is being tracked for 600 seconds, the clip will end up being the last 300 seconds. Defaults to 300 seconds. - -### Per-camera Configuration Options -- `pre_capture`: Defines how much time should be included in the clip prior to the beginning of the event. Defaults to 30 seconds. -- `objects`: List of object types to save clips for. Object types here must be listed for tracking at the camera or global configuration. Defaults to all tracked objects. - -## Detectors Configuration -Frigate attempts to detect your Coral device automatically. If you have multiple Coral devices or a version that is not detected automatically, you can specify using the `detectors` config option as shown in the example config. - -## Masks and limiting detection to a certain area -Masks can be used to ignore motion and reduce your idle CPU load. If you have areas with regular motion such as timestamps or trees blowing in the wind, frigate will be constantly trying to determine if that motion is from a person or other object you are tracking. Those detections not only increase your average CPU usage, but also clog the pipeline for detecting objects elsewhere. If you are experiencing high values for `detection_fps` when no objects of interest are in the cameras, you should use masks to tell frigate to ignore movement from trees, bushes, timestamps, or any part of the image where detections should not be wasted looking for objects. - -The following types of masks are supported: -- `poly`: (Recommended) List of x,y points like zone configuration -- `base64`: Base64 encoded image file -- `image`: Path to an image file in the config directory - -`base64` and `image` masks must be the same aspect ratio and resolution as your camera. - -The mask works by looking at the bottom center of any bounding box (first image, red dot below) and comparing that to your mask. If that red dot falls on an area of your mask that is black, the detection (and motion) will be ignored. The mask in the second image would limit detection on this camera to only objects that are in the front yard and not the street. - - - - - -To create a poly mask: -1. Download a camera snapshot image with the same resolution as the camera feed (`//latest.jpg`). -1. Upload the image to https://www.image-map.net/ -1. Select "shape" poly - start in the lowest left corner and place the first marker (point) and continue upwards and then to the right until the polygon shape covers the area that you want to mask out (ignore). -1. When you are finished with the polygon click "Show me the code!" and copy all coordinates (point), ie. `"0,461,3,0,1919,0,1919,843,1699,492,1344,458,1346,336,973,317,869,375,866,432"` -1. Adjust any -1 values to 0 and then add it all to the configuration (see the example configuration for correct indentation and placement) - -Example of a finished row corresponding to the below example image: `mask: 'poly,0,461,3,0,1919,0,1919,843,1699,492,1344,458,1346,336,973,317,869,375,866,432'` - - - -## Zones -Zones allow you to define a specific area of the frame and apply additional filters for object types so you can determine whether or not an object is within a particular area. Zones cannot have the same name as a camera. If desired, a single zone can include multiple cameras if you have multiple cameras covering the same area. See the sample config for details on how to configure. - -During testing, `draw_zones` can be set in the config to tell frigate to draw the zone on the frames so you can adjust as needed. The zone line will increase in thickness when any object enters the zone. +Contains some granular debug info that can be used for sensors in HomeAssistant. -![Zone Example](docs/zone_example.jpg) - -## Debug Info +Sample response: ```jsonc { /* Per Camera Stats */ @@ -395,19 +661,86 @@ During testing, `draw_zones` can be set in the config to tell frigate to draw th } ``` -## Tips -- Lower the framerate of the video feed on the camera to reduce the CPU usage for capturing the feed. Not as effective, but you can also modify the `take_frame` [configuration](config/config.example.yml) for each camera to only analyze every other frame, or every third frame, etc. -- Hard code the resolution of each camera in your config if you are having difficulty starting frigate or if the initial ffprobe for camerea resolution fails or returns incorrect info. Example: -``` -cameras: - back: - ffmpeg: - input: rtsp:// - height: 1080 - width: 1920 +[Back to top](#documentation) + +## MQTT Topics +These are the MQTT messages generated by Frigate. The default topic_prefix is `frigate`, but can be changed in the config file. + +### frigate/available +Designed to be used as an availability topic with HomeAssistant. Possible message are: +"online": published when frigate is running (on startup) +"offline": published right before frigate stops + +### frigate// +Publishes `ON` or `OFF` and is designed to be used a as a binary sensor in HomeAssistant for whether or not that object type is detected. + +### frigate///snapshot +Publishes a jpeg encoded frame of the detected object type. When the object is no longer detected, the highest confidence image is published or the original image +is published again. + +The height and crop of snapshots can be configured as shown in the example config. + +### frigate//events/start +Message published at the start of any tracked object. JSON looks as follows: +```json +{ + "label": "person", + "score": 0.87890625, + "box": [ + 95, + 155, + 581, + 1182 + ], + "area": 499122, + "region": [ + 0, + 132, + 1080, + 1212 + ], + "frame_time": 1600208805.60284, + "centroid": [ + 338, + 668 + ], + "id": "1600208805.60284-k1l43p", + "start_time": 1600208805.60284, + "top_score": 0.87890625, + "zones": [], + "score_history": [ + 0.87890625 + ], + "computed_score": 0.0, + "false_positive": true +} ``` -- Additional logging is available in the docker container - You can view the logs by running `docker logs -t frigate` -- Object configuration - Tracked objects types, sizes and thresholds can be defined globally and/or on a per camera basis. The global and camera object configuration is *merged*. For example, if you defined tracking person, car, and truck globally but modified your backyard camera to only track person, the global config would merge making the effective list for the backyard camera still contain person, car and truck. If you want precise object tracking per camera, best practice to put a minimal list of objects at the global level and expand objects on a per camera basis. Object threshold and area configuration will be used first from the camera object config (if defined) and then from the global config. See the [example config](config/config.example.yml) for more information. + +### frigate//events/end +Same as `frigate//events/start`, but with an `end_time` property as well. + +### frigate// +Publishes `ON` or `OFF` and is designed to be used a as a binary sensor in HomeAssistant for whether or not that object type is detected in the zone. + +[Back to top](#documentation) + +## Custom Models +Models for both CPU and EdgeTPU (Coral) are bundled in the image. You can use your own models with volume mounts: +- CPU Model: `/cpu_model.tflite` +- EdgeTPU Model: `/edgetpu_model.tflite` +- Labels: `/labelmap.txt` + +### Customizing the Labelmap +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. You must retain the same number of labels, but you can change the names. To change: + +- Download the [COCO labelmap](https://dl.google.com/coral/canned_models/coco_labels.txt) +- Modify the label names as desired. For example, change `7 truck` to `7 car` +- Mount the new file at `/labelmap.txt` in the container with an additional volume + ``` + -v ./config/labelmap.txt:/labelmap.txt + ``` + +[Back to top](#documentation) ## Troubleshooting @@ -421,3 +754,5 @@ ffmpeg: - info ``` +[Back to top](#documentation) + diff --git a/config/back-mask.bmp b/config/back-mask.bmp deleted file mode 100644 index b64353d12fe0ebb549d977b4a114d850ad71481e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1843256 zcmeI)&5p#laRA_nft+#)a?T;gJVB6i?s=wtMZeKz$CE}+&q!)f;$N{o8|&$oD6;A! zRb4O)|Ih#a_kaBR$LGKP>#u+Q^Yg<$e|-G?Zyz83^zpBs-#-5K*ZqI{mydt^^N$OE z{l}kw_%{Ip1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N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d30dN-J37iCF+009C72oSg;uv#a0#lSNJ2oNAZfB=Df0xNWZ`F2gl1PBlyK!5;& zy8>~$z`L1yo&W&?1PBlyK;R)Te^2;`)L#Mw2oNAZfB=EI0yB1kbu%;@0RjXF5FkK+ zz;A(hy1?JDxk7*d0RjXF5FpS>V0;(YDl_vEAV7cs0RjXF>1PBly zK%l+A`yOyVhWF3@9I-!_I|K+2AV7cs0Rkfgp8Zd)u)K9$X9Gywtx2oNAZfItKR zy Advanced Options > Memory Split) -```yaml -ffmpeg: - hwaccel_args: - - -c:v - - h264_mmal -``` - -## Raspberry Pi 4 (64bit OS) -```yaml -ffmpeg: - hwaccel_args: - - -c:v - - h264_v4l2m2m -``` \ No newline at end of file diff --git a/docs/CAMERAS.md b/docs/cameras.md similarity index 94% rename from docs/CAMERAS.md rename to docs/cameras.md index 34582f8da1..1fc7b7cab5 100644 --- a/docs/CAMERAS.md +++ b/docs/cameras.md @@ -16,8 +16,6 @@ input_args: - experimental - -fflags - +genpts+discardcorrupt - - -vsync - - drop - -use_wallclock_as_timestamps - '1' ``` \ No newline at end of file diff --git a/diagram.png b/docs/diagram.png similarity index 100% rename from diagram.png rename to docs/diagram.png diff --git a/docs/frigate.png b/docs/frigate.png new file mode 100644 index 0000000000000000000000000000000000000000..1156bc6bde476e5311d369a7d2614bd18085c038 GIT binary patch literal 12157 zcmZX)by!qi)HaL=GBiVjd*$hA8fuQbdokRH$-g>frD(YG@pk)c0sYLiHICScLjaB9MTf>YSc@ul92}%tj|w~o zxVX4Pz+he3ZC)pvgLwEX+8A3yDWOqyb$UCSU4LE)9AidQgz|r^gS?ZIlauw%2%1aN zUFz^dX>wfcTMaapQMAYSY&jgs>gmaNpbZe4uE?)%6VA%YvNy4~kNCS%UCL+l;QgcE z6^1dO@w zbl!eilAj8s;uutnBm%%JKN5P^M+foXkR#CK@gb!Fs+$X2+dBGHa;SuaNaNMinq4oL z9hWe^6)U7VZ)_{k(ux2xj7hF0$`1F@b8S}`-;`jSZV!I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Agz_9z9(n zz6`ua)9`Y}Y`HHwB05?k{PH(fo^c>PhxP|E)ElaQ2CIu1>^=^#@z`W^+gjjbeba*2 z_H_LmF0C^e_^LA2Y%0m#Yu@mC2L_k){t*dJL<3NNm5%1D-G`pdeeqx!K}IR`h)VG; z_4C>sN>B89|9_84G{il)y@Fj+S|~i92bU_-1a>t2@mvE#!|Ko8IZ6L>qpTNbDqU`4 zW21MODxRv?(CmM0COAkdVvH1hOYq;ziJ$qy<<6%q|B29n15@x{mcM@Q^!__^;nzt1 c_u4%rPFU`qnDj&`Tvm@DC#4Lj0h_%4Kl~Tp1^@s6 literal 0 HcmV?d00001 diff --git a/docs/how-frigate-works.md b/docs/how-frigate-works.md new file mode 100644 index 0000000000..b4dd20cb38 --- /dev/null +++ b/docs/how-frigate-works.md @@ -0,0 +1,10 @@ +# How Frigate Works +Frigate is designed to minimize resource and maximize performance by only looking for objects when and where it is necessary + +![Diagram](diagram.png) + +## 1. Look for Motion + +## 2. Calculate Detection Regions + +## 3. Run Object Detection \ No newline at end of file