Getting started with the Google Coral Edge TPU USB Accelerator: running video image recognition

Published 2024-04-17
In this video we finally get to run image recognition with video examples, step by step, on Ubuntu with the Google Coral Edge TPU USB Accelerator. Best is to use the 20.04.6 LTS (Focal Fossa) version of Ubuntu (due to the fact that there are no modern PyCoral wheels for python 3.10 or above, so stay at Python version 3.9 or below). Below, you will find all the commands used in this episode. As always, have fun!

If you have Python 3.10 or higher, the downgrade will not work. All you need is the Python version manager tool "pyenv". With this tool, you can choose the desired version of python maxat-akbanov.com/how-to-install-pyenv-python-vers…

I posted the entire course on Google Coral Edge TPU Dev Board, plus Micro on Udemy (ads free) at: www.udemy.com/course/mastering-google-coral-dev-bo…
In the future, I will make Udemy course on the USB accelerator.

GET Coral Edge TPU Dev Board (on Amazon): amzn.to/4a2WMDB
GET the aluminum case (on Amazon): amzn.to/3IM1Dxe
GET Coral USB accelerator (on Amazon): amzn.to/3x5Etz3
GET Logitech webcam (on Amazon): amzn.to/4aFH81w

coral.ai/docs/accelerator/get-started/
Ctrl+C to interrupt running script
Ctrl+L to clean terminal

sudo apt update
sudo apt upgrade
lsb_release -a
python3 -m venv Project20
cd Project20
source bin/activate
echo "deb packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
curl packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install libedgetpu1-std
sudo apt-get install python3-pycoral
mkdir coral && cd coral
git clone github.com/google-coral/pycoral.git
cd pycoral
bash examples/install_requirements.sh classify_image.py

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

pip install numpy
pip install pillow
python3 -m pip install --extra-index-url google-coral.github.io/py-repo/ pycoral~=2.0

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

python3 -m pip install tflite-runtime
mkdir google-coral && cd google-coral
git clone github.com/google-coral/examples-camera.git --depth 1
cd examples-camera
sh download_models.sh
ls
sudo apt install v4l-utils
v4l2-ctl --list-devices
cd gstreamer
python3 detect.py --videosrc /dev/video0 --videofmt jpeg
python3 detect.py --videosrc /dev/video2 --videofmt jpeg

sudo apt install libcairo2-dev libxt-dev libgireporitory1.0-dev
pip install pycairo PyGObject

python3 detect.py --videosrc /dev/video0
python3 detect.py --videosrc /dev/video2

python3 detect.py –model ../all_models/mobilenet_ssd_v2_face_quant_postprocess_edgetpu.tflite --labels ../all_models/coco_labels.txt --videosrc /dev/video2

cd ..
ls
cd raspicam
bash install_requirements.sh
cd ..
cd pygame
ls
bash install_requirements.sh
export DISPLAY=":0"
python3 detect.py
pip install pygame
python3 detect.py
“open and edit detect.py in line 69: /dev/video2 if you need to”
python3 detect.py

cd ..
cd ..
cd examples-camera
cd opencv
bash install_requirements.sh
python3 detect.py
python3 detect.py --camera_idx 2

All Comments (3)
  • @sosome1
    Thank you for posting this great tutorial. I was looking for it for quite a while. I am looking for a board to place inside my car. I want to use realtime object detection to recognise whenever a certain type of car is passing by in front of my car. And I want the board to notify me by 4g/lte sms( no wifi connection so i have to add a gsm/lte/4g module I am looking at 2 boards: 1. Raspberry pi 5 8Gb with Google Coral USB Accelerator 2. Google Coral Dev Board 4Gb Which one is the best option?
  • @jxzmh
    Not working because i have Python 3.11 and I need 3.6-3.9 but doesn’t work to downgrade it