blakeblackshear / frigate

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

[Detector Support]: No luck with USB or M.2 Coral #7445

Closed nicoya closed 1 year ago

nicoya commented 1 year ago

Describe the problem you are having

First up, the Coral USB seems to be forever stuck in "Global Unichip Corp." mode. I managed to once get it into "Google Inc." mode after some hours of random debugging but that didn't seem to improve things; it still didn't work in Frigate. I don't expect this is a power issue since the Coral is plugged directly into a USB 3.2 port on my desktop-class system.

I then managed to source an M.2 Coral and installed that. But, again, no dice, Frigate won't talk to it.

I found some diagnostics in another bug thread, and no luck there:

$ podman run -ti --rm --entrypoint=/bin/bash --privileged --mount type=bind,source=/dev,target=/dev blakeblackshear/frigate:stable
root@66377ba453ec:/opt/frigate# cd ~ \
 && apt-get -y update \
 && apt-get -y install curl \
 && mkdir test_data \
 && cd test_data \
 && curl -LO https://coral.ai/static/docs/images/parrot.jpg \
 && curl -LO https://raw.githubusercontent.com/google-coral/test_data/master/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
 && curl -LO https://raw.githubusercontent.com/google-coral/test_data/master/inat_bird_labels.txt \
 && cd .. \
 && curl -LO https://raw.githubusercontent.com/google-coral/pycoral/master/examples/classify_image.py \
 && python3 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
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]                             
Get:2 https://packages.cloud.google.com/apt coral-edgetpu-stable InRelease [6332 B]
Get:3 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:4 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:5 https://packages.cloud.google.com/apt coral-edgetpu-stable/main amd64 Packages [2317 B]
Get:6 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:7 http://deb.debian.org/debian bullseye/contrib amd64 Packages [50.6 kB]
Get:8 http://deb.debian.org/debian bullseye/non-free amd64 Packages [97.8 kB]
Get:9 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [255 kB]
Get:10 http://deb.debian.org/debian-security bullseye-security/non-free amd64 Packages [672 B]
Get:11 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [17.3 kB]
Fetched 8821 kB in 4s (2452 kB/s)                         
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
curl is already the newest version (7.74.0-1.3+deb11u7).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 94865  100 94865    0     0   216k      0 --:--:-- --:--:-- --:--:--  215k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4197k  100 4197k    0     0  6408k      0 --:--:-- --:--:-- --:--:-- 6399k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 37146  100 37146    0     0   145k      0 --:--:-- --:--:-- --:--:--  145k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4582  100  4582    0     0  23141      0 --:--:-- --:--:-- --:--:-- 23258
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:

Traceback (most recent call last):
  File "/root/classify_image.py", line 121, in <module>
    main()
  File "/root/classify_image.py", line 71, in main
    interpreter = make_interpreter(*args.model.split('@'))
  File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 87, in make_interpreter
    delegates = [load_edgetpu_delegate({'device': device} if device else {})]
  File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 52, in load_edgetpu_delegate
    return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
  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

root@66377ba453ec:~# 

I can't diagnose anything from the host OS because pycoral hasn't been updated for Python 3.11.

$ sudo apt install python3-pycoral
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-pycoral : Depends: python3-tflite-runtime (= 2.5.0.post1) but it is not going to be installed
                   Depends: python3 (< 3.10) but 3.11.4-5 is to be installed
E: Unable to correct problems, you have held broken packages.

I'm not sure what else to try?

Version

0.12.1-367D724

Frigate config file

mqtt:
  enabled: False

detectors:
  coral_usb:
    type: edgetpu
    device: usb
  coral_pci:
    type: edgetpu
    device: pci

go2rtc:
  streams:
    chromedome: 
      - "ffmpeg:http://192.168.111.128/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=*****#video=copy#audio=copy#audio=opus"
    chromedome_sub: 
      - "ffmpeg:http://192.168.111.128/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=*****"
    boolit: 
      - "ffmpeg:http://192.168.111.129/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=*****#video=copy#audio=copy#audio=opus"
    boolit_sub: 
      - "ffmpeg:http://192.168.111.129/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=*****"

objects:
  track:
    - person
    - car
    - bicycle
    - bird
    - cat
    - dog

record:
  enabled: True
  retain:
    days: 1
    mode: motion
  events:
    retain:
      default: 14
      mode: active_objects

cameras:
  chromedome:
    motion:
      mask:
        - 0,695,96,664,60,365,80,75,0,77
        - 1280,0,1280,55,0,54,0,0
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/chromedome?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/chromedome_sub?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect
  boolit:
    motion:
      mask:
        - 819,0,1280,0,1280,305
        - 223,0,250,207,655,198,726,371,889,360,935,0
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/boolit?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/boolit_sub?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect

