-
-
Save ZlodeiBaal/847569b24bb338566680ab2a8f22c6b2 to your computer and use it in GitHub Desktop.
sudo apt-get update | |
sudo apt-get install -y python3 python3-dev python3-pip gcc | |
sudo apt-get install -y python3-opencv | |
sudo apt-get install -y python3-numpy | |
sudo apt-get install git | |
sudo apt-get install wget | |
sudo apt-get install python3-setuptools | |
wget https://github.com/rockchip-linux/rknpu2/raw/master/runtime/RK356X/Linux/librknn_api/aarch64/librknnrt.so | |
sudo mv librknnrt.so /usr/lib/librknnrt.so | |
git clone https://github.com/rockchip-linux/rknn-toolkit2.git | |
cd rknn-toolkit2/rknn_toolkit_lite2/packages/ | |
pip3 install rknn_toolkit_lite2-1.5.2-cp39-cp39-linux_aarch64.whl |
The guide is working for Debian/RockPi/3568. So, you need to figure out what is your difference. At first glance it may be:
- Different versions of RKNN and librknn
- Incorrect chipset name in this line: "wget https://github.com/rockchip-linux/rknpu2/raw/master/runtime/RK356X"
But it may be something completely different.
And, it seems that today, they updated the version completely (1.6.0)
A different catalog structure, "https://github.com/rockchip-linux/rknpu2" is out-of-date.
I recommend using the 1.5.2 version. I have the same problem during installation
Ok, the quick hack is to use old lib - https://github.com/rockchip-linux/rknpu2/raw/master/runtime/RK3588/Linux/librknn_api/aarch64/librknnrt.so
Thank You, I tried using the old lib, and it worked for my OPi 5B
@ZlodeiBaal Thanks to your response based on which i solved the issue using old library, however faced below issue:
debian@bookworm:~/rknn_model_zoo/models/CV/object_detection/yolo/RKNN_python_demo$ python3 yolo_map_test_rknn.py --model yolov8 --model_path ../RKNN_model_convert/model_cvt/RK3588/yolov8s_rknnopt_RK3588_i8.rknn --img_folder ../test_data --img_save --img_show
/home/debian/rknn_model_zoo/models/CV/object_detection/yolo/RKNN_python_demo/yolo_map_test_rknn.py
None anchors file determine, free anchors mode
Continue? [Y/N]
Y or N:Y
--> Init runtime environment
I RKNN: [11:33:29.467] RKNN Runtime Information: librknnrt version: 1.5.2 (c6b7b351a@2023-08-23T15:28:22)
I RKNN: [11:33:29.467] RKNN Driver Information: version: 0.9.2
I RKNN: [11:33:29.467] RKNN Model Information: version: 6, toolkit version: 1.5.2+b642f30c(compiler version: 1.5.2 (c6b7b351a@2023-08-23T15:34:44)), target: RKNPU v2, target platform: rk3588, framework name: PyTorch, framework layout: NCHW, model inference type: static_shape
done
Model-../RKNN_model_convert/model_cvt/RK3588/yolov8s_rknnopt_RK3588_i8.rknn is rknn model, starting val
W RKNN: [11:33:29.539] Output(191): size_with_stride larger than model origin size, if need run OutputOperator in NPU, please call rknn_create_memory using size_with_stride.
W RKNN: [11:33:29.539] Output(192): size_with_stride larger than model origin size, if need run OutputOperator in NPU, please call rknn_create_memory using size_with_stride.
W RKNN: [11:33:29.539] Output(193): size_with_stride larger than model origin size, if need run OutputOperator in NPU, please call rknn_create_memory using size_with_stride.
W RKNN: [11:33:29.539] Output(194): size_with_stride larger than model origin size, if need run OutputOperator in NPU, please call rknn_create_memory using size_with_stride.
W RKNN: [11:33:29.539] Output(195): size_with_stride larger than model origin size, if need run OutputOperator in NPU, please call rknn_create_memory using size_with_stride.
W RKNN: [11:33:29.539] Output(196): size_with_stride larger than model origin size, if need run OutputOperator in NPU, please call rknn_create_memory using size_with_stride.
W RKNN: [11:33:29.539] Output(197): size_with_stride larger than model origin size, if need run OutputOperator in NPU, please call rknn_create_memory using size_with_stride.
IMG: cam_1_test_00000003.jpg
class: dog , score: 0.491100937128067
box coordinate left,top,right,down: [360, 535, 492, 627]
class: person, score: 0.7426213026046753
box coordinate left,top,right,down: [774, 330, 946, 417]
class: person, score: 0.6948288083076477
box coordinate left,top,right,down: [870, 372, 1036, 517]
class: person, score: 0.2646966874599457
box coordinate left,top,right,down: [606, 455, 690, 541]
class: person, score: 0.26102036237716675
box coordinate left,top,right,down: [323, 438, 441, 522]
class: diningtable, score: 0.27889660000801086
box coordinate left,top,right,down: [471, 754, 1275, 953]
arm_release_ver: g13p0-01eac0, rk_so_ver: 9
Cannot find EGLConfig, returning null config
Unable to find an X11 visual which matches EGL config 0
Segmentation fault
Can you advice on this?
Sorry, I never saw this.
Also, I tried to use a new lib + create link file for this, and it works:
wget https://github.com/airockchip/rknn-toolkit2/tree/master/rknpu2/runtime/Linux/librknn_api/aarch64/librknnrt.so
sudo mv librknnrt.so /usr/lib
cd /usr/lib
sudo ln -s librknnrt.so librknn_api.so
Hey following your guide, I successfully ran YoloV8 on RK3568 and RK3588. However recevied below error while doing the same for RK3399PRO Boar (even though it is supported by conversion). Can you please help me with it and advice.
:~/rock_chip/rknn_model_zoo/models/CV/object_detection/yolo/RKNN_model_convert$ sh ./convert_yolo.sh
WARNING - 'configs' in yaml file is deprecate, rename it as 'config'
W __init__: rknn-toolkit2 version: 1.5.2+b642f30c
========== parser_config ==========
TOOLKIT_MAIN_VERSION: 1
RK_device_platform: RK3399PRO
model_framework: pytorch
verbose: False
quantize: True
dataset: ../../../../../datasets/COCO/coco_subset_10.txt
graph:
in_0:
shape: 1,3,640,640
mean_values: 0
std_values: 255
img_type: RGB
config:
quantized_dtype: asymmetric_affine-u8
target_platform: RK3399PRO
quantized_algorithm: normal
optimization_level: 3
mean_values: [[0, 0, 0]]
std_values: [[255, 255, 255]]
reorder_channel: 0 1 2
pre_compile: online
core_mask: 1
export_rknn:
export_path: ./model_cvt/RK1808_3399pro/yolov8n_rknnopt_RK1808_3399pro_u8.rknn
model_file_path: yolov8n_rknnopt.torchscript
build:
do_quantization: True
dataset: ./../../../../../datasets/COCO/coco_subset_10.txt
qnnpack: False
load:
model: ./yolov8n_rknnopt.torchscript
input_size_list: [[3, 640, 640]]
inputs:
in_0:
shape: [1, 3, 640, 640]
mean_values: [0, 0, 0]
std_values: [255, 255, 255]
img_type: RGB
outputs:
input_example: [{'in_0': '../../../../../datasets/COCO/val_test/000000000285.jpg'}, {'in_0': '../../ ...
export_pre_compile_path: ./model_cvt/RK1808_3399pro/yolov8n_rknnopt_RK1808_3399pro_u8_precompile.rknn
===================================
---> Create RKNN object
W __init__: rknn-toolkit2 version: 1.5.2+b642f30c
---> Seting RKNN config
E config: Invalid target_platform 'rk3399pro'!
W config: ===================== WARN(2) =====================
E rknn-toolkit2 version: 1.5.2+b642f30c
Traceback (most recent call last):
File "../../../../../common/rknn_converter/rknn_convert.py", line 99, in <module>
convert(config_dict, args)
File "../../../../../common/rknn_converter/rknn_convert.py", line 19, in convert
rknn = cp.convert()
File "/home/fazliddin/rock_chip/rknn_model_zoo/common/rknn_converter/phase.py", line 118, in convert
rknn.config(**model_config_dict['config'])
File "/home/fazliddin/.conda/envs/rockchip_yolo/lib/python3.8/site-packages/rknn/api/rknn.py", line 120, in config
return self.rknn_base.config(args)
File "rknn/api/rknn_base.py", line 941, in rknn.api.rknn_base.RKNNBase.config
File "rknn/api/rknn_log.py", line 112, in rknn.api.rknn_log.RKNNLog.e
ValueError: Invalid target_platform 'rk3399pro'!
Thank You, I tried using the old lib, and it worked for my OPi 5B
Did you use the old lib and 1.6.0 version of the model zoo?
@Askovia did you use the old lib and 1.6.0 version of model zoo?
@ZlodeiBaal do you mean 1.6.0 model zoo version with old lib?
Hi
When I try to run code (or other npu related code) I get:
E RKNN: [22:57:09.806] failed to open rknpu module, need to insmod rknpu dirver!
E RKNN: [22:57:09.806] failed to open rknn device!
E Catch exception when init runtime!
On Orange PI 5, Ubuntu 22.04 downloaded from the OrangePi web site.
@ZlodeiBaal Can you updated the instruction for the new library Rokchip released a while back? It will be of great help.
Hey,
I followed you guide and my board is RK3588. I am fcaing below error:
Any help is much appreciated. Thanks in advance.