Skip to content
forked from RichieMay/tfmtcnn

MTCNN-TensorFlow - Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks

Notifications You must be signed in to change notification settings

kilinitt/tfmtcnn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MTCNN using TensorFlow framework

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

  • See <MTCNN_ROOT>/data/WIDER_Face/README.md for downloading WIDER Face dataset.
  • See <MTCNN_ROOT>/data/CelebA/README.md for downloading CelebA facial landmark dataset.

Prepare CelebA dataset for input.

python tfmtcnn/tfmtcnn/tools/prepare_celeba_dataset.py \
    --bounding_box_file_name ../data/CelebA/list_bbox_celeba.txt \
    --landmark_file_name ../data/CelebA/list_landmarks_celeba.txt \
    --output_file_name ../data/CelebA/CelebA.txt 

Generate a basic dataset i.e. PNet dataset.

python tfmtcnn/tfmtcnn/generate_simple_dataset.py \
	--annotation_image_dir ../data/WIDER_Face/WIDER_train/images \ 
	--annotation_file_name ../data/WIDER_Face/WIDER_train/wider_face_train_bbx_gt.txt \
	--landmark_image_dir ../data/CelebA/images \
	--landmark_file_name ../data/CelebA/CelebA.txt \
	--base_number_of_images 700000 \
	--target_root_dir ../data/datasets/mtcnn 

Train PNet.

python tfmtcnn/tfmtcnn/train_model.py \
	--network_name PNet \ 
	--train_root_dir ../data/models/mtcnn/train \
	--dataset_root_dir ../data/datasets/mtcnn \
	--base_learning_rate 0.001 \
	--max_number_of_epoch 19 \
	--test_dataset FDDBDataset \
	--test_annotation_image_dir /datasets/FDDB/ \
	--test_annotation_file /datasets/FDDB/FDDB-folds/FDDB-fold-01-ellipseList.txt

Generate a hard dataset i.e. RNet dataset.

python tfmtcnn/tfmtcnn/generate_hard_dataset.py \
	--network_name RNet \ 
	--train_root_dir ../data/models/mtcnn/train \
	--annotation_image_dir ../data/WIDER_Face/WIDER_train/images \ 
	--annotation_file_name ../data/WIDER_Face/WIDER_train/wider_face_train_bbx_gt.txt \
	--landmark_image_dir ../data/CelebA/images \
	--landmark_file_name ../data/CelebA/CelebA.txt \
	--base_number_of_images 700000 \
	--target_root_dir ../data/datasets/mtcnn 

Train RNet.

python tfmtcnn/tfmtcnn/train_model.py \
	--network_name RNet \ 
	--train_root_dir ../data/models/mtcnn/train \
	--dataset_root_dir ../data/datasets/mtcnn \
	--base_learning_rate 0.001 \
	--max_number_of_epoch 22 \
	--test_dataset FDDBDataset \
	--test_annotation_image_dir /datasets/FDDB/ \
	--test_annotation_file /datasets/FDDB/FDDB-folds/FDDB-fold-01-ellipseList.txt

Generate a hard dataset i.e. ONet dataset.

python tfmtcnn/tfmtcnn/generate_hard_dataset.py \
	--network_name ONet \ 
	--train_root_dir ../data/models/mtcnn/train \
	--annotation_image_dir ../data/WIDER_Face/WIDER_train/images \ 
	--annotation_file_name ../data/WIDER_Face/WIDER_train/wider_face_train_bbx_gt.txt \
	--landmark_image_dir ../data/CelebA/images \
	--landmark_file_name ../data/CelebA/CelebA.txt \
	--base_number_of_images 700000 \
	--target_root_dir ../data/datasets/mtcnn 

Train ONet.

python tfmtcnn/tfmtcnn/train_model.py \
	--network_name ONet \ 
	--train_root_dir ../data/models/mtcnn/train \
	--dataset_root_dir ../data/datasets/mtcnn \
	--base_learning_rate 0.001 \
	--max_number_of_epoch 21 \
	--test_dataset FDDBDataset \
	--test_annotation_image_dir /datasets/FDDB/ \
	--test_annotation_file /datasets/FDDB/FDDB-folds/FDDB-fold-01-ellipseList.txt

Webcamera demo.

python  tfmtcnn/tfmtcnn/webcamera_demo.py

Webcamera demo using trained models.

python  tfmtcnn/tfmtcnn/webcamera_demo.py --test_mode

Evaluate the model accuracy on the FDDB dataset.

python tfmtcnn/tfmtcnn/evaluate_model.py \
	--model_root_dir tfmtcnn/tfmtcnn/models/mtcnn/train \
	--dataset_name FDDBDataset \
	--annotation_image_dir /datasets/FDDB/ \ 
	--annotation_file_name /datasets/FDDB/FDDB-folds/FDDB-fold-01-ellipseList.txt

About

MTCNN-TensorFlow - Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.7%
  • Shell 3.3%