Raspberry#Using Coral USB Accelerator with raspberry pi4 in ML Application

Hello and In this Tutorial I will explain how to use TPU Raspberry pi with Coral USB Accelerator to test a ML application.

Coral USB Accelerator?

Coral USB Accelerator included Edge TPU from Google, can allow the Debian OS such as Raspberry PI to outsource the Machine Learning calculation to these devices.

It means that we can run out of Machine learning applications in some low-specification devices such as Raspberry pi4.

And We can integrate the trained model from google into our application.

Support OS

  • Linux Debian 10, or a derivative thereof (such as Ubuntu 18.04)
    • architecture of either x86-64, Armv7 (32-bit), or 
    • Armv8 (64-bit) (Raspberry Pi is supported
  • macOS 10.15 (Catalina) or 11 (Big Sur), with either MacPorts or Homebrew installed
  • Windows 10
  • One available USB port (for the best performance, use a USB 3.0 port)
  • Python 3.6-3.9

Expand File System

We need to extend the file system.

sudo raspi-config

Choose the Advanced Options.

Select A1 Expand Filesystem and reboot your Raspberry system.

Library Installation

Response

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

$ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add –
$ sudo apt-get update

Install

sudo apt-get install libedgetpu1-std

Library Install

sudo apt-get install python3-pycoral


Run Model

Download the Example

mkdir coral && cd coral
git clone https://github.com/google-coral/pycoral.git
cd pycoral

Download the model

bash examples/install_requirements.sh classify_image.py

Test the Model

python3 examples/classify_image.py \
–model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
–labels test_data/inat_bird_labels.txt \
input test_data/parrot.jpg

Result 

As for the terminal output, the first time of calculation is 11.8ms because of the loading of the memory into Edge TPU Memory, the second time is only 3ms.

—-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——–
Ara macao (Scarlet Macaw): 0.75781

Reference

https://coral.ai/docs/accelerator/get-started/#3-run-a-model-on-the-edge-tpu

Footer_Basic

Please Support some devices for my blog

Amazon Gift List

Find ME

Twitter:@3threes2
Email:soup01threes*gmail.com (* to @)
YoutubeChannel:https://www.youtube.com/channel/UCQ3CHGAIXZAbeOC_9mjQiWQ

シェアする

  • このエントリーをはてなブックマークに追加

フォローする