mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-01-07 00:06:57 +01:00
Updated README with abstracted HA config, expanded tips section
This commit is contained in:
parent
f1afaf641a
commit
2d0632adf8
98
README.md
98
README.md
@ -49,27 +49,53 @@ Example docker-compose:
|
||||
|
||||
A `config.yml` file must exist in the `config` directory. See example [here](config/config.example.yml) and device specific info can be found [here](docs/DEVICES.md).
|
||||
|
||||
Access the mjpeg stream at `http://localhost:5000/<camera_name>` and the best snapshot for any object type with at `http://localhost:5000/<camera_name>/<object_name>/best.jpg`
|
||||
|
||||
Debug info is available at `http://localhost:5000/debug/stats`
|
||||
|
||||
## Integration with HomeAssistant
|
||||
|
||||
Setup a the camera, binary_sensor, sensor and optionally automation as shown for each camera you define in frigate. Replace <camera_name> 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)
|
||||
|
||||
```
|
||||
camera:
|
||||
- name: Camera Last Person
|
||||
- name: <camera_name> Last Person
|
||||
platform: mqtt
|
||||
topic: frigate/<camera_name>/person/snapshot
|
||||
- name: Camera Last Car
|
||||
- name: <camera_name> Last Car
|
||||
platform: mqtt
|
||||
topic: frigate/<camera_name>/car/snapshot
|
||||
|
||||
binary_sensor:
|
||||
- name: Camera Person
|
||||
- name: <camera_name> Person
|
||||
platform: mqtt
|
||||
state_topic: "frigate/<camera_name>/person"
|
||||
device_class: motion
|
||||
availability_topic: "frigate/available"
|
||||
|
||||
sensor:
|
||||
- platform: rest
|
||||
name: Frigate Debug
|
||||
resource: http://localhost:5000/debug/stats
|
||||
scan_interval: 5
|
||||
json_attributes:
|
||||
- <camera_name>
|
||||
- coral
|
||||
value_template: 'OK'
|
||||
- platform: template
|
||||
sensors:
|
||||
<camera_name>_fps:
|
||||
value_template: '{{ states.sensor.frigate_debug.attributes["<camera_name>"]["fps"] }}'
|
||||
unit_of_measurement: 'FPS'
|
||||
<camera_name>_skipped_fps:
|
||||
value_template: '{{ states.sensor.frigate_debug.attributes["<camera_name>"]["skipped_fps"] }}'
|
||||
unit_of_measurement: 'FPS'
|
||||
<camera_name>_detection_fps:
|
||||
value_template: '{{ states.sensor.frigate_debug.attributes["<camera_name>"]["detection_fps"] }}'
|
||||
unit_of_measurement: 'FPS'
|
||||
frigate_coral_fps:
|
||||
value_template: '{{ states.sensor.frigate_debug.attributes["coral"]["fps"] }}'
|
||||
unit_of_measurement: 'FPS'
|
||||
frigate_coral_inference:
|
||||
value_template: '{{ states.sensor.frigate_debug.attributes["coral"]["inference_speed"] }}'
|
||||
unit_of_measurement: 'ms'
|
||||
|
||||
automation:
|
||||
- alias: Alert me if a person is detected while armed away
|
||||
trigger:
|
||||
@ -88,35 +114,18 @@ automation:
|
||||
data:
|
||||
photo:
|
||||
- url: http://<ip>:5000/<camera_name>/person/best.jpg
|
||||
caption: A person was detected.
|
||||
|
||||
sensor:
|
||||
- platform: rest
|
||||
name: Frigate Debug
|
||||
resource: http://localhost:5000/debug/stats
|
||||
scan_interval: 5
|
||||
json_attributes:
|
||||
- back
|
||||
- coral
|
||||
value_template: 'OK'
|
||||
- platform: template
|
||||
sensors:
|
||||
back_fps:
|
||||
value_template: '{{ states.sensor.frigate_debug.attributes["back"]["fps"] }}'
|
||||
unit_of_measurement: 'FPS'
|
||||
back_skipped_fps:
|
||||
value_template: '{{ states.sensor.frigate_debug.attributes["back"]["skipped_fps"] }}'
|
||||
unit_of_measurement: 'FPS'
|
||||
back_detection_fps:
|
||||
value_template: '{{ states.sensor.frigate_debug.attributes["back"]["detection_fps"] }}'
|
||||
unit_of_measurement: 'FPS'
|
||||
frigate_coral_fps:
|
||||
value_template: '{{ states.sensor.frigate_debug.attributes["coral"]["fps"] }}'
|
||||
unit_of_measurement: 'FPS'
|
||||
frigate_coral_inference:
|
||||
value_template: '{{ states.sensor.frigate_debug.attributes["coral"]["inference_speed"] }}'
|
||||
unit_of_measurement: 'ms'
|
||||
caption: A person was detected.
|
||||
```
|
||||
## Debuging Endpoint
|
||||
|
||||
Access the mjpeg stream at `http://localhost:5000/<camera_name>` and the best snapshot for any object type with at `http://localhost:5000/<camera_name>/<object_name>/best.jpg`
|
||||
|
||||
You can access a higher resolution mjpeg stream by appending `h=height-in-pixels` to the endpoint. For example `http://localhost:5000/back?h=1080`. You can also increase the FPS by appending `fps=frame-rate` to the URL such as `http://localhost:5000/back?fps=10`
|
||||
|
||||
Keep in mind the MJPEG endpoint is for debugging only, but should not be used continuously as it will put additional load on the system.
|
||||
|
||||
Debug info is available at `http://localhost:5000/debug/stats`
|
||||
|
||||
## Using a custom model
|
||||
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`
|
||||
@ -124,4 +133,21 @@ Models for both CPU and EdgeTPU (Coral) are bundled in the image. You can use yo
|
||||
- Labels: `/labelmap.txt`
|
||||
|
||||
## Tips
|
||||
- Lower the framerate of the video feed on the camera to reduce the CPU usage for capturing the feed
|
||||
- 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://<camera>
|
||||
height: 1080
|
||||
width: 1920
|
||||
```
|
||||
- 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.
|
||||
- Masks and limiting detection to a certain area - You can create a bitmap (bmp) file the same aspect ratio as your camera feed to limit detection to certain areas. The mask works by looking at the bottom center of any bounding box (red dot below) and comparing that to your mask.
|
||||
|
||||
<a href="docs/example-mask-check-point.png"><img src="docs/example-mask-check-point.png" height="300"></a>
|
||||
|
||||
If that red dot falls on an area of your mask that is black, the detection (and motion) will be ignored. Here is a sample mask that would limit detection to only the front yard and not the street for the above image:
|
||||
|
||||
<a href="docs/example-mask.bmp"><img src="docs/example-mask.bmp" height="300"></a>
|
||||
|
Loading…
Reference in New Issue
Block a user