Dixin-Lab / generalized-face-landmarker

Official PyTorch implementation for the paper Generalizable Face Landmarking Guided by Conditional Face Warping (CVPR 2024).
10 stars 1 forks source link

Generalizable Face Landmarking Guided by Conditional Face Warping (CVPR 2024)

This is the official repository for the following paper:

Generalizable Face Landmarking Guided by Conditional Face Warping [paper] [arxiv] [project page]

Jiayi Liang, Haotian Liu, Hongteng Xu, Dixin Luo
Accepted by CVPR 2024.

Scheme

Install

pip install -r requirements.txt

Model

Our proposed framework mainly contains two parts: face warper and landmark detector. They are trained in an alternative optimization framework.

In our implmentation, we employ SLPT as our backbone and locate the model in Landmark2 folder. For the reproduction on other detectors, substitute the Landmark2 folder with target model and make modifications in train.py.

Prepare

Data

Source Domain

Download images and annotations of 300-W from ibug.

We select frontal faces from the trainset of 300W as our training data, and list of image path 300W_frontal_train_list.txt can be downloaded from Google Drive.

Your directory should be like:

   Dataset
   │
   └──300W
      │
      └───300W_frontal_train_list.txt
      └───frontal_train
          └───261068_1.jpg
          │
          └───...
      └───frontal_train_label
          └───261068_1.jpg.npy
          │
          └───...
      └───test_list.txt
      └───test_list_common.txt
      └───test_list_challenge.txt
      └───lfpw
          └───trainset
          └───testset
              └───image_0001.png
              └───image_0001.pts
              │
              └───...
      │───helen
          │
          └───...
      │───ibug
          │
          └───...

Target Domain

Your directory should be like:

   Dataset
   │
   └──CariFace_dataset
      │
      └───images
          └───00005.jpg
          │
          └───...
      └───landmarks
          └───00005.jpg.npy
          │
          └───...
      └───train_list.txt
      └───test_list.txt
   │
   └──AF_dataset
      │
      └───images
          └───0.png
          │
          └───...
      └───landmarks
          └───0.png.npy
          │
          └───...
      └───train_list.txt
      └───test_list.txt
      └───test_list_all.txt

Train

Load Pretrained Model

Download source-pretrained weights model_best.pth from Google Drive and move it into folder Landmark2.

Training Begin!

python train.py --src_data path/to/source/data --tgt_data path/to/target/data --pretrain_path path/to/pretrained/checkpoint

Inference

Download our model and test on the CariFace by running:

python test.py --checkpoint path/to/model/weights

Further, to test on ArtiFace, download checkpoint and inference:

python test_Artistic.py --checkpoint path/to/model/weights

Citation

If our work is helpful for your research, please cite our paper:

@InProceedings{Liang_2024_CVPR,
    author    = {Liang, Jiayi and Liu, Haotian and Xu, Hongteng and Luo, Dixin},
    title     = {Generalizable Face Landmarking Guided by Conditional Face Warping},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2024},
    pages     = {2425-2435}
}