themactep.com

A home of miscellaneous projects by Paul Philippov.

Notes

How to install pycoral on Ubuntu 20.04

sudo apt update
sudo apt install -y build-essential apt-transport-https curl gnupg mlocate default-jdk \
  python-is-python3 python3-dev python3-wheel python3-pip python3-pil dh-python python3-all \
  libflatbuffers-dev debhelper libusb-1.0-0-dev

wget http://ftp.us.debian.org/debian/pool/main/a/abseil/libabsl-dev_0~20200225.2-3~bpo10+1_amd64.deb
wget http://ftp.us.debian.org/debian/pool/main/a/abseil/libabsl20200225_0~20200225.2-3~bpo10+1_amd64.deb
sudo dpkg -i libabsl-dev_0~20200225.2-3~bpo10+1_amd64.deb libabsl20200225_0~20200225.2-3~bpo10+1_amd64.deb

cd
git clone https://github.com/tensorflow/tensorflow
cd tensorflow
git checkout a4dfb8d1a71385bd6d122e4f27f86dcebb96712d -b tf2.5

cd
git clone https://github.com/google-coral/libedgetpu.git
cd libedgetpu
TFROOT=~/tensorflow make -f makefile_build/Makefile -j$(nproc) libedgetpu

curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
sudo mv bazel-archive-keyring.gpg /usr/share/keyrings
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] \
  https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list

### Bazel 6.x is broken
sudo apt-get --purge remove bazel
sudo apt install bazel-5.3.2
sudo ln -s /usr/bin/bazel-5.3.2 /usr/bin/bazel

git clone --recurse-submodules https://github.com/google-coral/pycoral
cd pycoral

make
make wheel
make tflite-wheel

pip3 install $(ls dist/*.whl)