Home

Awesome

DFGC2022 Detection Solution

This repo provides an solution for the DeepFake Game Competition (DFGC) @ IJCB 2022 Detection track. Our solution achieve the 1st in the final phase of the DFGC Detection track. The ranking can be seen here

1. Authors

Institution: Shenzhen Key Laboratory of Media Information Content Security(MICS)

Adviser: Professor Bin Li

Username: HanChen

Team members:

2. A brief report

3. Training Code

3.1 Extract faces from video and save as png (Only used to extract faces from the test set video of the competition)

python extract_video_mtcnn.py --input_root_path <video_path> --output_root_path <saved_image_path> --gpu_id <GPU_ID>

3.2 Training

## train swin_large_patch4_window12_384_in22k
python train_swin.py --model_name swin_large_patch4_window12_384_in22k --resolution 384 --gpu_id <GPU_ID>

## train convnext_xlarge_384_in22ft1k
CUDA_VISIBLE_DEVICES=0,1,2,3 python train_convnext.py --model_name convnext_xlarge_384_in22ft1k --resolution 384

3.3 Testing

## test the model weight of the 40th epoch of swin_large_patch4_window12_384_in22k
python predict_swin.py --model_name swin_large_patch4_window12_384_in22k --resolution 384 --pre_trained ./save_result/models/swin_large_patch4_window12_384_in22k_40.pth --root_path <saved_image_path> --output_txt ./save_result/pred_swin_large_patch4_window12_384_in22k_40e.txt --gpu_id <GPU_ID>

## test the model weight of the 10th epoch of convnext_xlarge_384_in22ft1k
python predict_convnext.py --model_name convnext_xlarge_384_in22ft1k --resolution 384 --pre_trained ./save_result/models/convnext_xlarge_384_in22ft1k_10.pth --root_path <saved_image_path> --output_txt ./save_result/pred_convnext_xlarge_384_in22ft1k_10e.txt --gpu_id <GPU_ID>

## test the model weight of the 30th epoch of convnext_xlarge_384_in22ft1k
python predict_convnext.py --model_name convnext_xlarge_384_in22ft1k --resolution 384 --pre_trained ./save_result/models/convnext_xlarge_384_in22ft1k_30.pth --root_path <saved_image_path> --output_txt ./save_result/pred_convnext_xlarge_384_in22ft1k_30e.txt --gpu_id <GPU_ID>

3.4 ensemble

## ensemble
python merge_csv.py --output_txt preds.txt

4. Environment

facenet-pytorch==2.5.0
torch==1.9.0
dlib==19.21.1