Skip to main content

Frigate & Google Coral and Proxmox VM

 

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 and Add USB device:

image.png

Restart VM

run lsusb to see if the vm has the USB

 

image.png

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

image.png

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.

image.png

Well done.