步骤

1. 安装软件

链接:https://pan.baidu.com/s/1ko28v8C9fuWUi0F2L3S1KQ
提取码:6666 (资料都在里面)

第一个是下载固件的,第二个是运行代码的,第三个是CH340驱动(连接K210时需要用到)。

2. 下载固件

2.1 获得机器码



用kflash_gui下载完成后,随便打开一个可以查看串口的软件(如arduino),按一下K210开发板的复位键把机器码复制下来。

2.2 下载人脸模型

下载地址 https://www.maixhub.com/modelInfo?modelId=14

点击下载粘贴机器码,完成后得到三个文件,依次添加到kflash_gui下载,下载地址要与文件名标识的一致。

2.3 下载支持K210的固件


用kflash_gui下载,如果不下载后缀带with_ide_support的,开发板会连接不上maixpy软件。

3. 运行代码

3.1 连接开发板


点击左下角连接图标,选择开发板的端口。

3.1 下载代码

点击工具栏,选择将打开的脚本保存到开发板即可。

代码如下(代码参考《K210口罩识别+人脸识别+断电储存(内存卡)》,https://blog.csdn.net/Mrli0530/article/details/123618647?utm_source=app&app_version=5.4.0&code=app_1562916241&uLinkId=usr1mkqgl919blen )

import sensor
import image
import lcd
import KPU as kpu
import time
from Maix import FPIOA, GPIO
import gc
from fpioa_manager import fm
from board import board_info
import utime
import os
import ubinasciitask_fd = kpu.load(0x300000)
task_ld = kpu.load(0x400000)
task_fe = kpu.load(0x500000)clock = time.clock()fm.register(board_info.BOOT_KEY, fm.fpioa.GPIOHS0)
key_gpio = GPIO(GPIO.GPIOHS0, GPIO.IN)
start_processing = FalseBOUNCE_PROTECTION = 50def set_key_state(*_):global start_processingstart_processing = Trueutime.sleep_ms(BOUNCE_PROTECTION)key_gpio.irq(set_key_state, GPIO.IRQ_RISING, GPIO.WAKEUP_NOT_SUPPORT)lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_hmirror(1)
sensor.set_vflip(1)
sensor.run(1)
anchor = (1.889, 2.5245, 2.9465, 3.94056, 3.99987, 5.3658, 5.155437,6.92275, 6.718375, 9.01025)  # anchor for face detect
dst_point = [(44, 59), (84, 59), (64, 82), (47, 105),(81, 105)]  # standard face key point position
a = kpu.init_yolo2(task_fd, 0.5, 0.3, 5, anchor)
img_lcd = image.Image()
img_face = image.Image(size=(128, 128))
a = img_face.pix_to_ai()#=================内存卡===================#
feature_file_exists = 0
for v in os.ilistdir('/sd'):#to check key directorys or files in sd card.sd card should be formated to fat32if v[0] == 'features.txt' and v[1] == 0x8000:#0x8000 is filefeature_file_exists = 1
#================内存卡读写操作================#
record_ftr=[] #空列表 用于存储当前196维特征
record_ftrs=[] #空列表 用于存储按键记录下人脸特征, 可以将特征以txt等文件形式保存到sd卡后,读取到此列表,即可实现人脸断电存储。
names = ['member.1', 'member.2', 'member.3', 'member.4', 'member.5', 'member.6', 'member.7', 'member.8', 'member.9' , 'member.10'] # 人名标签,与上面列表特征值一一对应。
reco = ''
record = []
def save_feature(feat):with open('/sd/features.txt','a') as f:record =ubinascii.b2a_base64(feat)f.write(record)st = ''
if(feature_file_exists):print("start")with open('/sd/features.txt','rb') as f:s = f.readlines()print(len(s))for line in s:record_ftrs.append(bytearray(ubinascii.a2b_base64(line)))#=================人脸识别===================#
ACCURACY = 80while (1):img = sensor.snapshot()clock.tick()code = kpu.run_yolo2(task_fd, img)if code:for i in code:# Cut face and resize to 128x128a = img.draw_rectangle(i.rect())face_cut = img.cut(i.x(), i.y(), i.w(), i.h())face_cut_128 = face_cut.resize(128, 128)a = face_cut_128.pix_to_ai()# a = img.draw_image(face_cut_128, (0,0))# Landmark for face 5 pointsfmap = kpu.forward(task_ld, face_cut_128)plist = fmap[:]le = (i.x() + int(plist[0] * i.w() - 10), i.y() + int(plist[1] * i.h()))re = (i.x() + int(plist[2] * i.w()), i.y() + int(plist[3] * i.h()))nose = (i.x() + int(plist[4] * i.w()), i.y() + int(plist[5] * i.h()))lm = (i.x() + int(plist[6] * i.w()), i.y() + int(plist[7] * i.h()))rm = (i.x() + int(plist[8] * i.w()), i.y() + int(plist[9] * i.h()))a = img.draw_circle(le[0], le[1], 4)a = img.draw_circle(re[0], re[1], 4)a = img.draw_circle(nose[0], nose[1], 4)a = img.draw_circle(lm[0], lm[1], 4)a = img.draw_circle(rm[0], rm[1], 4)# align face to standard positionsrc_point = [le, re, nose, lm, rm]T = image.get_affine_transform(src_point, dst_point)a = image.warp_affine_ai(img, img_face, T)a = img_face.ai_to_pix()# a = img.draw_image(img_face, (128,0))del (face_cut_128)# calculate face feature vectorfmap = kpu.forward(task_fe, img_face)feature = kpu.face_encode(fmap[:])reg_flag = Falsescores = []for j in range(len(record_ftrs)):score = kpu.face_compare(record_ftrs[j], feature)scores.append(score)max_score = 0index = 0for k in range(len(scores)):if max_score < scores[k]:max_score = scores[k]index = kif max_score > ACCURACY:a = img.draw_string(i.x(), i.y(), ("%s :%2.1f" % (names[index], max_score)), color=(0, 255, 0), scale=2)else:a = img.draw_string(i.x(), i.y(), ("X :%2.1f" % (max_score)), color=(255, 0, 0), scale=2)if start_processing:record_ftr = featurerecord_ftrs.append(record_ftr)save_feature(record_ftr) #存到SD卡start_processing = Falsebreakfps = clock.fps()print("%2.1f fps" % fps)a = lcd.display(img)gc.collect()# kpu.memtest()# a = kpu.deinit(task_fe)
# a = kpu.deinit(task_ld)
# a = kpu.deinit(task_fd)

K210人脸识别+断电保存相关推荐

  1. K210人脸识别+人脸信息存储

    K210系列教程 使用MaixPy IDE开发K210 K210实现人脸识别(附代码解读) K210人脸识别+人脸信息存储 K210人脸识别+RFID录入信息 在我的上一篇博客中已经介绍了如何使用K2 ...

  2. K210开发板学习笔记(一)——K210人脸识别门禁+SD卡实现人脸数据存储(附代码解读)

    基于K210的人脸门禁系统演示(按键录入人脸ID.人脸断电存储) 哔哩哔哩链接:https://b23.tv/MHXjhGa K210人脸识别门禁系统 一个按键实现所有功能. 具体功能: 在线人脸录入 ...

  3. K210人脸识别+RFID录入信息

    K210系列教程 使用MaixPy IDE开发K210 K210实现人脸识别(附代码解读) K210人脸识别+人脸信息存储 K210人脸识别+RFID录入信息 (置顶:有位码友看了这篇博客后尝试了RF ...

  4. Maix Bit K210人脸识别(内有获取机器码步骤)【保姆级教程】

    上一篇 MaixPy IDE Maix Bit K210定时器 介绍 在一张图片中找出人脸, 并且框出人脸,即知道脸的位置和大小,对人脸进行检测与识别. 方法 一种是采用LBP特征进行人脸识别,可进行 ...

  5. 人脸识别会被留底吗_人脸识别会保存我们的照片吗?

    第一,人脸识别并不是存储人的脸部照片,而是将人脸提取数字化特征之后进行存储和识别.提取了数字化特征之后,原始的人脸照片就删除了--要不然服务器就要存储太多的人脸照片了,这些照片又不能产生价值(除非该公 ...

  6. Mixly K210 人脸识别 物体识别 齐护机器人发布AIstart K210人工智能学习主机,解决人工智能学习难的问题

    齐护机器人AIstart K210人工智能主机Mixly编程图像识别语音识别图像分析 K210 AIstart入门教程人工智能人脸识别物体识别算法KPU mixly人脸识别与指纹识别控制舵机 深圳齐护 ...

  7. K210实现人脸识别(附代码解读)

    基于K210的人脸识别门禁(一) 进入官网(首次登陆需要注册)获取人脸识别源码 https://wiki.sipeed.com/soft/maixpy/zh/course/ai/image/face_ ...

  8. 基于stm32人脸识别和红外测温

    目录 一.项目功能 二.原理图 三.实物视频 四.实物图片 五.程序 资料下载地址:基于STM32人脸识别和红外测温 一.项目功能 本系统由stm32f103c8t6单片机最小系统电路+k210人脸识 ...

  9. Python+OpenCv实现AI人脸识别身份认证系统(2)——人脸数据采集、存储

    原 Python+OpenCv实现AI人脸识别身份认证系统(2)--人脸数据采集.存储 2019年07月02日 08:47:52 不脱发的程序猿 阅读数 602更多 所属专栏: 人脸识别身份认证系统设 ...

最新文章

  1. c#委托与事件(二)
  2. 数据结构实验之链表二:逆序建立链表
  3. mysql ignore index_mysql use index、ignore index、force index用法
  4. 试题导入mysql乱码_解决Mysql导入乱码问题
  5. (十二)java springcloud b2b2c多用户商城系统-springboot集成apidoc
  6. OpenStack入门科普,看这一篇就够啦!
  7. Oracle和Mysql中的字符串的拼接
  8. 华为设备配置ERPS单环多实例
  9. bootstrapform表单重置_“bootstrap table”怎么重置表单?
  10. html a4页面样式_4个使用将HTML转换为PDF的方法介绍-js教程
  11. 用python爬取交大图书馆图书信息
  12. PS进阶篇——如何PS软件给公司单位图片加版权水印(六)
  13. MFC CString 长度取得
  14. 引用base64包maven打包异常情况
  15. html实现手风琴轮播图,jQuery手风琴轮播图
  16. HandyJSON自带的值类型转换方法
  17. 计算机网络第二周作业,计算机网络第三次作业
  18. 创建制作 MacOS High Sierra 正式版 USB 安装盘
  19. [计算机毕业设计]生成式对抗网络生成动漫人物
  20. 12种食物最养男人,12种食物最养女人

热门文章

  1. java 读取mysql blob字段乱码
  2. 回归分析预测技术介绍
  3. Hadoop HA 高可用集群搭建
  4. 无人驾驶传感类型和传感信息处理方法
  5. 概述SAP云平台上的ABAP开发环境
  6. 不用找,你想要的横版人物,角色游戏素材素材都在这里
  7. 指针详解(包含指针,指针数组,数组指针,指向数组指针的指针,函数指针,函数指针数组,指向函数指针数组的指针)
  8. 基于WEB的数据挖掘综述
  9. nyoj106背包问题为模板解出杭电oj2187悼念512汶川大地震遇难同胞——老人是真饿了
  10. 店长必看:如何利用微信会员管理系统做好店铺营销和管理?