Firefly开源社区

标题: RK3588 开发板 librga库 运行 rknn_yolov5_demo 报错 [打印本页]

作者: liushuan    时间: 2022-4-1 16:18
标题: RK3588 开发板 librga库 运行 rknn_yolov5_demo 报错
运行该网址提供的RKNN SDK sample  https://wiki.t-firefly.com/Core-3568J/usage_npu.html  rknn_yolov5_demo

使用官方提供的图片可以运行,如果输入的图片不是640*640 RGA模块就会报错。

报错信息如下:下面几种错误都有可能出现。
rga_api version 1.6.0_[4] (d041200 build: 2021-12-01 15:26:14 base: )
rk-debug out_fence_fd = 0
Segmentation fault




free(): invalid next size (normal)



corrupted double-linked list



tchip_askquestions

log.log

118 Bytes, 下载次数: 0, 下载积分: 灯泡 -1 , 经验 -1


作者: liushuan    时间: 2022-4-1 17:20
root@firefly:/userdata/sdk/rk3588/external/rknpu2/examples/rknn_yolov5_demo/build# ./rknn_yolov5_demo ./model/RK3588/yolov5s-640-640.rknn ./car_line.jpg
post process config: box_conf_threshold = 0.50, nms_threshold = 0.60
Read ./car_line.jpg ...
img width = 1920, img height = 1920
Loading mode...
sdk version: 1.2.0 (1867aec5b@2022-01-14T15:16:40) driver version: 0.6.4
model input num: 1, output num: 3
  index=0, name=images, n_dims=4, dims=[1, 640, 640, 3], n_elems=1228800, size=4915200, fmt=NHWC, type=FP32, qnt_type=AFFINE, zp=-128, scale=0.003922
  index=0, name=output, n_dims=5, dims=[1, 3, 85, 80], n_elems=1632000, size=1632000, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=77, scale=0.080445
  index=1, name=371, n_dims=5, dims=[1, 3, 85, 40], n_elems=408000, size=408000, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=56, scale=0.080794
  index=2, name=390, n_dims=5, dims=[1, 3, 85, 20], n_elems=102000, size=102000, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=69, scale=0.081305
model is NHWC input fmt
model input height=640, width=640, channel=3
rga_api version 1.6.0_[4] (d041200 build: 2021-12-01 15:26:14 base: )
rk-debug out_fence_fd = 0
once run use 76.768000 ms
loadLabelName ./model/coco_80_labels_list.txt
car @ (1296 462 1482 543) 0.978061
car @ (1089 1485 1197 1554) 0.974313
car @ (1545 1551 1920 1761) 0.968164
car @ (1656 465 1740 522) 0.967032
car @ (1239 1482 1371 1569) 0.962012
car @ (912 1479 1008 1557) 0.944159
car @ (588 90 1089 231) 0.940720
car @ (471 414 642 501) 0.939743
car @ (684 1467 813 1572) 0.929917
loop count = 10 , average run  82.278200 ms
Segmentation fault

作者: liushuan    时间: 2022-4-2 13:25
单独运行 rga的库demo也会报错
root@firefly:/userdata/sdk/rk3588/external/linux-rga/build_linux/install/bin# ./rgaImDemo --resize up
Start selecting mode 0
im2d resize ..
up resize ...
MODE = 2
open file
rga_api version 1.7.0_[4]
resizing .... cost time 12420 us, Run successfully
open /usr/data/out0w1920-h1080-rgba8888.bin and write ok
free(): invalid pointer
Aborted

作者: cang_rong    时间: 2022-12-3 15:06
我在rk3588上调试rga填充图像,调试代码来自https://github.com/airockchip/librga
在rgaImDemo.cpp中加入:
STATUS = imconfig(IM_CONFIG_SCHEDULER_CORE, IM_SCHEDULER_RGA3_CORE0);
尝试启动RGA3,结果报错:
//=======================================================================
Start selecting mode 0
im2d fill ..
fill red ...
MODE = 9
[main][289]src_buf addr: 0x7f7ff9d010        dst_buf addr: 0x7f7fc18010
open file
open file
[main][306]src_buf addr: 0x7f7ff9d010        dst_buf addr: 0x7f7fc18010
rga_api version 1.8.1_[0]
651, imconfig return:Run successfully
653, imconfig return:Run successfully
RgaCollorFill(1717) RGA_COLORFILL fail: Invalid argument
RgaCollorFill(1718) RGA_COLORFILL fail: Invalid argument
srect[x,y,w,h] = [0, 0, 0, 0] src[w,h,ws,hs] = [0, 0, 0, 0]

drect[x,y,w,h] = [100, 100, 300, 300] dst[w,h,ws,hs] = [300, 300, 1280, 720]

usage[0x280000]
filling .... cost time 138 us, Fatal error: Failed to call RockChipRga interface, query log to find the cause of failure.
open /usr/data/out0w1280-h720-rgba8888.bin and write ok
//=======================================================================
以上是在16GB的开发板上的调试结果,在4GB的开发板上可以正确执行。
查阅文档可知:
**A1.8:**由于目前RGA1/RGA2的MMU仅支持最大32位的物理地址,所以当在搭载4G以上DDR的设备中,传给RGA大于4G内存空间的buffer时,RGA驱动会通过dma接口将高位地址的内存里的数据拷贝至swiotlb预留的低位内存上,并返回对应的地址以供RGA读写,RGA工作结束后再通过dma将结果拷贝至原本的高位目标地址上,因此增加了CPU的介入,导致librga整体的工作时间严重增加。对于这种仅搭载RGA2/RGA1,并且设备DDR大于4G的情况,建议调用RGA时使用低于4G空间的内存,保证RGA的效率。

问题:
在rk3588j 16GB的板卡上如何正确使用RGA3?
作者: cang_rong    时间: 2022-12-6 15:44
文档《RGA IM2D API 开发指南》(发布版本:V2.1.0)的表格指出RGA3不支持color fill。
作者: 开始认真    时间: 2023-6-23 17:29
如何调用RGA时使用低于4G空间的内存,保证RGA的效率?有相关的参数吗?




欢迎光临 Firefly开源社区 (https://dev.t-firefly.com/) Powered by Discuz! X3.1