Frigate & Google Coral and Proxmox VM
Good Youtube Tutorial: https://www.youtube.com/watch?v=zKk9dnAp8FM
In Proxmox Node:
lsusb
root@orange:/etc/pve/lxc# lsusb
Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 18d1:9302 Google Inc.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 8087:0029 Intel Corp. AX200 Bluetooth
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Setup Ubuntu VM and Add USB device:
Restart VM
run lsusb to see if the vm has the USB
Install Docker and Portainer
Add this Docker Compose to install frigate
version: "3.9"
services:
frigate:
container_name: frigate
privileged: true # this may not be necessary for all setups
restart: unless-stopped
stop_grace_period: 30s # allow enough time to shut down the various services
image: ghcr.io/blakeblackshear/frigate:stable
shm_size: "512mb" # 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/video11:/dev/video11 # For Raspberry Pi 4B
#- /dev/dri/renderD128:/dev/dri/renderD128 # For intel hwaccel, needs to be updated for your hardware
volumes:
- /etc/localtime:/etc/localtime:ro
- /mnt/portainer2/frigate/config:/config
- /mnt/portainer2/frigate/storage:/media/frigate
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 1000000000
ports:
- "8971:8971"
- "5000:5000" # Internal unauthenticated access. Expose carefully.
- "8554:8554" # RTSP feeds
- "8555:8555/tcp" # WebRTC over tcp
- "8555:8555/udp" # WebRTC over udp
environment:
FRIGATE_RTSP_PASSWORD: "strong@pwd"
go to path VM IP:5000 to view the Frigate UI Configuration Editor
Twist your config like mine:
make sure to change username , password and ip address. Below is the 3 tapo c110 configuration url address
mqtt:
enabled: false
cameras:
tapo_username001: # <------ Name the camera
enabled: true
ffmpeg:
inputs:
- path: rtsp://tapo_username001:yourpassw@192.168.1.xxx:554/stream1 # <----- The stream you want to use for detection
roles:
- detect
- record
detect:
enabled: true # <---- disable detection until you have a working camera feed
width: 2304
height: 1296
fps: 5
motion:
threshold: 30
contour_area: 28
improve_contrast: true
record:
enabled: true
retain:
days: 30
mode: motion
snapshots:
enabled: true
timestamp: true
bounding_box: true
retain:
default: 30
tapo_username002: # <------ Name the camera
enabled: true
ffmpeg:
inputs:
- path: rtsp://tapo_username002:yourpassw@192.168.1.xxx:554/stream1 # <----- The stream you want to use for detection
roles:
- detect
- record
detect:
enabled: true # <---- disable detection until you have a working camera feed
width: 2304
height: 1296
fps: 5
motion:
threshold: 30
contour_area: 28
improve_contrast: true
record:
enabled: true
retain:
days: 30
mode: motion
snapshots:
enabled: true
timestamp: true
bounding_box: true
retain:
default: 30
tapo_username003: # <------ Name the camera
enabled: true
ffmpeg:
inputs:
- path: rtsp://tapo_username003:yourpassw@192.168.1.xxx:554/stream1 # <----- The stream you want to use for detection
roles:
- detect
- record
detect:
enabled: true # <---- disable detection until you have a working camera feed
width: 2304
height: 1296
fps: 5
motion:
threshold: 30
contour_area: 28
improve_contrast: true
record:
enabled: true
retain:
days: 30
mode: motion
snapshots:
enabled: true
timestamp: true
bounding_box: true
retain:
default: 30
record:
enabled: true
retain:
days: 30
mode: active_objects
alerts:
retain:
days: 30
mode: motion
detections:
retain:
days: 30
mode: motion
detectors:
coral:
type: edgetpu
device: usb
objects:
track:
- person
- face
- printer
- toy
- filament
- print_bed
- extruder
- tool
- wrench
- screw
- spaghetti
- failed_print
version: 0.15-1
camera_groups:
SonA1:
order: 1
icon: LuFingerprint
cameras:
- tapo_username001
- tapo_username002
- tapo_username003
Click save and restart button
Tips:
Make sure to disable detection on your tapo settings, disable the local recording ( we don't need to use sd card for storage )
Go to the UI > Settings > Motion Tuner to update the Threshold and Contour Area to match your needs.
If you have google coral, it should have red label around the images.
Well done.
PCI Devices mapping in Proxmox
lsusb -t
/: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 10000M
/: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 10000M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 10000M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
|__ Port 2: Dev 3, If 0, Class=Vendor Specific Class, Driver=usbfs, 5000M << this is the one
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/5p, 480M
|__ Port 5: Dev 2, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 5: Dev 2, If 1, Class=Wireless, Driver=btusb, 12M
Bus 02, Port 2 → Driver=xhci_hcd → PCIe USB controller
readlink -f /sys/bus/usb/devices/usb2
/sys/devices/pci0000:00/0000:00:08.1/0000:c5:00.3/usb2
PCI address: 0000:c5:00.3
Go to Data Center > Resource Mappings > Under PCI Devices Panel , click Add > Choose Mapping on Node: Orange
Scroll down and pick the id like the above, which is 0000:c5:00.3
give it a short Name: coralusb
click Create
Now go back to your VM and add your pci device into your vm hardware setting:
Pick your mapped device:
Done. Restart the VM.