Skip to content

Quick start guide

Mirza Krak edited this page Mar 9, 2023 · 11 revisions

Setup the environment

As this layer depends on the Freescale/NXP BSP we can utilize the base setup from there.

Repo tool

Create directory for repo

mkdir ${HOME}/bin

Fetch the repo script

curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ${HOME}/bin/repo

Set the executable bit

chmod a+x ${HOME}/bin/repo

You should also add the following to your .bashrc or equivalent, for convenience.

PATH=${PATH}:~/bin

Setup enviroment

Create directory where you want to store the environment and change the shell to that location:

mkdir coral && cd coral

Initialize repo manifest:

repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b master

Fetch layers in manifest:

repo sync

Clone meta-clang:

git clone https://github.com/kraj/meta-clang.git sources/meta-clang -b master

Clone meta-coral:

git clone https://github.com/mirzak/meta-coral.git sources/meta-coral -b master

Setup the environment:

MACHINE=coral-dev DISTRO=fslc-xwayland source ./setup-environment build

Add the meta-clang layer to bblayers.conf:

echo 'BBLAYERS += "${BSPDIR}/sources/meta-clang"' >> conf/bblayers.conf

Add the meta-coral-bsp layer to bblayers.conf:

echo 'BBLAYERS += "${BSPDIR}/sources/meta-coral"' >> conf/bblayers.conf

Build and test base setup

Add python3-edgetpu-examples to your build:

echo 'IMAGE_INSTALL:append = "python3-edgetpu-examples"' >> conf/local.conf

Start the build:

bitbake core-image-base

On the device now you can run the following.

Go to the examples directory:

cd /usr/share/edgetpu/examples

Run the classify_image.py examples:

python3 classify_image.py \
    --model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
    --label models/inat_bird_labels.txt \
    --image images/parrot.jpg

python3 classify_image.py \
    --model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
    --label models/inat_bird_labels.txt \
    --image images/owl.jpg

python3 classify_image.py \
    --model models/mobilenet_v1_1.0_224_quant.tflite \
    --label models/imagenet_labels.txt \
    --image images/hot_dog.jpg
Clone this wiki locally