blakeblackshear / frigate

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

[Detector Support]: Coral not detected by Frigate #6382

Closed rockas69 closed 1 year ago

rockas69 commented 1 year ago

Describe the problem you are having

After updating from DSM 6 to DSM 7 and setting up new Frigate container within Synology Docker, container fails to start due to not detecting Coral USB dongle connect on Synology back USB port.

Version

Unable to run container to see it.

Frigate config file

mqtt:
  enabled: True
  host: xxx.xxx.xxx.xx
  port: 1883
  topic_prefix: frigate
  client_id: frigate

detectors:  # <--------------- Edge-TPU Detector  -----> https://docs.frigate.video/configuration/detectors
  coral:
    type: edgetpu
    device: usb
    model:
      path: "/custom_model.tflite"

ffmpeg:  #  <----- Hardware Acceleration
 hwaccel_args:
   - -hwaccel
   - vaapi
   - -hwaccel_device
   - /dev/dri/renderD128
   - -hwaccel_output_format
   - yuv420p     

cameras:
  Garage_Ramp: # <------ Name the camera  -----> GARAGE
    ffmpeg:
      inputs:
        - path: rtsp://user:passt@IP:554//h264Preview_01_main # <----- The stream you want to use for detection
          roles:
            - detect
    detect:
      enabled: False # <---- disable detection until you have a working camera feed
      width: 1280 # <---- update for your camera's resolution
      height: 720 # <---- update for your camera's resolution

docker-compose file or Docker CLI command

docker run -d \
  --name frigate_blakeblackshear \
  --restart=unless-stopped \
  --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 \
  --device /dev/bus/usb:/dev/bus/usb \
  --device /dev/dri/renderD128 \
  --shm-size=256m \
  -v /volume1/docker/Frigate/storage:/media/frigate \
  -v /volume1/docker/Frigate/config.yml:/config/config.yml \
  -v /dev/bus/usb:/dev/bus/usb \
  -v /etc/localtime:/etc/localtime:ro \
  -e FRIGATE_RTSP_PASSWORD='Fr1g4t3RkS!69#' \
  -p 5000:5000 \
  -p 8554:8554 \
  -p 8555:8555/tcp \
  -p 8555:8555/udp \
  ghcr.io/blakeblackshear/frigate:stable

