10. RKNN Toolkit Lite usage

RKNN Toolkit Lite is a stripped-down version of RKNN Toolkit that provides users with a development kit for model inference on PC, RK3399Pro, RK1808, RK1806, V1109, RV1126. Users can easily and quickly complete the development and deployment of AI applications through the Python interface provided by the SDK. Compared with the complicated and time-consuming installation process of RKNN Toolkit, the installation process of RKNN Toolkit Lite takes less than ten minutes.

  • OS: Ubuntu18.04 / Debian 10

  • OpenCV version: 3.4.15

  • Board: RK3399pro

  • NPU driver:firefly-3399pronpu-driver_1.7.1_arm64.deb

  1. Build a python3.7 virtual environment

    # Install compilation environments such as gcc and cmake in turn
    # Install python3.7-tk and python3.7-dev
    # Install virtualenv virtual environment
    sudo apt install gcc cmake git build-essential \
    python3-tk python3.7-dev \
  2. Create a python3.7 virtual environment

    virtualenv -p /usr/bin/python3.7m /home/firefly/venv
    # Use a virtual environment, if you want to quit, you can enter deactivate in the terminal
    source /home/firefly/venv/bin/activate
  3. Install rknn_toolkit_lite-1.7.1-cp37-cp37m-linux_aarch64.whl

    mkdir /home/firefly/wrok
    cd /home/firefly/wrok
    git clone https://github.com/rockchip-linux/rknn-toolkit.git
    pip3 install /home/firefly/work/rknn-toolkit/rknn-toolkit-lite/packages/rknn_toolkit_lite-1.7.1-cp37-cp37m-linux_aarch64.whl -i https://mirrors.aliyun.com/pypi/simple/

10.1. Test

The test process requires OpenCV support. For the installation of OpenCV, please refer to “Opencv compilation and installation”

  1. Install the NPU driver for 3399pro: firefly-3399pronpu-driver_1.7.1_arm64.deb

    sudo apt install firefly-3399pronpu-driver
    # reboot
    sudo reboot
  2. Run test code

    cd /home/firefly/work/rknn-toolkit/rknn-toolkit-lite/examples/inference_with_lite/
    source /home/firefly/venv/bin/activate
    python3 test.py