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_en.md 5.0 kB

8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <div align=center>
  2. <a href="http://dface.io" target="_blank"><img src="http://pic.dface.io/dfacelogoblue.png" width="350"></a>
  3. </div>
  4. -----------------
  5. # DFace • [![License](http://pic.dface.io/apache2.svg)](https://opensource.org/licenses/Apache-2.0) [![gitter](http://pic.dface.io/gitee.svg)](https://gitter.im/cmusatyalab/DFace)
  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. **Free and open source face detection and recognition with
  10. deep learning. Based on the MTCNN and ResNet Center-Loss**
  11. [中文版 README](https://github.com/kuaikuaikim/DFace/blob/master/README_zh.md)
  12. **DFace** is an open source software for face detection and recognition. All features implemented by the **[pytorch](https://github.com/pytorch/pytorch)** (the facebook deeplearning framework). With PyTorch, we use a technique called reverse-mode auto-differentiation, which allows developer to change the way your network behaves arbitrarily with zero lag or overhead.
  13. DFace inherit these advanced characteristic, that make it dynamic and ease code review.
  14. DFace support GPU acceleration with NVIDIA cuda. We highly recommend you use the linux GPU version.It's very fast and extremely realtime.
  15. Our inspiration comes from several research papers on this topic, as well as current and past work such as [Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks](https://arxiv.org/abs/1604.02878) and face recognition topic [FaceNet: A Unified Embedding for Face Recognition and Clustering](https://arxiv.org/abs/1503.03832)
  16. **MTCNN Structure**  
  17. ![mtcnn](http://pic.dface.io/mtcnn.png)
  18. **If you want to contribute to DFace, please review the CONTRIBUTING.md in the project.We use [GitHub issues](https://github.com/DFace/DFace/issues) for
  19. tracking requests and bugs.**
  20. ## Installation
  21. DFace has two major module, detection and recognition.In these two, We provide all tutorials about how to train a model and running.
  22. First setting a pytorch and cv2. We suggest Anaconda to make a virtual and independent python envirment.
  23. ### Requirements
  24. * cuda 8.0
  25. * anaconda
  26. * pytorch
  27. * torchvision
  28. * cv2
  29. * matplotlib
  30. Also we provide a anaconda environment dependency list called environment.yml in the root path.
  31. You can create your DFace environment very easily.
  32. ```shell
  33. conda env create -f path/to/environment.yml
  34. ```
  35. ### Face Detetion
  36. If you are interested in how to train a mtcnn model, you can follow next step.
  37. #### Train mtcnn Model
  38. MTCNN have three networks called **PNet**, **RNet** and **ONet**.So we should train it on three stage, and each stage depend on previous network which will generate train data to feed current train net, also propel the minimum loss between two networks.
  39. Please download the train face **datasets** before your training. We use **[WIDER FACE](http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace/)** and **[CelebA](http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html)**
  40. * Generate PNet Train data and annotation file
  41. ```shell
  42. python src/prepare_data/gen_Pnet_train_data.py --dataset_path {your dataset path} --anno_file {your dataset original annotation path}
  43. ```
  44. * Assemble annotation file and shuffle it
  45. ```shell
  46. python src/prepare_data/assemble_pnet_imglist.py
  47. ```
  48. * Train PNet model
  49. ```shell
  50. python src/train_net/train_p_net.py
  51. ```
  52. * Generate RNet Train data and annotation file
  53. ```shell
  54. 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}
  55. ```
  56. * Assemble annotation file and shuffle it
  57. ```shell
  58. python src/prepare_data/assemble_rnet_imglist.py
  59. ```
  60. * Train RNet model
  61. ```shell
  62. python src/train_net/train_r_net.py
  63. ```
  64. * Generate ONet Train data and annotation file
  65. ```shell
  66. 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}
  67. ```
  68. * Generate ONet Train landmarks data
  69. ```shell
  70. python src/prepare_data/gen_landmark_48.py
  71. ```
  72. * Assemble annotation file and shuffle it
  73. ```shell
  74. python src/prepare_data/assemble_onet_imglist.py
  75. ```
  76. * Train ONet model
  77. ```shell
  78. python src/train_net/train_o_net.py
  79. ```
  80. #### Test face detection
  81. ```shell
  82. python test_image.py
  83. ```
  84. ### Face Recognition
  85. TODO
  86. ## Demo
  87. ![mtcnn](http://pic.dface.io/figure_2.png)
  88. ## License
  89. [Apache License 2.0](LICENSE)
  90. ## Reference
  91. * [Seanlinx/mtcnn](https://github.com/Seanlinx/mtcnn)

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

Contributors (1)