Getting Coral USB Accelerator working

Hey,

I’m trying to install my new Coral USB Accelerator onto my Raspberry Pi running Home Assistant. Home Assistant was installed via the Raspberry Pi imager, so I’m currently running the following:

Home Assistant 2023.6.2
Supervisor 2023.06.2
Operating System 10.3
Frontend 20230608.0 - latest

I’m trying to follow the following guide here:

However, I’ve got an issue trying to SSH into my Raspberry Pi to run the required commands. It seems like I don’t have the right username or password to do so. Any idea on how I can fix this issue. I’m able to connect to the Home Assistant U.I. and also run a addon like “Advanced SSH & Web Terminal” where I think I’m connected as root. But potentially this is not the same form or access, as when running the commands on the above site within that terminal, I don’t believe they are running successfully. For example:

echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list

Does anyone have any thoughts on what I need to do?

I have pretty much the same setup as you and my Coral arrived today.

I’ll be watching this with interest :+1:

1 Like

I made an assumption as I followed the guide in the box that some setup via SSH was required. However, after running Frigate with the following addition:

detectors: # <-------- Add this section to specify the detectors you want to use
  coral: # <---------- Name your detector (you can choose any name)
    type: edgetpu # <-- This specifies that you want to use the Coral USB Accelerator
    device: usb # <-- This tells Frigate to use the USB connected Coral device

I am getting the following in Frigates logs:

detector.coral INFO : Starting detection process: 299
frigate.detectors.plugins.edgetpu_tfl INFO : Attempting to load TPU as usb
frigate.detectors.plugins.edgetpu_tfl INFO : TPU found

Though I’m not sure that confims as it is actually being used as I’m seeing pretty high Pi CPU still

1 Like

If it works it is being used. There is no setup required for USB Coral and frigate

1 Like

I am having the same issue. Which is:
-Installed Frigate (full access)
-Configured using the Frigate website
-Success in saying “TPU Found”
-Check the hardware performance and the CPU usage is high. The Coral USB has no usage.
-I configure additional cameras to overload the CPU. Whatever the CPU can’t handle, it is then off loaded to the Coral USB.

Now I am running on an 2008 iMac which is not meant to handle more than 1 stream. I’ve tried 2 cameras or more on raw CPU and it crashes. It shows signs that the Coral USB is working but it not the first choice of Frigate to use. Is there a way to force Frigate to use Coral USB as the primary?

that’s not how frigate works. If you configure it to use the coral then it will only use the coral for object detection

I think you are confusing something, the coral does not support usage stats as it only supports one inference at a time.

Thanks for the response, it got me thinking to look at it a different angle.

Do you mean that coral only runs when there are objects in the frame?

After looking at the Coral datasheet, the Coral has a light: if it is a solid light it is to let you know that it is powered/initialized, if the light is “pulsing” then it means the TPU is running/activity on it. My light only stays solid and only pulses when there is a subject on the frame. The only thing I can reason here is that the CPU is constantly analyzing the frames and hands off the object recognition process to the Coral USB. Would this be an accurate statement?

the CPU is used to run motion detection and regions (portions of the camera frame) are sent to object detection.

you should provide a screenshot of the system page to see which process is using high amounts of CPU

1 Like

Thank you for the insight. I think this explains it well and hopefully it serves as a reference point for other users that are wanting to use Coral with Frigate (or the like).

Hi. I’m trying frigate for the first time and I ended with trying to know more about coral, because my CPU get’s to +90% usage.
It seems you get that working. Did the CPU usage dropped?

