Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rk3568问题 #18

Open
gxydbc opened this issue Nov 16, 2023 · 6 comments
Open

rk3568问题 #18

gxydbc opened this issue Nov 16, 2023 · 6 comments

Comments

@gxydbc
Copy link

gxydbc commented Nov 16, 2023

如果要将这个代码部署在rk3568上,需要做哪些修改呢 谢谢!

@gxydbc
Copy link
Author

gxydbc commented Nov 16, 2023

在运行./build-linux_RK3588.sh时,结果如下
root@iTOP-RK3568:/home/topeet/rknn-cpp-Multithreading-main$ ./build-linux_RK3588.sh
-- Configuring done
-- Generating done
-- Build files have been written to: /home/topeet/rknn-cpp-Multithreading-main/build/build_linux_aarch64
[100%] Built target rknn_yolov5_demo
[100%] Built target rknn_yolov5_demo
Install the project...
-- Install configuration: ""
-- Up-to-date: /home/topeet/rknn-cpp-Multithreading-main/install/rknn_yolov5_demo_Linux/./rknn_yolov5_demo
-- Up-to-date: /home/topeet/rknn-cpp-Multithreading-main/install/rknn_yolov5_demo_Linux/lib/librknnrt.so
-- Up-to-date: /home/topeet/rknn-cpp-Multithreading-main/install/rknn_yolov5_demo_Linux/lib/librga.so
-- Up-to-date: /home/topeet/rknn-cpp-Multithreading-main/install/rknn_yolov5_demo_Linux/.//model
-- Up-to-date: /home/topeet/rknn-cpp-Multithreading-main/install/rknn_yolov5_demo_Linux/.//model/RK3588
-- Up-to-date: /home/topeet/rknn-cpp-Multithreading-main/install/rknn_yolov5_demo_Linux/.//model/RK3588/yolov5s.rknn
-- Up-to-date: /home/topeet/rknn-cpp-Multithreading-main/install/rknn_yolov5_demo_Linux/.//model/RK3588/yolov5s-640-640.rknn
-- Up-to-date: /home/topeet/rknn-cpp-Multithreading-main/install/rknn_yolov5_demo_Linux/.//model/coco_80_labels_list.txt
/home/topeet/rknn-cpp-Multithreading-main
模型名称: ./model/RK3588/yolov5s.rknn
线程数: 6
Loading mode...
E RKNN: [07:34:24.135] failed to check rknpu hardware version: 0
E RKNN: [07:34:24.135] This rknn model is for RK3588, but current platform is RK3566/RK3568
E RKNN: [07:34:24.143] rknn_init, load model failed!
rknn_init error ret=-6

@leafqycc
Copy link
Owner

leafqycc commented Nov 16, 2023

如果要将这个代码部署在rk3568上,需要做哪些修改呢 谢谢!

快速部署的话可以尝试:

替换include下的动态链接库librknn_api.so librknnrt.so

替换include下的头文件rknn_api.h

将model/RK3588的模型换为https://github.com/rockchip-linux/rknpu2/tree/v1.5.0/examples/rknn_yolov5_demo/model/RK3566_RK3568 下的模型

注释掉include/rknnPool.hpp的59 - 71行

注释掉build-linux_RK3588.sh的28行, 并取消26行的注释

将include/rknnPool.hpp的167 - 186行替换为

if (img_width !=  width || img_height !=  height)
        cv::resize(img, img, cv::Size(640, 640));
inputs[0].buf = (void *)img.data;

然后到根目录下运行build-linux_RK3588.sh进行编译测试

@leafqycc
Copy link
Owner

leafqycc commented Nov 16, 2023

需要注意的是,rk3568的npu算力并不高(rk3588的1/6),多线程的加速效果可能不明显(在rk3566上测试提升大约50% ?)

可能的改进提升方案:

  1. 采用 rknn_model_zoo下的优化模型

  2. 更新rknn的api版本为1.5.2,本项目截止目前使用的api仍是1.5.0版本(校内作业太多暂无力更新项目)

  3. 使用mpp进行解/编码,使用rga进行图片放缩,具体也可以参考rknpu2主线下的视频demo

  4. 尝试跳帧推理(第一帧进行推理绘制,第二帧使用第一帧的推理结果进行预测框体绘制,第三帧进行推理绘制······以此类推),此方法能较明显地提高帧率,但在高速场景下的表现可能非常糟糕

@gxydbc
Copy link
Author

gxydbc commented Nov 17, 2023

好的,非常感谢!

@jumengbo
Copy link

如果要将这个代码部署在rk3568上,需要做哪些修改呢 谢谢!

快速部署的话可以尝试:

替换include下的动态链接库librknn_api.so librknnrt.so

替换include下的头文件rknn_api.h

将model/RK3588的模型换为https://github.com/rockchip-linux/rknpu2/tree/v1.5.0/examples/rknn_yolov5_demo/model/RK3566_RK3568 下的模型

注释掉include/rknnPool.hpp的59 - 71行

注释掉build-linux_RK3588.sh的28行, 并取消26行的注释

将include/rknnPool.hpp的167 - 186行替换为

if (img_width !=  width || img_height !=  height)
        cv::resize(img, img, cv::Size(640, 640));
inputs[0].buf = (void *)img.data;

然后到根目录下运行build-linux_RK3588.sh进行编译测试

将include/rknnPool.hpp的167 - 186行替换为,为什么rknnPool.hpp并没有这么多行

@leafqycc
Copy link
Owner

如果要将这个代码部署在rk3568上,需要做哪些修改呢 谢谢!

快速部署的话可以尝试:
替换include下的动态链接库librknn_api.so librknnrt.so
替换include下的头文件rknn_api.h
将model/RK3588的模型换为https://github.com/rockchip-linux/rknpu2/tree/v1.5.0/examples/rknn_yolov5_demo/model/RK3566_RK3568 下的模型
注释掉include/rknnPool.hpp的59 - 71行
注释掉build-linux_RK3588.sh的28行, 并取消26行的注释
将include/rknnPool.hpp的167 - 186行替换为

if (img_width !=  width || img_height !=  height)
        cv::resize(img, img, cv::Size(640, 640));
inputs[0].buf = (void *)img.data;

然后到根目录下运行build-linux_RK3588.sh进行编译测试

将include/rknnPool.hpp的167 - 186行替换为,为什么rknnPool.hpp并没有这么多行

见于此分支https://github.com/leafqycc/rknn-cpp-Multithreading/tree/1.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants