TFlite implementations from https://github.com/sravansenthiln1/armnn_tflite/ adapted to run on Rockchip's RKNN NPU hardware platform.
Compatible with Edge2
Note: make sure you have setup the runtime requirements
| model | description |
|---|---|
| Sine Model | Basic Neural network TFLite model |
| Digit recognize Model | Digit recognization model |
| model | description |
|---|---|
| Audio classifier Model | Audio classifier model |
| model | description |
|---|---|
| Mobilenet v1 Model | Mobilenet v1 image classification model |
| YOLOv8n Model | YOLOv8n image detection model |
| Auto crop Model | Automatic document crop model |
You can convert TFLite models to run the NPU using the convert.py conversion script
Requires: Ubuntu 22.04/20.04/18.04 x86 Host computer.
After you have cloned this repo:
sudo apt-get install git python3 python3-dev python3-pip
sudo apt-get install libxslt1-dev zlib1g-dev libglib2.0 libsm6 libgl1-mesa-glx libprotobuf-dev gcc cmakegit clone https://github.com/rockchip-linux/rknn-toolkit2
cd rknn-toolkit2
git checkout b25dadacc24b88eb7dfcaa47c9c525ecca89b319Note: at this point of time, you can also create a virtual environment to store all the packages you need. This will keep your system packages clean and not disturb their package versions. for this you need to install Conda
conda create -n npu-env
conda activate npu-env
whenever you need to convert the models, you need to activate this env.
python3 --version
and run the command accordingly
| python version | command |
|---|---|
| 3.11 | version=cp311 |
| 3.10 | version=cp310 |
| 3.9 | version=cp39 |
| 3.8 | version=cp38 |
| 3.7 | version=cp37 |
| 3.6 | version=cp36 |
pip3 install -r rknn-toolkit2/packages/requirements_$version-*.txtpip3 install rknn-toolkit2/packages/rknn_toolkit2-*-$version-$version-linux_x86_64.whl
cd ../python3 convert.pyeg. to convert a file such as detect_model.tflite, run
python3 convert.py detect_modelin the same directory, a file called detect_model.rknn will have been created.
To run it on your board, you need to install appropriate RKNN API wheel
Requires: Edge2 with Ubuntu 22.04 OS.
After cloning this repo:
sudo apt-get install python3-pippip3 install numpy pillow opencv-python librosa sounddevicegit clone https://github.com/rockchip-linux/rknn-toolkit2
cd rknn-toolkit2
git checkout b25dadacc24b88eb7dfcaa47c9c525ecca89b319python3 --version
and run the command accordingly
| python version | command |
|---|---|
| 3.11 | version=cp311 |
| 3.10 | version=cp310 |
| 3.9 | version=cp39 |
| 3.8 | version=cp38 |
| 3.7 | version=cp37 |
| 3.6 | version=cp36 |
pip3 install rknn_toolkit_lite2/packages/rknn_toolkit_lite2-*-$version-$version-linux_aarch64.whlsudo cp rknpu2/runtime/Linux/librknn_api/aarch64/librknnrt.so /usr/lib/
cd ../Now try the examples