[Detector Support]: Even with correct mount points, Coral TPU is not found by Frigate on unprivileged LXC in Proxmox #10732
-
Describe the problem you are havingI am trying to get a Coral TPU to be detected by a frigate instance inside an LXC. My proxmox host returns consistently this for
The root has on bus 4:
I am allowing that device to the LXC using their major and majors, as weell as mounting
Inside the container, I U see the mounted devices:
But when Frigate starts, it fails constanly due not detected TPU I have seen #9970 and #9019 (comment) but it does not look like I have those problems (unless I am miss reading something) Version13.2 Frigate config file# yaml-language-server: $schema=http:https://frigate:5001/api/config/schema.json
mqtt:
host: homeassistant
user: mosquitto_broker
password: "{FRIGATE_MOSQUITO_PASSWORD}"
go2rtc:
streams:
dana:
- "{FRIGATE_CAMERA_DANA_PATH}"
- "ffmpeg:dana#audio=opus"
ian:
- "ffmpeg:{FRIGATE_CAMERA_IAN_PATH}"
- "ffmpeg:ian#audio=opus"
sala:
- "{FRIGATE_CAMERA_SALA_PATH}"
- "ffmpeg:sala#audio=opus"
hobbyraum:
- "{FRIGATE_CAMERA_HOBBYRAUM_PATH}"
- "ffmpeg:hobbyraum#audio=opus"
webrtc:
candidates:
## This is the device running frigate
- frigate:8555
ui:
live_mode: webrtc
cameras:
dana: # <------ Name the camera
ffmpeg:
output_args:
record: preset-record-generic-audio-copy
inputs:
- path: rtsp:https://127.0.0.1:8554/dana
input_args: preset-rtsp-restream
roles:
- record
- detect
record:
enabled: True
retain:
days: 5
mode: motion
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
motion:
threshold: 25 # Default 25
contour_area: 15 # Default 30
delta_alpha: 0.2 # default 0.2
# https://www.geeksforgeeks.org/background-subtraction-in-an-image-using-concept-of-running-average/
frame_alpha: 0.2 # default 0.2
frame_height: 50 # default 50
# NOTE: see docs for more detailed info on creating masks
mask:
# Camara encima de la cabeza
- 0,0,1050,0,631,0,754,0,750,67,763,1080,1414,1080,1657,0,1920,0,1920,402,1920,1080,0,1080
improve_contrast: False
mqtt_off_delay: 3 # 30
snapshots:
enabled: false
bounding_box: true
# retain:
# default: 14
ian: # <------ Name the camera
ffmpeg:
# output_args:
# record: preset-record-generic-audio-copy
inputs:
- path: "{FRIGATE_CAMERA_IAN_PATH}"
roles:
- record
- detect
record:
enabled: True
retain:
days: 2
mode: motion
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
motion:
threshold: 25 # Default 25
contour_area: 15 # Default 30
delta_alpha: 0.2 # default 0.2
# https://www.geeksforgeeks.org/background-subtraction-in-an-image-using-concept-of-running-average/
frame_alpha: 0.2 # default 0.2
frame_height: 50 # default 50
mask:
- 0,0,623,0,624,62,0,70 # Ignore time
improve_contrast: False
mqtt_off_delay: 3 # 30
snapshots:
enabled: false
bounding_box: true
sala: # <------ Name the camera
ffmpeg:
output_args:
record: preset-record-generic-audio-copy
inputs:
- path: rtsp:https://127.0.0.1:8554/sala
input_args: preset-rtsp-restream
roles:
- record
- detect
record:
enabled: True
retain:
days: 2
mode: motion
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
motion:
threshold: 25 # Default 25
contour_area: 15 # Default 30
delta_alpha: 0.2 # default 0.2
# https://www.geeksforgeeks.org/background-subtraction-in-an-image-using-concept-of-running-average/
frame_alpha: 0.2 # default 0.2
frame_height: 50 # default 50
mask:
- 0,0,623,0,624,62,0,70 # Ignore time
improve_contrast: False
# Optional: Delay when updating camera motion through MQTT from ON -> OFF (default: shown below).
mqtt_off_delay: 1 # 30
snapshots:
enabled: false
bounding_box: true
# retain:
# default: 14
hobbyraum: # <------ Name the camera
ffmpeg:
output_args:
record: preset-record-generic-audio-copy
inputs:
# NOTE: path may include environment variables, which must begin with 'FRIGATE_' and be referenced in {}
- path: rtsp:https://127.0.0.1:8554/hobbyraum
input_args: preset-rtsp-restream
roles:
- record
- detect
record:
enabled: True
retain:
days: 2
mode: motion
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
motion:
threshold: 25 # Default 25
contour_area: 15 # Default 30
delta_alpha: 0.2 # default 0.2
# https://www.geeksforgeeks.org/background-subtraction-in-an-image-using-concept-of-running-average/
frame_alpha: 0.2 # default 0.2
frame_height: 50 # default 50
mask:
- 0,0,623,0,624,62,0,70 # Ignore time
improve_contrast: False
mqtt_off_delay: 1 # 30
snapshots:
enabled: false
bounding_box: true
# retain:
# default: 14
detectors:
# Required: name of the detector
coral:
# Required: type of the detector
# Valid values are 'edgetpu' (requires device property below) and 'cpu'.
type: edgetpu
# Optional: device name as defined here: https://coral.ai/docs/edgetpu/multiple-edgetpu/#using-the-tensorflow-lite-python-api
device: usb
# Optional: num_threads value passed to the tflite.Interpreter (default: shown below)
# This value is only used for CPU types
# num_threads: 3 docker-compose file or Docker CLI commandversion: "3.9"
services:
frigate:
container_name: frigate
restart: unless-stopped
image: ghcr.io/blakeblackshear/frigate:stable
shm_size: "150mb" # 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
- /srv/stack/frigate/config:/config
- /srv/stack/frigate/storage:/media/frigate
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 1000000000
ports:
- 5001:5000 # MAC devices use port 5000 for AirPlay Receiver https://stackoverflow.com/a/69829313/1255819
- "8554:8554" # RTSP feeds
- "8555:8555/tcp" # WebRTC over tcp
- "8555:8555/udp" # WebRTC over udp
environment:
- FRIGATE_MOSQUITO_PASSWORD=${FRIGATE_MOSQUITO_PASSWORD}
- FRIGATE_CAMERA_DANA_PATH=${FRIGATE_CAMERA_DANA_PATH}
- FRIGATE_CAMERA_IAN_PATH=${FRIGATE_CAMERA_IAN_PATH}
- FRIGATE_CAMERA_SALA_PATH=${FRIGATE_CAMERA_SALA_PATH}
- FRIGATE_CAMERA_HOBBYRAUM_PATH=${FRIGATE_CAMERA_HOBBYRAUM_PATH} Relevant log outputs6-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
2024-03-29 07:54:13.253202397 [INFO] Preparing new go2rtc config...
s6-rc: info: service frigate successfully started
s6-rc: info: service nginx: starting
s6-rc: info: service go2rtc-healthcheck successfully started
2024-03-29 07:54:13.266126060 [INFO] Preparing Frigate...
2024-03-29 07:54:13.289321525 [INFO] Starting Frigate...
s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
2024-03-29 07:54:13.320106382 [INFO] Starting NGINX...
s6-rc: info: service legacy-services successfully started
2024-03-29 07:54:13.668974298 [WARN] Using go2rtc binary from '/config/go2rtc' instead of the embedded one
2024-03-29 07:54:13.668980734 [INFO] Starting go2rtc...
2024-03-29 07:54:13.844348042 07:54:13.842 INF go2rtc version 1.8.5 linux/amd64
2024-03-29 07:54:13.844353689 07:54:13.843 INF [rtsp] listen addr=:8554
2024-03-29 07:54:13.844355825 07:54:13.843 INF [webrtc] listen addr=:8555
2024-03-29 07:54:13.844757494 07:54:13.844 INF [api] listen addr=:1984
2024-03-29 07:54:14.822479283 [2024-03-29 07:54:14] frigate.app INFO : Starting Frigate (0.13.2-6476f8a)
2024-03-29 07:54:14.875412539 [2024-03-29 07:54:14] peewee_migrate.logs INFO : Starting migrations
2024-03-29 07:54:14.879295437 [2024-03-29 07:54:14] peewee_migrate.logs INFO : There is nothing to migrate
2024-03-29 07:54:14.884368664 [2024-03-29 07:54:14] frigate.app INFO : Recording process started: 423
2024-03-29 07:54:14.888681375 [2024-03-29 07:54:14] frigate.app INFO : go2rtc process pid: 89
2024-03-29 07:54:14.925349372 [2024-03-29 07:54:14] frigate.app INFO : Output process started: 434
2024-03-29 07:54:14.949677502 [2024-03-29 07:54:14] frigate.comms.dispatcher INFO : Turning off detection for sala
2024-03-29 07:54:14.949683442 [2024-03-29 07:54:14] frigate.comms.dispatcher INFO : Turning off detection for dana
2024-03-29 07:54:14.949689838 [2024-03-29 07:54:14] frigate.comms.dispatcher INFO : Turning off detection for ian
2024-03-29 07:54:14.978414437 [2024-03-29 07:54:14] frigate.app INFO : Camera processor started for dana: 444
2024-03-29 07:54:14.987300148 [2024-03-29 07:54:14] frigate.app INFO : Camera processor started for ian: 445
2024-03-29 07:54:15.003594897 [2024-03-29 07:54:14] frigate.app INFO : Camera processor started for sala: 447
2024-03-29 07:54:15.018408996 [2024-03-29 07:54:15] frigate.app INFO : Camera processor started for hobbyraum: 448
2024-03-29 07:54:15.041701655 [2024-03-29 07:54:15] frigate.app INFO : Capture process started for dana: 451
2024-03-29 07:54:15.064016187 [2024-03-29 07:54:15] frigate.app INFO : Capture process started for ian: 457
2024-03-29 07:54:15.076837931 [2024-03-29 07:54:15] frigate.app INFO : Capture process started for sala: 465
2024-03-29 07:54:15.088568437 [2024-03-29 07:54:15] frigate.app INFO : Capture process started for hobbyraum: 469
2024-03-29 07:54:23.267046335 [INFO] Starting go2rtc healthcheck service...
2024-03-29 07:54:40.127105128 [2024-03-29 07:54:14] detector.coral INFO : Starting detection process: 433
2024-03-29 07:54:40.127110742 [2024-03-29 07:54:14] frigate.detectors.plugins.edgetpu_tfl INFO : Attempting to load TPU as usb
2024-03-29 07:54:40.144978867 Process detector:coral:
2024-03-29 07:54:40.144984416 Traceback (most recent call last):
2024-03-29 07:54:40.144986847 File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
2024-03-29 07:54:40.144988799 delegate = Delegate(library, options)
2024-03-29 07:54:40.144991151 File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
2024-03-29 07:54:40.145032301 raise ValueError(capture.message)
2024-03-29 07:54:40.145034701 ValueError
2024-03-29 07:54:40.145036423
2024-03-29 07:54:40.145039672 During handling of the above exception, another exception occurred:
2024-03-29 07:54:40.145041488
2024-03-29 07:54:40.145043497 Traceback (most recent call last):
2024-03-29 07:54:40.145045894 File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
2024-03-29 07:54:40.145084914 self.run()
2024-03-29 07:54:40.145087582 File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
2024-03-29 07:54:40.145089924 self._target(*self._args, **self._kwargs)
2024-03-29 07:54:40.145092058 File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector
2024-03-29 07:54:40.145113670 object_detector = LocalObjectDetector(detector_config=detector_config)
2024-03-29 07:54:40.145115942 File "/opt/frigate/frigate/object_detection.py", line 53, in __init__
2024-03-29 07:54:40.145118411 self.detect_api = create_detector(detector_config)
2024-03-29 07:54:40.145120664 File "/opt/frigate/frigate/detectors/__init__.py", line 18, in create_detector
2024-03-29 07:54:40.145122736 return api(detector_config)
2024-03-29 07:54:40.145124953 File "/opt/frigate/frigate/detectors/plugins/edgetpu_tfl.py", line 41, in __init__
2024-03-29 07:54:40.145127274 edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config)
2024-03-29 07:54:40.145149419 File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
2024-03-29 07:54:40.145151644 raise ValueError('Failed to load delegate from {}\n{}'.format(
2024-03-29 07:54:40.145153674 ValueError: Failed to load delegate from libedgetpu.so.1.0
2024-03-29 07:54:40.145155489
2024-03-29 07:54:40.145973515 [2024-03-29 07:54:40] frigate.detectors.plugins.edgetpu_tfl ERROR : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
2024-03-29 07:54:45.205966081 [2024-03-29 07:54:45] 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
2024-03-29 07:54:45.222465009 [INFO] The go2rtc-healthcheck service exited with code 256 (by signal 15)
s6-rc: info: service go2rtc-healthcheck successfully stopped
2024-03-29 07:54:45.300633910 [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
2024-03-29 07:54:45.311017070 [2024-03-29 07:54:45] frigate.app INFO : Stopping...
s6-rc: info: service nginx-log successfully stopped
2024-03-29 07:54:45.312653348 [2024-03-29 07:54:45] frigate.storage INFO : Exiting storage maintainer...
2024-03-29 07:54:45.312657017 [2024-03-29 07:54:45] frigate.events.cleanup INFO : Exiting event cleanup...
2024-03-29 07:54:45.312659234 [2024-03-29 07:54:45] frigate.record.cleanup INFO : Exiting recording cleanup...
2024-03-29 07:54:45.312998390 [2024-03-29 07:54:45] frigate.stats INFO : Exiting stats emitter...
2024-03-29 07:54:45.313137829 [2024-03-29 07:54:45] frigate.ptz.autotrack INFO : Exiting autotracker...
2024-03-29 07:54:45.313239953 [2024-03-29 07:54:45] frigate.watchdog INFO : Exiting watchdog...
2024-03-29 07:54:45.449194647 [2024-03-29 07:54:45] frigate.comms.ws INFO : Exiting websocket client...
2024-03-29 07:54:45.478823935 [2024-03-29 07:54:45] frigate.object_processing INFO : Exiting object processor...
2024-03-29 07:54:46.246125757 [2024-03-29 07:54:46] frigate.events.maintainer INFO : Exiting event processor...
2024-03-29 07:54:46.247017516 [2024-03-29 07:54:46] peewee.sqliteq INFO : writer received shutdown request, exiting.
2024-03-29 07:54:46.249991608 [2024-03-29 07:54:46] watchdog.sala INFO : Terminating the existing ffmpeg process...
2024-03-29 07:54:46.249995785 [2024-03-29 07:54:46] watchdog.sala INFO : Waiting for ffmpeg to exit gracefully...
2024-03-29 07:54:46.250367267 [2024-03-29 07:54:46] watchdog.ian INFO : Terminating the existing ffmpeg process...
2024-03-29 07:54:46.250750845 [2024-03-29 07:54:46] watchdog.ian INFO : Waiting for ffmpeg to exit gracefully...
2024-03-29 07:54:46.251396988 [2024-03-29 07:54:46] watchdog.hobbyraum INFO : Terminating the existing ffmpeg process...
2024-03-29 07:54:46.251684893 [2024-03-29 07:54:46] watchdog.hobbyraum INFO : Waiting for ffmpeg to exit gracefully...
2024-03-29 07:54:46.252314389 [2024-03-29 07:54:46] watchdog.dana INFO : Terminating the existing ffmpeg process...
2024-03-29 07:54:46.272552603 [2024-03-29 07:54:46] watchdog.dana INFO : Waiting for ffmpeg to exit gracefully...
2024-03-29 07:54:46.284257697 [2024-03-29 07:54:46] frigate.video INFO : hobbyraum: exiting subprocess
2024-03-29 07:54:46.338335789 [2024-03-29 07:54:46] frigate.video INFO : dana: exiting subprocess
2024-03-29 07:54:46.351449079 [2024-03-29 07:54:46] frigate.video INFO : sala: exiting subprocess
2024-03-29 07:54:47.114133832 [2024-03-29 07:54:47] frigate.video INFO : ian: exiting subprocess
2024-03-29 07:54:47.613458607 [2024-03-29 07:54:47] frigate.output INFO : exiting output process...
s6-rc: info: service frigate successfully stopped
2024-03-29 07:54:48.867610894 /usr/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 19 leaked shared_memory objects to clean up at shutdown
2024-03-29 07:54:48.867616277 warnings.warn('resource_tracker: There appear to be %d '
2024-03-29 07:54:48.867618529 [INFO] Service Frigate exited with code 0 (by signal 0)
s6-rc: info: service go2rtc: stopping
s6-rc: info: service frigate-log: stopping
2024-03-29 07:54:48.869852378 exit with signal: terminated
s6-rc: info: service frigate-log successfully stopped
2024-03-29 07:54:48.879696167 [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 Operating systemDebian Install methodDocker Compose Coral versionUSB Any other information that may be helpfulNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
#9019 might be helpful |
Beta Was this translation helpful? Give feedback.
-
So after trying a lot of stuff, I tried something that I needed to get iGPU working on a Nextcloud LXC machine, allowing everyone to use the usb device. On the proxmox host, I had call I am not sure if a better way exists to be honest. |
Beta Was this translation helpful? Give feedback.
So after trying a lot of stuff, I tried something that I needed to get iGPU working on a Nextcloud LXC machine, allowing everyone to use the usb device.
On the proxmox host, I had call
chmod 666 /dev/bus/usb/004/002
andchmod 666 /dev/bus/usb/004/002
and now it works.I am not sure if a better way exists to be honest.