Google Coral - Edge TPU
The Google Coral Edge TPU (Tensor Processing Unit) is a USB device which speeds up your machine learning algorithms, on any Linux device. While we run it on Linux in general, the Raspberry Pi is our focus. And so is this guide.
NOTICE: This page is under construction. We are investigating the device and it's usage. Work in progress. Please come back regularly, you'll find updates as we try out things.
Installation
Installation is extremely straightforward. Follow the Google Coral Getting Started Guide and you're ready in no time at all. That is on Ubuntu, Raspbians etc.
Further, if using Raspberry Pi (any model), you should install feh as an image viewer:
sudo apt install feh
After finishing the above installation, you will have the Edge TPU runtime installed. We suggest to test on the provided example, and do your first bird photo detection. Seriously, it's a good idea to test, not to mention extremely rewarding. You would do your first classification of the Ara Macao, and the results should look like this:
Initializing TF Lite interpreter...
INFO: Initialized TensorFlow Lite runtime.
----INFERENCE TIME----
Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory.
11.8ms
3.0ms
2.8ms
2.9ms
2.9ms
-------RESULTS--------
923 Ara macao (Scarlet Macaw): 0.76562
Installing the Edge TPU Python API
After you install the basics, you will probably want to start making your own code. We recommend to install the Python API. You will need it soon.
- Install the API following the guide here: Edge TPU Python API overview. It really boils down to executing the following code:
# install the Edge TPU Python API
sudo apt install python3-edgetpu
# download/install the example code: it will be saved to '/usr/share/edgetpu/examples/'
sudo apt install edgetpu-examples
- Test the Installation of the Python API
python3 -c 'import edgetpu; print("OK")'
Edge TPU Software
After following the above installation steps, you will have software and APIs available for several key tasks:
- Image Classification: these tasks allow you to identify images / videos, providing labels and confidence scores. Test this out on cluttered and uncluttered images to get a feel of what you are getting.
- Object Detection: You can analyze a given image and return a list of objects (labels), confidence scores and object coordinates
- Transfer Learning, allowing you to retrain classification models on the Edge TPU
Further, other pre-trained TensorFlow Lite models are available. Find them here: Edge TPU Pre-Trained Models
Tips
Here is our tips section, covering interesting topics, or if things go wrong.
Links
- Getting Started with the USB Accelerator
- Edge TPU Pre-Trained Models
- Mini Go Example - great implementation of GO