/face_landmark

A simple method for face alignment based on wingloss and mutitask learning :)

Primary LanguagePythonApache License 2.0Apache-2.0

face_landmark

A simple face aligment method, based on tensorflow2.0

introduction

This is the tensorflow2.0 branch, if u need to work on tf1 switch to branch tf1, it still work.

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).

CN blog

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. 2120140200@mail.nankai.edu.cn :)

demo pictures:

samples

gifs

this gif is from github.com/610265158/Peppa_Pig_Face_Engine, but it is the same model : )

pretrained model:

requirment

  • tensorflow2.0

  • tensorpack (for data provider)

  • opencv

  • python 3.6

useage

train

  1. 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
  1. run python make_json.py produce train.json and val.json (if u like train u own data, please read the json produced , it is quite simple)

  2. then, run: python train.py

  3. by default it trained with shufflenetv2_1.0

finetune

  1. download the pretrained model keypoints, put it into ./model and the model dir structure is :
 ./model/
  └── keypoints
      ├── saved_model.pb
      └── variables
          ├── variables.data-00000-of-00002
          ├── variables.data-00001-of-00002
          └── variables.index

  1. set config.MODEL.pretrained_model='./model/keypoints/variables/variables', in train_config.py

  2. adjust the lr policy

  3. python train.py

visualization

python vis.py --model ./model/keypoints

TODO: