RV1103调用摄像头运行retinaface和facenet进行人脸识别

硬件:luckfox_pico_RV1103,摄像头是SC3336 3MP Camera (A)摄像头,参考RV1103 Luckfox Pico使用SPI NAND Flash烧录镜像焊了nand flash,烧录的buildroot系统。

在这里插入图片描述

在官方的luckfox_pico_rtsp_retinaface的基础上,参考luckfox_pico_rknn_example增加facenet实现人脸识别功能。

下载项目

git clone https://github.com/zhouayi/luckfox_pico_retinaface_facenet.git

编译

前提需要下载luckfox pico的sdk:https://github.com/LuckfoxTECH/luckfox-pico或者https://gitee.com/LuckfoxTECH/luckfox-pico,编译脚本:

export LUCKFOX_SDK_PATH=< 你的 Luckfox-pico SDK 路径>
cd ~/luckfox_pico_retinaface_facenet
mkdir build
cd build
cmake ..
make && make install
# 在确定能adb连接开发板后将程序push进开发板
adb push ../luckfox_retinaface_facenet_demo/ /

运行程序

准备一张类似下方示例的人脸局部图片test.jpgpush进开发板:adb push test.jpg /luckfox_retinaface_facenet_demo
在这里插入图片描述

adb shell连接开发板

top或者ps输出自启动的程序有哪些,需要kill掉一些程序释放出内存才能跑起来

[root@luckfox ]# top
Mem: 26820K used, 920K free, 228K shrd, 0K buff, 1604K cached
CPU:  17% usr  79% sys   0% nic   2% idle   0% io   0% irq   0% sirq
Load average: 11.21 3.00 1.02 2/106 426
  PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
  251     1 root     S    92616 334%  51% rkipc -a /oem/usr/share/iqfiles
  401   399 root     D    31148 112%   8% smbd -D
  425   420 root     R     1796   6%   8% top
   36     2 root     SW       0   0%   8% [kswapd0]
  424   423 root     S     1800   6%   5% {default.script} /bin/sh /usr/share/ud
  190     2 root     SW       0   0%   5% [vcodec_thread_0]
  193     1 root     S     5368  19%   3% /usr/sbin/ntpd -g -p /var/run/ntpd.pid
  355     1 root     S    14392  52%   0% /usr/bin/adbd
  314     1 root     S     4852  17%   0% sshd: /usr/sbin/sshd [listener] 0 of 1
  420   355 root     S     1804   6%   0% /bin/sh -l
   65     1 root     S     1800   6%   0% {rcS} /bin/sh /etc/init.d/rcS
    1     0 root     S     1796   6%   0% init
  423   251 root     S     1792   6%   0% udhcpc -i usb0 -T 1 -A 0 -b -q
  399    65 root     S     1792   6%   0% {S91smb} /bin/sh /etc/init.d/S91smb st
   71     1 root     S     1788   6%   0% /sbin/syslogd -n
  320     1 root     S     1788   6%   0% /usr/sbin/telnetd -F
   75     1 root     S     1784   6%   0% /sbin/klogd -n
   86     1 root     S     1628   6%   0% /sbin/udevd -d
  426   424 root     D     1012   4%   0% /sbin/ifconfig usb0 up
   41     2 root     IW       0   0%   0% [kworker/u2:1-fl]
[root@luckfox ]# killall rkipc
[root@luckfox ]# killall smbd
[root@luckfox ]# killall sshd
[root@luckfox ]# killall ntpd
[root@luckfox ]# killall udhcpc
[root@luckfox ]# killall nmbd

运行程序,将摄像头对着人后会输入人脸在摄像头中的坐标位置,norm表示的是摄像头中的人与test.jpg的参考人的特征向量的距离,数值越小两人越相似。

[root@luckfox luckfox_retinaface_facenet_demo]# ./luckfox_rtsp_retinaface 
this device is not whitelisted for jpeg decoder cvi
this device is not whitelisted for jpeg decoder cvi
this device is not whitelisted for jpeg decoder cvi
init retinaface
init facenet
Retinaface Info
model input num: 1, output num: 3
input tensors:
  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=1.000000
output tensors:
  index=0, name=515, n_dims=3, dims=[1, 16800, 4, 0], n_elems=67200, size=67200, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=-125, scale=1.951411
  index=1, name=553, n_dims=3, dims=[1, 16800, 2, 0], n_elems=33600, size=33600, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=-2, scale=0.243586
  index=2, name=592, n_dims=3, dims=[1, 16800, 10, 0], n_elems=168000, size=168000, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=-119, scale=1.485194
input_attrs[0].size_with_stride=1228800
output mem [0] = 67200 
output mem [1] = 33600 
output mem [2] = 168000 
model is NHWC input fmt
Facenet Info
model input num: 1, output num: 1
input tensors:
  index=0, name=input.1, n_dims=4, dims=[1, 160, 160, 3], n_elems=76800, size=76800, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
output tensors:
  index=0, name=313, n_dims=2, dims=[1, 128, 0, 0], n_elems=128, size=128, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=9, scale=0.081335
