This is the official Pytorch implementation of our paper:
Improving Synthetic Image Detection Towards Generalization: An Image Transformation Perspectives
Ouxiang Li, Jiayin Cai, Yanbin Hao, Xiaolong Jiang, Yao Hu, Fuli Feng
2024/11
🔥 We collect a new testsetDiTFake
, comprising three SOTA DiT-based generators (i.e., Flux, PixArt, and SD3). We hope this dataset could facilitate more comprehensive evaluations for SID.2024/11
🎉 Our paper is accepted by KDD2025 ADS Track.
Install the environment as follows:
# create conda environment
conda create -n SAFE -y python=3.9
conda activate SAFE
# install pytorch
pip install torch==2.2.1 torchvision==0.17.1
# install other dependencies
pip install -r requirements.txt
We are using torch 2.2.1 in our production environment, but other versions should be fine as well.
paper | Url | |
---|---|---|
Train Set | CNNDetection CVPR2020 | Link |
Val Set | CNNDetection CVPR2020 | Link |
Test Set1 | CNNDetection CVPR2020 | Link |
Test Set2 | FreqNet AAAI2024 | Link |
Test Set3 | UniversalFakeDetect CVPR2023 | Link |
Test Set4 | GenImage NeurIPS2023 | Link |
Test Set5 | DiTFake Ours | Link |
The generation script for our dataset is provided in data/generation.py
, we hope more synthetic images from up-to-date generative models coud be promptly evaluated and made publicly available. Details of our DiTFake
testset and comparative results will be presented in the forthcoming camera-ready version soon.
You should organize the above data as follows:
data/datasets
|-- train_ForenSynths
| |-- train
| | |-- car
| | |-- cat
| | |-- chair
| | |-- horse
| |-- val
| | |-- car
| | |-- cat
| | |-- chair
| | |-- horse
|-- test1_ForenSynths/test
| |-- biggan
| |-- cyclegan
| |-- deepfake
| |-- gaugan
| |-- progan
| |-- stargan
| |-- stylegan
| |-- stylegan2
|-- test2_Self-Synthesis/test
| |-- AttGAN
| |-- BEGAN
| |-- CramerGAN
| |-- InfoMaxGAN
| |-- MMDGAN
| |-- RelGAN
| |-- S3GAN
| |-- SNGAN
| |-- STGAN
|-- test3_Ojha/test
| |-- dalle
| |-- glide_100_10
| |-- glide_100_27
| |-- glide_50_27
| |-- guided # Also known as ADM.
| |-- ldm_100
| |-- ldm_200
| |-- ldm_200_cfg
|-- test4_GenImage/test
| |-- ADM
| |-- BigGAN
| |-- Glide
| |-- Midjourney
| |-- stable_diffusion_v_1_4
| |-- stable_diffusion_v_1_5
| |-- VQDM
| |-- wukong
|-- test5_DiTFake/test
| |-- FLUX.1-schnell
| |-- PixArt-Sigma-XL-2-1024-MS
| |-- stable-diffusion-3-medium-diffusers
bash scripts/train.sh
This script enables training with 4 GPUs, you can specify the number of GPUs by setting GPU_NUM
.
bash scripts/eval.sh
We provide the pretrained checkpoint in ./checkpoint/checkpoint-best.pth
, you can directly run the script to reproduce our results.
If you find this repository useful for your work, please consider citing it as follows:
@article{li2024improving,
title={Improving Synthetic Image Detection Towards Generalization: An Image Transformation Perspective},
author={Li, Ouxiang and Cai, Jiayin and Hao, Yanbin and Jiang, Xiaolong and Hu, Yao and Feng, Fuli},
journal={arXiv preprint arXiv:2408.06741},
year={2024}
}