Page 1 of 1

Fail to deploy custom yolov5 to luckfox pico max

Posted: 2024-11-03 8:06
by pdoanthuannb96
I am trying to customize my model to detect only the human body.
Workflow:

Image

After that, I obtained two files: best.onnx and RK-anchors.txt.

I placed the model on an Ubuntu machine and converted it to an RKNN model:

Image

Configuration: I changed the labels list to include only "person" and updated the anchors to match those in RK-Anchor.txt. After converting, I added the model to the rkmpi-example (https://github.com/LuckfoxTECH/luckfox_ ... pi_example), compiled it, and ran it. However, I encountered an error:

Code: Select all

[root@luckfox luckfox_pico_rtsp_yolov5_demo]# ./luckfox_pico_rtsp_yolov5
Stop Application ...
killall: rkipc: no process killed
killall: udhcpc: no process killed
rkipc exit
ls: /oem/usr/etc/init.d/S??*: No such file or directory
  index=0, name=images, n_dims=4, dims=[1, 640, 640, 3], n_elems=1228800, size=1228800, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
  index=0, name=output0, n_dims=4, dims=[1, 80, 80, 18], n_elems=115200, size=115200, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
  index=1, name=286, n_dims=4, dims=[1, 40, 40, 18], n_elems=28800, size=28800, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
  index=2, name=288, n_dims=4, dims=[1, 20, 20, 18], n_elems=7200, size=7200, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
model is NHWC input fmt
model input height=640, width=640, channel=3
init rknn model success!
load lable ./model/coco_80_labels_list.txt
rkaiq log level ff0
ID: 0, sensor_name is m00_b_sc3336 4-0030, iqfiles is /etc/iqfiles
rk_aiq_uapi2_sysctl_init/prepare succeed
rk_aiq_uapi2_sysctl_start succeed
rockit log path (null), log_size = 0, can use export rt_log_path=, export rt_log_size= change
log_file = (nil)
RTVersion        12:22:01-135 {dump              :064} ---------------------------------------------------------
RTVersion        12:22:01-139 {dump              :065} rockit version: git-8cb4d25b8 Tue Feb 28 11:12:39 2023 +0800
RTVersion        12:22:01-141 {dump              :066} rockit building: built- 2023-02-28 15:23:19
RTVersion        12:22:01-142 {dump              :067} ---------------------------------------------------------
(null)           12:22:01-143 {log_level_init    :203}

 please use echo name=level > /tmp/rt_log_level set log level
	name: all cmpi mb sys vdec venc rgn vpss vgs tde avs wbc vo vi ai ao aenc adec
	log_level: 0 1 2 3 4 5 6

rockit default level 4, can use export rt_log_level=x, x=0,1,2,3,4,5,6 change
(null)           12:22:01-144 {read_log_level    :093} text is all=4
(null)           12:22:01-145 {read_log_level    :095} module is all, log_level is 4
(null)           12:22:01-148 {monitor_log_level :144} #Start monitor_log_level thread, arg:(nil)
RTIsp3x          12:22:01-154 {ispInitDevice     :208} sensor name = m00_b_sc3336 4-0030
RTIsp3x          12:22:01-155 {ispInitDevice     :211} sensor_index = 0
RTIsp3x          12:22:01-163 {ispInitDevice     :208} sensor name = m00_b_sc3336 4-0030
RTIsp3x          12:22:01-165 {ispInitDevice     :211} sensor_index = 0
[INFO  rtsp_demo.c:280:rtsp_new_demo] rtsp server demo starting on port 554
[DEBUG rtsp_demo.c:480:rtsp_new_session] add session path: /live/0
rtsp streamq_alloc size is 1753484
vi_dev_init
RKViDev          12:22:01-183 {vi_set_dev_attr   :440} VI_DEV_ATTR_S all parameter reserved
  === VI ATTRS INFO: ===
	devId  :      0
	chnId  :      0
	buffcnt:      0
	buffSize:     0
	width:        0
	height:       0
	Maxwidth:     0
	Maxwidth:     0
	streaming:    0
RKViChn          12:22:01-188 {prepareRuntime    :334} ---------------------------------------------------------
RKViChn          12:22:01-189 {prepareRuntime    :336} vi version: 1.86, name:vvi
RKViChn          12:22:01-189 {prepareRuntime    :337} rockit-ko version: vmpi:fb2eed2be49e
RKViChn          12:22:01-189 {prepareRuntime    :338} rockit-ko building: -2023-02-09-11:04:49
RKViChn          12:22:01-189 {prepareRuntime    :339} ---------------------------------------------------------
RKViChn          12:22:01-191 {prepareRuntime    :358} mb pool create success, MBCnt= 2
cmpi             12:22:01-192 {createRuntime     :546} [non-WRAP MODE]: buff size = 518400
RTIsp3x          12:22:01-194 {ispInitDevice     :208} sensor name = m00_b_sc3336 4-0030
RTIsp3x          12:22:01-196 {ispInitDevice     :211} sensor_index = 0
RTDeviceV4L2     12:22:01-200 {open              :138} open video name(/dev/video11)
RKViChn          12:22:01-202 {setFrameRate      :1153} [vi] dev(0) ch(0) illegal param s32SrcFrameRate(0) s32DstFrameRate(0)
RTDeviceV4L2     12:22:01-204 {ispCameraInfo     :549} current device:/dev/video11 isn't compatible(cap:0x84201000) device,memoryType:4, retry:0
RTDeviceV4L2     12:22:01-205 {ispInitFormat     :726} ioctl VIDIOC_S_FMT OK
RKViChn          12:22:01-208 {start             :813} =========== vi Start startRuntime ===========
RTDeviceV4L2     12:22:01-209 {ispStreamOn       :440} do ispStreamOn start
RTDeviceV4L2     12:22:01-232 {ispStreamOn       :493} do ispStreamOn done
vpss_init
=== 0 ===
rga_api version 1.9.1_[0]
====RK_MPI_SYS_Bind vi0 to vpss0====
venc_init
MpiAdapterEncode 12:22:01-252 {ma_encode_create  :1653} ringbuf buf_size 520192
venc init success
=== 1 ===
cmpi             12:22:01-314 {mb_get_buffer_by_i:422} allocated buffer(this=0x29a218, data=(nil), size=0, id=-1)
Segmentation fault (core dumped)

System dmesg:

Code: Select all

[ 1327.544900] rga_job: [tgid:999 pid:1007] destroy request[1090] when the user exits
[ 1327.544914] rga_job: [tgid:999 pid:1007] destroy request[1091] when the user exits
[ 1327.544948] rga_job: [tgid:999 pid:1007] destroy request[1092] when the user exits
[ 1327.544959] rga_job: [tgid:999 pid:1007] destroy request[1093] when the user exits
[ 1327.544969] rga_job: [tgid:999 pid:1007] destroy request[1094] when the user exits
[ 1327.551063] rkcif-mipi-lvds: stream[0] start stopping, total mode 0x2, cur 0x2
[ 1327.590345] rockchip-mipi-csi2 ffa20000.mipi-csi2: stream off, src_sd: b08dc4ce, sd_name:rockchip-csi2-dphy0
[ 1327.590375] rockchip-mipi-csi2 ffa20000.mipi-csi2: stream OFF
[ 1327.591268] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream_stop stream stop, dphy0
[ 1327.591290] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:0, dphy0
[ 1327.591323] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:0, dphy0
[ 1327.591530] rkcif-mipi-lvds: stream[0] stopping finished, dma_en 0x0
[ 1327.592087] rockit isp stream off
[ 1327.592556] stream_cif_mipi_id1: close video, entity use_count 0
[ 1327.592595] stream_cif_mipi_id0: close video, entity use_count 1
[ 1327.592817] stream_cif_mipi_id0: s_power 0, entity use_count 0
Is it possible to customize a model, optimize it, and then convert it to an RKNN format -> deploy to board ?

Re: Fail to deploy custom yolov5 to luckfox pico max

Posted: 2024-11-04 1:29
by Crocodile
Hello, when using the luckfox_pico_rtsp_yolov5 example from luckfox_pico_rkmpi_example, you need to modify the coco_80_labels_list.txt file in luckfox_pico_rkmpi_example_5.10.160/example/luckfox_pico_rtsp_yolov5/model/ and the value of OBJ_CLASS_NUM in luckfox_pico_rkmpi_example/include/rknn/postprocess.h according to the structure of your model for the classes you want to detect. For detailed instructions, refer to https://wiki.luckfox.com/Luckfox-Pico/L ... ted-issues

Additionally, it is recommended to test using https://github.com/LuckfoxTECH/luckfox_ ... n_example first. The logs you provided show that the RKNN model loading part has already succeeded preliminarily. Using RKMPI may incur additional CMA consumption, and insufficient CMA allocation might also be a reason for failure.