This repository contains files for training and testing Yolov3 for multi-task face detection and facial landmarks extraction.
P.S. A jupyter-notebook for all parts can be found here.
- First, clone the repository.
git clone https://github.com/sefaburakokcu/yolov3-facial-landmark-detection.git
- Then, install prerequisites.
pip install -r requirements.txt
- For training the models with Widerface dataset, first download dataset from Widerface website. Then, under data/datasets/ run,
python widerface_yolo_format.py
Or downlaod Widerface training dataset in YOLO format directly from Google Drive and put images folder under data/datasets/widerface/.
- Under src folder, run
python train.py
For inference, pretrained weights can be used. Pretrained weights can be download from Google Drive. After downloading weigts, put all weights in weights folder under project main folder.
Under src folder, run
python inference.py
-
In order to evaluate the models, first download Widerface Validation dataset from Widerface Website and WFLW dataset from WFLW Website or Google Drive and put it under data/datasets/wflw/.
-
Then, under src run,
python test.py
in order to save face detection and facial landmarks predictions.
- Finally, under src/evaluations/widerface/, run
python evaluate_widerface.py
for face detection performance and under src/evaluations/wiflw/, run
python evaluate_wflw.py
for facial landmarks extraction performance.
Evaluation of models on Widerface Validation dataset for face detection is indicated below. Average Precision is used as a performance metric.
Models | Easy | Medium | Hard |
---|---|---|---|
Mobilenetv2(0.75) | 0.85 | 0.83 | 0.63 |
Mobilenetv2(1.0) | 0.87 | 0.86 | 0.69 |
Retinaface(Mobilenetv2(0.25)) | 0.90 | 0.87 | 0.67 |
Retinaface(Resnet50) | 0.93 | 0.91 | 0.69 |
MTCNN | 0.79 | 0.76 | 0.50 |
Evaluation of models on WFLW dataset for facial landmarks extraction is shown below. Average Root Mean Square Error(RMSE) is chosen as a performance metric.
Models | RMSE |
---|---|
Mobilenetv2(0.75) | 6.53 |
Mobilenetv2(1.0) | 4.36 |
Retinaface(Mobilenetv2(0.25)) | 4.03 |
Retinaface(Resnet50) | 0.93 |
MTCNN | 4.5 |