frigate: [Support]: No EdgeTPU was detected, ValueError: Failed to load delegate from libedgetpu.so.1.0. Was working previously.

Describe the problem you are having

Frigate has stopped detecting the EdgeTPU I’ve been using successfully for quite some time. Everything was working until recently, but I don’t have an exact timeframe when it stopped. I’m using a M.2 Accelerator with Dual Edge TPU with a couple adapters to get it into a pcie slot. I haven’t had any luck troubleshooting this on my own. Looking for some next steps I could try.

Version

0.10.1-83481AF

Frigate config file

mqtt:
  host: 192.168.10.111
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: admin
  password: '{FRIGATE_MQTT_PASSWORD}'
  stats_interval: 60
  
####################################################
#                                                  #
#              GLOBAL CONFIGURATION                #
#                                                  #
####################################################

detectors:
  coral1:
    type: edgetpu
    device: pci:0
#  coral2:
#    type: edgetpu
#    device: pci:1
    
database:
  path: /config/frigate.db

ffmpeg:
  global_args: -hide_banner -loglevel warning
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p
  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1
  output_args:
    detect: -f rawvideo -pix_fmt yuv420p
    record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
    rtmp: -f flv -c:v copy -c:a aac
    
detect:
  width: 640
  height: 480
  fps: 5
  enabled: True
  max_disappeared: 25

record:
  enabled: True
  retain:
    days: 15
    mode: all
  events:
    max_seconds: 300
    pre_capture: 5
    post_capture: 15
    objects:
      - person
    required_zones: []
    retain:
      default: 15
      objects:
        person: 30
        
snapshots:
  enabled: True
  timestamp: True
  bounding_box: True
  crop: False
  height: 175
  required_zones: []
  retain:
    default: 10
    objects:
      person: 15
      
rtmp:
  enabled: True
  
live:
  height: 640
  quality: 12

timestamp_style:
  position: "tl"
  format: "%m/%d/%Y %H:%M:%S"
  color:
    red: 255
    green: 255
    blue: 255
  thickness: 2
  effect: shadow
  
####################################################
#                                                  #
#              CAMERA CONFIGURATION                #
#                                                  #
####################################################

cameras:
  front:
    ffmpeg:
      inputs:
        - path: rtsp://admin:{FRIGATE_AMCSH_PASSWORD}@192.168.44.110:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - record
            - rtmp
        - path: rtsp://admin:{FRIGATE_AMCSH_PASSWORD}@192.168.44.110:554/cam/realmonitor?channel=1&subtype=1&authbasic=64
          roles:
            - detect
    detect:
      enabled: True
    record:
      enabled: True
    objects:
      track:
        - person
        - car
        - dog
        - cat
        - bird
        - bicycle
    
  kitchen:
    ffmpeg:
      inputs:
        - path: rtsp://admin:{FRIGATE_AMCIP_PASSWORD}@192.168.44.111:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
        - path: rtsp://admin:{FRIGATE_AMCIP_PASSWORD}@192.168.44.111:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
    detect:
      enabled: True
    record:
      enabled: True
    objects:
      track:
        - person

  living_room:
    ffmpeg:
      inputs:
        - path: rtsp://admin:{FRIGATE_AMCIP_PASSWORD}@192.168.44.112:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
        - path: rtsp://admin:{FRIGATE_AMCIP_PASSWORD}@192.168.44.112:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
    detect:
      enabled: True
    record:
      enabled: True
    objects:
      track:
        - person

  garage:
    ffmpeg:
      inputs:
        - path: rtsp://admin:{FRIGATE_AMCIP_PASSWORD}@192.168.44.113:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
        - path: rtsp://admin:{FRIGATE_AMCIP_PASSWORD}@192.168.44.113:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
    detect:
      enabled: True
    record:
      enabled: True
    objects:
      track:
        - person
        - dog
        - cat
        - bird
        - mouse
        - car

  den:
    ffmpeg:
      inputs:
        - path: rtsp://admin:{FRIGATE_AMCIP_PASSWORD}@192.168.44.114:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
        - path: rtsp://admin:{FRIGATE_AMCIP_PASSWORD}@192.168.44.114:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
    detect:
      enabled: True
    record:
      enabled: True
    objects:
      track:
        - person

  baby:
    ffmpeg:
      inputs:
        - path: rtsp://admin:{FRIGATE_AMCIP_PASSWORD}@192.168.44.115:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
        - path: rtsp://admin:{FRIGATE_AMCIP_PASSWORD}@192.168.44.115:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
    detect:
      enabled: True
    record:
      enabled: True
    objects:
      track:
        - person

