Quickly build an RKNN environment
-
To facilitate users' development based on RKNN, the RKNN C and Python environments have been made into PPA installation sources. Running the following command can complete the installation and setup.Currently, only the ubuntu22.04 environment is supported, and other versions will be added in the future.
sudo add-apt-repository ppa:george-coolpi/rknpu sudo apt update sudo apt-get install rknpu2
Environmental testing
- Python
cd /usr/share/rknn-toolkit2/examples/inference_with_lite/ python3 test.py
The following results indicate that the environment was successfully built
--> Load RKNN model done --> Init runtime environment I RKNN: [11:36:49.473] RKNN Runtime Information: librknnrt version: 1.4.0 (a10f100eb@2022-09-09T09:07:14) I RKNN: [11:36:49.474] RKNN Driver Information: version: 0.8.2 I RKNN: [11:36:49.475] 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
- C
sudo apt-get install git cmake -y git clone https://gitee.com/yanyitech/rknpu2.git cd rknpu2/examples/rknn_mobilenet_demo ./build-linux_RK3588.sh cd install/rknn_mobilenet_demo_Linux/ ./rknn_mobilenet_demo model/RK3588/mobilenet_v1.rknn model/dog_224x224.jpg
The following results indicate that the environment was successfully built
model input num: 1, output num: 1 input tensors: index=0, name=input, n_dims=4, dims=[1, 224, 224, 3], n_elems=150528, size=150528, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=0, scale=0.007812 output tensors: index=0, name=MobilenetV1/Predictions/Reshape_1, n_dims=2, dims=[1, 1001, 0, 0], n_elems=1001, size=1001, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003906 rknn_run --- Top5 --- 156: 0.984375 155: 0.007812 205: 0.003906 -1: 0.000000 -1: 0.000000
-