Page 1 of 1

LuckFox_Pico_plus Using retinaface.rknn model but show error : out of memory

Posted: 2024-08-16 3:13
by wenjie
Today, I generated a model based on the personnel detection algorithm on the official website. When running rknn_yolov5_demo_test, it showed insufficient memory. However, using the yolv5_rknn on the official website, I will not encounter any errors
log

Code: Select all

this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
  index=0, name=input.1, 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=501, n_dims=3, dims=[1, 16800, 4, 0], n_elems=67200, size=67200, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=-121, scale=1.969940
  index=1, name=536, n_dims=3, dims=[1, 16800, 2, 0], n_elems=33600, size=33600, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=-2, scale=0.243524
  index=2, name=571, n_dims=3, dims=[1, 16800, 10, 0], n_elems=168000, size=168000, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=-120, scale=1.466965
model is NHWC input fmt
model input height=640, width=640, channel=3
load lable ./model/coco_80_labels_list.txt
[  779.261699] stream_cif_mipi_id0: s_power 1, entity use_count 1
   devpath = /dev/video11
   driver = rkisp_v7
   card = rkisp_mainpath
   bus_info = platform:rkisp-vir0
   version = 20000
   capabilities = 84201000
   device_caps = 4201000
   fmt = UYVY 4:2:2  59565955
   fmt = Y/CbCr 4:2:2  3631564e
   fmt = Y/CrCb 4:2:2  3136564e
   fmt = Y/CrCb 4:2:0  3132564e
       size = 32 x 16  ~  2304 x 1296  (+8 +8)
   fmt = Y/CbCr 4:2:0  3231564e
   fmt = Y/CrCb 4:2:0 (N-C)  31324d4e
   fmt = Y/CbCr 4:2:0 (N-C)  32314d4e
