A Comprehensive Benchmark for AI-generated Image Detection [Project Page]
method | paper | test code | train code |
---|---|---|---|
CNNSpot | CNN-generated images are surprisingly easy to spot...for now | ✅ | ⚙️ |
FreDect | Leveraging Frequency Analysis for Deep Fake Image Recognition | ✅ | ⚙️ |
Fusing | Fusing global and local features for generalized AI-synthesized image detection | ✅ | ⚙️ |
Gram-Net | Global Texture Enhancement for Fake Face Detection In the Wild | ✅ | ⚙️ |
LGrad | Learning on Gradients: Generalized Artifacts Representation for GAN-Generated Images Detection | ✅ | ⚙️ |
LNP | Detecting Generated Images by Real Images | ✅ | ⚙️ |
DIRE | DIRE for Diffusion-Generated Image Detection | ✅ | ⚙️ |
UnivFD | Towards Universal Fake Image Detectors that Generalize Across Generative Models | ✅ | ⚙️ |
RPTC | Rich and Poor Texture Contrast: A Simple yet Effective Approach for AI-generated Image Detection | ⚙️ | ⚙️ |
usage: eval_all.py [-h] [--rz_interp RZ_INTERP] [--blur_sig BLUR_SIG] [--jpg_method JPG_METHOD] [--jpg_qual JPG_QUAL] [--batch_size BATCH_SIZE] [--loadSize LOADSIZE] [--CropSize CROPSIZE] [--no_crop]
[--no_resize] [--no_flip] [--model_path MODEL_PATH] [--detect_method DETECT_METHOD] [--noise_type NOISE_TYPE] [--LNP_modelpath LNP_MODELPATH] [--DIRE_modelpath DIRE_MODELPATH]
[--LGrad_modelpath LGRAD_MODELPATH]
options:
-h, --help show this help message and exit
--rz_interp RZ_INTERP
--blur_sig BLUR_SIG
--jpg_method JPG_METHOD
--jpg_qual JPG_QUAL
--batch_size BATCH_SIZE
input batch size (default: 64)
--loadSize LOADSIZE scale images to this size (default: 256)
--CropSize CROPSIZE scale images to this size (default: 224)
--no_crop if specified, do not crop the images for data augmentation (default: False)
--no_resize if specified, do not resize the images for data augmentation (default: False)
--no_flip if specified, do not flip the images for data augmentation (default: False)
--model_path MODEL_PATH
the path of detection model (default: ./weights/CNNSpot.pth)
--detect_method DETECT_METHOD
choose the detection method (default: CNNSpot)
--noise_type NOISE_TYPE
such as jpg, blur and resize (default: None)
--LNP_modelpath LNP_MODELPATH
the path of LNP pre-trained model (default: ./weights/sidd_rgb.pth)
--DIRE_modelpath DIRE_MODELPATH
the path of DIRE pre-trained model (default: ./weights/lsun_bedroom.pt)
--LGrad_modelpath LGRAD_MODELPATH
the path of LGrad pre-trained model (default: ./weights/karras2019stylegan-bedrooms-256x256_discriminator.pth)
❗ You should set your dataroot and dataset name in eval_config.py
All pre-trained detection models and necessary pre-processing models are available in ./weights
For example, if you want to evaluate the performance of CNNSpot under blurring.
python eval_all.py --model_path ./weights/CNNSpot.pth --detect_method CNNSpot --noise_type blur --blur_sig 1.0 --no_resize --no_crop --batch_size 1
We adopt the training set in CNNSpot, you can download it from link
The whole test set and checkpoints we used in our experiments can be downloaded from BaiduNetdisk or Google Drive.
Our code is developed based on CNNDetection, GANDCTAnalysis, Fusing, Gram-Net, LGrad, LNP, DIRE, UnivFD, GenImage. Thanks for their sharing codes and models.:heart:
If you find this repository useful for your research, please consider citing this bibtex.
@article{rptc,
title={Rich and Poor Texture Contrast: A Simple yet Effective Approach for AI-generated Image Detection},
author={Zhong, Nan and Xu, Yiran and Qian, Zhenxing and Zhang, Xinpeng},
journal={arXiv preprint arXiv:2311.12397},
year={2023}
}