Code Monkey home page Code Monkey logo

tfmtcnn's Introduction

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

tfmtcnn's People

Contributors

look4pritam avatar

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.