Even though I don’t see any recent activity (if 18 days isn’t recent) I wanted to jump in here as I have similar circumstances. I am running Home Assistant on a Windows 10 machine under a VMWare Workstation (17). I got the Coral working by modifying the .vmx file and the logs show basically what Lockie (OP) states. My problem is that occasionally the Coral “gets stuck” and restarts leaving about 30 seconds where it is offline. I moved the coral to a powered USB hub in case that was the problem but it didn’t seem to help. I noticed my inference times were around 300 ms which I thought was okay until I saw that the norm was 10-30 ms. Can anyone confirm that there is no need for additional setup of the Coral with HA? - sorry Nick. Seems like I saw something in a HA forum about different models (or libraries?). Also, there are many forums about using Coral with HA so it isn’t even close to being “plug and play”. Example: 7 months ago on Reddit the OP was directed to the Google Coral getting started page, which begins with the code Lockie mentioned - so we’re back to the original question of how/where to enter that code. I also tried Advanced SSH and web terminal add on. Steps 1 and 2 are to “Add our Debian package repository to your system:” and “Install the Edge TPU runtime:” I am Linux illiterate (obviously) but I can’t be the only one. I’m surprised there isn’t something in HACS to help, but maybe it’s too easy???

everything needed is included in Frigate, but there can be setup on the host side when not running docker natively (like the docs recommend). VMs and proxmox can especially cause extra issues and require configuration.

Installing pycoral and other libs is never required as the frigate docker container contains these, users saying this are misinformed

1 Like

That makes sense. I might just have a faulty Coral - I was wondering how it was available when I got it back in August. I got it from Allied Electronics for about 80 bucks. I noticed it was down to 65ms earlier and now it’s back to 295ms. Funny because it “got stuck” 3 times within 20 minutes earlier (at 65ms) and I restarted an hour ago with zero “stucks” so far.
Another thing I noticed is it says under "Storage/ recordings and snapshots that I have 31 gig of data - for the life of me I don’t know where. Not in “media/frigate”. You are 100% correct about VMs - they are a pain in the ass. If I didn’t have Blue Iris I would try a different setup. Of course, if I could get Frigate to work with the Coral dependably I could get rid of BI. Still having trouble viewing clips from Frigate via the HA app though. Thought I had it working albeit slowly earlier. I am trying out Nabu Casa in case Cloudflare affected it. Anyway Thanks for the help - I see you answering questions all over the net

I’ve been searching forums for more info and I see you come up a lot (example: [Detector Support]: Google Coral USB TPU get stuck · Issue #7427 · blakeblackshear/frigate · GitHub). I also see you and other people recommending trying different USB cables. I am currently on the short one provided with the coral. I have tried other ones, but how do I know if I have a quality cable other than spending more and hoping “you get what you pay for?” The powered hub I have has it’s own (proprietary?) cord between itself and the USB outlet but the problem existed before I bought it.
Current situation is inference at 140ms and Coral was “stuck” only once in the past 15 hours - I could live with that if it were consistent. I restarted HA once about an hour ago so will see. I haven’t moved anything around physically since I started asking questions yesterday but I did restart the VM, so it may be pointing to a problem there still

1 Like

Forgot to update, but I switched to a mini PC with HA installed via Ubuntu as suggested in Installation Option for x86-64. Everything is so much easier now - inference is under 10ms and don’t seem to get any instances where the Coral is “stuck” anymore. Thanks as always for your help and input Nick.

1 Like

Ah. That’s not the best news. I was hoping I could run one camera on my Pi4, Frigate as an addon with Coral.

I don’t think there is a problem with running frigate on a pi4. What makes you think otherwise?

1 Like

Thanks for the reply. This.

@DaveW1 was not running on a Pi.

I was going to say the same thing as Nick. Plenty of people ( I see online) run Frigate with Coral on a pi even with more than 1 camera. In fact, I’m wondering if the OP got his working; maybe they’re like me and forgot to come back to confirm whether they did or if they just gave up. You’re definitely in the right place for help. If/when you get it working on the pi, be sure to come back here and let anybody searching for a similar answer know - I kinda detoured with my experience. At the time I probably thought it was the closest to my experience I could find
Hopefully I’ll remember to bookmark the forum homepage this time LOL