Skip to main content

RKNN Toolkit Lite2

1 Toolkit Lite2 Installation

RKNN Toolkit Lite2 is a programming interface (Python) for the Rockchip NPU platform, used for deploying RKNN models on the board.

Test Environment

System Version: Debian 12 • Tool Version: RKNN-Toolkit2 2.3.0 • Driver Version: NPU driver 0.8.8

Installation Steps

Toolkit-lite2 is suitable for board-side model deployment. For more dependencies and usage information, please check Rockchip_RKNPU_User_Guide_RKNN_SDK

To get RKNN Toolkit Lite2 on the board, you can download directly from official github

  1. Get Installation Files:

    git clone https://github.com/airockchip/rknn-toolkit2.git
    cd rknn_toolkit_lite2/
  2. Install Dependencies:

    sudo apt update
    sudo apt-get install python3-dev python3-pip gcc
    sudo apt install -y python3-opencv python3-numpy python3-setuptools
  3. Install Package:

    # Debian 12 (Python 3.10)
    pip3 install packages/rknn_toolkit_lite2-2.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  4. Verify Installation:

    from rknnlite.api import RKNNLite  # No error means successful installation

2 Toolkit Lite2 Interface Usage

Deployment Process

  1. Create RKNNLite object
  2. Call load_rknn to import the model (must match the hardware platform)
  3. Call init_runtime to initialize the runtime environment
  4. Call inference for inference
  5. Process inference results
  6. Call release to release resources

Interface Documentation

Refer to the user manual in the rknn_toolkit_lite2/docs directory.


3 Board-Side Inference Test

Precautions

• Ensure the board has the librknnrt.so runtime library installed (default path: /usr/lib) • The version must match RKNN-Toolkit2 to avoid compatibility issues (e.g., error Invalid RKNN model version)

3.1 Resnet18 Inference Test

  1. Run Example:
    cd examples/inference_with_lite
    python3 test.py
  2. Output Example:
    --> Load RKNN model done
    --> Init runtime environment done
    --> Running model
    resnet18
    -----TOP 5-----
    [812]: 0.9996760487556458
    [404]: 0.00024927023332566023
    ...

4 References

https://github.com/airockchip/rknn-toolkit2

https://github.com/rockchip-linux/rknn-toolkit2

https://github.com/rockchip-linux/rknpu2


Note
Ensure the RKNN model and runtime library versions are consistent to avoid compatibility issues.