Image processing with USB acceleration - all pi! ARCHIVED

Is there a way to use the current Tensorflow component with the coral or must it be done through a separate install of tensorflow? And how hard is it to integrate that back to HA?

I think this may be the only way to utilise the Coral with Tensorflow - https://github.com/robmarkcole/coral-pi-rest-server

Integration is quite straight forward per the README

I think the only way possible to use a coral is with tensorflow-lite

coral is for use with tensorflow-lite models. The official HA Tensorflow is for full tensorflow models

some people are hoping the coral code i wrote will perform as well as the official deepstack docker container - that is not the case. The coral code is very alpha, and doesn’t handle multiple requests

what do you mean exactly by “multiple requests”?

If deepstack receives multiple request it will queue them. Coral is very fast so should be fine, but I have not stress tested it

Just ordered mine. Would be interested to see how many FPS you can get from this stick :slight_smile:

Hi Robin,

I read here:

you aren’t working anymore on Coral stick.
Don’t you see still advantages of high FPS capabilities and no need to rely upon internet connection?

for HA deepstack type integration I need at most 1-2 FPS. For video rate processing there is frigate or doods.

First off, thanks for making this project. I bought a coral accelerator just to use for this application.

However, I’m seeing high memory and CPU usage after running either the coral-pi-reset-server or the tensorflow-lite-rest-server for about a day.

Is anyone else having this issue?

Might be an idea to have it restart daily, I wouldnt know where to begin debugging this kind of issue

Good news, the issue seems to have gone away on it’s own after upgrading to Home Assistant 0.113.1. It makes sense that it was on the HA side since it was affecting both the coral-pi-reset-server and the tensorflow-lite-rest-server. Keeping my fingers crossed that the issue is gone for good.

2 Likes

@robmarkcole Hello I’ve just bought Google Coral USB Accelerator and I cannot make it work on synology DS918+. Did you managed to get it working on your syno ?

Not something I tried, I do recall someone did it

did u try to make it work with synology with docker device mount ?

I was planning to do the same (DS1618+ here) can you elaborate a little bit more, what you tried, and how it failed?

Yea at the moment I’m running it in docker. It’s plausible but quite hard to run it on VM not mentioned that after extensive talk with Google Coral Stick Dev Team there is a huge performance bottleneck (their claim).
With docker it’s basically hassle free and it’s really 10x faster than without the stick. I’m having 8~10ms processing time.

1 Like

Hello,

On VM:
I’ve tried multiple options. And these are my findings:

  • Google Coral USB Accelerator changes VID/PID after inicialization (weird behaviour and design by Google)
    • When plugged into usb device is recognized as Global Unichip Corp (PID:0x089a , VID:0x1a6e)
    • After initialization (calling method from libedgetpu.so.1.0) usb stick changes to Google Inc (PID:0x9302, VID:0x18d1)
  • Changes mentioned above doesn’t propagate to VM
    • Configuration XML for VM has still the PID and VID of Global Unichip Corp
    • I tried to change this via UI VMM and these two thigs happens:
      • An error shows up after clicking on OK to save changes -
        "error msg Failedd to read the USB device. Please make sure it is properly mounted on DiskStation"
      • When I try to make changes again no error is showed and everything is saved. Sometimes changes are persistent sometimes they are not (I couldn’t find more details causing this)
    • I tried do this via calling virsh attach-device this yield some changes in configuration however I still cannot see it in VM even when address of device is configured properly.
    • I tried also to change XML configuration however same result :frowning:

My hypothesis is that VMM cannot make proper passthrough for this device due to the fact that PID/VID changes.

In Docker:
I run container with these parameters (I’m using Frigate NVR in this case) on my DS918+:

docker run -d \
  --name frigate \
  --privileged \
  --restart=unless-stopped \
  --shm-size 2gb \
  --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 \
  --device /dev/dri/renderD128 \
  -v /dev/bus/usb:/dev/bus/usb \
  -v /volume1/docker/frigate/config:/config:ro \
  -v /volume2/docker_data/frigate:/media/frigate:rw \
  -v /etc/localtime:/etc/localtime:ro \
  -e FRIGATE_RTSP_PASSWORD='<password>' \
  -p 5000:5000 \
  blakeblackshear/frigate:stable-amd64

I hope it helps if you would need any help with it let me know. (If I won’t be busy I will respond :smiley: )

thank you very much for sharing your findings. it will definitely run in docker.

one of my ongoing projects is a self hosted voice assistant (rhasspy). unfortunately several service options (rasa nlu, mycroft precise, mozilla deepspeach etc.) require a certain cpu feature (AVX) to run.
i was hoping to get around that requirement by adding such a TPU unit, but I am not sure if this will work, or if like the rasaNLU container still say it wont start on my cpu.

1 Like

Hi @borodom, thanks i was able to make coral usb work with synology 920+, can i know the frigate yaml file for used for hwaccel_args, thanks

1 Like