rkaiq log level ff0
[  779.571661] stream_cif_mipi_id0: open video, entity use_countt 2
[  779.571876] stream_cif_mipi_id1: open video, entity use_countt 1
/dev/video11 does not support changing fps
rga_api version 1.10.0_[2]
[  779.651308] rkisp rkisp-vir0: first params buf queue
[  779.657544] rkisp_hw ffa00000.rkisp: set isp clk = 198000000Hz
[  779.657682] rkcif-mipi-lvds: sditf_reinit_mode, mode->rdbk_mode 0, mode->name rkisp-vir0, link_mode 1
[  779.659419] rkcif-mipi-lvds: stream[0] start streaming
[  779.659611] rockchip-mipi-csi2 ffa20000.mipi-csi2: stream on, src_sd: 8e63bb03, sd_name:rockchip-csi2-dphy0
[  779.659627] rockchip-mipi-csi2 ffa20000.mipi-csi2: stream ON
[  779.659682] rockchip-csi2-dphy0: dphy0, data_rate_mbps 506
[  779.659712] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:1, dphy0
[  779.659723] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:1, dphy0
WENJIE process_i8_rv1106 success,align_c = 255,grid_h = 4, grid_w = 16800
[  781.135235] xc:GrpMsgThrd invoked oom-killer: gfp_mask=0x1100cca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=0
[  781.135274] CPU: 0 PID: 825 Comm: xc:GrpMsgThrd Tainted: G           O      5.10.110 #1
[  781.135282] Hardware name: Generic DT based system
[  781.135327] [<b000f565>] (unwind_backtrace) from [<b000e037>] (show_stack+0xbKilled
/0xc)
[  781.135354] [<b000e037>] (show_stack) from [<b03b175b>] (dump_header+0x37/0x148)
[  781.135377] [<b03b175b>] (dump_header) from [<b004ee29>] (oom_kill_process+0x3d/0x178)
[  781.135398] [<b004ee29>] (oom_kill_process) from [<b004f3c3>] (out_of_memory+0x21f/0x264)
[  781.135417] [<b004f3c3>] (out_of_memory) from [<b006afbd>] (__alloc_[root@luckfox tmp]# pages_nodemask+0x44f/0x502)
[  781.135437] [<b006afbd>] (__alloc_pages_nodemask) from [<b004da2b>] (pagecache_get_page.part.12+0x8b/0xd4)
[  781.135453] [<b004da2b>] (pagecache_get_page.part.12) from [<b004e1fd>] (filemap_fault+0x155/0x2ac)
[  781.135469] [<b004e1fd>] (filemap_fault) from [<b005f3d3>] (__do_fault+0x23/0x3a)
[  781.135485] [<b005f3d3>] (__do_fault) from [<b0060f8b>] (handle_mm_fault+0x251/0x44a)
[  781.135500] [<b0060f8b>] (handle_mm_fault) from [<b000faff>] (do_page_fault+0x10f/0x18c)
[  781.135515] [<b000faff>] (do_page_fault) from [<b000fcd5>] (do_PrefetchAbort+0x25/0x58)
[  781.135531] [<b000fcd5>] (do_PrefetchAbort) from [<b00092af>] (__pabt_usr+0x4f/0x50)
[  781.135543] Exception stack(0xb13e3fb0 to 0xb13e3ff8)
[  781.135555] 3fa0:                                     a6d791ac 00000001 00000001 a6d5c0ec
[  781.135567] 3fc0: 00000018 002c5d58 0000004b 00211ba0 0029d524 a6f1dec4 00000001 002143b0
[  781.135577] 3fe0: 00000000 a5563c00 a6d4751c a6d5c000 20000010 ffffffff
[  781.135585] Mem-Info:
[  781.135605] active_anon:409 inactive_anon:2078 isolated_anon:0
[  781.135605]  active_file:0 inactive_file:3 isolated_file:0
[  781.135605]  unevictable:0 dirty:0 writeback:0
[  781.135605]  slab_reclaimable:823 slab_unreclaimable:1257
[  781.135605]  mapped:325 shmem:705 pagetables:51 bounce:0
[  781.135605]  free:156 free_pcp:0 free_cma:0
[  781.135628] Node 0 active_anon:1636kB inactive_anon:8312kB active_file:0kB inactive_file:12kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:1300kB dirty:0kB writeback:0kB shmem:2820kB writeback_tmp:0kB kernel_stack:616kB all_unreclaimable? yes
[  781.135651] Normal free:624kB min:624kB low:780kB high:936kB reserved_highatomic:0KB active_anon:1636kB inactive_anon:8312kB active_file:0kB inactive_file:12kB unevictable:0kB writepending:0kB present:65536kB managed:24664kB mlocked:0kB pagetables:204kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[  781.135659] lowmem_reserve[]: 0 0
[  781.135675] Normal: 8*4kB (UM) 26*8kB (UM) 18*16kB (U) 1*32kB (U) 1*64kB (M) 0*128kB 0*256kB 0*512kB 0*1024kB = 624kB
[  781.135717] 708 total pagecache pages
[  781.135729] 0 pages in swap cache
[  781.135738] Swap cache stats: add 0, delete 0, find 0/0
[  781.135744] Free swap  = 0kB
[  781.135750] Total swap = 0kB
[  781.135756] 16384 pages RAM
[  781.135762] 0 pages HighMem/MovableOnly
[  781.135769] 10218 pages reserved
[  781.135775] 8448 pages cma reserved
[  781.135781] Tasks state (memory values in pages):
[  781.135788] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
[  781.135809] [     76]     0    76      447       17     6144        0             0 syslogd
[  781.135823] [     80]     0    80      446       16     6144        0             0 klogd
[  781.135833] [     91]     0    91      402      106     6144        0         -1000 udevd
[  781.135849] [    268]     0   268      447       17     6144        0             0 telnetd
[  781.135860] [    341]     0   341     2556       23    12288        0             0 adbd
[  781.135872] [    772]     0   772      192       16     6144        0             0 luckfox_switch_
[  781.135884] [    778]     0   778      458       30     6144        0             0 sh
[  781.135895] [    818]     0   818    10701     1864    49152        0             0 rknn_yolov5_dem
[  781.135905] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),task=rknn_yolov5_dem,pid=818,uid=0
[  781.135972] Out of memory: Killed process 818 (rknn_yolov5_dem) total-vm:42804kB, anon-rss:6156kB, file-rss:264kB, shmem-rss:1036kB, UID:0 pgtables:48kB oom_score_adj:0
[  781.139640] oom_reaper: reaped process 818 (rknn_yolov5_dem), now anon-rss:0kB, file-rss:264kB, shmem-rss:0kB
[  781.146415] rga_mm: [tgid:818] Decrement the reference of handle[5] when the user exits
[  781.146453] rga_mm: [tgid:818] Decrement the reference of handle[6] when the user exits
[  781.146794] stream_cif_mipi_id1: close video, entity use_count 0
[  781.147239] stream_cif_mipi_id0: close video, entity use_count 1
[  781.147979] rkcif-mipi-lvds: stream[0] start stopping, total mode 0x2, cur 0x2
[  781.155777] rockchip-mipi-csi2 ffa20000.mipi-csi2: stream off, src_sd: 8e63bb03, sd_name:rockchip-csi2-dphy0
[  781.155807] rockchip-mipi-csi2 ffa20000.mipi-csi2: stream OFF
[  781.156552] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream_stop stream stop, dphy0
[  781.156571] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:0, dphy0
[  781.156600] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:0, dphy0
[  781.156794] rkcif-mipi-lvds: stream[0] stopping finished, dma_en 0x0
[  781.157022] stream_cif_mipi_id0: s_power 0, entity use_count 0

