Raspberry Pi 3 Model B with Coral Edge TPU acceleration running SSD object detection

It wasn’t too hard to go from the inline rt-ai Edge Stream Processing Element using the Coral Edge TPU accelerator to an embedded version running on a Raspberry Pi 3 Model B with Pi camera.  The rt-ai Edge test design for this SPE is pretty simple again:

As can be seen, the Pi + Coral runs at about 4 fps with 1280 x 720 frames which is not too bad at all. In this example, I am running the PiCoral camera SPE on the Raspberry Pi node (Pi7) and the View SPE on the Default node (an i7 Ubuntu machine). Also, I’m using the combined video and metadata output which contains both the detection data and the associated JPEG video frame. However, the PiCoral SPE also has a metadata-only output. This contains all the frame information and detection data (scores, boxes etc) but not the JPEG frame itself. This can be useful for a couple of reasons. First, especially if the Raspberry Pi is connected via WiFi, transmitting the JPEGs can be a bit onerous and, if they are not needed, very wasteful. Secondly, it satisfies a potential privacy issue in that the raw video data never leaves the Raspberry Pi. Provided the metadata contains enough information for useful downstream processing, this can be a very efficient way to configure a system.

6 thoughts on “Raspberry Pi 3 Model B with Coral Edge TPU acceleration running SSD object detection”

  1. Since Coral performs better on USB3 it makes sens to use ARM64 ( in my case nanopi neo4 1GB with Armbian )
    ( for some reason both coral and ncs2 has slow support for ARM54 )
    After installation of Coral ( there is a minor missing part in coral installation script )
    cd /usr/local/lib/python3.6/dist-packages/edgetpu/swig/
    sudo cp _edgetpu_cpp_wrapper.cpython-35m-aarch64-linux-gnu.so _edgetpu_cpp_wrapper.so
    Add minimum 1GB file swap for compilation OpenCV
    MobileNet SSD v2 (COCO) 300×300 Time per inference on average 0.02s
    ( 40-50% load & peak 8.5W Coral stick included while live streaming to screen desktop mode )

    1. That’s very interesting – thanks. The odd thing is that the Coral was much slower than the NCS 2 on my x86 64 machine. Maybe this has more to do with Python (Coral SPE) versus C++ (NCS 2 SPE) than anything else, even though very little work is done at the Python level. I will try converting the Coral SSD SPE to C++ at some point and see how much faster that runs.

      1. One comment is that those tests were done with the Coral dev board rather than the USB version I believe. Don’t know how much difference that makes. It’ll be interesting to see if things change with the Raspberry Pi 4 with its (presumably) better USB3 interfaces. It’s worth noting that I am running the video data in and out of the Pi via Ethernet which may interact with the USB interface on the Pi 3. Possibly the NCS2 is less affected by this. Anyway, hopefully my Pi 4s will turn up soon and I will be able to find out if that makes any difference.

      2. Thanks for that – wasn’t aware of that board. These days I standardize on Pis to keep things simple – I recently recycled a big pile of old dev boards of many types that require different OSes and have different quirks. So, for software purposes, I just target Ubuntu/PC (and sometimes macOS) and Raspbian/Pi and that’s it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.