Google Coral on jlmkr not initializing

Hi,
I just got my Google Coral, and I now want to use it for Frigate.
Unfortunately, even when I forwarded it as a device (or volume, as I found online) in docker, it is not initializing. When I run lsusb in the jail shell, it recognizes the device, so to my knowledge, it is passing it through to Frigate as per the docker config. I tried three
different cables, USB ports, and powering the Coral through a powered USB-C hub.
No matter what I try, it always recognizes the TPU but never initializes it.
What am I doing wrong?

lsusb results:
1a6e:089a Global Unichip Corp.

what it should change to after initializing:
18d1:9302 Google Inc.

docker-compose.yml:

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: "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/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
      - /path/to/your/config:/config
      - /path/to/your/storage:/media/frigate
      - 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"

frigate config:

mqtt:
  enabled: false

** camera config **

snapshots:
  enabled: true
  timestamp: true
  bounding_box: true
  retain:
    default: 14
record:
  enabled: true
  retain:
    days: 2
    mode: all
  events:
    retain:
      default: 10

ui:
  live_mode: webrtc

detectors:
  coral:
    type: edgetpu
    device: usb

frigate logs:

2024-06-02 20:16:31.230885953  Process detector:coral:
2024-06-02 20:16:31.230904563  [2024-06-02 20:16:31] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as usb
2024-06-02 20:16:31.230924732  [2024-06-02 20:16:31] frigate.detectors.plugins.edgetpu_tfl ERROR   : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
2024-06-02 20:16:31.231375259  Traceback (most recent call last):
2024-06-02 20:16:31.231382369    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
2024-06-02 20:16:31.231382729      delegate = Delegate(library, options)
2024-06-02 20:16:31.231383139    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
2024-06-02 20:16:31.231384019      raise ValueError(capture.message)
2024-06-02 20:16:31.231387539  ValueError
2024-06-02 20:16:31.231390559  
2024-06-02 20:16:31.231390969  During handling of the above exception, another exception occurred:
2024-06-02 20:16:31.231391249  
2024-06-02 20:16:31.231394489  Traceback (most recent call last):
2024-06-02 20:16:31.231407159    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
2024-06-02 20:16:31.231407559      self.run()
2024-06-02 20:16:31.231407939    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
2024-06-02 20:16:31.231408339      self._target(*self._args, **self._kwargs)
2024-06-02 20:16:31.231408699    File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector
2024-06-02 20:16:31.231409099      object_detector = LocalObjectDetector(detector_config=detector_config)
2024-06-02 20:16:31.231413019    File "/opt/frigate/frigate/object_detection.py", line 53, in __init__
2024-06-02 20:16:31.231413389      self.detect_api = create_detector(detector_config)
2024-06-02 20:16:31.231413739    File "/opt/frigate/frigate/detectors/__init__.py", line 18, in create_detector
2024-06-02 20:16:31.231414019      return api(detector_config)
2024-06-02 20:16:31.231414389    File "/opt/frigate/frigate/detectors/plugins/edgetpu_tfl.py", line 41, in __init__
2024-06-02 20:16:31.231414789      edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config)
2024-06-02 20:16:31.231415189    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
2024-06-02 20:16:31.231422329      raise ValueError('Failed to load delegate from {}\n{}'.format(
2024-06-02 20:16:31.231426069  ValueError: Failed to load delegate from libedgetpu.so.1.0

Thanks

I was planning to do this as well, but with an m.2 variant of the TPU. Was hoping to not have to resort to a VM for 1 app, Frigate.

That was what I am trying to avoid, I don’t want to allocate a certain amount of resources to frigate but have it all shared. Unfortunately I was not able to solve this issue and I guess I just wasted $80 :(.

It’s a real shame cause this would work really nicely.
Maybe my Coral was just DOA but I doubt it.
I’m gonna test it on another computer soon and see how that works out.

There is an ix TrueNAS official “app” which I’m using with a USB Coral and it works perfectly; is that a possibility for you?

I’ve heard that they are not as good as jlmkr and consume more system rescources. Also, when I tried Jellyfin it was really bad. I guess as a last resort I could do that, but would rather not.

I know it’s been a looong while but I finally got the urge to try using the coral once more and this time it worked!!!

I was doing some research and just randomly stumbled upon a possible solution when setting up AMD iGPU hardware acceleration for my jellyfin jail. I adjusted what was suggested here and here by dalgibbard. This is the config I ended up with for the jail:

--bind=/dev/bus/usb
--property=DeviceAllow=/dev/bus/usb
'--property=DeviceAllow=char-usb_device rwm'

Then I followed the official Google guide (you don’t need to install pycoral so step 1 is enough). However, with the gpg keys being depracated now (I think :slight_smile: ) I messed about with ChatGPT to get it installed properly instead of disabling the key verifications. Then I messed around with it with no luck until I got fed up (it actually even stopped showing up as Global Unichip Corp. at all) and just ran:

# sudo apt purge libedgetpu1-std
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following packages will be REMOVED:
libedgetpu1-std*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 1,206 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database … 17099 files and directories currently installed.)
Removing libedgetpu1-std:amd64 (16.0) …
Processing triggers for libc-bin (2.36-9+deb12u13) …

Then I don’t know why but I decided to unplug and plug it back in one last time this time in a USB 3.0 5Gbps port not my 10Gpbs port and It magically started working!!!

# 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 003: ID 18d1:9302 Google Inc.
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 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 0b05:19af ASUSTek Computer, Inc. AURA LED Controller
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

and now it works in the latest Frigate 0.17 - frigate.detectors.plugins.edgetpu_tfl | TPU found, of course after passing through- /dev/bus/usb:/dev/bus/usin docker-compose.yaml.

This is running no problem with 8ms inference on TrueNAS Scale Dragonfish-24.04.2.5.

I know most people already migrated to newer scale versions and the official APPS or LXC Containers but still wanted to document this just in case :slight_smile:

1 Like