Re: LuckFox_Pico_plus Using retinaface.rknn model but show error : out of memory

Posted: 2024-08-16 3:54
by Crocodile
Hello, you can try creating a swap file to resolve the issue. Please ensure that you have enough space available. The steps to create a swap partition are as follows:

Code: Select all

fallocate -l <size> /swapfile  # Replace <size> with the actual size, e.g., "1G" for SD cards
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

Re: LuckFox_Pico_plus Using retinaface.rknn model but show error : out of memory

Posted: 2024-08-19 9:09
by wenjie
Crocodile wrote: 2024-08-16 3:54 Hello, you can try creating a swap file to resolve the issue. Please ensure that you have enough space available. The steps to create a swap partition are as follows:

Code: Select all

fallocate -l <size> /swapfile  # Replace <size> with the actual size, e.g., "1G" for SD cards
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
Create a swap file using the method you provided, but encountered some errors.
The SD card has two partitions mounted to the same directory, but the permissions of the two partitions are different.

Re: LuckFox_Pico_plus Using retinaface.rknn model but show error : out of memory

Posted: 2024-08-20 1:12
by Crocodile
Your SD card appears to have multiple partitions, and the mount permissions may not be set correctly. You can try using

Code: Select all

umount /dev/mmcblk1p2
to unmount the unused read-only partition or use

Code: Select all

mount -o remount,rw /mnt/sdcard
to remount the partition with read-write permissions.

Re: LuckFox_Pico_plus Using retinaface.rknn model but show error : out of memory

Posted: 2024-08-20 5:53
by wenjie
Crocodile wrote: 2024-08-20 1:12 Your SD card appears to have multiple partitions, and the mount permissions may not be set correctly. You can try using

Code: Select all

umount /dev/mmcblk1p2
to unmount the unused read-only partition or use

Code: Select all

mount -o remount,rw /mnt/sdcard
to remount the partition with read-write permissions.
Using rknn_yolov5_demo_test to run Retinaface.rknn model but reporting the following segment error.

Code: Select all

