Open Eiritj opened 1 year ago
I think you cant run M.2 device inside docker container or virtial machine. USB device will work for sure
I hope you have installed edgetpu runtime inside the container just in case it somehow pass pci device to the container
Hi easy-and-simple, thanks a lot for taking the time to reply.
I decided to go through the installation again to check that I did not miss anything, and I very well may have botched it the first time. I use this guide: https://coral.ai/docs/m2/get-started/
I can see the device when I get to step 5:
But in step 6 I get an error when checking if the PCI driver is installed, even if I run the install again and it says that its already in place:
What can I gather from this? Is everything as it should be?
Step 3: Already installed and good.
Step 4.3: When I run the image classifier with the example bird picture I get an error:
So there seems to be an issue with the install. Do you see what the issue is?
Hello @Eiritj In order to see apex device inside docker container you can pass it with --device option to docker run command as first parameter. For example docker run --device=/dev/apex_0 ........... in place of dots pass other parameters you use to run docker container I tried it and "ls /dev/apex_0" inside dicker container can see apex_0 device,but I am not sure if this will be enough to make coral device to run inside container. Try it to see If passing apex_0 with --device option will solve your issue If it works installing edgetppu driver inside docker container should bot be necessary, but edgetpu runtime is needed because libedgetpu.so.1 file is from here. If Frigate supports edgetpu it probably is installed edgetpu runtime, but if not you can install it from here https://github.com/google-coral/libedgetpu/releases/download/release-grouper/edgetpu_runtime_20221024.zip This link id from here: https://coral.ai/software/#edgetpu-runtime
@easy-and-simple thanks for the tips, here is how I tried to implement it:
In the container console, I ran docker images
to get the image ID for the docker run command:
I tried both the ID for Portainer and Frigate, which returned the following errors:
I also tried with a different ID for the PCI coral:
I am very green, so we can assume that there is a basic step I messed up..
@Eiritj You must install gasket-dkms on host machine and then to restart host machine in order to have /dev/apex_0 device available, and only after it is available on host machine you can try to pass it to docker conatainer with --device option.
Thanks @easy-and-simple, but after installing gasket-dkms and restarting I have the same issue; /dev/apex_0 no such file or directory.
In the meantime I came across a different post that seems similar to what I am experiencing, and the issue was caused by secure boot:
@manoj7410 While digging into a separate issue I disabled secure boot and it's now working. This may be an issue specific to the NUC since I was having failures running a wireguard docker image that cleared up once I disabled it. This might be worth including in the troubleshooting documents specific to the NUC platform.
https://github.com/google-coral/edgetpu/issues/407#issuecomment-877217212
I will check this tomorrow.
Thanks again for all your help.
@Eiritj please try the steps mentioned at: https://github.com/google-coral/pycoral/issues/94#issuecomment-1343839142 .. Thanks!!
@Eiritj please try the steps mentioned at: google-coral/pycoral#94 (comment) .. Thanks!!
Hi @hjonnala, I had to travel due to work so there will be more than a week delay before I get the chance to test. I will check the secure boot setting and your suggestion when I get back. Thanks a lot for your suggestion.
Hi again @hjonnala and @easy-and-simple, sorry for the late reply, my trip got extended. Here is an update:
Secure boot was disabled.
@hjonnala docker run -ti --rm --entrypoint=/bin/bash --privileged --mount type=bind,source=/dev,target=/dev blakeblackshear/frigate:stable
Return:
Did I mess something up with the command here?
About gasked-dkms, I asked ChatGPT for help and I did the following according to its suggestions:
I installed the packages apt install build-essential dkms
, then apt install gasket-dkms
(was already installed), then I rebooted. Still, ls -l /dev/apex_0
returns "ls: cannot access '/dev/apex_0': No such file or directory".
I then made the directory manually using mknod /dev/apex_0 c 240 0
. and now I can see it when I run ls -l, but docker run --device=/dev/apex_0 65a75ca6a2e9
(I tried passing it to both Portainer and Frigate ID's) returns "-bash: docker: command not found".
Could I expect a USB Coral to be more straightforward? I am completely helpless here.
apt reinstall gasked-dkms
apt reinstall gasked-dkms
No luck, thanks anyway.
Any chance installing HAOS on bare metal and running the frigate add-on from HAOS would be succesfull with the PCI Coral?
I've decided to try two separate machines instead of the VMs to see if I get around this. I still have some questions about how to excecute this, so I will make a new thread for that.
Thanks again everyone who chimed in!
Hi all.
I've had success getting Frigate to run by using the CPU as the detector, but now I have installed a M.2 Coral (A+E key) and I can't seem to get it to detect the Coral. In the console of the docker where Portainer is installed I can see that the Coral is detected when I run
lspci
, with this output: 04:00.0 System peripheral: Global Unichip Corp. Coral Edge TPUMy last attempt was with this config for the detector:
I've also tried 04:00.0, and pci:0 as the device, but with no success. The Frigate logs output the following:
2023-05-27 21:42:42.007247830 [INFO] Starting Frigate... 2023-05-27 21:42:42.631342533 [2023-05-27 21:42:42] frigate.app INFO : Starting Frigate (0.12.0-da3e197) 2023-05-27 21:42:42.641814203 [2023-05-27 21:42:42] peewee_migrate INFO : Starting migrations 2023-05-27 21:42:42.644360106 [2023-05-27 21:42:42] peewee_migrate INFO : There is nothing to migrate 2023-05-27 21:42:42.654581912 [2023-05-27 21:42:42] detector.coral1 INFO : Starting detection process: 554 2023-05-27 21:42:42.659628665 Process detector:coral1: 2023-05-27 21:42:42.659630929 Traceback (most recent call last): 2023-05-27 21:42:42.659631871 File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate 2023-05-27 21:42:42.659635668 delegate = Delegate(library, options) 2023-05-27 21:42:42.659636870 File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in init 2023-05-27 21:42:42.659643252 raise ValueError(capture.message) 2023-05-27 21:42:42.659643974 ValueError 2023-05-27 21:42:42.659644545
2023-05-27 21:42:42.659645697 During handling of the above exception, another exception occurred: 2023-05-27 21:42:42.659646298
2023-05-27 21:42:42.659646889 Traceback (most recent call last): 2023-05-27 21:42:42.659647661 File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap 2023-05-27 21:42:42.659656647 self.run() 2023-05-27 21:42:42.659657379 File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run 2023-05-27 21:42:42.659658080 self._target(*self._args, **self._kwargs) 2023-05-27 21:42:42.659658832 File "/opt/frigate/frigate/object_detection.py", line 98, in run_detector 2023-05-27 21:42:42.659663010 object_detector = LocalObjectDetector(detector_config=detector_config) 2023-05-27 21:42:42.659663741 File "/opt/frigate/frigate/object_detection.py", line 52, in init 2023-05-27 21:42:42.659664472 self.detect_api = create_detector(detector_config) 2023-05-27 21:42:42.659665254 File "/opt/frigate/frigate/detectors/init.py", line 24, in create_detector 2023-05-27 21:42:42.659665875 return api(detector_config) 2023-05-27 21:42:42.659666606 File "/opt/frigate/frigate/detectors/plugins/edgetpu_tfl.py", line 37, in init 2023-05-27 21:42:42.659667318 edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config) 2023-05-27 21:42:42.659672167 File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate 2023-05-27 21:42:42.659672928 raise ValueError('Failed to load delegate from {}\n{}'.format( 2023-05-27 21:42:42.659673620 ValueError: Failed to load delegate from libedgetpu.so.1.0 2023-05-27 21:42:42.659674201
2023-05-27 21:42:42.659674932 [2023-05-27 21:42:42] frigate.app INFO : Output process started: 556 2023-05-27 21:42:42.659675704 [2023-05-27 21:42:42] frigate.detectors.plugins.edgetpu_tfl INFO : Attempting to load TPU as /dev/apex_0 2023-05-27 21:42:42.659682015 [2023-05-27 21:42:42] 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-27 21:42:42.665230576 [2023-05-27 21:42:42] frigate.app INFO : Camera processor started for garasje: 560 2023-05-27 21:42:42.666660700 [2023-05-27 21:42:42] frigate.app INFO : Capture process started for garasje: 562
If anyone has any pointers for me to get me on the right track it would be very much appriciated.