Relevant log output

[2022-04-17 14:01:30] detector.coral1                INFO    : Starting detection process: 213
    self.run()
[2022-04-17 14:01:30] frigate.edgetpu                INFO    : Attempting to load TPU as pci:0
[2022-04-17 14:01:30] frigate.edgetpu                ERROR   : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
Process detector:coral1:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
    delegate = Delegate(library, options)
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
    raise ValueError(capture.message)
ValueError
During handling of the above exception, another exception occurred:
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/frigate/frigate/edgetpu.py", line 136, in run_detector
    object_detector = LocalObjectDetector(
  File "/opt/frigate/frigate/edgetpu.py", line 44, in __init__
    edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config)
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
    raise ValueError('Failed to load delegate from {}\n{}'.format(
ValueError: Failed to load delegate from libedgetpu.so.1.0

FFprobe output from your camera

Input #0, rtsp, from 'rtsp://user:pass@192.168.44.111:554':
  Metadata:
    title           : Media Server
  Duration: N/A, start: 0.080000, bitrate: N/A
    Stream #0:0: Video: h264, yuvj420p(pc, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 20 fps, 50 tbr, 90k tbn, 40 tbc
    Stream #0:1: Audio: aac, 16000 Hz, mono, fltp

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

M.2

Network connection

Wired

Camera make and model

AMCREST IP3M-HX2

Any other information that may be helpful

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 32 (1 by maintainers)

Most upvoted comments

I was able to fix my problem with Coral. I think it was a problem with my python installation.

Coral was previously working correctly with Frigate, but recently stopped working. I have a dual TPU Coral using a PCIe adapter, Ubuntu system, and Frigate running in Docker.

ls /dev showed apex0 and lspci -nn | grep 089a showed the correct device, so that meant the Coral PCIe driver and the Edge TPU runtime were installed correctly.

But when I tested pycoral with the example from Google, it failed. This suggested something was wrong with either my pycoral installation or python installation on my system.

Listed below are the commands I ran. Some of it might not be required, but that’s what I ran this morning and now my Coral is working again with Frigate.

Remove python2 if it’s installed

sudo apt remove --purge python2

Set python3 version

update-alternatives --config python3

Note: I set mine to 3.9. If you’re using a different version, the below commands will need to be modified accordingly.

Reinstall python3.9

sudo apt reinstall python3.9 sudo apt remove --purge python3-apt sudo apt autoclean sudo apt reinstall python3.9-distutils sudo apt reinstall python3-pip python3.9 -m pip install --upgrade pip sudo apt reinstall python3.9-venv

Reboot system

sudo reboot

Reinstall pycoral and numpy

sudo apt reinstall python3-pycoral sudo pip uninstall numpy pip install numpy

Install Pillow if missing

pip install -U Pillow

Remove existing example for pycoral and then reinstall it

sudo rm -fr coral mkdir coral && cd coral git clone https://github.com/google-coral/pycoral.git cd pycoral bash examples/install_requirements.sh classify_image.py

Test pycoral with Google’s example

python3 examples/classify_image.py
–model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite
–labels test_data/inat_bird_labels.txt
–input test_data/parrot.jpg

If the test with Google’s example was successful, then Coral TPU should now also work in Frigate.

Does this coincide with some host os update? Maybe a new kernel update isn’t compatible with the apex driver?