Cv9527 / DFace

MTCNN_pytorch_Deep learning face detection and recognition, implemented by pytorch. (pytorch实现的人脸检测和人脸识别)

Home Page:http://dface.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


DFace • License gitter

Linux CPU Linux GPU Mac OS CPU Windows CPU
Build Status Build Status Build Status Build Status

Free and open source face detection and recognition with deep learning. Based on the MTCNN and ResNet Center-Loss

中文版 README

码云项目地址

Slack address

DFace is an open source software for face detection and recognition. All features implemented by the 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 and face recognition topic FaceNet: A Unified Embedding for Face Recognition and Clustering

MTCNN Structure

mtcnn

If you want to contribute to DFace, please review the CONTRIBUTING.md in the project.We use Slack for tracking requests and bugs.

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

Also we provide a anaconda environment dependency list called environment.yml in the root path. You can create your DFace environment very easily.

conda env create -f path/to/environment.yml

Face Detetion

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 and CelebA

  • Generate PNet Train data and annotation file
python src/prepare_data/gen_Pnet_train_data.py --dataset_path {your dataset path} --anno_file {your dataset original annotation path}
  • Assemble annotation file and shuffle it
python src/prepare_data/assemble_pnet_imglist.py
  • Train PNet model
python src/train_net/train_p_net.py
  • Generate RNet Train data and annotation file
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}
  • Assemble annotation file and shuffle it
python src/prepare_data/assemble_rnet_imglist.py
  • Train RNet model
python src/train_net/train_r_net.py
  • Generate ONet Train data and annotation file
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}
  • Generate ONet Train landmarks data
python src/prepare_data/gen_landmark_48.py
  • Assemble annotation file and shuffle it
python src/prepare_data/assemble_onet_imglist.py
  • Train ONet model
python src/train_net/train_o_net.py

Test face detection

python test_image.py

Face Recognition

TODO

Demo

mtcnn

QQ交流群

681403076

License

Apache License 2.0

Reference

About

MTCNN_pytorch_Deep learning face detection and recognition, implemented by pytorch. (pytorch实现的人脸检测和人脸识别)

http://dface.io


Languages

Language:Python 100.0%