docker-compose file or Docker CLI command

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: "1024mb" # 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/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/nicoya/frigate/config.yml:/config/config.yml
      - /home/nicoya/frigate/media:/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: "*****"

Relevant log output

$ podman-compose up  
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.3.1
** excluding:  set()
['podman', 'ps', '--filter', 'label=io.podman.compose.project=frigate', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
['podman', 'network', 'exists', 'frigate_default']
podman create --name=frigate --label io.podman.compose.config-hash=7e2dc468c05caee9d88cb0f283c2124d603055030ce04d924094b244df53acc2 --label io.podman.compose.project=frigate --label io.podman.compose.version=1.0.6 --label PODMAN_SYSTEMD_UNIT=podman-compose@frigate.service --label com.docker.compose.project=frigate --label com.docker.compose.project.working_dir=/home/nicoya/frigate --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=frigate --device /dev/bus/usb:/dev/bus/usb --device /dev/apex_0:/dev/apex_0 --device /dev/dri/renderD128 -e FRIGATE_RTSP_PASSWORD=***** -v /etc/localtime:/etc/localtime:ro -v /home/nicoya/frigate/config.yml:/config/config.yml -v /home/nicoya/frigate/media:/media/frigate --tmpfs /tmp/cache:size=1000000000 --net frigate_default --network-alias frigate -p 5000:5000 -p 8554:8554 -p 8555:8555/tcp -p 8555:8555/udp --shm-size 1024mb --privileged --restart unless-stopped ghcr.io/blakeblackshear/frigate:stable
4284ed9a628702600b33200c040f2c84bea28efe3e82202b9312d1ec1d052305
exit code: 0
podman start -a frigate
s6-rc: info: service s6rc-fdholder: starting
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service s6rc-fdholder successfully started
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service log-prepare: starting
s6-rc: info: service log-prepare successfully started
s6-rc: info: service nginx-log: starting
s6-rc: info: service go2rtc-log: starting
s6-rc: info: service frigate-log: starting
s6-rc: info: service nginx-log successfully started
s6-rc: info: service go2rtc-log successfully started
s6-rc: info: service go2rtc: starting
s6-rc: info: service frigate-log successfully started
s6-rc: info: service go2rtc successfully started
s6-rc: info: service go2rtc-healthcheck: starting
s6-rc: info: service frigate: starting
s6-rc: info: service go2rtc-healthcheck successfully started
s6-rc: info: service frigate successfully started
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
[frigate] | 2023-08-10 17:45:05.722882326  [INFO] Preparing go2rtc config...
[frigate] | 2023-08-10 17:45:05.737020463  [INFO] Starting Frigate...
[frigate] | 2023-08-10 17:45:05.747396074  [INFO] Starting NGINX...
s6-rc: info: service legacy-services successfully started
[frigate] | 2023-08-10 17:45:14.282908664  [INFO] Starting go2rtc...
[frigate] | 2023-08-10 17:45:14.923254299  17:45:14.923 INF go2rtc version 1.2.0 linux/amd64
[frigate] | 2023-08-10 17:45:14.923498287  17:45:14.923 INF [api] listen addr=:1984
[frigate] | 2023-08-10 17:45:14.924095848  17:45:14.924 INF [rtsp] listen addr=:8554
[frigate] | 2023-08-10 17:45:14.924489963  17:45:14.924 INF [srtp] listen addr=:8443
[frigate] | 2023-08-10 17:45:14.924705428  17:45:14.924 INF [webrtc] listen addr=:8555
[frigate] | 2023-08-10 17:45:15.694546523  [INFO] Starting go2rtc healthcheck service...
[frigate] | 2023-08-10 17:45:34.550277001  [2023-08-10 17:45:34] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
[frigate] | 2023-08-10 17:45:34.751534944  [2023-08-10 17:45:34] peewee_migrate                 INFO    : Starting migrations
[frigate] | 2023-08-10 17:45:34.837314437  [2023-08-10 17:45:34] peewee_migrate                 INFO    : There is nothing to migrate
[frigate] | 2023-08-10 17:45:34.914336936  [2023-08-10 17:45:34] detector.coral_usb             INFO    : Starting detection process: 430
[frigate] | 2023-08-10 17:45:34.918101411  [2023-08-10 17:45:34] detector.coral_pci             INFO    : Starting detection process: 432
[frigate] | 2023-08-10 17:45:34.919239227  [2023-08-10 17:45:34] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as usb
[frigate] | 2023-08-10 17:45:34.920904099  [2023-08-10 17:45:34] frigate.app                    INFO    : Output process started: 434
[frigate] | 2023-08-10 17:45:34.924607110  Process detector:coral_pci:
[frigate] | 2023-08-10 17:45:34.925065844  [2023-08-10 17:45:34] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as pci
[frigate] | 2023-08-10 17:45:34.925075510  [2023-08-10 17:45:34] 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] | 2023-08-10 17:45:34.926973668  [2023-08-10 17:45:34] frigate.app                    INFO    : Camera processor started for chromedome: 443
[frigate] | 2023-08-10 17:45:34.931253542  [2023-08-10 17:45:34] frigate.app                    INFO    : Camera processor started for boolit: 445
[frigate] | 2023-08-10 17:45:34.934547937  [2023-08-10 17:45:34] frigate.app                    INFO    : Capture process started for chromedome: 446
[frigate] | 2023-08-10 17:45:34.938043866  [2023-08-10 17:45:34] frigate.app                    INFO    : Capture process started for boolit: 447
[frigate] | 2023-08-10 17:45:35.103626745  Traceback (most recent call last):
[frigate] | 2023-08-10 17:45:35.103842023    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
[frigate] | 2023-08-10 17:45:35.103853091      delegate = Delegate(library, options)
[frigate] | 2023-08-10 17:45:35.104049702    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
[frigate] | 2023-08-10 17:45:35.104060690      raise ValueError(capture.message)
[frigate] | 2023-08-10 17:45:35.104243871  ValueError
[frigate] | 2023-08-10 17:45:35.104376274  
[frigate] | 2023-08-10 17:45:35.104388522  During handling of the above exception, another exception occurred:
[frigate] | 2023-08-10 17:45:35.104395493  
[frigate] | 2023-08-10 17:45:35.104498473  Traceback (most recent call last):
[frigate] | 2023-08-10 17:45:35.104714761    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
[frigate] | 2023-08-10 17:45:35.104723452      self.run()
[frigate] | 2023-08-10 17:45:35.104828364    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
[frigate] | 2023-08-10 17:45:35.104837547      self._target(*self._args, **self._kwargs)
[frigate] | 2023-08-10 17:45:35.104934636    File "/opt/frigate/frigate/object_detection.py", line 98, in run_detector
[frigate] | 2023-08-10 17:45:35.104944918      object_detector = LocalObjectDetector(detector_config=detector_config)
[frigate] | 2023-08-10 17:45:35.105043705    File "/opt/frigate/frigate/object_detection.py", line 52, in __init__
[frigate] | 2023-08-10 17:45:35.105053367      self.detect_api = create_detector(detector_config)
[frigate] | 2023-08-10 17:45:35.105247201    File "/opt/frigate/frigate/detectors/__init__.py", line 24, in create_detector
[frigate] | 2023-08-10 17:45:35.105257457      return api(detector_config)
[frigate] | 2023-08-10 17:45:35.105725883    File "/opt/frigate/frigate/detectors/plugins/edgetpu_tfl.py", line 37, in __init__
[frigate] | 2023-08-10 17:45:35.105737679      edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config)
[frigate] | 2023-08-10 17:45:35.105847031    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
[frigate] | 2023-08-10 17:45:35.105856843      raise ValueError('Failed to load delegate from {}\n{}'.format(
[frigate] | 2023-08-10 17:45:35.105991056  ValueError: Failed to load delegate from libedgetpu.so.1.0
[frigate] | 2023-08-10 17:45:35.105999069  
[frigate] | 2023-08-10 17:45:55.490491598  [2023-08-10 17:45:55] frigate.watchdog               INFO    : Detection appears to have stopped. Exiting Frigate...
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service nginx: stopping
s6-rc: info: service go2rtc-healthcheck: stopping
[frigate] | 2023-08-10 17:45:56.926803116  [INFO] The go2rtc-healthcheck service exited with code 256 (by signal 15)
s6-rc: info: service go2rtc-healthcheck successfully stopped
[frigate] | 2023-08-10 17:45:57.028300612  [INFO] Service NGINX exited with code 0 (by signal 0)
s6-rc: info: service nginx successfully stopped
s6-rc: info: service nginx-log: stopping
s6-rc: info: service frigate: stopping
[frigate] | 2023-08-10 17:45:57.067739982  [2023-08-10 17:45:57] frigate.app                    INFO    : Stopping...
[frigate] | 2023-08-10 17:45:57.068784762  [2023-08-10 17:45:57] root                           INFO    : Waiting for detection process to exit gracefully...
[frigate] | 2023-08-10 17:45:57.068922770  [2023-08-10 17:45:57] frigate.watchdog               INFO    : Exiting watchdog...
[frigate] | 2023-08-10 17:45:57.069247395  [2023-08-10 17:45:57] frigate.storage                INFO    : Exiting storage maintainer...
[frigate] | 2023-08-10 17:45:57.069893127  [2023-08-10 17:45:57] frigate.record                 INFO    : Exiting recording cleanup...
[frigate] | 2023-08-10 17:45:57.070092325  [2023-08-10 17:45:57] frigate.events                 INFO    : Exiting event cleanup...
[frigate] | 2023-08-10 17:45:57.070257038  [2023-08-10 17:45:57] frigate.stats                  INFO    : Exiting stats emitter...
[frigate] | 2023-08-10 17:45:57.171010718  [2023-08-10 17:45:57] frigate.object_processing      INFO    : Exiting object processor...
s6-rc: info: service nginx-log successfully stopped
[frigate] | 2023-08-10 17:45:57.219043927  [2023-08-10 17:45:57] frigate.events                 INFO    : Exiting event processor...
[frigate] | 2023-08-10 17:45:57.516531656  [2023-08-10 17:45:57] frigate.record                 INFO    : Exiting recording maintenance...
[frigate] | 2023-08-10 17:45:59.984646687  Process detector:coral_usb:
[frigate] | 2023-08-10 17:45:59.984822596  [2023-08-10 17:45:59] detector.coral_usb             INFO    : Signal to exit detection process...
[frigate] | 2023-08-10 17:45:59.985038394  [2023-08-10 17:45:59] 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] | 2023-08-10 17:45:59.988679109  Traceback (most recent call last):
[frigate] | 2023-08-10 17:45:59.989110385    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
[frigate] | 2023-08-10 17:45:59.989118034      delegate = Delegate(library, options)
[frigate] | 2023-08-10 17:45:59.989124117    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
[frigate] | 2023-08-10 17:45:59.989129512      raise ValueError(capture.message)
[frigate] | 2023-08-10 17:45:59.989135602  ValueError
[frigate] | 2023-08-10 17:45:59.989177334  
[frigate] | 2023-08-10 17:45:59.989188259  During handling of the above exception, another exception occurred:
[frigate] | 2023-08-10 17:45:59.989193077  
[frigate] | 2023-08-10 17:45:59.989197974  Traceback (most recent call last):
[frigate] | 2023-08-10 17:45:59.989259076    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
[frigate] | 2023-08-10 17:45:59.989264213      self.run()
[frigate] | 2023-08-10 17:45:59.989270034    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
[frigate] | 2023-08-10 17:45:59.989340875      self._target(*self._args, **self._kwargs)
[frigate] | 2023-08-10 17:45:59.989346833    File "/opt/frigate/frigate/object_detection.py", line 98, in run_detector
[frigate] | 2023-08-10 17:45:59.989353548      object_detector = LocalObjectDetector(detector_config=detector_config)
[frigate] | 2023-08-10 17:45:59.989358770    File "/opt/frigate/frigate/object_detection.py", line 52, in __init__
[frigate] | 2023-08-10 17:45:59.989417623      self.detect_api = create_detector(detector_config)
[frigate] | 2023-08-10 17:45:59.989424089    File "/opt/frigate/frigate/detectors/__init__.py", line 24, in create_detector
[frigate] | 2023-08-10 17:45:59.989429320      return api(detector_config)
[frigate] | 2023-08-10 17:45:59.989434804    File "/opt/frigate/frigate/detectors/plugins/edgetpu_tfl.py", line 37, in __init__
[frigate] | 2023-08-10 17:45:59.989440384      edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config)
[frigate] | 2023-08-10 17:45:59.989499838    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
[frigate] | 2023-08-10 17:45:59.989505771      raise ValueError('Failed to load delegate from {}\n{}'.format(
[frigate] | 2023-08-10 17:45:59.989511196  ValueError: Failed to load delegate from libedgetpu.so.1.0
[frigate] | 2023-08-10 17:45:59.989515812  
[frigate] | 2023-08-10 17:45:59.999555593  [2023-08-10 17:45:59] root                           INFO    : Detection process has exited...
[frigate] | 2023-08-10 17:46:00.376446526  [2023-08-10 17:46:00] frigate.comms.ws               INFO    : Exiting websocket client...
[frigate] | 2023-08-10 17:46:00.376995975  [2023-08-10 17:46:00] peewee.sqliteq                 INFO    : writer received shutdown request, exiting.
[frigate] | 2023-08-10 17:46:00.382929346  [2023-08-10 17:46:00] watchdog.chromedome            INFO    : Terminating the existing ffmpeg process...
[frigate] | 2023-08-10 17:46:00.383504901  [2023-08-10 17:46:00] watchdog.boolit                INFO    : Terminating the existing ffmpeg process...
[frigate] | 2023-08-10 17:46:00.383728089  [2023-08-10 17:46:00] watchdog.chromedome            INFO    : Waiting for ffmpeg to exit gracefully...
[frigate] | 2023-08-10 17:46:00.384053421  [2023-08-10 17:46:00] watchdog.boolit                INFO    : Waiting for ffmpeg to exit gracefully...
[frigate] | 2023-08-10 17:46:01.162164947  [2023-08-10 17:46:01] watchdog.boolit                INFO    : Terminating the existing ffmpeg process...
[frigate] | 2023-08-10 17:46:01.162534263  [2023-08-10 17:46:01] watchdog.boolit                INFO    : Waiting for ffmpeg to exit gracefully...
[frigate] | 2023-08-10 17:46:01.165443530  [2023-08-10 17:46:01] watchdog.chromedome            INFO    : Terminating the existing ffmpeg process...
[frigate] | 2023-08-10 17:46:01.165846373  [2023-08-10 17:46:01] watchdog.chromedome            INFO    : Waiting for ffmpeg to exit gracefully...
[frigate] | 2023-08-10 17:46:01.324446136  [2023-08-10 17:46:01] frigate.output                 INFO    : exiting output process...
[frigate] | 2023-08-10 17:46:05.187351360  /usr/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 13 leaked shared_memory objects to clean up at shutdown
[frigate] | 2023-08-10 17:46:05.187355693    warnings.warn('resource_tracker: There appear to be %d '
[frigate] | 2023-08-10 17:46:05.192618290  [INFO] Service Frigate exited with code 0 (by signal 0)
s6-rc: info: service frigate successfully stopped
s6-rc: info: service go2rtc: stopping
s6-rc: info: service frigate-log: stopping
[frigate] | 2023-08-10 17:46:05.212216798  exit OK
s6-rc: info: service frigate-log successfully stopped
[frigate] | 2023-08-10 17:46:05.323733335  [INFO] The go2rtc service exited with code 0 (by signal 0)
s6-rc: info: service go2rtc successfully stopped
s6-rc: info: service go2rtc-log: stopping
s6-rc: info: service go2rtc-log successfully stopped
s6-rc: info: service log-prepare: stopping
s6-rc: info: service s6rc-fdholder: stopping
s6-rc: info: service log-prepare successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service s6rc-fdholder successfully stopped
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
exit code: 0

Operating system

Debian

Install method

Docker Compose

Coral version

Other

Any other information that may be helpful

$ lsusb Bus 006 Device 002: ID 1a6e:089a Global Unichip Corp. 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 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 0b38:0010 Gear Head 107-Key Keyboard Bus 001 Device 002: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS Bus 001 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

$ lspci 00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05) 00:01.0 PCI bridge: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) (rev 05) 00:14.0 USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller (rev 31) 00:16.0 Communication controller: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 (rev 31) 00:17.0 SATA controller: Intel Corporation Q170/Q150/B150/H170/H110/Z170/CM236 Chipset SATA Controller [AHCI Mode] (rev 31) 00:1b.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #17 (rev f1) 00:1b.3 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #20 (rev f1) 00:1c.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #1 (rev f1) 00:1c.7 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #8 (rev f1) 00:1d.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #9 (rev f1) 00:1f.0 ISA bridge: Intel Corporation Z170 Chipset LPC/eSPI Controller (rev 31) 00:1f.2 Memory controller: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller (rev 31) 00:1f.3 Audio device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller (rev 31) 00:1f.4 SMBus: Intel Corporation 100 Series/C230 Series Chipset Family SMBus (rev 31) 00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (2) I219-V (rev 31) 01:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2070] (rev a1) 01:00.1 Audio device: NVIDIA Corporation TU106 High Definition Audio Controller (rev a1) 01:00.2 USB controller: NVIDIA Corporation TU106 USB 3.1 Host Controller (rev a1) 01:00.3 Serial bus controller: NVIDIA Corporation TU106 USB Type-C UCSI Controller (rev a1) 03:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 02) 04:00.0 USB controller: ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller 05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04) 06:00.0 System peripheral: Global Unichip Corp. Coral Edge TPU

NickM-27 commented 1 year ago

Remove the usb from your config so it only tries to load the PCIe coral.

nicoya commented 1 year ago

Still fails with the USB one commented out

podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.3.1
** excluding:  set()
['podman', 'ps', '--filter', 'label=io.podman.compose.project=frigate', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
['podman', 'network', 'exists', 'frigate_default']
podman create --name=frigate --label io.podman.compose.config-hash=7e2dc468c05caee9d88cb0f283c2124d603055030ce04d924094b244df53acc2 --label io.podman.compose.project=frigate --label io.podman.compose.version=1.0.6 --label PODMAN_SYSTEMD_UNIT=podman-compose@frigate.service --label com.docker.compose.project=frigate --label com.docker.compose.project.working_dir=/home/nicoya/frigate --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=frigate --device /dev/bus/usb:/dev/bus/usb --device /dev/apex_0:/dev/apex_0 --device /dev/dri/renderD128 -e FRIGATE_RTSP_PASSWORD=***** -v /etc/localtime:/etc/localtime:ro -v /home/nicoya/frigate/config.yml:/config/config.yml -v /home/nicoya/frigate/media:/media/frigate --tmpfs /tmp/cache:size=1000000000 --net frigate_default --network-alias frigate -p 5000:5000 -p 8554:8554 -p 8555:8555/tcp -p 8555:8555/udp --shm-size 1024mb --privileged --restart unless-stopped ghcr.io/blakeblackshear/frigate:stable
d0bebfaa9f6b1c3ae0f1fa393c5fe4545ed1be6495249a9b3a6c44d60fb79bcb
exit code: 0
podman start -a frigate
s6-rc: info: service s6rc-fdholder: starting
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service s6rc-fdholder successfully started
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service log-prepare: starting
s6-rc: info: service log-prepare successfully started
s6-rc: info: service nginx-log: starting
s6-rc: info: service go2rtc-log: starting
s6-rc: info: service frigate-log: starting
s6-rc: info: service go2rtc-log successfully started
s6-rc: info: service go2rtc: starting
s6-rc: info: service nginx-log successfully started
s6-rc: info: service frigate-log successfully started
s6-rc: info: service go2rtc successfully started
s6-rc: info: service go2rtc-healthcheck: starting
s6-rc: info: service frigate: starting
s6-rc: info: service go2rtc-healthcheck successfully started
s6-rc: info: service frigate successfully started
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
[frigate] | 2023-08-10 20:25:47.473933582  [INFO] Preparing go2rtc config...
[frigate] | 2023-08-10 20:25:47.478759203  [INFO] Starting Frigate...
[frigate] | 2023-08-10 20:25:47.480688165  [INFO] Starting NGINX...
s6-rc: info: service legacy-services successfully started
[frigate] | 2023-08-10 20:25:47.779412588  [INFO] Starting go2rtc...
[frigate] | 2023-08-10 20:25:47.875197790  20:25:47.875 INF go2rtc version 1.2.0 linux/amd64
[frigate] | 2023-08-10 20:25:47.875421226  20:25:47.875 INF [api] listen addr=:1984
[frigate] | 2023-08-10 20:25:47.875922978  20:25:47.875 INF [rtsp] listen addr=:8554
[frigate] | 2023-08-10 20:25:47.876274435  20:25:47.876 INF [srtp] listen addr=:8443
[frigate] | 2023-08-10 20:25:47.876431912  20:25:47.876 INF [webrtc] listen addr=:8555
[frigate] | 2023-08-10 20:25:48.690775326  [2023-08-10 20:25:48] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
[frigate] | 2023-08-10 20:25:48.715404084  [2023-08-10 20:25:48] peewee_migrate                 INFO    : Starting migrations
[frigate] | 2023-08-10 20:25:48.720617238  [2023-08-10 20:25:48] peewee_migrate                 INFO    : There is nothing to migrate
[frigate] | 2023-08-10 20:25:48.731956478  [2023-08-10 20:25:48] detector.coral_pci             INFO    : Starting detection process: 429
[frigate] | 2023-08-10 20:25:48.733759624  [2023-08-10 20:25:48] frigate.app                    INFO    : Output process started: 431
[frigate] | 2023-08-10 20:25:48.738174807  [2023-08-10 20:25:48] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as pci
[frigate] | 2023-08-10 20:25:48.738343810  Process detector:coral_pci:
[frigate] | 2023-08-10 20:25:48.738787808  [2023-08-10 20:25:48] 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] | 2023-08-10 20:25:48.739344141  [2023-08-10 20:25:48] frigate.app                    INFO    : Camera processor started for chromedome: 437
[frigate] | 2023-08-10 20:25:48.739965477  Traceback (most recent call last):
[frigate] | 2023-08-10 20:25:48.740000936    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
[frigate] | 2023-08-10 20:25:48.740002945      delegate = Delegate(library, options)
[frigate] | 2023-08-10 20:25:48.740005147    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
[frigate] | 2023-08-10 20:25:48.740008817      raise ValueError(capture.message)
[frigate] | 2023-08-10 20:25:48.740017331  ValueError
[frigate] | 2023-08-10 20:25:48.740031240  
[frigate] | 2023-08-10 20:25:48.740047891  During handling of the above exception, another exception occurred:
[frigate] | 2023-08-10 20:25:48.740049315  
[frigate] | 2023-08-10 20:25:48.740050819  Traceback (most recent call last):
[frigate] | 2023-08-10 20:25:48.740060183    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
[frigate] | 2023-08-10 20:25:48.740061556      self.run()
[frigate] | 2023-08-10 20:25:48.740063385    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
[frigate] | 2023-08-10 20:25:48.740065096      self._target(*self._args, **self._kwargs)
[frigate] | 2023-08-10 20:25:48.740177324    File "/opt/frigate/frigate/object_detection.py", line 98, in run_detector
[frigate] | 2023-08-10 20:25:48.740179533      object_detector = LocalObjectDetector(detector_config=detector_config)
[frigate] | 2023-08-10 20:25:48.740191051    File "/opt/frigate/frigate/object_detection.py", line 52, in __init__
[frigate] | 2023-08-10 20:25:48.740192844      self.detect_api = create_detector(detector_config)
[frigate] | 2023-08-10 20:25:48.740194673    File "/opt/frigate/frigate/detectors/__init__.py", line 24, in create_detector
[frigate] | 2023-08-10 20:25:48.740196190      return api(detector_config)
[frigate] | 2023-08-10 20:25:48.740197992    File "/opt/frigate/frigate/detectors/plugins/edgetpu_tfl.py", line 37, in __init__
[frigate] | 2023-08-10 20:25:48.740199621      edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config)
[frigate] | 2023-08-10 20:25:48.740201469    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
[frigate] | 2023-08-10 20:25:48.740220719      raise ValueError('Failed to load delegate from {}\n{}'.format(
[frigate] | 2023-08-10 20:25:48.740222645  ValueError: Failed to load delegate from libedgetpu.so.1.0
[frigate] | 2023-08-10 20:25:48.740223906  
[frigate] | 2023-08-10 20:25:48.743905158  [2023-08-10 20:25:48] frigate.app                    INFO    : Camera processor started for boolit: 439
[frigate] | 2023-08-10 20:25:48.749138181  [2023-08-10 20:25:48] frigate.app                    INFO    : Capture process started for chromedome: 441
[frigate] | 2023-08-10 20:25:48.754445749  [2023-08-10 20:25:48] frigate.app                    INFO    : Capture process started for boolit: 444
[frigate] | 2023-08-10 20:25:57.478922910  [INFO] Starting go2rtc healthcheck service...
[frigate] | 2023-08-10 20:26:08.987404170  [2023-08-10 20:26:08] frigate.watchdog               INFO    : Detection appears to have stopped. Exiting Frigate...
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service nginx: stopping
s6-rc: info: service go2rtc-healthcheck: stopping
[frigate] | 2023-08-10 20:26:09.053350563  [INFO] The go2rtc-healthcheck service exited with code 256 (by signal 15)
s6-rc: info: service go2rtc-healthcheck successfully stopped
[frigate] | 2023-08-10 20:26:09.169478391  [INFO] Service NGINX exited with code 0 (by signal 0)
s6-rc: info: service nginx successfully stopped
s6-rc: info: service nginx-log: stopping
s6-rc: info: service frigate: stopping
[frigate] | 2023-08-10 20:26:09.186822380  [2023-08-10 20:26:09] frigate.app                    INFO    : Stopping...
[frigate] | 2023-08-10 20:26:09.195136552  [2023-08-10 20:26:09] frigate.stats                  INFO    : Exiting stats emitter...
[frigate] | 2023-08-10 20:26:09.195145795  [2023-08-10 20:26:09] frigate.record                 INFO    : Exiting recording maintenance...
[frigate] | 2023-08-10 20:26:09.195152021  [2023-08-10 20:26:09] frigate.record                 INFO    : Exiting recording cleanup...
[frigate] | 2023-08-10 20:26:09.195155767  [2023-08-10 20:26:09] frigate.storage                INFO    : Exiting storage maintainer...
[frigate] | 2023-08-10 20:26:09.195159859  [2023-08-10 20:26:09] frigate.watchdog               INFO    : Exiting watchdog...
[frigate] | 2023-08-10 20:26:09.195164650  [2023-08-10 20:26:09] frigate.events                 INFO    : Exiting event cleanup...
[frigate] | 2023-08-10 20:26:09.196717322  [2023-08-10 20:26:09] frigate.object_processing      INFO    : Exiting object processor...
s6-rc: info: service nginx-log successfully stopped
[frigate] | 2023-08-10 20:26:09.746211008  [2023-08-10 20:26:09] frigate.comms.ws               INFO    : Exiting websocket client...
[frigate] | 2023-08-10 20:26:10.004311572  [2023-08-10 20:26:10] frigate.events                 INFO    : Exiting event processor...
[frigate] | 2023-08-10 20:26:10.006634565  [2023-08-10 20:26:10] peewee.sqliteq                 INFO    : writer received shutdown request, exiting.
[frigate] | 2023-08-10 20:26:10.012351457  [2023-08-10 20:26:10] watchdog.chromedome            INFO    : Terminating the existing ffmpeg process...
[frigate] | 2023-08-10 20:26:10.012916694  [2023-08-10 20:26:10] watchdog.boolit                INFO    : Terminating the existing ffmpeg process...
[frigate] | 2023-08-10 20:26:10.013327761  [2023-08-10 20:26:10] watchdog.chromedome            INFO    : Waiting for ffmpeg to exit gracefully...
[frigate] | 2023-08-10 20:26:10.013699541  [2023-08-10 20:26:10] watchdog.boolit                INFO    : Waiting for ffmpeg to exit gracefully...
[frigate] | 2023-08-10 20:26:10.048181921  [2023-08-10 20:26:10] watchdog.chromedome            INFO    : Terminating the existing ffmpeg process...
[frigate] | 2023-08-10 20:26:10.048586539  [2023-08-10 20:26:10] watchdog.chromedome            INFO    : Waiting for ffmpeg to exit gracefully...
[frigate] | 2023-08-10 20:26:10.101296294  [2023-08-10 20:26:10] watchdog.boolit                INFO    : Terminating the existing ffmpeg process...
[frigate] | 2023-08-10 20:26:10.101475918  [2023-08-10 20:26:10] watchdog.boolit                INFO    : Waiting for ffmpeg to exit gracefully...
[frigate] | 2023-08-10 20:26:10.286880888  [2023-08-10 20:26:10] frigate.output                 INFO    : exiting output process...
[frigate] | 2023-08-10 20:26:14.332473636  /usr/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 11 leaked shared_memory objects to clean up at shutdown
[frigate] | 2023-08-10 20:26:14.332477488    warnings.warn('resource_tracker: There appear to be %d '
[frigate] | 2023-08-10 20:26:14.336999704  [INFO] Service Frigate exited with code 0 (by signal 0)
s6-rc: info: service frigate successfully stopped
s6-rc: info: service go2rtc: stopping
s6-rc: info: service frigate-log: stopping
[frigate] | 2023-08-10 20:26:14.340586864  exit OK
s6-rc: info: service frigate-log successfully stopped
[frigate] | 2023-08-10 20:26:14.346562161  [INFO] The go2rtc service exited with code 0 (by signal 0)
s6-rc: info: service go2rtc successfully stopped
s6-rc: info: service go2rtc-log: stopping
s6-rc: info: service go2rtc-log successfully stopped
s6-rc: info: service log-prepare: stopping
s6-rc: info: service s6rc-fdholder: stopping
s6-rc: info: service log-prepare successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service s6rc-fdholder successfully stopped
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
exit code: 0
NickM-27 commented 1 year ago

Could try mapping the device as a volume instead, I've never seen this type of issue before.

nicoya commented 1 year ago

Hmm, further experimentation revealed that this is a peculiar podman issue. Despite using the privileged flag, the device node was not accessible from within the container. Adding group-add: keep-groups to the compose file got the PCI device working. The USB device is still stuck in "Global Unichip" mode but that's probably its own, additional issue that I don't feel like looking into right now.

NickM-27 commented 1 year ago

Thanks for the update, that is odd. Feel free to create a new issue if something else comes up.

nicoya commented 1 year ago

Oops, I misspoke. group-add: keep-groups wasn't what fixed it, making the device node o+rw did. I'll open a podman bug for this because this clearly doesn't seem right.

nicoya commented 1 year ago

Ok, finally finally figured it out. It's supposed to be:

    group_add: 
      - keep-groups

Annoyingly, podman-compose isn't very verbal about skipping over directives it doesn't understand.