roflcoopter / viseron

Self-hosted, local only NVR and AI Computer Vision software. With features such as object detection, motion detection, face recognition and more, it gives you the power to keep an eye on your home, office or any other place you want to monitor.
MIT License
1.75k stars 179 forks source link

EdgeTPU found but not working #438

Open thehijacker opened 1 year ago

thehijacker commented 1 year ago

Hello,

Giving Viseron a try and hopefuly it can replay Frigate and Blue Iris for me. I have Google Coral USB version connected, visible on host and docker container and also detected:

21. 12. 2022 9:05:29
[2022-12-21 09:05:29] [DEBUG   ] [viseron.components.edgetpu] - Available devices: [{'type': 'usb', 'path': '/sys/bus/usb/devices/4-2'}]

But then I start getting:

21. 12. 2022 9:07:30
[2022-12-21 09:07:30] [ERROR   ] [viseron.components.edgetpu] - Error when trying to load EdgeTPU: Failed to load delegate from libedgetpu.so.1
21. 12. 2022 9:07:30
21. 12. 2022 9:07:30
[2022-12-21 09:07:30] [ERROR   ] [viseron.components] - Domain object_detector for component edgetpu is not ready. Retrying in 40 seconds. Error: 

Cameras are all streams from Blue Iris in MJPEG format. My config file looks like:

ffmpeg:
  camera:
    vhod:
      name: Vhod
      host: 192.168.28.59
      port: 81
      path: !secret vhod
      stream_format: mjpeg
      fps: 5
      recorder:
        idle_timeout: 1
        codec: h264

    garaza:
      name: Garaza
      host: 192.168.28.59
      port: 81
      path: !secret garaza
      stream_format: mjpeg
      fps: 5
      recorder:
        idle_timeout: 1
        codec: h264

    nadstresek:
      name: Nadstresek
      host: 192.168.28.59
      port: 81
      path: !secret nadstresek
      stream_format: mjpeg
      fps: 5
      recorder:
        idle_timeout: 1
        codec: h264

    spredaj:
      name: Spredaj
      host: 192.168.28.59
      port: 81
      path: !secret spredaj
      stream_format: mjpeg
      fps: 5
      recorder:
        idle_timeout: 1
        codec: h264

    zadaj:
      name: Zadaj
      host: 192.168.28.59
      port: 81
      path: !secret zadaj
      stream_format: mjpeg
      fps: 5
      recorder:
        idle_timeout: 1
        codec: h264

    balkon:
      name: Balkon
      host: 192.168.28.59
      port: 81
      path: !secret balkon
      stream_format: mjpeg
      fps: 5
      recorder:
        idle_timeout: 1
        codec: h264

#darknet:
#  object_detector:
#    cameras:
#      vhod:
#        fps: 1
#        scan_on_motion_only: false
#        labels:
#          - label: person
#            confidence: 0.75
#            trigger_recorder: true

# You can also use motion detection
mog2:
  motion_detector:
    cameras:
      vhod:
        fps: 1
      garaza:
        fps: 1
      spredaj:
        fps: 1
      zadaj:
        fps: 1
      balkon:
        fps: 1
      nadstresek:
        fps: 1

nvr:
  vhod:
  garaza:
  spredaj:
  zadaj:
  balkon:
  nadstresek:

edgetpu:
  object_detector:
    device: usb
    cameras:
      vhod:
        fps: 1
        labels:
          - label: car
            confidence: 0.8
          - label: person
            confidence: 0.8
      garaza:
        fps: 1
        labels:
          - label: car
            confidence: 0.8
          - label: person
            confidence: 0.8
      spredaj:
        fps: 1
        labels:
          - label: car
            confidence: 0.8
          - label: person
            confidence: 0.8
      zadaj:
        fps: 1
        labels:
          - label: car
            confidence: 0.8
          - label: person
            confidence: 0.8
      nadstresek:
        fps: 1
        labels:
          - label: car
            confidence: 0.8
          - label: person
            confidence: 0.8

#  image_classification:
#    device: usb
#    cameras:
#      vhod:
#      garaza:
#      spredaj:
#      zadaj:
#      nadstresek:
#    labels:
#      - dog

webserver:
#  port: 8888

logger:
  default_level: debug

And my docker compose:

  viseron:
    image: roflcoopter/viseron:latest
    privileged: true
    container_name: viseron
    volumes:
      - "/mnt/usb_3/Viseron/recordings:/recordings"
      - "/mnt/usb_3/Viseron/config:/config"
      - "/etc/localtime:/etc/localtime:ro"
      - type: tmpfs
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    devices:
      - /dev/bus/usb:/dev/bus/usb
      - /dev/dri/renderD128
    restart: unless-stopped
    ports:
      - "8200:8888"
    deploy:
      resources:
        limits:
          memory: 1024M
    environment:
#      - PUID=1000
#      - PGID=1000
      - TZ=Europe/Ljubljana

GUI opens but it doesn't display cameras. In log I can see:

21. 12. 2022 9:07:36
[2022-12-21 09:07:36] [WARNING ] [tornado.access] - 404 GET /api/v1/camera/nadstresek/snapshot?rand=fhd91&width=568 (192.168.28.58) 14.90ms
21. 12. 2022 9:07:36
[2022-12-21 09:07:36] [DEBUG   ] [viseron.components.webserver.api] - Routing to CameraAPIHandler.get_snapshot(*args=[], **kwargs={'camera_identifier': b'garaza'})
21. 12. 2022 9:07:36
[2022-12-21 09:07:36] [WARNING ] [tornado.access] - 404 GET /api/v1/camera/garaza/snapshot?rand=5noi2&width=568 (192.168.28.58) 2.49ms
21. 12. 2022 9:07:36
[2022-12-21 09:07:36] [DEBUG   ] [viseron.components.webserver.api] - Routing to CameraAPIHandler.get_snapshot(*args=[], **kwargs={'camera_identifier': b'spredaj'})
21. 12. 2022 9:07:36
[2022-12-21 09:07:36] [WARNING ] [tornado.access] - 404 GET /api/v1/camera/spredaj/snapshot?rand=o0gfrg&width=568 (192.168.28.58) 2.98ms

What else can I try to make Google Coral work? This is fist step. Next step will be actualy recording on detection. And MQTT so I can see this events in Home Assistant. But first I need person and car detected using USB Google Coral working :).

Thank you.

roflcoopter commented 1 year ago

Sorry you are having issues, will investigate asap!

roflcoopter commented 1 year ago

You dont happen to have some other container running at the same time using the EdgeTPU?

thehijacker commented 1 year ago

Good question. Frigate was not running, but it seems Coral is not available anymore. I could see it under lsusb but it did not work on Frigate either anymore. I tried to reset USB from SSH, but it failed and now lsusb doesn't even see it :). When I get home I will replug it back to the server and try again, making sure that Frigate is not running. Will write here what I found.

roflcoopter commented 1 year ago

Great, i just tested on my machine and it works there, so atleast we know the builds are not completely busted