step1:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.9 python3.9-dev
step2:
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/coolpi/.local/bin:$PATH
pip3 -V
pip3 install numpy --upgrade
pip3 install opencv-python
#check opencv
python3.9 -c "import cv2; print(cv2.__version__)"
get-pip.py
step3:
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
step4:
cd rknn-toolkit2/rknn_toolkit_lite2/examples/inference_with_lite
coolpi@coolpi:~/Downloads/rknn-toolkit2/rknn_toolkit_lite2/examples/inference_with_lite$ python3.9 test.py
--> Load RKNN model
done
--> Init runtime environment
I RKNN: [16:32:12.279] RKNN Runtime Information: librknnrt version: 1.4.0 (a10f100eb@2022-09-09T09:07:14)
I RKNN: [16:32:12.280] RKNN Driver Information: version: 0.8.2
I RKNN: [16:32:12.281] 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