You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 5.0 kB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <div align=center>
  2. <img src="http://affluent.oss-cn-hangzhou.aliyuncs.com/html/images/dface_logo.png" width="350">
  3. </div>
  4. -----------------
  5. # DFace • [![License](http://pic.dface.io/apache2.svg)](https://opensource.org/licenses/Apache-2.0)
  6. | **`Linux CPU`** | **`Linux GPU`** | **`Mac OS CPU`** | **`Windows CPU`** |
  7. |-----------------|---------------------|------------------|-------------------|
  8. | [![Build Status](http://pic.dface.io/pass.svg)](http://pic.dface.io/pass.svg) | [![Build Status](http://pic.dface.io/pass.svg)](http://pic.dface.io/pass.svg) | [![Build Status](http://pic.dface.io/pass.svg)](http://pic.dface.io/pass.svg) | [![Build Status](http://pic.dface.io/pass.svg)](http://pic.dface.io/pass.svg) |
  9. **基于多任务卷积网络(MTCNN)和Center-Loss的多人实时人脸检测和人脸识别系统。**
  10. [Github项目地址](https://github.com/kuaikuaikim/DFace)
  11. **DFace** 是个开源的深度学习人脸检测和人脸识别系统。所有功能都采用 **[pytorch](https://github.com/pytorch/pytorch)** 框架开发。pytorch是一个由facebook开发的深度学习框架,它包含了一些比较有趣的高级特性,例如自动求导,动态构图等。DFace天然的继承了这些优点,使得它的训练过程可以更加简单方便,并且实现的代码可以更加清晰易懂。
  12. DFace可以利用CUDA来支持GPU加速模式。我们建议尝试linux GPU这种模式,它几乎可以实现实时的效果。
  13. 所有的灵感都来源于学术界最近的一些研究成果,例如 [Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks](https://arxiv.org/abs/1604.02878) 和 [FaceNet: A Unified Embedding for Face Recognition and Clustering](https://arxiv.org/abs/1503.03832)
  14. **MTCNN 结构**  
  15. ![mtcnn](http://affluent.oss-cn-hangzhou.aliyuncs.com/html/images/mtcnn_st.png)
  16. **如果你对DFace感兴趣并且想参与到这个项目中, 请查看目录下的 CONTRIBUTING.md 文档,它会实时展示一些需要@TODO的清单。我会用issues来跟踪和反馈所有的问题.**
  17. ## 安装
  18. DFace主要有两大模块,人脸检测和人脸识别。我会提供所有模型训练和运行的详细步骤。你首先需要构建一个pytorch和cv2的python环境,我推荐使用Anaconda来设置一个独立的虚拟环境。
  19. ### 依赖
  20. * cuda 8.0
  21. * anaconda
  22. * pytorch
  23. * torchvision
  24. * cv2
  25. * matplotlib
  26. 在这里我提供了一个anaconda的环境依赖文件environment.yml,它能方便你构建自己的虚拟环境。
  27. ```shell
  28. conda env create -f path/to/environment.yml
  29. ```
  30. ### 人脸检测
  31. 如果你对mtcnn模型感兴趣,以下过程可能会帮助到你。
  32. #### 训练mtcnn模型
  33. MTCNN主要有三个网络,叫做**PNet**, **RNet** 和 **ONet**。因此我们的训练过程也需要分三步先后进行。为了更好的实现效果,当前被训练的网络都将依赖于上一个训练好的网络来生成数据。所有的人脸数据集都来自 **[WIDER FACE](http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace/)** 和 **[CelebA](http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html)**。WIDER FACE仅提供了大量的人脸边框定位数据,而CelebA包含了人脸关键点定位数据。
  34. * 生成PNet训练数据和标注文件
  35. ```shell
  36. python src/prepare_data/gen_Pnet_train_data.py --dataset_path {your dataset path} --anno_file {your dataset original annotation path}
  37. ```
  38. * 乱序合并标注文件
  39. ```shell
  40. python src/prepare_data/assemble_pnet_imglist.py
  41. ```
  42. * 训练PNet模型
  43. ```shell
  44. python src/train_net/train_p_net.py
  45. ```
  46. * 生成RNet训练数据和标注文件
  47. ```shell
  48. python src/prepare_data/gen_Rnet_train_data.py --dataset_path {your dataset path} --anno_file {your dataset original annotation path} --pmodel_file {yout PNet model file trained before}
  49. ```
  50. * 乱序合并标注文件
  51. ```shell
  52. python src/prepare_data/assemble_rnet_imglist.py
  53. ```
  54. * 训练RNet模型
  55. ```shell
  56. python src/train_net/train_r_net.py
  57. ```
  58. * 生成ONet训练数据和标注文件
  59. ```shell
  60. python src/prepare_data/gen_Onet_train_data.py --dataset_path {your dataset path} --anno_file {your dataset original annotation path} --pmodel_file {yout PNet model file trained before} --rmodel_file {yout RNet model file trained before}
  61. ```
  62. * 生成ONet的人脸关键点训练数据和标注文件
  63. ```shell
  64. python src/prepare_data/gen_landmark_48.py
  65. ```
  66. * 乱序合并标注文件(包括人脸关键点)
  67. ```shell
  68. python src/prepare_data/assemble_onet_imglist.py
  69. ```
  70. * 训练ONet模型
  71. ```shell
  72. python src/train_net/train_o_net.py
  73. ```
  74. #### 测试人脸检测
  75. ```shell
  76. python test_image.py
  77. ```
  78. ### 人脸识别
  79. @TODO 根据center loss实现人脸识别
  80. ## 测试效果
  81. ![mtcnn](http://affluent.oss-cn-hangzhou.aliyuncs.com/html/images/dface_demoall.PNG)
  82. ### QQ交流群
  83. #### 681403076
  84. ![](http://affluent.oss-cn-hangzhou.aliyuncs.com/html/images/dfaceqqsm.png)
  85. ## License
  86. [Apache License 2.0](LICENSE)

开源的深度学习人脸检测和人脸识别系统。所有功能都采用 pytorch 框架开发。pytorch是一个由facebook开发的深度学习框架,它包含了一些比较有趣的高级特性,例如自动求导,动态构图等。DFace天然的继承了这些优点,使得它的训练过程可以更加简单方便,并且实现的代码可以更加清晰易懂

Contributors (1)