Skip to content

Instantly share code, notes, and snippets.

@DiogenesAnalytics
Created July 15, 2024 14:26
Show Gist options
  • Save DiogenesAnalytics/857eded9c7967ab6074eee3b52a5e1df to your computer and use it in GitHub Desktop.
Save DiogenesAnalytics/857eded9c7967ab6074eee3b52a5e1df to your computer and use it in GitHub Desktop.
Coral Edge TPU test example executed in Docker for Coral USB Accelerator

About

Simple Dockerfile and helper script to run examples from Coral USB Accelerator docs

Output

This is from a Raspberry Pi 4 1GB running Debian GNU/Linux 12 (bookworm):

---------------------------
Ara macao (Scarlet Macaw)
Score :  0.6796875
---------------------------
Platycercus elegans (Crimson Rosella)
Score :  0.12109375

References

sudo docker run \
--rm \
--device /dev/bus/usb:/dev/bus/usb \
-it \
coral:test \
python3 /usr/share/edgetpu/examples/classify_image.py \
--model /usr/share/edgetpu/examples/models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
--label /usr/share/edgetpu/examples/models/inat_bird_labels.txt \
--image /usr/share/edgetpu/examples/images/parrot.jpg
# ref: https://www.jeffgeerling.com/blog/2023/testing-coral-tpu-accelerator-m2-or-pcie-docker
# base image
FROM debian:10
# setting workdir
WORKDIR /home
# setting home var
ENV HOME=/home
# to home dir
RUN cd ~
# getting dependencies/tools
RUN apt-get update && apt-get install -y \
git \
nano \
python3-pip \
python-dev \
pkg-config \
wget \
usbutils \
curl
# install coral ai examples
RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | \
tee /etc/apt/sources.list.d/coral-edgetpu.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
RUN apt-get update && apt-get install -y edgetpu-examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment