Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

products:sbc:vim3:npu:vx-tflite

NPU TFLite Delegate

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

Get source code

Clone the examples sravansenthiln1/vx_tflite

$ git clone https://github.com/sravansenthiln1/vx_tflite
$ cd vx_tflite

Setup the environment

Install pip

$ sudo apt-get install python3-pip

Install necessary python packages

$ pip3 install numpy pillow

Install the TFLite runtime interpreter

$ 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

Copy the necessary library files

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/

Run Examples

Taking the Mobilenet v1 as example.

Enter the example directory

$ cd mobilenet_v1
$ sudo ln ../libs/libvx_delegate.so libvx_delegate.so

Run the example

$ 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.

Last modified: 2023/10/23 02:53 by sravan