Towards Universal Fake Image Detectors that Generalize Across Generative Models
Utkarsh Ojha*, Yuheng Li*, Yong Jae Lee
(*Equal contribution)
CVPR 2023
[Project Page] [Paper]
>
Using images from one type of generative model (e.g., GAN), detect fake images from other breeds (e.g., Diffusion models)
git clone https://github.com/Yuheng-Li/UniversalFakeDetect
cd UniversalFakeDetect
pip install torch torchvision
datasets/test. You could also use the bash scripts provided by the authors, as described here in their code repository.
datasets
└── test
├── progan
│── cyclegan
│── biggan
│ .
│ .
0_real and 1_fake folders respectively../diffusion_datasets directory.python validate.py --arch=CLIP:ViT-L/14 --ckpt=pretrained_weights/fc_weights.pth --result_folder=clip_vitl14
python validate.py --arch=CLIP:ViT-L/14 --ckpt=pretrained_weights/fc_weights.pth --result_folder=clip_vitl14 --real_path datasets/test/progan/0_real --fake_path datasets/test/progan/1_fake
Note that if no arguments are provided for real_path and fake_path, the script will perform the evaluation on all the domains specified in dataset_paths.py.
results/<folder_name> in two files: ap.txt stores the Average Prevision for each of the test domains, and acc.txt stores the accuracy (with 0.5 as the threshold) for the same domains.Our main model is trained on the same dataset used by the authors of this work. Download the official training dataset provided here (dataset size ~ 72GB).
Download and unzip the dataset in datasets/train directory. The overall structure should look like the following:
datasets
└── train
└── progan
├── airplane
│── bird
│── boat
│ .
│ .
0_real and 1_fake folders.python train.py --name=clip_vitl14 --wang2020_data_path=datasets/ --data_mode=wang2020 --arch=CLIP:ViT-L/14 --fix_backbone
--fix_backbone argument during training, which makes sure that the only the linear layer's parameters will be trained.We would like to thank Sheng-Yu Wang for releasing the real/fake images from different generative models. Our training pipeline is also inspired by his open-source code. We would also like to thank CompVis for releasing the pre-trained LDMs and LAION for open-sourcing LAION-400M dataset.
If you find our work helpful in your research, please cite it using the following:
@inproceedings{ojha2023fakedetect,
title={Towards Universal Fake Image Detectors that Generalize Across Generative Models},
author={Ojha, Utkarsh and Li, Yuheng and Lee, Yong Jae},
booktitle={CVPR},
year={2023},
}
7 commits
2 commits
Python
99.9%
Towards Universal Fake Image Detectors that Generalize Across Generative Models
Utkarsh Ojha*, Yuheng Li*, Yong Jae Lee
(*Equal contribution)
CVPR 2023
[Project Page] [Paper]
>
Using images from one type of generative model (e.g., GAN), detect fake images from other breeds (e.g., Diffusion models)
git clone https://github.com/Yuheng-Li/UniversalFakeDetect
cd UniversalFakeDetect
pip install torch torchvision
datasets/test. You could also use the bash scripts provided by the authors, as described here in their code repository.
datasets
└── test
├── progan
│── cyclegan
│── biggan
│ .
│ .
0_real and 1_fake folders respectively../diffusion_datasets directory.python validate.py --arch=CLIP:ViT-L/14 --ckpt=pretrained_weights/fc_weights.pth --result_folder=clip_vitl14
python validate.py --arch=CLIP:ViT-L/14 --ckpt=pretrained_weights/fc_weights.pth --result_folder=clip_vitl14 --real_path datasets/test/progan/0_real --fake_path datasets/test/progan/1_fake
Note that if no arguments are provided for real_path and fake_path, the script will perform the evaluation on all the domains specified in dataset_paths.py.
results/<folder_name> in two files: ap.txt stores the Average Prevision for each of the test domains, and acc.txt stores the accuracy (with 0.5 as the threshold) for the same domains.Our main model is trained on the same dataset used by the authors of this work. Download the official training dataset provided here (dataset size ~ 72GB).
Download and unzip the dataset in datasets/train directory. The overall structure should look like the following:
datasets
└── train
└── progan
├── airplane
│── bird
│── boat
│ .
│ .
0_real and 1_fake folders.python train.py --name=clip_vitl14 --wang2020_data_path=datasets/ --data_mode=wang2020 --arch=CLIP:ViT-L/14 --fix_backbone
--fix_backbone argument during training, which makes sure that the only the linear layer's parameters will be trained.We would like to thank Sheng-Yu Wang for releasing the real/fake images from different generative models. Our training pipeline is also inspired by his open-source code. We would also like to thank CompVis for releasing the pre-trained LDMs and LAION for open-sourcing LAION-400M dataset.
If you find our work helpful in your research, please cite it using the following:
@inproceedings{ojha2023fakedetect,
title={Towards Universal Fake Image Detectors that Generalize Across Generative Models},
author={Ojha, Utkarsh and Li, Yuheng and Lee, Yong Jae},
booktitle={CVPR},
year={2023},
}
7 commits
2 commits
Python
99.9%