Giter VIP home page Giter VIP logo

mtcnn-tensorflow's Introduction

Description

This work is used for reproduce MTCNN, a Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks.

Prerequisites

  1. You need CUDA-compatible GPUs to train the model.

Dependencies

  • Tensorflow 1.2.1
  • Python 2.7
  • Ubuntu 16.04
  • Cuda 8.0

Prepare For Training Data

  1. Download the WIDER Face Dataset. Unzip it and put the WIDER_train folder in the prepare_data folder.
  2. Download the Landmark Dataset. Unzip it and put both the lfw_5590 and net_7876 into the prepare_data folder.
  3. Run gen_12net_data.py to generate training data(Face Detection Part) for PNet.
  4. Run gen_landmark_data.py lfwnet PNet to generate training data(Face Landmark Detection Part) for PNet.
  5. Run gen_imglist.py PNet to merge two parts of training data.
  6. Run gen_tfrecords.py PNet to generate tfrecord for PNet.
  7. In train_models/, run train_net.py PNet to train PNet.
  8. After training PNet, run gen_hard_example.py --test_mode PNet to generate training data(Face Detection Part) for RNet.
  9. Run gen_landmark_data.py lfwnet RNet to generate training data(Face Landmark Detection Part) for RNet.
  10. Run gen_imglist.py PNet to merge two parts of training data.
  11. Run gen_tfrecords.py RNet to generate tfrecords for RNet.
  12. In train_models/, run train_net.py RNet to train RNet.
  13. After training RNet, run gen_hard_example.py --test_mode RNet to generate training data(Face Detection Part) for ONet.
  14. Run gen_landmark_data.py lfwnet ONet to generate training data(Face Landmark Detection Part) for ONet.
  15. Run gen_imglist.py ONet to merge two parts of training data.
  16. Run gen_tfrecords.py ONet to generate tfrecords for ONet.
  17. In train_models/, run train_net.py ONet to train ONet.

Some Details

  • When training PNet,I merge four parts of data(pos,part,landmark,neg) into one tfrecord,since their total number radio is almost 1:1:1:3.But when training RNet and ONet,I generate four tfrecords,since their total number is not balanced.During training,I read 64 samples from pos,part and landmark tfrecord and read 192 samples from neg tfrecord to construct mini-batch.

  • It's important for PNet and RNet to keep high recall radio.When using well-trained PNet to generate training data for RNet,I can get 14w+ pos samples.When using well-trained RNet to generate training data for ONet,I can get 19w+ pos samples.

  • Since MTCNN is a Multi-task Network,we should pay attention to the format of training data.The format is:

    [path to image][cls_label][bbox_label][landmark_label]

    For pos sample,cls_label=1,bbox_label(calculate),landmark_label=[0,0,0,0,0,0,0,0,0,0].

    For part sample,cls_label=-1,bbox_label(calculate),landmark_label=[0,0,0,0,0,0,0,0,0,0].

    For landmark sample,cls_label=-2,bbox_label=[0,0,0,0],landmark_label(calculate).

    For neg sample,cls_label=0,bbox_label=[0,0,0,0],landmark_label=[0,0,0,0,0,0,0,0,0,0].

  • Since the training data for landmark is less.I use transform,random rotate and random flip to conduct data augment(the result of landmark detection is not that good).

Result

result1.png

result2.png

result3.png

reult4.png

result5.png

result6.png

result7.png

result8.png

result9.png

Result on FDDB result10.png

License

MIT LICENSE

References

  1. Kaipeng Zhang, Zhanpeng Zhang, Zhifeng Li, Yu Qiao , " Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks," IEEE Signal Processing Letter
  2. MTCNN-MXNET
  3. MTCNN-CAFFE
  4. deep-landmark

mtcnn-tensorflow's People

Contributors

aittsmd avatar ltrottier avatar

Watchers

 avatar  avatar

Forkers

kinect59

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.