NPU

From FriendlyELEC WiKi
Revision as of 07:19, 8 January 2024 by Tzs (Talk | contribs) (updated by API)

Jump to: navigation, search

查看中文

1 RK3588

1.1 install rknpu

git clone https://github.com/rockchip-linux/rknpu2.git
cd rknpu2
sudo cp ./runtime/RK3588/Linux/librknn_api/aarch64/* /usr/lib
sudo cp ./runtime/RK3588/Linux/rknn_server/aarch64/usr/bin/* /usr/bin/

1.2 install rknn_toolkit

sudo apt-get install -y python3-dev python3-numpy python3-opencv
git clone https://github.com/rockchip-linux/rknn-toolkit2.git
pip3 install ./rknn-toolkit2/rknn_toolkit_lite2/packages/rknn_toolkit_lite2-1.5.0-cp39-cp39-linux_aarch64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple/

1.3 run test

$ cd rknn-toolkit2/rknn_toolkit_lite2/examples/inference_with_lite
$ python3 test.py
--> Load RKNN model
done
--> Init runtime environment
I RKNN: [11:33:44.186] RKNN Runtime Information: librknnrt version: 1.5.0 (e6fe0c678@2023-05-25T08:09:20)
I RKNN: [11:33:44.186] RKNN Driver Information: version: 0.8.8
I RKNN: [11:33:44.186] RKNN Model Information: version: 4, toolkit version: 1.5.0+1fa95b5c(compiler version: 1.5.0 (e6fe0c678@2023-05-25T16:15:03)), target: RKNPU v2, target platform: rk3588, framework name: PyTorch, framework layout: NCHW, model inference type: static_shape
done
--> Running model
resnet18
-----TOP 5-----
[812]: 0.9996760487556458
[404]: 0.00024927023332566023
[657]: 1.449744013370946e-05
[466 833]: 9.023910024552606e-06
[466 833]: 9.023910024552606e-06
 
done