Home

Awesome

GenImage: A Million-Scale Benchmark for Detecting AI-Generated Image [Homepage]

Mingjian Zhu, Hanting Chen, Qiangyu Yan, Xudong Huang, Guanyu Lin, Wei Li, Zhijun Tu, Hailin Hu, Jie Hu, Yunhe Wang

:star:News [20240315]: We have uploaded the dataset to Google Drive. The link is https://drive.google.com/drive/folders/1jGt10bwTbhEZuGXLyvrCuxOI0cBqQ1FS?usp=sharing.

:star:News: We have recently released a paper, which proposes a detector named GenDet for AI-generated image detection! https://arxiv.org/abs/2312.08880

This repository is the official repository of the GenImage benchmark.

This repository contains the GenImage dataset and the evaluated methods.

If this project helps you, please fork, watch, and give a star to this repository.

We recommend you to visit our homepage.

GenImage is a million-scale AI-generated image detection dataset. This dataset has the following advantages:

<div align=center> <img src='Examples/visulization.png' width=750> </div>

Dataset

The training set and testing set used in the paper can be downloaded in Baidu Yunpan. The code is ztf1.

Each folder contains compressed files. After unzip the file, files under the data root directory can be organized as follows. The ai folder contains the AI-generated images, and the nature folder contains the collected images from ImageNet.

├── Midjourney
│   ├── train
│   │   ├── ai
│   │   ├── nature
│   ├── val
│   │   ├── ai
│   │   ├── nature
├── VQDM
│   ├── train
│   │   ├── ai
│   │   ├── nature
│   ├── val
│   │   ├── ai
│   │   ├── nature
├── Wukong
│   ├── ...
├── Stable Diffusion V1.4
│   ├── ...
├── Stable Diffusion V1.5
│   ├── ...
├── GLIDE
│   ├── ...
├── BigGAN
│   ├── ...
├── ADM
│   ├── ...

Tutorial

To train a detector with Stable diffusion v1.4, we can only use Stable Diffusion V1.4/ folder. To train a detector with full GenImage training set, we should create a folder named imagenet_ai, as follows.

├── imagenet_ai
│   ├── train
│   │   ├── ai
│   │   ├── nature
│   ├── val
│   │   ├── ai
│   │   ├── nature

All the images in the generator foloder should be put into the corresponding folder in imagenet_ai. For example, the images in Midjourney/train/ai should be put into imagenet_ai/train/ai. The images in VQDM/val/nature should be put into imagenet_ai/val/nature. Then we can train a binary classifier for the dataset. A typical example is training a ResNet-50 with Timm Library and 2 GPU.

sh ./distributed_train.sh 2 /cache/imagenet_ai/ -b 64 --model resnet50 --sched cosine --epochs 200 --lr 0.05 --amp --remode pixel --reprob 0.6 --aug-splits 3 --aa rand-m9-mstd0.5-inc1 --resplit --jsd --dist-bn reduce --num-classes 2

Detection Methods

We use the codes of detection methods provided in the corresponding paper. The codes are stored in detection_codes/ folder.

Generators

We use the codes of generative models provided in the corresponding paper. The codes are stored in generator_codes/ folder.

Benchmark

Method / Testing SubsetMidjourneySD V1.4SD V1.5ADMGLIDEWukongVQDMBigGANAvg Acc.(%)
ResNet-5054.999.999.753.561.998.256.652.072.1
DeiT-S55.699.999.849.858.198.956.953.571.6
Swin-T62.199.999.849.867.699.162.357.674.8
CNNSpot52.896.395.950.139.878.653.446.864.2
Spec52.099.499.249.749.894.855.649.868.8
F3Net50.199.999.949.950.099.949.949.968.7
GramNet54.299.299.150.354.698.950.851.769.9
Method / Testing SubsetMidjourneySD V1.4SD V1.5ADMGLIDEWukongVQDMBigGANAvg Acc.(%)
ResNet-5059.072.372.459.773.171.460.966.666.9
DeiT-S60.774.274.259.571.173.161.766.367.6
Swin-T61.776.076.161.376.975.165.869.570.3
CNNSpot58.270.370.257.057.167.756.756.661.7
Spec56.772.472.357.965.470.361.764.365.1
F3Net55.173.173.166.557.872.362.156.564.6
GramNet58.172.872.758.765.371.357.861.264.7
Method / Testing SubsetLR (112)LR (64)JPEG (q=65)JPEG (q=30)Blur ($\sigma$=3)Blur ($\sigma$=5)Avg Acc.(%)
ResNet-5096.257.451.951.297.969.470.6
DeiT-S97.154.055.650.594.467.269.8
Swin-T97.454.652.550.994.552.567.0
CNNSpot50.050.097.397.397.477.978.3
Spec50.049.950.850.449.949.950.1
F3Net50.050.089.074.457.951.762.1
GramNet98.894.968.853.495.981.682.2

Reference

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

@misc{zhu2023genimage,
      title={GenImage: A Million-Scale Benchmark for Detecting AI-Generated Image}, 
      author={Mingjian Zhu and Hanting Chen and Qiangyu Yan and Xudong Huang and Guanyu Lin and Wei Li and Zhijun Tu and Hailin Hu and Jie Hu and Yunhe Wang},
      year={2023},
      eprint={2306.08571},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}