blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
18.52k stars 1.68k forks source link

[Config Support]: Coral passthrough to Proxmox LXC - Not working. #9330

Closed Buckeyes1995 closed 8 months ago

Buckeyes1995 commented 8 months ago

Describe the problem you are having

I apologize for opening this issue.. but I cannot for the life of me figure out what I'm doing wrong.

I'm able to successfully passthrough my Coral USB to my frigate LXC; I even got the Device vendor to change to 'Google'.. but frigate still says I don't have a TPU. I literally had this working yesterday but had to reinstall Proxmox (out of stupidity). Anyways, would appreciate if someone can see something obvious I'm missing.

This is in my frigate LXC: Bus 002, Device 006 as you can see.

root@frigate:~# lsusb
Bus 001 Device 002: ID 8087:8001 Intel Corp. Integrated Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 005: ID 8087:0a2a Intel Corp. Bluetooth wireless interface
Bus 002 Device 006: ID 18d1:9302 Google Inc. 
Bus 002 Device 003: ID 25a7:fa67 Areson Technology Corp 2.4G Receiver
Bus 002 Device 002: ID 1b1c:1ab1 Corsair Voyager
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Excerpt from my docker-compose.yml file:

services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:0.13.0-rc1
    shm_size: "128mb" # 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/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /root/.config/:/config
      - /root/.storage:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000" # GUI Interface
      - "1935:1935" # RTMP feeds

Version

0.12.0-e454daf

Frigate config file

environment_vars:
  LIBVA_DRIVER_NAME: iHD

mqtt:
  enabled: false

birdseye:
  enabled: True
  mode: continuous

cameras:
  front_porch:
    ffmpeg:
      inputs:
        # - path: rtsp://admin:123456@10.0.0.50/stream2
        #   roles:
        #     - detect
        - path: rtsp://admin:123456@192.168.50.4/stream0
          roles:
            - detect
            - record     
      hwaccel_args: preset-vaapi
    record:
      enabled: True
      retain:
        mode: all
        days: 4
      events:
        required_zones:
          - front_yard_and_porch  
    snapshots:
      enabled: True
      timestamp: True
      retain:
        default: 4
      required_zones:
        - front_yard_and_porch 
    zones:
      front_yard_and_porch:
        coordinates: 216,960,318,960,436,960,546,960,666,960,812,960,901,960,931,924,956,887,980,848,995,813,1016,743,1029,714,10
41,674,1053,636,1056,594,1005,524,993,475,1001,432,1013,376,1020,323,1034,270,1048,230,985,200,908,163,846,146,789,122,719,102,61
6,83,508,64,413,45,300,56,192,69,102,112,23,166
        objects:
          - person
          - dog
          - cat
    # motion:
    #   mask: 1130,315,1093,512,1007,508,1011,319
    rtmp:
      enabled: false
    detect:
      width: 1280
      height: 960
      fps: 5
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 960

  back_yard:
    ffmpeg:
      inputs:
        # - path: rtsp://admin:123456@10.0.0.53/stream1
        #   roles:
        #     - detect
        - path: rtsp://admin:123456@192.168.50.5/stream0
          roles:
            - record   
            - detect  
      hwaccel_args: preset-vaapi  
    record:
      enabled: True
      retain:
        mode: all
        days: 4
    snapshots:
      enabled: True
      timestamp: True
      retain:
        default: 4
    rtmp:
      enabled: false
    detect:
      width: 1280
      height: 960
      fps: 5
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 960

  side_porch:
      ffmpeg:
        inputs:
          # - path: rtsp://admin:123456@10.0.0.51/stream2
          #   roles:
          #     - detect
          - path: rtsp://admin:123456@192.168.50.2/stream0
            roles:
              - detect
              - record     
        hwaccel_args: preset-vaapi  
      record:
        enabled: True
        retain:
          mode: all
          days: 4
      snapshots:
        enabled: True
        timestamp: True
        retain:
          default: 4
      rtmp:
        enabled: false
      detect:
        width: 1280
        height: 960
        fps: 5
      mqtt:
        timestamp: False
        bounding_box: False
        crop: True
        quality: 100
        height: 960

  deck:
    ffmpeg:
      inputs:
        # - path: rtsp://admin:123456@10.0.0.54/stream1
        #   roles:
        #     - detect
        - path: rtsp://admin:123456@192.168.50.3/stream0
          roles:
            - detect
            - record     
      hwaccel_args: preset-vaapi  
    record:
      enabled: True
      retain:
        mode: all
        days: 4
    snapshots:
      enabled: True
      timestamp: True
      retain:
        default: 4
    rtmp:
      enabled: false
    detect:
      width: 1280
      height: 960
      fps: 5
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 960

