A simple face aligment method
A simple face aligment method based on tensorflow. It is simple and flexible, trained with wingloss , multi task learning, also with data augmentation based on headpose and face attributes(eyes state and mouth state).
And i suggest that you could try with another project,including face detect and keypoints, and some optimizations were made, u can check it there [pappa_pig_face_engine].
Contact me if u have problem about it. [email protected] :)
demo pictures:
this gif is from github.com/610265158/Peppa_Pig_Face_Engine, but it is the same model : )
pretrained model:
- baidu disk (code wd5g)
- google drive
-
tensorflow1.14 (tensorflow 1.14 at least if mix_precision turns on)
-
tensorpack (for data provider)
-
opencv
-
python 3.6
- download all the 300W data set including the 300VW(parse as images, and make the label the same formate as 300W)
├── 300VW
│ ├── 001_annot
│ ├── 002_annot
│ ....
├── 300W
│ ├── 01_Indoor
│ └── 02_Outdoor
├── AFW
│ └── afw
├── HELEN
│ ├── testset
│ └── trainset
├── IBUG
│ └── ibug
├── LFPW
│ ├── testset
│ └── trainset
-
run
python make_list.py
produce train.txt and val.txt (if u like train u own data, u should prepare the data like this:****.jpg| x1 y1 x2 y2 x3 y3...
-
then, run:
python train.py
-
by default it trained with shufflenetv2_1.0, if u like want train with resnet,do as follow:
4.1 download pretrained model resnet50
4.2 change train_config as config.MODEL.net_structure='resnet_v1_50',config.MODEL.pretrained_model='resnet_v1_50.ckpt', it uses the first three blocks, so it is still fast, a pruning may achieve a better one.
After training, convert the model to pb file and visualization.
run python tools/auto_freeze.py
produce keypoint.pb
python vis.py
-
A face detector is needed.
-
2. train with resnet
-
then pruning resnet, it should be faster.