早期版本 Ubuntu22.04 rknn toolkit lite2环境部署
-
默认Ubuntu22预装python3.10,暂时与RKNN 本机开发环境不一致,需要单独安装python3.9版本。
step1:增加源
sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt-mark unhold libexpat1 sudo apt install python3.9* -y #sudo update-alternatives --list python #sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 #sudo update-alternatives --config python3
setp 2:安装pip3
sudo apt-mark unhold libcurl4 sudo apt install curl -y curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python3.9 get-pip.py export PATH=/home/ubuntu/.local/bin:$PATH pip3 -V pip3 install numpy --upgrade pip3 install opencv-python #check opencv python3.9 -c "import cv2; print(cv2.__version__)"
step 3: 安装rknn toolkit lite2
git clone https://gitee.com/yanyitech/rknpu2.git sudo cp -arf rknpu2/runtime/RK3588/Linux/librknn_api/aarch64/* /usr/lib/ git clone https://gitee.com/yanyitech/rknn-toolkit2.git pip3 install rknn-toolkit2/rknn_toolkit_lite2/packages/rknn_toolkit_lite2-1.4.0-cp39-cp39-linux_aarch64.whl
step 4: 验证运行环境
cd rknn-toolkit2/rknn_toolkit_lite2/examples/inference_with_lite ubuntu@coolpi:~/rknn-toolkit2/rknn_toolkit_lite2/examples/inference_with_lite$ python3.9 test.py --> Load RKNN model done --> Init runtime environment I RKNN: [10:19:55.691] RKNN Runtime Information: librknnrt version: 1.4.0 (a10f100eb@2022-09-09T09:07:14) I RKNN: [10:19:55.691] RKNN Driver Information: version: 0.8.0 I RKNN: [10:19:55.691] RKNN Model Information: version: 1, toolkit version: 1.4.0-c15f5e0b(compiler version: 1.4.0 (c73777b51@2022-09-05T12:06:01)), target: RKNPU v2, target platform: rk3588, framework name: PyTorch, framework layout: NCHW done --> Running model resnet18 -----TOP 5----- [812]: 0.9996696710586548 [404]: 0.0002492684288881719 [657]: 1.632158637221437e-05 [833]: 1.0159346857108176e-05 [466 895]: 9.02384545042878e-06 done
-
上述环境操作不适用于新的镜像版本。