[root@luckfox tmp]# ./rknn_yolov5_demo_test /mnt/sdcard/app/model/retinaface.rkn
n
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
this device is not whitelisted for capture cvi
  index=0, name=input.1, n_dims=4, dims=[1, 640, 640, 3], n_elems=1228800, size=1228800, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003768
  index=0, name=501, n_dims=3, dims=[1, 16800, 4, 0], n_elems=67200, size=67200, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=-121, scale=1.968694
  index=1, name=536, n_dims=3, dims=[1, 16800, 2, 0], n_elems=33600, size=33600, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=-2, scale=0.243453
  index=2, name=571, n_dims=3, dims=[1, 16800, 10, 0], n_elems=168000, size=168000, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=-120, scale=1.466372
model is NHWC input fmt
model input height=640, width=640, channel=3
load lable ./model/coco_80_labels_list.txt
[  319.494610] stream_cif_mipi_id0: s_power 1, entity use_count 1
   devpath = /dev/video11
   driver = rkisp_v7
   card = rkisp_mainpath
   bus_info = platform:rkisp-vir0
   version = 20000
   capabilities = 84201000
   device_caps = 4201000
   fmt = UYVY 4:2:2  59565955
   fmt = Y/CbCr 4:2:2  3631564e
   fmt = Y/CrCb 4:2:2  3136564e
   fmt = Y/CrCb 4:2:0  3132564e
       size = 32 x 16  ~  2304 x 1296  (+8 +8)
   fmt = Y/CbCr 4:2:0  3231564e
   fmt = Y/CrCb 4:2:0 (N-C)  31324d4e
   fmt = Y/CbCr 4:2:0 (N-C)  32314d4e
rkaiq log level ff0
[  324.780836] stream_cif_mipi_id0: open video, entity use_countt 2
[  324.781064] stream_cif_mipi_id1: open video, entity use_countt 1
/dev/video11 does not support changing fps
rga_api version 1.10.0_[2]
[  324.822503] rkisp rkisp-vir0: first params buf queue
[  324.825224] rkisp_hw ffa00000.rkisp: set isp clk = 198000000Hz
[  324.825274] rkcif-mipi-lvds: sditf_reinit_mode, mode->rdbk_mode 0, mode->name rkisp-vir0, link_mode 1
[  324.826980] rkcif-mipi-lvds: stream[0] start streaming
[  324.827172] rockchip-mipi-csi2 ffa20000.mipi-csi2: stream on, src_sd: e8d396b4, sd_name:rockchip-csi2-dphy0
[  324.827187] rockchip-mipi-csi2 ffa20000.mipi-csi2: stream ON
[  324.828392] rockchip-csi2-dphy0: dphy0, data_rate_mbps 506
[  324.828526] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:1, dphy0
[  324.828563] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:1, dphy0
WENJIE process_i8_rv1106 success,align_c = 255,grid_h = 4, grid_w = 16800




[  507.646953] rga_mm: [tgid:791] Decrement the reference of handle[3] when the user exits
[  507.647070] rga_mm: [tgid:791] Decrement the reference of handle[4] when the user exits
[  507.647562] stream_cif_mipi_id1: close video, entity use_count 0
[  507.647604] stream_cif_mipi_id0: close video, entity use_count 1
[  507.647957] rkcif-mipi-lvds: stream[0] start stopping, total mode 0x2, cur 0x2
[  507.683813] rockchip-mipi-csi2 ffa20000.mipi-csi2: stream off, src_sd: e8d396b4, sd_name:rockchip-csi2-dphy0
[  507.683893] rockchip-mipi-csi2 ffa20000.mipi-csi2: stream OFF
[  507.684692] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream_stop stream stop, dphy0
[  507.684719] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:0, dphy0
[  507.684761] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:0, dphy0
[  507.684975] rkcif-mipi-lvds: stream[0] stopping finished, dma_en 0x0
[  507.685356] stream_cif_mipi_id0: s_power 0, entity use_count 0
Segmentation fault (core dumped)

Re: LuckFox_Pico_plus Using retinaface.rknn model but show error : out of memory

Posted: 2024-08-20 6:01
by Crocodile
The model structures of Yolov5 and RetinaFace are different, and the processes they execute are also different. A segmentation fault is inevitable. Please ensure you understand the working principles of RKNN before proceeding with related testing and development.