blakeblackshear / frigate

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

[Support]: No Edge TPU (Coral) found #4991

Closed FS1961 closed 1 year ago

FS1961 commented 1 year ago

Describe the problem you are having

This is an ongoing problem. Seems like you and the Home Assistant people keep stepping on each other's code. This works beautifully for a while, and then this issue resurfaces.

Home Assistant 2023.1.2

When I was running the Beta version of Frigate, it got somehow clobbered and I started receiving an HA "Unsupported software" message so I reverted to Frigate 0.11.1

Version

0.11.1

Frigate config file

cameras:
  Dining: # <------ Name the camera
    motion:
      mask:
        - 85,207,134,279,174,352,106,352,0,352,0,104,0,0,86,0
        - 394,36,389,229,313,188,315,42    
    ffmpeg:
      inputs:
        - path: rtsp://frigate:password@192.168.178.59:554/play2.sdp # <----- Update for your camera
          roles:
            - detect
        - path: rtsp://frigate:password@192.168.178.59:554/play1.sdp # <----- Update for your camera
          roles:
            - record
            - rtmp
    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 640 # <---- update for your camera's resolution
      height: 352 # <---- update for your camera's resolution
      fps: 10

  Garage: # <------ Name the camera
    motion:
      mask:
        - 110,352,91,220,173,227,351,352
        - 578,352,402,352,473,158,563,167
    ffmpeg:
      inputs:
        - path: rtsp://frigate:password@192.168.178.36:554/play1.sdp          # <----- Update for your camera
          roles:
            - record
            - rtmp
        - path: rtsp://frigate:password@192.168.178.36:554/play3.sdp         # <----- Update for your camera
          roles:
            - detect
    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 640 # <---- update for your camera's resolution
      height: 352 # <---- update for your camera's resolution
      fps: 10

  Front-door: # <------ Name the camera
    motion:
      mask:
        - 0,127,0,352,226,352,242,327,206,83
        - 640,352,640,218,506,318,356,352,240,331,227,352
    zones:
      entry_doors:
        coordinates: 293,318,513,302,574,63,285,27
    ffmpeg:
      inputs:
        - path: rtsp://frigate:password@192.168.178.28:554/play3.sdp # <----- Update for your camera
          roles:
            - detect
        - path: rtsp://frigate:password@192.168.178.28:554/play1.sdp # <----- Update for your camera
          roles:
            - record
            - rtmp
    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 640 # <---- update for your camera's resolution
      height: 352 # <---- update for your camera's resolution
      fps: 10

  Garten-house: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: rtsp://frigate:password@192.168.178.46:554/play1.sdp # <----- Update for your camera
          roles:
            - record
            - rtmp
        - path: rtsp://frigate:password@192.168.178.46:554/play2.sdp # <----- Update for your camera
          roles:
            - detect
    rtmp:
      enabled: False # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 640 # <---- update for your camera's resolution
      height: 480 # <---- update for your camera's resolution
      fps: 5
    motion:
      mask:
        - 0,480,241,480,171,403,0,100
        - 640,480,572,480,511,399,560,252,640,168

  Drive-way: # <------ Name the camera
    motion:
      mask:
        - 206,0,123,176,195,360,0,360,0,0
        - 640,180,640,0,530,0,451,0
    zones:
      driveway_area:
        coordinates: 469,117,596,360,226,360,224,115
      front_entrance:
        coordinates: 224,112,463,105,442,0,211,0
    ffmpeg:
      inputs:
        - path: rtsp://frigate:password!@192.168.178.55:554/h264  # <----- Update for your camera
          roles:
            - record
            - rtmp
        - path: rtsp://frigate:password!@192.168.178.55:554/h264cif  # <----- Update for your camera
          roles:
            - detect
    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 640 # <---- update for your camera's resolution
      height: 360 # <---- update for your camera's resolution
      fps: 5

  Patio: # <------ Name the camera.
    motion:
      mask:
        - 640,0,436,0,397,120,640,129
        - 575,126,521,221,488,196,525,129
        - 0,283,0,0,273,0,198,54,151,65,179,220,125,273
    ffmpeg:
      inputs:
        - path: rtsp://frigate:password!@192.168.178.74:554/h264  # <----- Update for your camera
          roles:
            - record
            - rtmp
        - path: rtsp://frigate:password!@192.168.178.74:554/h264cif  # <----- Update for your camera
          roles:
            - detect
    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 640 # <---- update for your camera's resolution
      height: 360 # <---- update for your camera's resolution
      fps: 5