Relevant log output

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
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
s6-rc: info: service legacy-services successfully started
2023-05-04 16:40:39.047025132  [INFO] Preparing go2rtc config...
2023-05-04 16:40:39.047149221  [INFO] Starting NGINX...
2023-05-04 16:40:39.047324949  [INFO] Starting Frigate...
2023-05-04 16:40:40.184248585  [INFO] Starting go2rtc...
2023-05-04 16:40:40.312812461  16:40:40.312 INF go2rtc version 1.2.0 linux/amd64
2023-05-04 16:40:40.313831115  16:40:40.313 INF [api] listen addr=:1984
2023-05-04 16:40:40.314515175  16:40:40.314 INF [rtsp] listen addr=:8554
2023-05-04 16:40:40.315254512  16:40:40.315 INF [srtp] listen addr=:8443
2023-05-04 16:40:40.315917510  16:40:40.315 INF [webrtc] listen addr=:8555
2023-05-04 16:40:44.300009162  [2023-05-04 16:40:44] frigate.app                    INFO    : Starting Frigate (0.12.0-da3e197)
2023-05-04 16:40:44.355061062  [2023-05-04 16:40:44] frigate.config                 WARNING : Customizing more than a detector model path is unsupported.
2023-05-04 16:40:44.377100007  [2023-05-04 16:40:44] peewee_migrate                 INFO    : Starting migrations
2023-05-04 16:40:44.391769424  [2023-05-04 16:40:44] peewee_migrate                 INFO    : There is nothing to migrate
2023-05-04 16:40:44.467702014  [2023-05-04 16:40:44] frigate.app                    INFO    : Output process started: 293
2023-05-04 16:40:44.504247524  [2023-05-04 16:40:44] detector.coral                 INFO    : Starting detection process: 292
2023-05-04 16:40:44.505142425  [2023-05-04 16:40:44] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as usb
2023-05-04 16:40:44.508259237  [2023-05-04 16:40:44] frigate.detectors.plugins.edgetpu_tfl ERROR   : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
2023-05-04 16:40:44.520419077  Process detector:coral:
2023-05-04 16:40:44.527867781  Traceback (most recent call last):
2023-05-04 16:40:44.529361992    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
2023-05-04 16:40:44.529371930      delegate = Delegate(library, options)
2023-05-04 16:40:44.530083004    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
2023-05-04 16:40:44.530092029      raise ValueError(capture.message)
2023-05-04 16:40:44.530849703  ValueError
2023-05-04 16:40:44.531487901  
2023-05-04 16:40:44.531496888  During handling of the above exception, another exception occurred:
2023-05-04 16:40:44.531499513  
2023-05-04 16:40:44.532215974  Traceback (most recent call last):
2023-05-04 16:40:44.532790671    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
2023-05-04 16:40:44.532799034      self.run()
2023-05-04 16:40:44.533858188    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
2023-05-04 16:40:44.533867938      self._target(*self._args, **self._kwargs)
2023-05-04 16:40:44.534612437    File "/opt/frigate/frigate/object_detection.py", line 98, in run_detector
2023-05-04 16:40:44.534622112      object_detector = LocalObjectDetector(detector_config=detector_config)
2023-05-04 16:40:44.535287848    File "/opt/frigate/frigate/object_detection.py", line 52, in __init__
2023-05-04 16:40:44.535297398      self.detect_api = create_detector(detector_config)
2023-05-04 16:40:44.535867457    File "/opt/frigate/frigate/detectors/__init__.py", line 24, in create_detector
2023-05-04 16:40:44.535875344      return api(detector_config)
2023-05-04 16:40:44.536488691    File "/opt/frigate/frigate/detectors/plugins/edgetpu_tfl.py", line 37, in __init__
2023-05-04 16:40:44.536497229      edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config)
2023-05-04 16:40:44.537135814    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
2023-05-04 16:40:44.537144414      raise ValueError('Failed to load delegate from {}\n{}'.format(
2023-05-04 16:40:44.539474501  ValueError: Failed to load delegate from libedgetpu.so.1.0
2023-05-04 16:40:44.539484401  
2023-05-04 16:40:44.552983662  [2023-05-04 16:40:44] frigate.app                    INFO    : Camera processor started for Garage_Ramp: 300
2023-05-04 16:40:44.575922334  [2023-05-04 16:40:44] frigate.app                    INFO    : Capture process started for Garage_Ramp: 301
2023-05-04 16:40:48.973130184  [INFO] Starting go2rtc healthcheck service...

Operating system

Other Linux

Install method

Docker CLI

Coral version

USB

Any other information that may be helpful

No response

NickM-27 commented 1 year ago

Someone has this working on DSM 7!and added it to the docs https://docs.frigate.video/frigate/installation#synology-nas-on-dsm-7

rockas69 commented 1 year ago

Have followed that guide for setup although without success

NickM-27 commented 1 year ago

I just realized the issue, you have randomly configured a custom model which isn't being used

model: path: "/custom_model.tflite"
rockas69 commented 1 year ago

thanks for noting, have already commented model and it's path, still not working.

NickM-27 commented 1 year ago

Can you comment out the detector and start frigate, then go into the container and run lsusb ? (You may need to instal usb utils)

rockas69 commented 1 year ago

After commenting detector, frigate started up with cpu correctly. Find below lsusb output. (USB Device is Coral USB)

Bus 004 Device 001: ID 1d6b:0003 Linux 3.10.108 etxhci_hcd-170202 Etron xHCI Host Controller Bus 003 Device 001: ID 1d6b:0002 Linux 3.10.108 etxhci_hcd-170202 Etron xHCI Host Controller Bus 002 Device 001: ID 1d6b:0003 Linux 3.10.108 xhci_hcd xHCI Host Controller Bus 001 Device 002: ID f400:f400 Synology DiskStation Bus 001 Device 004: ID 18d1:9302 USBDevice Bus 001 Device 001: ID 1d6b:0002 Linux 3.10.108 xhci_hcd xHCI Host Controller

NickM-27 commented 1 year ago

That seems off, the device name should be Google Inc. if the coral is being properly initialized

rockas69 commented 1 year ago

Think just solved it. During lsusb utils instalation within the container with command below: apt-get update && apt-get install -y usbutils && lsusb

Notice that also connect to Google and download a package related to Coral. Now, when looking to Info Center in Synology, shows correctly "USBDevice - Google Inc." instead of "USBDevice - Global unichip Corp."

Will keep testing and return in confirmed resolution,

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

IsaacInsoll commented 10 months ago

apt-get update && apt-get install -y usbutils && lsusb

I had the same problem (No Coral USB TPU detected in DSM7 when setting up Frigate for the first time) and this solved it 🔥

SaisonG commented 1 month ago

I have this exact problem but the steps above didn't help. Even saw coral packages in the output of update. But frigate and lsusb won't recognize the usb still:

Bus 002 Device 001: ID 1d6b:0003 Linux 4.4.302+ xhci-hcd xHCI Host Controller Bus 001 Device 003: ID 10c4:ea60 Nabu Casa SkyConnect v1.0 Bus 001 Device 002: ID f400:f400 Synology DiskStation Bus 001 Device 001: ID 1d6b:0002 Linux 4.4.302+ xhci-hcd xHCI Host Controller