Coder Social home page Coder Social logo

face_recognition's Introduction

人脸识别


这个仓库是使用TensorFlow 2.0框架,并基于 cvpr2019-arcface 论文上完成的,其中主要分为四大块:人脸检测、人脸矫正、提取特征和特征比对。各个模块的大小和在我的 17 款 macbook-pro 的 CPU 上跑耗时如下:

  • 人脸检测:使用的是 mtcnn 网络,模型大小约 1.9MB,耗时约 30ms;
  • 人脸矫正:OpenCV 的仿射变换,耗时约 0.83ms;
  • 提取特征:使用 MobileFaceNet 和 IResNet 网络,耗时约30ms;
  • 特征比对:使用曼哈顿距离,单次搜索和完成比对耗时约 0.011 ms;

注册人脸


注册人脸的方式有两种,分别是:

  1. 打开相机注册:
$ python register_face.py -person Sam -camera

s 键保存图片,需要在不同距离和角度拍摄 10 张图片或者按 q 退出。

  1. 导入人脸图片:

保证文件的名字与注册人名相同,并且每张图片只能出现一张这个 ID 的人脸。

$ python register_face.py -person Jay

识别人脸


Method LFW(%) CFP-FP(%) AgeDB-30(%) MegaFace(%) cpu-time weights
MobileFaceNet 99.50 88.94 95.91 --- 35ms 提取码: xgmo
IResNet 99.77 98.27 98.28 98.47 435ms 下载链接

识别模型用的是 MobileFaceNet 网络,这里直接使用了 insightface 在 ms1m-refine-v1 三百万多万张人脸数据集上训练的模型。这部分工作在 mxnet 分支上,你可以通过 git checkout mxnet 进行切换。

由于该模型是 mxnet 格式,因此使用了 mmdnn 导出了其模型权重 mobilefacenet.npy。接着使用了 TF2 自己手写了一个 MobileFaceNet 网络并导入权重,预测精度没有任何损失。这部分工作在 master 分支上。

最后,如果你要识别人脸,可以执行:

$ python main.py

face_recognition's People

Contributors

yunyang1994 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.