Libre Computer Cottonwood Alta TensorFlow Lite MobileNetV1 Guide

Alta features a 5TOPs INT8 Verisilicon NPU for running tensor and convolution computation for AI based workloads. Tomeu has developed TensorFlow Lite delegate for Mesa to make use of the existing piping for Verisilicon’s Etnaviv IP. The long term goal is to create a NN API HAL frontend that is targeted by TensorFlow Lite and PyTorch Mobile with Gallium as the backend to create dmabufs and command streams for the physical hardware. If you are interested in this work, there is a community at #ml-mainline on OFTC.

Please update your board to the latest firmware. You can setup an NFS environment on Debian with LOON or use our Debian 12 image.

Enable the NPU with the wiring tool:

git clone
cd libretech-wiring-tool
sudo ./ldto enable npu
cd ..

Enable APT sources

sed "s/^deb\s/deb-src /" /etc/apt/sources.list > /etc/apt/sources.list.d/src.list
sudo apt update

Install Mesa Build Dependencies

sudo eatmydata apt-get -y build-dep mesa
sudo eatmydata apt -y install meson glslang-tools glslang-dev python3-mako zlib1g-dev flatbuffers-compiler python3-pytest python3-exceptiongroup python3-pip python3-pil

Build Teflon

git clone -b teflon --single-branch --depth=1
cd mesa
meson setup build -Dgallium-drivers=etnaviv -Dvulkan-drivers= -Dteflon=true
meson compile -C build

Install TensorFlow Lite

pip3 install --break-system-packages tflite-runtime
#cd subprojects
#tar -xf v2.14.0.tar.gz
#mv tensorflow-2.14.0 tensorflow

Run Teflon Tests

DELEGATE_PATH=build/src/gallium/targets/teflon/ python3 -m pytest -v src/gallium/frontends/teflon/tests/

Run MobileNetV1

python3 src/gallium/frontends/teflon/tests/ -i ~/tensorflow/assets/grace_hopper.bmp -m src/gallium/frontends/teflon/tests/mobilenet_v1_1.0_224_quant.tflite -l src/gallium/frontends/teflon/tests/labels_mobilenet_quant_v1_224.txt -e build/src/gallium/targets/teflon/

To learn more about AI/neuro computing and how it is applied, Tomeu gathered a list of reading material.