detectors:
  coral:
    type: edgetpu
    device: usb

logger:
  default: debug

objects:
  track:
    - person
    - cat
    - dog
  filters:
    person:
      min_area: 9000

Relevant log output

rigate  | 2024-01-14 05:29:15.213288619  [2024-01-14 05:29:15] asyncio                        DEBUG   : Using selector: EpollSelector
frigate  | 2024-01-14 05:29:15.584372423  [2024-01-14 05:28:50] detector.coral                 INFO    : Starting detection process: 300
frigate  | 2024-01-14 05:29:15.584379701  [2024-01-14 05:28:50] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as usb
frigate  | 2024-01-14 05:29:15.586688732  [2024-01-14 05:29:15] frigate.detectors.plugins.edgetpu_tfl ERROR   : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
frigate  | 2024-01-14 05:29:15.593444743  Process detector:coral:
frigate  | 2024-01-14 05:29:15.593451478  Traceback (most recent call last):
frigate  | 2024-01-14 05:29:15.593455598    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
frigate  | 2024-01-14 05:29:15.593458750      delegate = Delegate(library, options)
frigate  | 2024-01-14 05:29:15.593462310    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
frigate  | 2024-01-14 05:29:15.593465433      raise ValueError(capture.message)
frigate  | 2024-01-14 05:29:15.593506997  ValueError
frigate  | 2024-01-14 05:29:15.593510094  
frigate  | 2024-01-14 05:29:15.593515316  During handling of the above exception, another exception occurred:
frigate  | 2024-01-14 05:29:15.593518109  
frigate  | 2024-01-14 05:29:15.593521150  Traceback (most recent call last):
frigate  | 2024-01-14 05:29:15.593524724    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
frigate  | 2024-01-14 05:29:15.593564932      self.run()
frigate  | 2024-01-14 05:29:15.593569073    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
frigate  | 2024-01-14 05:29:15.593572714      self._target(*self._args, **self._kwargs)
frigate  | 2024-01-14 05:29:15.593576037    File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector
frigate  | 2024-01-14 05:29:15.593605628      object_detector = LocalObjectDetector(detector_config=detector_config)
frigate  | 2024-01-14 05:29:15.593609198    File "/opt/frigate/frigate/object_detection.py", line 53, in __init__
frigate  | 2024-01-14 05:29:15.593612741      self.detect_api = create_detector(detector_config)
frigate  | 2024-01-14 05:29:15.593616237    File "/opt/frigate/frigate/detectors/__init__.py", line 18, in create_detector
frigate  | 2024-01-14 05:29:15.593619468      return api(detector_config)
frigate  | 2024-01-14 05:29:15.593623309    File "/opt/frigate/frigate/detectors/plugins/edgetpu_tfl.py", line 41, in __init__
frigate  | 2024-01-14 05:29:15.593626701      edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config)
frigate  | 2024-01-14 05:29:15.593659455    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
frigate  | 2024-01-14 05:29:15.593663169      raise ValueError('Failed to load delegate from {}\n{}'.format(
frigate  | 2024-01-14 05:29:15.593666619  ValueError: Failed to load delegate from libedgetpu.so.1.0

Frigate stats

No response

Operating system

Proxmox

Install method

Docker Compose

Coral version

USB

Any other information that may be helpful

No response

NickM-27 commented 8 months ago

maybe try passing /dev/bus/usb as a volume instead of device, some users have had success with that

Buckeyes1995 commented 8 months ago

Edit: Working.

Turns out if I pass the device, not the bus in docker compose it works.

- /dev/bus/usb/002/006:/dev/bus/usb/002/006

NickM-27 commented 8 months ago

Thanks for updating with a solution