input_attrs[0].size_with_stride=76800
output mem [0] = 128 
Init success 
init rknn model success!
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        00:46:07-118 {dump              :064} ---------------------------------------------------------
RTVersion        00:46:07-268 {dump              :065} rockit version: git-8cb4d25b8 Tue Feb 28 11:12:39 2023 +0800
RTVersion        00:46:07-268 {dump              :066} rockit building: built- 2023-02-28 15:23:19
RTVersion        00:46:07-268 {dump              :067} ---------------------------------------------------------
(null)           00:46:07-268 {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)           00:46:07-268 {read_log_level    :093} text is all=4
(null)           00:46:07-275 {read_log_level    :095} module is all, log_level is 4
(null)           00:46:07-297 {monitor_log_level :144} #Start monitor_log_level thread, arg:(nil)
RTIsp3x          00:46:07-398 {ispInitDevice     :208} sensor name = m00_b_sc3336 4-0030
RTIsp3x          00:46:07-399 {ispInitDevice     :211} sensor_index = 0
RTIsp3x          00:46:07-408 {ispInitDevice     :208} sensor name = m00_b_sc3336 4-0030
RTIsp3x          00:46:07-409 {ispInitDevice     :211} sensor_index = 0
vi_dev_init
RKViDev          00:46:07-442 {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          00:46:07-453 {prepareRuntime    :334} ---------------------------------------------------------
RKViChn          00:46:07-453 {prepareRuntime    :336} vi version: 1.86, name:vvi
RKViChn          00:46:07-453 {prepareRuntime    :337} rockit-ko version: vmpi:fb2eed2be49e
RKViChn          00:46:07-453 {prepareRuntime    :338} rockit-ko building: -2023-02-09-11:04:49
RKViChn          00:46:07-453 {prepareRuntime    :339} ---------------------------------------------------------
RKViChn          00:46:07-466 {prepareRuntime    :358} mb pool create success, MBCnt= 2
cmpi             00:46:07-468 {createRuntime     :546} [non-WRAP MODE]: buff size = 518400
RTIsp3x          00:46:07-478 {ispInitDevice     :208} sensor name = m00_b_sc3336 4-0030
RTIsp3x          00:46:07-479 {ispInitDevice     :211} sensor_index = 0
RTDeviceV4L2     00:46:07-486 {open              :138} open video name(/dev/video11)
RKViChn          00:46:07-487 {setFrameRate      :1153} [vi] dev(0) ch(0) illegal param s32SrcFrameRate(0) s32DstFrameRate(0)
RTDeviceV4L2     00:46:07-489 {ispCameraInfo     :549} current device:/dev/video11 isn't compatible(cap:0x84201000) device,memoryType:4, retry:0
RTDeviceV4L2     00:46:07-494 {ispInitFormat     :726} ioctl VIDIOC_S_FMT OK
RKViChn          00:46:07-494 {start             :813} =========== vi Start startRuntime ===========
RTDeviceV4L2     00:46:07-494 {ispStreamOn       :440} do ispStreamOn start
RTDeviceV4L2     00:46:07-515 {ispStreamOn       :493} do ispStreamOn done
test_vpss_init
=== 0 ===
=== 1 ===
rga_api version 1.10.0_[2]
====RK_MPI_SYS_Bind vi0 to vpss0====
Loop
cmpi             00:46:07-638 {mb_get_buffer_by_i:422} allocated buffer(this=0x3b5eb8, data=(nil), size=0, id=-1)
fps = 0.0
fps = 12.5
466 456 509 520
norm = 1.40
fps = 16.7
fps = 12.5
216 192 344 381
norm = 1.21
fps = 14.3
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
rv1226人脸识别是一种基于人脸特征进行身份验证的技术。该技术利用摄像头或其他图像采集设备捕捉到的用户脸部图像,通过对图像进行处理和分析,提取出脸部的特征信息,然后与预先存储的人脸特征进行比对,以确定用户的身份。 rv1226人脸识别的应用非常广泛,例如在安全领域,它可以用于门禁系统、人脸支付、手机解锁等场景中,可以取代传统的密码和身份证验证方式,提高安全性和便利性。此外,它还可以应用在公共场所的人脸监控中,帮助管理人员及时发现和处理异常行为。 rv1226人脸识别技术的特点是准确性高、识别速度快、使用方便。现在的人脸识别技术已经能够克服一些传统的限制因素,如低光照、面部表情变化等,在一定程度上提高了准确性和稳定性。此外,该技术还可以进行多种辅助功能的开发,例如年龄识别、情绪识别等,为用户带来更多的实用价值。 虽然rv1226人脸识别在实际应用中具有许多优势,但也存在一些挑战。例如隐私问题、传感器质量、人种及性别歧视等,需要不断的研究和改进来解决这些问题,以保证人脸识别技术的公正性和安全性。 综上所述,rv1226人脸识别是一种有广泛应用前景的技术,可以提高人们的生活便利性和工作效率,但在应用中还需要解决一些问题,以保证其合理性和可靠性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值