Giter Club home page Giter Club logo

face-landmarks-dlib's Introduction

face-landmarks-dlib

Face landmarks detection with DLib

Data preparation

To download 300W and Menpo datasets simply run:

bash scripts/download_data.sh

Then prepare splits for 300W and Menpo datasets in .xml format by running:

bash scripts/prepare_data.sh

or download it:

bash scripts/download_splits.sh

The dataset directory structure should be the following:

data/landmarks_task
├── 300W/  # annotation json files
    ├── train/    # train images
    ├── test/    # test images
    ├── train_with_face_landmarks.xml/    # 300W train annotations
    └── test_with_face_landmarks.xml/    # 300W test annotations
├── Menpo/
    ├── train/    # train images
    ├── test/    # test images
    ├── train_with_face_landmarks.xml/    # Menpo train annotations
    └── test_with_face_landmarks.xml/    # Menpo test annotations
├── train_with_face_landmarks.xml/    # 300W + Menpo train annotations
└── test_with_face_landmarks.xml/    # 300W + Menpo test annotations

Training

To train face shape predictor on 300W + Menpo dataset simply run:

bash scripts/shape_predictor_68_300W_Menpo.sh

or

python train.py \
    --dataset 300W Menpo \
    --data_root data/landmarks_task \
    --train_annotation train_with_face_landmarks.xml \
    --test_annotation test_with_face_landmarks.xml \
    --save_dir output

Evaluation

Download trained models by running:

bash scripts/download_models.sh

or use your own trained model.

To evaluate model on 300W + Menpo dataset and save predictions run:

bash scripts/shape_predictor_68_300W_Menpo_eval.sh

or

python evaluate.py \
    --model_path output/shape_predictor_68_300W_Menpo.dat \
    --data_root data/landmarks_task \
    --image_dir test \
    --save_dir results/300W_Menpo

Plot CED curve

Download results of shape_predictor_68_300W_Menpo.dat model on 300W, Menpo and 300W + Menpo test splits:

bash scripts/download_results.sh

or use your own results.

To plot CED curve simply run:

python compute_ced.py \
    --gt_path data/landmarks_task/300W/test data/landmarks_task/Menpo/test \
    --predictions_path results/300W results/Menpo results/300W_Menpo \
    --output_path results/ced.png

Inference

Download trained models by running:

bash scripts/download_models.sh

or use your own trained model.

To visualize results on example images run:

python inference.py \
    --model_path output/shape_predictor_68_300W_Menpo.dat \
    --data_root examples \
    --save_dir examples/300W_Menpo

face-landmarks-dlib's People

Contributors

akanametov avatar

Watchers

 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.