-
This repository contains an implementation of Deep Head Pose based on original code from Oreobird/tf-keras-deep-head-pose with following changes:
- Use ShuffleNetV2 or EfficientNet-B0 as backbone network. The ideal of using ShuffleNetV2 comes from this Pytorch implementation.
- Rewrite data generator for multi-threading.
- Add 5-point landmark as an output branch.
- Support 3 datasets: BIWI, AFLW2000, 300W_LP.
- All datasets are converted to uniform format (png files for images and JSON files for labels).
- Use Retina Face for generating bounding box and landmark label automatically for BIWI dataset.
- Re-label landmark points for AFLW2000. The final dataset can be downloaded from here.
- Write image augmentation code using multiple methods: blur, crop, add padding, sharpen, dropout, flip, adjust color and constrast...
-
The original Pytorch version: https://github.com/natanielruiz/deep-head-pose
-
Pretrained model for:
- ShuffleNet V2: models/shufflenet_v2.h5.
- EfficientNet: https://1drv.ms/u/s!Av71xxzl6mYZgddGNOolzhRWvELnlQ?e=TCd055.
- We use Tensorflow 2.0.0.
- Install environment from
environment.yml
file using Anaconda and Miniconda and activate that environment.
-
- Use following scripts to generate data from those datasets:
make_data_300W_LP.py
,make_data_BIWI.py
,make_data_AFLW2000.py
. You can download final AFLW2000 from here.
- Use following scripts to generate data from those datasets:
-
- Run
sh split_data_set.sh
to split dataset. This script will take 2000 images from 300W_LP and 2000 images from BIWI dataset to build validation set atdata/val_set
and remaining parts of these dataset to build training set atdata/train_set
. We use AFLW2000 as testing set.
- Run
-
Modify config files at
config_shufflenetv2.json
andconfig_efficientnet.json
to use for training and testing. -
Example of commands for training:
python train.py -c config_shufflenetv2.json
Or
python train.py -c config_efficientnet.json
python test.py -c config_shufflenetv2.json
Or
python test.py -c config_efficientnet.json