Frigate and Compreface Configuration Optimization

Frigate and Compreface Configuration Optimization

Hello everyone! I wanted to share my experience with configuring Frigate, Compreface, and Double Take for my home security setup. While everything is functional, I’ve encountered a few challenges that I’m hoping to address with your help.

My Setup

I’m running an HP EliteDesk 800 G4 DM with an Intel Core i5-8500T processor, 32GB of RAM, and a 480GB SSD. I’ve set up Proxmox with HA in a VM and Double Take as an addon. Frigate is running in an LXC container, as is Compreface. I’ve allocated 6 cores to HA, 6 cores and 4GB RAM to Frigate, and 6 cores and 8GB RAM to Compreface. Frigate is utilizing a Coral USB for edge computing.

I’ve got a Dahua NVR with 8 cameras, all configured with H.265 video compression. Most of them have 2560x1440 primary streams and 704x576 secondary streams, except for one that has a 1280x720 primary stream and a 1920x1080 secondary stream. Frigate is running version 0.12.0-27A31E7.

Current Issues

  1. Low Quality Detection: I switched my detection streams to primary streams for better quality, but Frigate crashed due to high CPU usage (95%). Despite this, Frigate detects objects like people, cars, dogs, and cats very well. I need to find a balance between detection quality and system stability.

  2. Compreface Face Recognition Issues: Compreface is recognizing faces with very low quality and giving false positives. For example, it often identifies people as me or my kids, even when they’re not in the database. This is frustrating and reduces the reliability of the system.

Configuration Details

Here’s a snippet of my Frigate configuration for reference:
yaml
mqtt:
host: 192.168.XX.XX
port: 1883
user: xxxx
password: XXXXXX

detectors:
coral:
type: edgetpu
device: usb

birdseye:
enabled: True
quality: 8
mode: objects

database:
path: /media/frigate/frigate.db

logger:
default: info
logs:
frigate.app: debug
ffmpeg: hwaccel_args: - -hwaccel - vaapi

input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1

output_args: -threads 1 -f rawvideo -pix_fmt yuv420p

Cameras Configuration

Varanda_da_Frente:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/Varanda_da_Frente
input_args: preset-rtsp-restream
roles: - record
- path: rtsp://127.0.0.1:8554/Varanda_da_Frente_Sub
input_args: preset-rtsp-restream
roles: - detect

live:
stream_name: Varanda_da_Frente_Sub

detect:
width: 1920
height: 1080
fps: 5
enabled: True
max_disappeared: 25
stationary:
interval: 0
threshold: 50
max_frames: default: 3000

objects:
person: 1000
track: - person - cat - dog - knife - cell phone - mouse
mask: 0,0,1000,0,1000,200,0,200

filters:
person:
min_area: 5000
max_area: 100000
min_score: 0.5
threshold: 0.7
mask: 0,0,1000,0,1000,200,0,200

motion:
threshold: 25
contour_area: 30
delta_alpha: 0.2
frame_alpha: 0.2
frame_height: 50
mask: 0,900,1080,900,1080,1920,0,1920
improve_contrast: False
best_image_timeout: 60

record:
enabled: True
retain:
days: 3
mode: motion
events:
retain:
default: 7
mode: active_objects
objects:
person: 50

mqtt:
enabled: True
timestamp: True
bounding_box: True
crop: True
height: 500
quality: 100

Questions and Requests

  1. Balancing Detection Quality and CPU Usage: How can I optimize Frigate’s configuration to handle primary streams without maxing out CPU usage? Is there a way to limit the resolution or frame rate dynamically based on system load?

  2. Improving Compreface Recognition: What settings or configurations can I adjust in Compreface to reduce false positives and improve face recognition accuracy? Is there a way to fine-tune the face detection models or improve the quality of the video feed to Compreface?

  3. Hardware Utilization: Am I allocating resources optimally between HA, Frigate, and Compreface? Should I consider dedicating more resources to one service over the others?

  4. Alternative Solutions: Are there alternative face recognition solutions that integrate well with Frigate and offer better performance? I’m open to exploring other options if they provide a more reliable experience.

Conclusion

I’m really impressed with the capabilities of Frigate and Compreface, but these issues are holding me back from achieving the seamless security system I envisioned. Any advice or suggestions would be greatly appreciated! Thanks in advance for your help!