<div align=center>
<a href="http://dface.io" target="_blank"><img src="http://pic.dface.io/dfacelogoblue.png" width="350"></a>
</div>
-----------------
# DFace • [![License](http://pic.dface.io/apache2.svg)](https://opensource.org/licenses/Apache-2.0) [![gitter](http://pic.dface.io/gitee.svg)](https://dfaceio.slack.com)
| **`Linux CPU`** | **`Linux GPU`** | **`Mac OS CPU`** | **`Windows CPU`** |
|-----------------|---------------------|------------------|-------------------|
| [![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) |
**Free and open source face detection and recognition with
deep learning. Based on the MTCNN and ResNet Center-Loss**
[中文版 README](https://github.com/kuaikuaikim/DFace/blob/master/README_zh.md)
[码云项目地址](https://gitee.com/kuaikuaikim/dface)
**[Slack address](https://dfaceio.slack.com/)**
**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.
DFace inherit these advanced characteristic, that make it dynamic and ease code review.
DFace support GPU acceleration with NVIDIA cuda. We highly recommend you use the linux GPU version.It's very fast and extremely realtime.
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)
**MTCNN Structure**
![mtcnn](http://pic.dface.io/mtcnn.png)
**If you want to contribute to DFace, please review the CONTRIBUTING.md in the project.We use [Slack](https://dfaceio.slack.com/) for tracking requests and bugs. Also you can following the QQ group 681403076 or my wechat jinkuaikuai005**
## TODO(contribute to DFace)
- Based on cener loss or triplet loss implement the face conpare. Recommended Model is ResNet inception v2. Refer this [Paper](https://arxiv.org/abs/1503.03832) and [FaceNet](https://github.com/davidsandberg/facenet)
- Face Anti-Spoofing, distinguish from face light and texture。Recomend with the LBP algorithm and SVM.
- 3D mask Anti-Spoofing.
- Mobile first with caffe2 and c++.
- Tensor rt migration.
- Docker support, gpu version
## Installation
DFace has two major module, detection and recognition.In these two, We provide all tutorials about how to train a model and running.
First setting a pytorch and cv2. We suggest Anaconda to make a virtual and independent python envirment.
### Requirements
* cuda 8.0
* anaconda
* pytorch
* torchvision
* cv2
* matplotlib
```shell
git clone https://github.com/kuaikuaikim/DFace.git
```
Also we provide a anaconda environment dependency list called environment.yml (windows please use environment-win64.yml) in the root path.
You can create your DFace environment very easily.
```shell
cd DFace
conda env create -f path/to/environment.yml
```
### Face Detetion and Recognition
If you are interested in how to train a mtcnn model, you can follow next step.
#### Train mtcnn Model
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.
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)** .WIDER FACE is used for training face classification and face bounding box, also CelebA is used for face landmarks. The original wider face annotation file is matlab format, you must transform it to text. I have put the transformed annotation text file into [anno_store/wider_origin_anno.txt](https://github.com/kuaikuaikim/DFace/blob/master/anno_store/wider_origin_anno.txt). This file is related to the following parameter called --anno_file.
* Create the DFace train data temporary folder, this folder is involved in the following parameter --dface_traindata_store
```shell
mkdir {your dface traindata folder}
```
* Generate PNet Train data and annotation file
```shell
python dface/prepare_data/gen_Pnet_train_data.py --prefix_path {annotation file image prefix path, just your local wider face images folder} --dface_traindata_store {dface train data temporary folder you made before } --anno_file {wider face original combined annotation file, default anno_store/wider_origin_anno.txt}
```
* Assemble annotation file and shuffle it
```shell
python dface/prepare_data/assemble_pnet_imglist.py
```
* Train PNet model
```shell
python dface/train_net/train_p_net.py
```
* Generate RNet Train data and annotation file
```shell
python dface/prepare_data/gen_Rnet_train_data.py --prefix_path {annotation file image prefix path, just your local wider face images folder} --dface_traindata_store {dface train data temporary folder you made before } --anno_file {wider face original combined annotation file, default anno_store/wider_origin_anno.txt} --pmodel_file {your PNet model file trained before}
```
* Assemble annotation file and shuffle it
```shell
python dface/prepare_data/assemble_rnet_imglist.py
```
* Train RNet model
```shell
python dface/train_net/train_r_net.py
```
* Generate ONet Train data and annotation file
```shell
python dface/prepare_data/gen_Onet_train_data.py --prefix_path {annotation file image prefix path, just your local wider face images folder} --dface_traindata_store {dface train data temporary folder you made before } --anno_file {wider face original combined annotation file, default anno_store/wider_origin_anno.txt} --pmodel_file {your PNet model file trained before} --rmodel_file {your RNet model file trained before}
```
* Generate ONet Train landmarks data
```shell
python dface/prepare_data/gen_landmark_48.py
```
* Assemble annotation file and shuffle it
```shell
python dface/prepare_data/assemble_onet_imglist.py
```
* Train ONet model
```shell
python dface/train_net/train_o_net.py
```
#### Test face detection
```shell
python test_image.py
```
### Face Comparing
TODO
## Demo
![mtcnn](http://pic.dface.io/figure_2.png)
### QQ交流群
#### 681403076
#### 本人微信(wechat)
![](http://affluent.oss-cn-hangzhou.aliyuncs.com/html/images/perqr.jpg)
## License
[Apache License 2.0](LICENSE)
## Reference
* [OpenFace](https://github.com/cmusatyalab/openface)
没有合适的资源?快使用搜索试试~ 我知道了~
Python-pytorch实现的人脸检测和人脸识别
共49个文件
py:38个
info:3个
md:2个
3星 · 超过75%的资源 需积分: 46 150 下载量 162 浏览量
2019-08-09
15:56:52
上传
评论 5
收藏 2.67MB ZIP 举报
温馨提示
Deep learning face detection and recognition, implemented by pytorch. (pytorch实现的人脸检测和人脸识别)
资源推荐
资源详情
资源评论
收起资源包目录
Python-pytorch实现的人脸检测和人脸识别.zip (49个子文件)
kuaikuaikim-DFace-ce444ab
README_zh.md 8KB
log
info 7B
__init__.py 0B
environment-win64.yml 7KB
model_store
info 63B
__init__.py 0B
__init__.py 0B
environment.yml 1KB
README.md 7KB
dface
config.py 1KB
core
image_tools.py 1KB
roc.py 20B
detect.py 22KB
utils.py 3KB
__init__.py 0B
models.py 9KB
resnet_inception_v2.py 9KB
imagedb.py 5KB
image_reader.py 4KB
nms.py 1KB
vision.py 5KB
prepare_data
assemble_pnet_imglist.py 958B
gen_Rnet_train_data.py 7KB
assemble_rnet_imglist.py 958B
gen_landmark_net_48.py 8KB
assemble.py 979B
__init__.py 0B
assemble_onet_imglist.py 946B
gen_landmark_24.py 5KB
gen_Onet_train_data.py 8KB
widerface_annotation_gen
transform.py 1016B
wider_face_train.mat 1.48MB
__init__.py 0B
wider_loader.py 1KB
gen_Pnet_train_data.py 7KB
gen_landmark_12.py 5KB
gen_landmark_48.py 5KB
__init__.py 0B
train_net
train_o_net.py 2KB
train.py 11KB
__init__.py 0B
train_p_net.py 2KB
train_r_net.py 2KB
anno_store
info 55B
__init__.py 0B
wider_origin_anno.txt 3.06MB
test_image.py 630B
.gitignore 58B
test.jpg 75KB
共 49 条
- 1
资源评论
- 杜杜杜俊杰2020-10-22大家不要下载,骗人的
- 醴國菌2020-05-08very helpful resource
- 清水即心2020-01-16感觉不能运行啊!
weixin_39840924
- 粉丝: 492
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功