detectors:
  coral:
    type: edgetpu
    device: usb

Relevant log output

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2023-01-10 11:39:07] frigate.app                    INFO    : Starting Frigate (0.11.1-2eada21)
[2023-01-10 11:39:07] frigate.app                    INFO    : Creating directory: /tmp/cache
Starting migrations
[2023-01-10 11:39:07] peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
[2023-01-10 11:39:07] peewee_migrate                 INFO    : There is nothing to migrate
[2023-01-10 11:39:08] frigate.app                    INFO    : Output process started: 213
[2023-01-10 11:39:08] detector.coral                 INFO    : Starting detection process: 212
[2023-01-10 11:39:08] frigate.edgetpu                INFO    : Attempting to load TPU as usb
[2023-01-10 11:39:08] frigate.app                    INFO    : Camera processor started for Dining: 216
[2023-01-10 11:39:08] frigate.mqtt                   INFO    : Turning off detection for Dining via mqtt
[2023-01-10 11:39:08] ws4py                          INFO    : Using epoll
[2023-01-10 11:39:08] frigate.app                    INFO    : Camera processor started for Garage: 219
[2023-01-10 11:39:08] frigate.mqtt                   INFO    : Turning on snapshots for Garten-house via mqtt
[2023-01-10 11:39:08] frigate.app                    INFO    : Camera processor started for Front-door: 224
[2023-01-10 11:39:08] frigate.app                    INFO    : Camera processor started for Garten-house: 226
[2023-01-10 11:39:08] frigate.mqtt                   INFO    : Turning on recordings for Drive-way via mqtt
[2023-01-10 11:39:08] frigate.app                    INFO    : Camera processor started for Drive-way: 228
[2023-01-10 11:39:08] frigate.mqtt                   INFO    : Turning on snapshots for Drive-way via mqtt
[2023-01-10 11:39:08] frigate.app                    INFO    : Camera processor started for Patio: 230
[2023-01-10 11:39:08] frigate.mqtt                   INFO    : Turning on recordings for Patio via mqtt
[2023-01-10 11:39:08] frigate.app                    INFO    : Capture process started for Dining: 232
[2023-01-10 11:39:08] frigate.app                    INFO    : Capture process started for Garage: 234
[2023-01-10 11:39:08] frigate.mqtt                   INFO    : Turning on snapshots for Patio via mqtt
[2023-01-10 11:39:08] frigate.app                    INFO    : Capture process started for Front-door: 236
[2023-01-10 11:39:08] frigate.app                    INFO    : Capture process started for Garten-house: 243
[2023-01-10 11:39:08] frigate.app                    INFO    : Capture process started for Drive-way: 252
[2023-01-10 11:39:08] frigate.app                    INFO    : Capture process started for Patio: 262
[2023-01-10 11:39:08] ws4py                          INFO    : Using epoll
[2023-01-10 11:39:33] frigate.edgetpu                ERROR   : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
Process detector:coral:
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 "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/frigate/frigate/edgetpu.py", line 135, in run_detector
    object_detector = LocalObjectDetector(
  File "/opt/frigate/frigate/edgetpu.py", line 43, 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
[2023-01-10 11:39:38] frigate.watchdog               INFO    : Detection appears to have stopped. Exiting frigate...
[2023-01-10 11:39:38] frigate.app                    INFO    : Stopping...
[2023-01-10 11:39:38] ws4py                          INFO    : Closing all websockets with [1001] 'Server is shutting down'
[2023-01-10 11:39:38] frigate.events                 INFO    : Exiting event cleanup...
[2023-01-10 11:39:38] frigate.record                 INFO    : Exiting recording cleanup...
[2023-01-10 11:39:38] frigate.stats                  INFO    : Exiting watchdog...
[2023-01-10 11:39:38] frigate.watchdog               INFO    : Exiting watchdog...
[2023-01-10 11:39:38] frigate.record                 INFO    : Exiting recording maintenance...
[2023-01-10 11:39:38] frigate.object_processing      INFO    : Exiting object processor...
[2023-01-10 11:39:48] frigate.events                 INFO    : Exiting event processor...
[2023-01-10 11:39:48] peewee.sqliteq                 INFO    : writer received shutdown request, exiting.
[2023-01-10 11:39:48] root                           INFO    : Waiting for detection process to exit gracefully...
[2023-01-10 11:39:48] watchdog.Dining                INFO    : Terminating the existing ffmpeg process...
[2023-01-10 11:39:48] watchdog.Dining                INFO    : Waiting for ffmpeg to exit gracefully...
/usr/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 39 leaked shared_memory objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
[cmd] python3 exited 0
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

FFprobe output from your camera

none

Frigate stats

none

Operating system

HassOS

Install method

HassOS Addon

Coral version

USB

Network connection

Wired

Camera make and model

D-Link and others

Any other information that may be helpful

The Coral is the 18D1:9302

Screenshot 2023-01-10 at 11 48 09 AM Screenshot 2023-01-10 at 11 50 33 AM
blakeblackshear commented 1 year ago

It's not possible for us to be stepping on each other's code given that everything is isolated in containers. Sometimes this happens if the supervisor isn't successful at cleaning up an addons container, but that could happen with any addon. If that happens, restarting the OS cleans it up.

FS1961 commented 1 year ago

Okay. Can you tell me why Frigate doesn’t see the TOU when the HA does?

NickM-27 commented 1 year ago

Which variant of the addon are you running?

Like Blake said this can happen when containers aren't cleaned up, the coral may have a reference to a previous instance of frigate and hasn't let that go so it isn't allowing frigate to access it (coral can only be accessed by one process at a time).

So suggestion is to reboot the full system, use the full access addon with protected mode disabled.

FS1961 commented 1 year ago

I’ve rebooted the host and restarted HA as well. No joy.

NickM-27 commented 1 year ago

So which variant of the addon are you running?

FS1961 commented 1 year ago

DEBUG 0.11.1-2EADA21

NickM-27 commented 1 year ago

That's version, I am asking which variant of the addon you are running (normal or full access)

FS1961 commented 1 year ago

Sorry, Full Access.

NickM-27 commented 1 year ago

and is protected mode enabled or disabled in the addon configuration?

FS1961 commented 1 year ago

After a complete HA shutdown, here is the log.

[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2023-01-10 15:34:10] frigate.app                    INFO    : Starting Frigate (0.11.1-2eada21)
[2023-01-10 15:34:10] frigate.app                    INFO    : Creating directory: /tmp/cache
Starting migrations
[2023-01-10 15:34:10] peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
[2023-01-10 15:34:10] peewee_migrate                 INFO    : There is nothing to migrate
[2023-01-10 15:34:10] frigate.mqtt                   INFO    : Turning off detection for Dining via mqtt
[2023-01-10 15:34:10] frigate.app                    INFO    : Output process started: 214
[2023-01-10 15:34:10] frigate.app                    INFO    : Camera processor started for Dining: 217
[2023-01-10 15:34:10] detector.coral                 INFO    : Starting detection process: 213
[2023-01-10 15:34:10] frigate.edgetpu                INFO    : Attempting to load TPU as usb
[2023-01-10 15:34:10] ws4py                          INFO    : Using epoll
[2023-01-10 15:34:10] frigate.app                    INFO    : Camera processor started for Garage: 220
[2023-01-10 15:34:10] frigate.app                    INFO    : Camera processor started for Front-door: 225
[2023-01-10 15:34:10] frigate.app                    INFO    : Camera processor started for Garten-house: 226
[2023-01-10 15:34:11] frigate.app                    INFO    : Camera processor started for Drive-way: 227
[2023-01-10 15:34:11] frigate.mqtt                   INFO    : Turning on snapshots for Garten-house via mqtt
[2023-01-10 15:34:11] frigate.app                    INFO    : Camera processor started for Patio: 229
[2023-01-10 15:34:11] frigate.app                    INFO    : Capture process started for Dining: 231
[2023-01-10 15:34:11] frigate.app                    INFO    : Capture process started for Garage: 232
[2023-01-10 15:34:11] frigate.mqtt                   INFO    : Turning on recordings for Drive-way via mqtt
[2023-01-10 15:34:11] frigate.mqtt                   INFO    : Turning on snapshots for Drive-way via mqtt
[2023-01-10 15:34:11] frigate.app                    INFO    : Capture process started for Front-door: 234
[2023-01-10 15:34:11] frigate.app                    INFO    : Capture process started for Garten-house: 241
[2023-01-10 15:34:11] frigate.mqtt                   INFO    : Turning on recordings for Patio via mqtt
[2023-01-10 15:34:11] frigate.mqtt                   INFO    : Turning on snapshots for Patio via mqtt
[2023-01-10 15:34:11] frigate.app                    INFO    : Capture process started for Drive-way: 246
[2023-01-10 15:34:11] frigate.app                    INFO    : Capture process started for Patio: 252
[2023-01-10 15:34:11] ws4py                          INFO    : Using epoll
[2023-01-10 15:34:14] frigate.video                  ERROR   : Dining: Unable to read frames from ffmpeg process.
[2023-01-10 15:34:14] frigate.video                  ERROR   : Dining: ffmpeg process is not running. exiting capture thread...
[2023-01-10 15:34:14] frigate.video                  ERROR   : Garten-house: Unable to read frames from ffmpeg process.
[2023-01-10 15:34:14] frigate.video                  ERROR   : Garten-house: ffmpeg process is not running. exiting capture thread...
[2023-01-10 15:34:31] watchdog.Dining                ERROR   : Ffmpeg process crashed unexpectedly for Dining.
[2023-01-10 15:34:31] watchdog.Dining                ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2023-01-10 15:34:31] ffmpeg.Dining.detect           ERROR   : [tcp @ 0x55eb16d2be00] Connection to tcp://192.168.178.59:554?timeout=5000000 failed: No route to host
[2023-01-10 15:34:31] ffmpeg.Dining.detect           ERROR   : rtsp://frigate:spyb0t@192.168.178.59:554/play2.sdp: No route to host
[2023-01-10 15:34:31] ffmpeg.Dining.record_rtmp      ERROR   : [tcp @ 0x55aef6df8d80] Connection to tcp://192.168.178.59:554?timeout=5000000 failed: No route to host
[2023-01-10 15:34:31] ffmpeg.Dining.record_rtmp      ERROR   : rtsp://frigate:spyb0t@192.168.178.59:554/play1.sdp: No route to host
[2023-01-10 15:34:31] watchdog.Dining                INFO    : Terminating the existing ffmpeg process...
[2023-01-10 15:34:31] watchdog.Dining                INFO    : Waiting for ffmpeg to exit gracefully...
[2023-01-10 15:34:31] watchdog.Garten-house          ERROR   : Ffmpeg process crashed unexpectedly for Garten-house.
[2023-01-10 15:34:31] watchdog.Garten-house          ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2023-01-10 15:34:31] ffmpeg.Garten-house.detect     ERROR   : [tcp @ 0x56128a8d8e00] Connection to tcp://192.168.178.46:554?timeout=5000000 failed: No route to host
[2023-01-10 15:34:31] ffmpeg.Garten-house.detect     ERROR   : rtsp://frigate:spyb0t@192.168.178.46:554/play2.sdp: No route to host
[2023-01-10 15:34:34] frigate.video                  ERROR   : Dining: Unable to read frames from ffmpeg process.
[2023-01-10 15:34:34] frigate.video                  ERROR   : Dining: ffmpeg process is not running. exiting capture thread...
[2023-01-10 15:34:34] frigate.video                  ERROR   : Garten-house: Unable to read frames from ffmpeg process.
[2023-01-10 15:34:34] frigate.video                  ERROR   : Garten-house: ffmpeg process is not running. exiting capture thread...
[2023-01-10 15:34:36] frigate.edgetpu                ERROR   : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
Process detector:coral:
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 "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/frigate/frigate/edgetpu.py", line 135, in run_detector
    object_detector = LocalObjectDetector(
  File "/opt/frigate/frigate/edgetpu.py", line 43, 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
[2023-01-10 15:34:41] watchdog.Dining                ERROR   : Ffmpeg process crashed unexpectedly for Dining.
[2023-01-10 15:34:41] watchdog.Dining                ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2023-01-10 15:34:41] ffmpeg.Dining.detect           ERROR   : [tcp @ 0x55815c9c8e00] Connection to tcp://192.168.178.59:554?timeout=5000000 failed: No route to host
[2023-01-10 15:34:41] ffmpeg.Dining.detect           ERROR   : rtsp://frigate:spyb0t@192.168.178.59:554/play2.sdp: No route to host
[2023-01-10 15:34:41] ffmpeg.Dining.record_rtmp      ERROR   : [tcp @ 0x5602a4267d80] Connection to tcp://192.168.178.59:554?timeout=5000000 failed: No route to host
[2023-01-10 15:34:41] ffmpeg.Dining.record_rtmp      ERROR   : rtsp://frigate:spyb0t@192.168.178.59:554/play1.sdp: No route to host
[2023-01-10 15:34:41] watchdog.Dining                INFO    : Terminating the existing ffmpeg process...
[2023-01-10 15:34:41] watchdog.Dining                INFO    : Waiting for ffmpeg to exit gracefully...
[2023-01-10 15:34:41] watchdog.Garten-house          ERROR   : Ffmpeg process crashed unexpectedly for Garten-house.
[2023-01-10 15:34:41] watchdog.Garten-house          ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2023-01-10 15:34:41] ffmpeg.Garten-house.detect     ERROR   : [tcp @ 0x5643d988de00] Connection to tcp://192.168.178.46:554?timeout=5000000 failed: No route to host
[2023-01-10 15:34:41] ffmpeg.Garten-house.detect     ERROR   : rtsp://frigate:spyb0t@192.168.178.46:554/play2.sdp: No route to host
[2023-01-10 15:34:41] frigate.watchdog               INFO    : Detection appears to have stopped. Exiting frigate...
[2023-01-10 15:34:41] frigate.app                    INFO    : Stopping...
[2023-01-10 15:34:41] ws4py                          INFO    : Closing all websockets with [1001] 'Server is shutting down'
[2023-01-10 15:34:41] frigate.record                 INFO    : Exiting recording cleanup...
[2023-01-10 15:34:41] frigate.stats                  INFO    : Exiting watchdog...
[2023-01-10 15:34:41] frigate.watchdog               INFO    : Exiting watchdog...
[2023-01-10 15:34:41] frigate.events                 INFO    : Exiting event cleanup...
[2023-01-10 15:34:41] frigate.events                 INFO    : Exiting event processor...
[2023-01-10 15:34:41] frigate.record                 INFO    : Exiting recording maintenance...
FS1961 commented 1 year ago

