donydchen / ran_replicate

A PyTorch re-implementation of Weakly Supervised Facial Action Unit Recognition through Adversarial Training
MIT License
10 stars 3 forks source link
action-units pseudo-au pytorch replicate weakly-supervised

A Reimplementation of Recognition Adversary Network (RAN)

Status Platform PyTorch License

A PyTorch reimplementation of Weakly Supervised Facial Action Unit Recognition through Adversarial Training

RAN

Please note that this project is NOT the official implementation. It is a replicate only for learning, and I cannot guarantee its correctness. Kindly refer to the Differences and Existing Problems below before using this project or making contact with me. Thanks

Getting Started

Requirements

Installation

git clone https://github.com/donydchen/ran_replicate.git
cd ran_replicate

Preprocess

Generate Pseudo AU Vectors

python tools/gen_pseudo_au.py

Preprocess CK+ dataset

python tools/preprocess_ckplus.py

# this script will parse image path and label, create train and test list, detect and align faces, etc.

Extract AU Vectors (if applicable)

python tools/extract_au.py

# note that you need to build and install OpenFace first.

Train

python main.py --data_root datasets/CKPlus --which_model_netR resnet18 --backend_pretrain --gpu_ids 0 --gan_type wgan-gp --load_size 250 --final_size 224 --visdom_env resnet18_wgan_fold1 --train_csv train_ids_1.csv --test_csv test_ids_1.csv

Test

python main.py --mode test --data_root datasets/CKPlus --gpu_ids 0 --ckpt_dir ckpts/CKPlus/resnet18/fold_1/190423_105211 --load_epoch 300 --which_model_netR resnet18 --load_size 250 --final_size 224 --test_csv test_ids_1.csv

Results

Five-fold subject-independent corss-validation on CK+.

AU F1 Score
AU01 0.463703
AU02 0.605515
AU04 0.684670
AU05 0.623919
AU06 0.513861
AU07 0.379647
AU09 0.529395
AU12 0.629960
AU17 0.728096
AU23 0.632099
AU25 0.367475
Avg 0.559849

Differences and Existing Problems

Pull Request

You are always welcome to contribute to this repository by sending a pull request.