i 人脸识别系统开发(9)-Dlib人脸比对-生物识别技术-电子人社区 -

电子人社区

 找回密码
 立即注册

今日 : 0|主题 : 719|排名 : 290 
打印 上一主题 下一主题

人脸识别系统开发(9) -- Dlib人脸比对

发表于 2019-1-15 09:08:33 | 102030 只看该作者 回帖奖励 |倒序浏览 |阅读模式

[复制链接]
发表于 2019-1-15 09:08:33 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
电子人社区网讯:   这里的人脸识别准确的说是人脸比对,特征点比对。opencv是基于机器学习的,需要使用素材进行训练,不符合该系统的要求。所以这里使用dlib来实现。
  从dlib官方网站http://dlib.net/下载源码,使用cmake生成visual stuido工程,然后编译。
  编译dlib可能需要安装mkl,mkl下载地址:https://pan.baidu.com/s/1qYHriKs 密码:wl6z
  使用dlib进行人脸图片比对的大致流程如下(代码摘要):
  #include
  #include
  #include
  #include
  #include
  #include
  #include

  template   using residual = add_prev1;

  template   using residual_down = add_prev2;

  template
  using block = BN
  template  using ares_down =>  template  using alevel0 = ares_down;
  template  using alevel1 = ares;
  template  using alevel2 = ares;
  template  using alevel3 = ares;
  template  using alevel4 = ares;
  using anet_type = loss_metric>>>>>>>>>>;
  // 声明anet_type
  anet_type net;
  // 使用dlib_face_recognition_resnet_model_v1.data初始化anet_type
  //
  QString strDataPath = QCoreApplication::applicationDirPath() + "/data/dlib_face_recognition_resnet_model_v1.dat";
  try {
  deserialize(cpp4j::Utf8ToAnsi(strDataPath.toStdString())) >> net;
  }
  catch (serialization_error &e) {
  qDebug()
  cv::resize(m_Face2, m_Face2,>  cv::imwrite(strTmpFace1, m_Face1);
  cv::imwrite(strTmpFace2, m_Face2);
  matrix img1;
  matrix img2;
  load_image(img1, strTmpFace1);
  load_image(img2, strTmpFace2);

  std::vector>  faces.push_back(img1);
  faces.push_back(img2);

  std::vector>  // 比对结果是一个距离值

  float f = length(face_descriptors[0] ->  qDebug()

 

                                                   转载请注明:电子人社区

0条回复
跳转到指定楼层

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|电子人物联网  

Copyright 2013 最新最精彩-社区论坛 版权所有 All Rights Reserved.

QQ|电子人物联网  

GMT+8, 2024-4-30 03:52 , Processed in 0.103010 second(s), 33 queries.

快速回复 返回顶部 返回列表