这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 活动中心 » 板卡试用 » 【M5CoreS3测评】人脸检测

共2条 1/1 1 跳转至

【M5CoreS3测评】人脸检测

工程师
2025-10-14 00:44:32     打赏

使用UIFLOW完成一下人脸检测功能

在advanced的camera找到摄像头初始化配置,进行设置

1760372734392399.png

只需要拖动出为摆放一下就已经完成相关初始化工作,非常快捷

ESP-DL里主要是深度学习的一些相关函数摆件,包括一些识别结果的处理

1760372837635929.png

IMAGE里主要是对识别后的图片进行一些标记处理

1760372927781530.png

用图形化操作主要还是需要有清晰的逻辑,可以参考官方的说明文档进行探索。

import os, sys, io
import M5
from M5 import *
import camera
import dl
import image



dual_button_0_blue = None
dual_button_0_red = None


img = None
detector = None
detection_result = None
res = None
kp = None


def setup():
  global dual_button_0_blue, dual_button_0_red, img, detector, detection_result, kp

  M5.begin()
  Widgets.setRotation(1)
  Widgets.fillScreen(0x222222)

  camera.init(pixformat=camera.RGB565, framesize=camera.QVGA)
  detector = dl.ObjectDetector(dl.model.HUMAN_FACE_DETECT)


def loop():
  global dual_button_0_blue, dual_button_0_red, img, detector, detection_result, kp
  M5.update()
  img = camera.snapshot()
  detection_result = detector.infer(img)
  if detection_result:
    for res in detection_result:
      kp = res.keypoint()
      img.draw_circle(kp[0], kp[1], 3, color=0x0000ff, thickness=1, fill=True)
      img.draw_circle(kp[2], kp[3], 3, color=0x00ff00, thickness=1, fill=True)
      img.draw_circle(kp[4], kp[5], 3, color=0xff0000, thickness=1, fill=True)
      img.draw_circle(kp[6], kp[7], 3, color=0x0000ff, thickness=1, fill=True)
      img.draw_circle(kp[8], kp[9], 3, color=0x00ff00, thickness=1, fill=True)
      img.draw_rectangle(res.x(), res.y(), res.w(), res.h(), color=0x3366ff, thickness=3, fill=False)
  M5.Lcd.show(img, 0, 0, 320, 240)


if __name__ == '__main__':
  try:
    setup()
    while True:
      loop()
  except (Exception, KeyboardInterrupt) as e:
    try:
      from utility import print_error_msg
      print_error_msg(e)
    except ImportError:
      print("please update to latest firmware")

image.png

烧录一下看看效果

1760373354965914.png

1760373603937795.png

完美流畅运行。还可以将程序通过文件管理上传至设备

1760373712293403.png

这样就可以通过这UIFLOW的固件系统在设备端进行执行

1760373837458389.jpg




关键词: M5CoreS3     人脸检测     UIFLOW    

院士
2025-10-14 20:02:24     打赏
2楼

嘿嘿,把我的加菲猫头像也丢给它,让它给识别一下


共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]