Protection mode is on.

NickM-27 commented 1 year ago

Protection mode is on.

recommendation is to disable protected mode

FS1961 commented 1 year ago

Okay, trying.

FS1961 commented 1 year ago

Okay, it found the TPU now.

NickM-27 commented 1 year ago

Great, so this confirms that the supervisor was not giving the addon access to the coral when it should have been, frigate has no problem finding the coral when it is available 👍

FS1961 commented 1 year ago

So - just to reiterate, I had had this running for some time. There was an update to HA and Frigate and I started getting the "unsupported software" message and this were the only changes. I backed down the version of HA but it was still a problem (restored from backup.)

So I uninstalled Frigate Full Access (Beta) and installed Frigate Full Access. The "unsupported software" error disappeared which is why I said there was some stepping on between HA and Frigate.

NickM-27 commented 1 year ago

I've never seen the unsupported software issue when running an addon but no one else has reported that while running the beta. Seeing that error would be helpful to understand it

FS1961 commented 1 year ago

Technically, I think the exact message was in a repair message "unsupported installation - unsupported software." The dialog simply said "Ignore or learn more" Under the learn more link all it said was HA can be the only software running on the host and refers me to ADR-0012.

NickM-27 commented 1 year ago

Sounds like a bug that detected something that wasn't there as that is usually what happens when running a supervised install.

So I think this particular issue is closable, up to you if you want to try the beta again 👍 feel free to create a new issue if something comes up

FS1961 commented 1 year ago

Alrighty then.