Skip to content

OUC-VAS/DPL

Repository files navigation

DPL: Cross-quality DeepFake Detection via Dual Progressive Learning

Powered by

This repo contains an official PyTorch implementation of our paper: DPL: Cross-quality DeepFake Detection via Dual Progressive Learning.

[pre-trained weights]

🌏Overview

🛠️ Setup

⚙️ Installation

You can run the following script to configure the necessary environment:

python -m venv venv/dpl
source venv/dpl/bin/activate
pip install -r requirements.txt

📑Data Preparation

Please refer to DeepfakeBench to generate the JSON file for each dataset for the unified data loading in the training and testing process, then put json files into ./dataset_json folder.

The json file format is like below (see more details in ./dataset_json/demo.json):

{
    "FF-NT":{
        "FF-real":{
            "train":{
                "c40":{
                    "899":{
                        "label": "FF-real",
                        "frames":[
                            "FaceForensics++/original_sequences/youtube/c40/frames/899/258.png",
                            "FaceForensics++/original_sequences/youtube/c40/frames/899/352.png",
                            ...
                        ]
                    },
                    ...
                },
                "c23":{
                    ...
                }
            },
            ...
        },
        "FF-NT":{
            "train":{
                "c40":{
                    ...
                },
                "c23":{
                    ...
                }
            },
            ...
        }
    }
}

⭐️ You can directly download the processed data from DeepfakeBench, but in order to load the data correctly, you will need to modify abstract_dataset.py and pair_dataset.py

🚀 Training and Testing

In the training phase, the model is trained on FF++(c23) dataset.

Run training script:

python train.py --detector_path ./config/dpl.yaml

When you want to train Stage I, simply modify the train_stage to 1 in ./config/dpl.yaml.

To train Stage II, change train_stage to 2 in ./config/dpl.yaml and set the checkpoint_path to the optimal weight path from Stage I 「selected by running the test_1.py」.

🪧 Regarding the selection of Stage I checkpoint weight for training Stage II:
Typically, the weight that achieves the best performance on the FF++c40 validation set during Stage I is considered the optimal weight. The optimal weight in Stage I is then used as the pretrained weight for Stage II.

Running the following script to evaluate the performance of the trained weights on FF++c40, and use the results to select the optimal weights:

python test_1.py

Run the following script to evaluate the performance of the selected weight on the dataset after applying four types of random JPEG compression:

python test.py

📖 Citation

If you find our repo useful for your research, please consider citing our paper:

@InProceedings{Zhang_2024_ACCV,
    author    = {Zhang, Dongliang and Li, Yunfei and Zhou, Jiaran and Li, Yuezun},
    title     = {DPL: Cross-quality DeepFake Detection via Dual Progressive Learning},
    booktitle = {Proceedings of the Asian Conference on Computer Vision (ACCV)},
    month     = {December},
    year      = {2024},
    pages     = {1116-1132}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages