I'll put this down for history. It's took all my 2-hour morning brain power for weeks. At the end, it can recognize the dog.
You need a mini-pc from ammie. I just got a commodity amd box. I use them all over the house now. Comes with a 250gb ssd, and a hunk of memory. I install standard Debian Sid on it.
Then, a huge effort to install Docker and Portainer.
Eventually, my reading list was dozens of articles. All showing their recipes, all wrong to some degree. You have to combine them in your brain.
version: "3.9"
services:
frigate:
container_name: frigate
privileged: true # this may not be necessary for all setups
restart: unless-stopped
image: ghcr.io/blakeblackshear/frigate:stable
shm_size: "64mb" # update for your cameras based on calculation above
devices:
- /dev/bus/usb:/dev/bus/usb # passes the USB Coral, needs to be modified for other versions
#- /dev/apex_0:/dev/apex_0 # passes a PCIe Coral, follow driver instructions here https://coral.ai/docs/m2/get-started/#2a-on-linux
#- /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
volumes:
- /etc/localtime:/etc/localtime:ro
- /mnt/hubfiles/frigate/frigate.yml:/config/config.yml
- /mnt/hubfiles/frigate:/media/frigate
- /frigdb:/db
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 1000000000
ports:
- "5000:5000"
- "8554:8554" # RTSP feeds
- "8555:8555/tcp" # WebRTC over tcp
- "8555:8555/udp" # WebRTC over udp
environment:
FRIGATE_RTSP_PASSWORD: "password"
That's just the first part. Then you need a Frigate configuration file.
mqtt:
enabled: false
detectors:
coral:
type: edgetpu
device: usb
cameras:
driveway:
ffmpeg:
hwaccel_args: preset-vaapi
inputs:
- path: rtsp://192.168.0.43:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream
roles:
- detect
- record
detect:
width: 1280
height: 720
snapshots:
enabled: True
record:
enabled: True
retain:
days: 5
events:
retain:
default: 10
objects:
track:
- person
- dog
- bicycle
# - car
# - motorcycle
database:
path: /db/frigate.db
Because the mini-pc doesn't have much storage, you have to mount an smb file to your main disks for storage. The database stays on the mini pc.
The last few days are spent debugging the config file. It is written in yaml, which is like python, in that every space is important.
In the end, it works great. You get to fool around with an AI card, and it's all private.
ps. you also need that Coral USB which you can also get at ammie. I am using an old no-name Chinese starlight camera, powered by usb. It's been there for 6 years, and I still can't find anything better.
pps. it's absolutely in love with the fire hydrant as a person. I may have to go to zones next.
4 comments:
Nice work and thanks for the info. I'll get stuff organised and try to replicate. If I get it working I can easily set up a webservice to pass any data onto whatsapp/telegram or whatever and give you the address. Question does it just do MQTT or is there an HTTP(S) option?
The mqtt is just for Home Assistant integration. I didn't go down that rabbit hole yet. The concept of 'sending out' means getting a stable ip address and/or a dynamic dns. My brain hurts.
Yeah...sorry. just reading up on all this now
I just give myself 2 hours a day of super-brain work, and I'm recovering from doing this. :)
Post a Comment