Source code for the Edge TPU API library
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
This repository contains an easy-to-use Python API to work with Coral devices:
You can run inference and do transfer learning.
scripts/runtime/install.shto install Edge TPU runtime or
scripts/runtime/uninstall.shto uninstall it.
scripts/build_swig.shto build SWIG-based native layer for different Linux architectures. Build is Docker-based, so you need to have it installed.
make wheelto generate Python library wheel and then
pip3 install $(ls dist/*.whl)to install it
All native code is inside
srcfolder. You can build everything using
makecommand which invokes Bazel internally.
For example, run
make teststo build all C++ unit tests or
make benchmarksto build all C++ benchmarks. To get the list of all available make targets run
make help. All output goes to
On Linux you can compile natively or cross-compile for 32-bit and 64-bit ARM CPUs.
To compile natively you need to install at least the following packages:
sudo apt-get install -y build-essential \ libpython3-dev \ libusb-1.0-0-dev \
and to cross-compile:
sudo dpkg --add-architecture armhf sudo apt-get install -y crossbuild-essential-armhf \ libpython3-dev:armhf \ libusb-1.0-0-dev:armhf
sudo dpkg --add-architecture arm64 sudo apt-get install -y crossbuild-essential-arm64
Compilation or cross-compilation is done by setting CPU variable for
make CPU=k8 tests # Builds for x86_64 (default CPU value) make CPU=armv7a tests # Builds for ARMv7-A, e.g. Pi 3 or Pi 4 make CPU=aarch64 tests # Builds for ARMv8, e.g. Coral Dev Board
You need to install the following software:
sudo port install python35 python36 python37 py35-numpy py36-numpy py37-numpy
sudo port install libusb
Right after that all normal
makecommands should work as usual. You can run
make teststo compile all C++ unit tests natively on macOS.
Docker allows to avoid complicated environment setup and build binaries for Linux on other operating systems without complicated setup:
make DOCKER_IMAGE=debian:buster DOCKER_CPUS="k8 armv7a aarch64" DOCKER_TARGETS=tests docker-build make DOCKER_IMAGE=ubuntu:18.04 DOCKER_CPUS="k8 armv7a aarch64" DOCKER_TARGETS=tests docker-build