Khadas VIM3/3L are powered by VeriSilicon Vivante NPU.
We can make use of the available computation power for running TFLite models directly using TIM-VX Libraries by leveraging TFLite interpreter Delegate.
The Delegate is provided by VeriSilicon as VeriSilicon/tflite-vx-delegate and the provided examples are made to make use of it.
This library depends Galcore and OpenVX drivers, make sure you are using the following platforms to ensure the driver is present.
board | Linux Kernel (BSP) | OS |
---|---|---|
VIM3 | 4.9 5.15 | Ubuntu 22.04 Ubuntu 20.04 |
VIM3L | 4.9 5.15 | Ubuntu 22.04 Ubuntu 20.04 |
Clone the examples sravansenthiln1/vx_tflite
$ git clone https://github.com/sravansenthiln1/vx_tflite $ cd vx_tflite
$ sudo apt-get install python3-pip
$ pip3 install numpy pillow
$ pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime
$ sudo ln /usr/lib/libOpenVX.so /usr/lib/libOpenVX.so.1
If you are running on VIM3
:
$ sudo cp libs/VIM3/libtim-vx.so /usr/lib/aarch64-linux-gnu/
If you are running on VIM3L
:
$ sudo cp libs/VIM3L/libtim-vx.so /usr/lib/
Taking the Mobilenet v1 as example.
$ cd mobilenet_v1
$ sudo ln ../libs/libvx_delegate.so libvx_delegate.so
$ python3 run_npu_inference.py
If you would like to analyse the performance of your model through the examples, please follow the NPU Performance Analysis guide.