This repository is the official implementation of Joint Physical-Digital Facial Attack Detection Via Simulating Spoofing Clues
The overview pipeline of our method. We propose Simulated Physical Spoofing Clues augmentation (SPSC), which augments live samples into simulated physical attack samples for training within protocols 1 and 2.1. Concurrently, we present Simulated Digital Spoofing Clues augmentation (SDSC), converting live samples into simulated digital attack samples, tailored for training under protocols 1 and 2.2.
Please make a copy of the original data and place it in the following formatοΌ
cp -r xxx/phase1/* cvpr2024/data/
cp -r xxx/phase2/* cvpr2024/data/
cd cvpr2024/data
cat p1/dev.txt p1/test.txt > p1/dev_test.txt
cat p2.1/dev.txt p2.1/test.txt > p2.1/dev_test.txt
cat p2.2/dev.txt p2.2/test.txt > p2.2/dev_test.txt
python data_preprocess/merge_dev_train_data.py # please modify the base path
# p1: merge all dev data to train
# p2.1: only merge dev live data to train
# p2.2: only merge dev live data to train
base_path = "xxx/cvpr2024"
|----cvpr2024/data |----p1 |----train |----dev |----test |----train_live_mask |----train_label.txt |----dev_label.txt |----train_dev_label.txt |----dev_test.txt |----p2.1 |----train |----dev |----test |----train_live_mask |----train_label.txt |----dev_label.txt |----train_dev_label.txt |----dev_test.txt |----p2.2 |----train |----dev |----test |----train_live_mask |----train_label.txt |----dev_label.txt |----train_dev_label.txt |----dev_test.txt
## βοΈ Installation
```bash
pip install -r requirements.txt
if image width >= 700 and image height >= 700, we will detect face from the image and expand 20 pixel crop face from the image.
If no face is detected in the image, we will center crop a 500*500 bbox from the image which implements this logic in dataset.py where the training data is loaded.
we need pip install insightface and use insightface to detect face.It will download the model by default to detect faces.
Please modify the base path and run detect_face.py.The crop_face will overwrite the original image.
cd data_preprocess
python detect_face.py
face-parsing github
download face-parsing model from 79999_iter.pth
Please modify root_dir and model_path.
cd data_preprocess/face_parsing
bash generate_mask.sh
download pretrain model: resnet50
Train p1 protocol:
bash scripts/train_p1.sh
Test: select the 200th epoch model weight
bash scripts/test_p1.sh
Train p2.1 protocol:
bash scripts/train_p21.sh
Test: select the 200th epoch model weight
bash scripts/test_p21.sh
Train p2.2 protocol:
bash scripts/train_p22.sh
Test: select the 200th epoch model weight
bash scripts/test_p22.sh
Protocol | APCER(%) | BPCER(%) | ACER(%) | model |
---|---|---|---|---|
P1 | 0.31 | 0.09 | 0.20 | p1_resnet50.pth |
P2.1 | 2.55 | 0.09 | 1.32 | p21_resnet50.pth |
P2.2 | 1.73 | 1.58 | 1.65 | p22_resnet50.pth |
If you find this repository useful for your research, please use the following entry.
@inproceedings{he2024joint,
title={Joint Physical-Digital Facial Attack Detection Via Simulating Spoofing Clues},
author={He, Xianhua and Liang, Dashuang and Yang, Song and Hao, Zhanlong and Ma, Hui and Mao, Binjie and Li, Xi and Wang, Yao and Yan, Pengfei and Liu, Ajian},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={995--1004},
year={2024}
}