~~tag> VIM3 Linux Mainline NPU ~~ ====== VIM3 Ubuntu 24.04 Linux Mainline NPU Usage ====== You need Mainline OS version [[https://dl.khadas.com/products/vim3/firmware/ubuntu/generic/vim3-ubuntu-24.04-gnome-linux-6.9-fenix-1.6.8-240605.img.xz|V1.6.8-240605]] or newer. Now only support **MobileNet** and **SSDLite MobileDet**. ===== Introduction ===== This documentation will introduce VIM3 NPU usage based on the Open Source NPU driver. ===== Install Environment ===== Remove all of ''#'' in ''/etc/apt/sources.list'' ```shell $ sudo vi /etc/apt/sources.list ``` ```shell $ sudo apt update $ sudo apt-get -y build-dep mesa $ sudo apt-get -y install git cmake python3-pip ``` ===== Download Codes ===== ```shell $ git clone https://gitlab.freedesktop.org/tomeu/mesa.git $ git checkout teflon-accel ``` ===== Compile ===== Demo should run in **Python3.10**. Install **Python3.10** and activate **Python3.10** environment. Install Python library in **Python3.10** environment and then compile. ```shell $ cd mesa $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update $ sudo apt-get -y install python3.10 python3-pytest python3.10-venv $ python3.10 -m venv myenv $ source myenv/bin/activate $ pip install pycparser mako $ pip install 'numpy<2' $ pip install tflite-runtime==2.13.0 pillow $ meson setup build -Dgallium-drivers=etnaviv -Dvulkan-drivers= -Dteflon=true $ meson compile -C build ``` ===== Run ===== ```shell $ wget https://github.com/tensorflow/tensorflow/raw/master/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp $ TEFLON_DEBUG=verbose ETNA_MESA_DEBUG=ml_dbgs python3.10 src/gallium/frontends/teflon/tests/classification.py \ -i ./grace_hopper.bmp -m src/gallium/targets/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/libteflon.so ``` {{:products:sbc:vim3:npu:vim3_mainline_1.png?400|}}