{"id":19241553,"url":"https://github.com/yunyang1994/face_recognition","last_synced_at":"2025-04-05T19:13:14.655Z","repository":{"id":96974395,"uuid":"150694208","full_name":"YunYang1994/face_recognition","owner":"YunYang1994","description":"🍎 My own face recognition with deep neural networks.","archived":false,"fork":false,"pushed_at":"2023-03-19T14:56:09.000Z","size":27071,"stargazers_count":366,"open_issues_count":10,"forks_count":112,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-29T18:07:14.388Z","etag":null,"topics":["deep-learning","face-detection","face-recognition","image-classification","image-processing","neural-network","object-detection"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YunYang1994.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-28T06:15:55.000Z","updated_at":"2025-03-24T19:22:06.000Z","dependencies_parsed_at":"2023-07-07T01:33:51.900Z","dependency_job_id":null,"html_url":"https://github.com/YunYang1994/face_recognition","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YunYang1994%2Fface_recognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YunYang1994%2Fface_recognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YunYang1994%2Fface_recognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YunYang1994%2Fface_recognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YunYang1994","download_url":"https://codeload.github.com/YunYang1994/face_recognition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386265,"owners_count":20930619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","face-detection","face-recognition","image-classification","image-processing","neural-network","object-detection"],"created_at":"2024-11-09T17:11:49.695Z","updated_at":"2025-04-05T19:13:14.631Z","avatar_url":"https://github.com/YunYang1994.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 人脸识别\n--------------------\n这个仓库是使用`TensorFlow 2.0`框架，并基于 [cvpr2019-arcface](https://openaccess.thecvf.com/content_CVPR_2019/papers/Deng_ArcFace_Additive_Angular_Margin_Loss_for_Deep_Face_Recognition_CVPR_2019_paper.pdf) 论文上完成的，其中主要分为四大块：人脸检测、人脸矫正、提取特征和特征比对。各个模块的大小和在我的 17 款 macbook-pro 的 CPU 上跑耗时如下：\n\n- 人脸检测：使用的是 mtcnn 网络，模型大小约 1.9MB，耗时约 30ms；\n- 人脸矫正：OpenCV 的仿射变换，耗时约 0.83ms；\n- 提取特征：使用 MobileFaceNet（或IResNet）网络，耗时约30ms；\n- 特征比对：使用曼哈顿距离，单次搜索和完成比对耗时约 0.011 ms；\n\n\u003cp align=\"center\"\u003e\n    \u003cimg width=\"80%\" src=\"https://raw.githubusercontent.com/YunYang1994/face_recognition/master/weights/demo.png\" style=\"max-width:65%;\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## 注册人脸\n--------------------\n\n注册人脸的方式有两种，分别是:\n\n1. 打开相机注册:\n\n```bashrc\n$ python register_face.py -person Sam -camera\n```\n\n按 `s` 键保存图片，需要在不同距离和角度拍摄 10 张图片或者按 `q` 退出。\n\n2. 导入人脸图片:\n\n保证文件的名字与注册人名相同，并且每张图片只能出现一张这个 ID 的人脸。\n\n\n```bashrc\n$ python register_face.py -person Jay\n```\n\n## 识别人脸\n--------------------\n\n|Method | LFW(%) | CFP-FP(%) | AgeDB-30(%) | MegaFace(%)| cpu-time | weights |\n|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n| MobileFaceNet | 99.50 | 88.94 | 95.91 | --- | 35ms | [下载链接](https://github.com/YunYang1994/face_recognition/blob/master/weights/mobilefacenet.npy)\n| IResNet | 99.77 | 98.27 | 98.28 | 98.47 | 435ms | [提取码: xgmo](https://pan.baidu.com/s/1QIYpHYazaPMTI0E15WRGug)\n\n识别模型用的是 `MobileFaceNet` 网络，这里直接使用了 [insightface](https://github.com/deepinsight/insightface) 在 ms1m-refine-v1 三百万多万张人脸数据集上训练的模型。这部分工作在 `mxnet` 分支上，你可以通过 `git checkout mxnet` 进行切换。\n\n由于该模型是 mxnet 格式，因此使用了 [mmdnn](https://github.com/microsoft/MMdnn) 导出了其模型权重 `mobilefacenet.npy`。接着使用了 `TF2` 自己手写了一个 `MobileFaceNet` 网络并导入权重，预测精度没有任何损失。这部分工作在 `master` 分支上。\n\n最后，如果你要识别人脸，可以执行：\n\n```bashrc\n$ python main.py\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyunyang1994%2Fface_recognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyunyang1994%2Fface_recognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyunyang1994%2Fface_recognition/lists"}