SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Mingjian Zhu, Hanting Chen, Qiangyu Yan, Xudong Huang, Guanyu Lin, Wei Li, Zhijun Tu, Hailin Hu, Jie Hu, Yunhe Wang* Huawei Noah's Ark Lab {zhumingjian, yunhe.wang}@huawei.com
The extraordinary ability of generative models to generate photographic images has intensified concerns about the spread of disinformation, thereby leading to the demand for detectors capable of distinguishing between AI-generated fake images and real images. However, the lack of large datasets containing images from the most advanced image generators poses an obstacle to the development of such detectors. In this paper, we introduce the GenImage dataset, which has the following advantages: 1) Plenty of Images, including over one million pairs of AI-generated fake images and collected real images. 2) Rich Image Content, encompassing a broad range of image classes. 3) State-of-the-art Generators, synthesizing images with advanced diffusion models and GANs. The aforementioned advantages allow the detectors trained on GenImage to undergo a thorough evaluation and demonstrate strong applicability to diverse images. We conduct a comprehensive analysis of the dataset and propose two tasks for evaluating the detection method in resembling real-world scenarios. The cross-generator image classification task measures the performance of a detector trained on one generator when tested on the others. The degraded image classification task assesses the capability of the detectors in handling degraded images such as low-resolution, blurred, and compressed images. With the GenImage dataset, researchers can effectively expedite the development and evaluation of superior AI-generated image detectors in comparison to prevailing methodologies.
The advancement of generative models has yielded remarkable progress in synthesizing photorealistic images, drastically reducing the requisite expertise and effort to generate fake images. This unprecedented accessibility has evoked concerns regarding the ubiquitous dissemination of disinformation. Fake images are particularly convincing because of visual comprehensibility. Therefore they enable a negative impact on social areas such as politics and economics by manipulating public opinion. For example, AI-generated photos of the Pentagon on fire are widely shared on Twitter [22]. This image fools several major news outlets and causes a significant drop in the US stock market. Current state-of-the-art (SOTA) generative models have exhibited the ability to generate images that pose a significant challenge to human perception and discrimination. Humans can only achieve an accuracy rate of  $61.3\%$  when discriminating between real images and AI-generated fake images [19]. To this end, it is of utmost urgency to prioritize the development of an effective detector capable of accurately identifying fake images generated by these advanced generative models.
To aid in the development of detectors, early fake image detection dataset [30, 3] primarily concentrate on face forgery, utilizing generative models to manipulate the human face, thereby replacing a person's
Table 1: An overview of fake image detection datasets.
Dataset	Image Content	Generator Category	Public Availability	Real Images	Fake Images
GAN	Diffusion
UADFV [36]	Face	✓	X	X	241	252
FakeSpotter [30]	Face	✓	X	X	6,000	5,000
DFFD [3]	Face	✓	X	✓	58,703	240,336
APFDD [7]	Face	✓	X	X	5,000	5,000
ForgeryNet [10]	Face	✓	X	✓	1,438,201	1,457,861
DeepArt [32]	Art	X	✓	✓	64,479	73,411
CNNSpot [31]	General	✓	X	✓	362,000	362,000
IEEE VIP Cup [29]	General	✓	✓	X	7,000	7,000
DE-FAKE [27]	General	X	✓	X	20,000	60,000
CiFAKE [1]	General	X	✓	✓	60,000	60,000
GenImage	General	✓	✓	✓	1,331,167	1,350,000
identity or modifying the facial attributes. UADFV [36] presents a small-scale face forgery dataset, comprising solely 241 real images and 252 fake images. A larger dataset, namely ForgeryNet [10], introduces a more comprehensive dataset encompassing over one million instances of face forgery images. Nevertheless, the applicability of these datasets is limited due to their sole focus on face images, rendering them less effective for a broader range of image categories. Early datasets for general AI-generated images are built upon generative adversarial network (GAN), such as CNNSpot [31]. CNNSpot only employs ProGAN [12] for generating training set and evaluates detector performance across a variety of GAN-based testing set. These generators generate images bearing a strong resemblance to real images, although humans could often detect their synthetic nature. Besides GAN, the recent advent of alternative generators, such as diffusion models, significantly enhances the quality of generated images, rendering the task of distinguishing real from fake images increasingly challenging. Therefore, it is essential to explore the images generated by diffusion models. IEEE VIP Cup [29] and DE-FAKE [27] have employed diffusion models to generate more general images. Based on a small-scale Cifar10 dataset [15], CiFAKE [1] generates fake images only with Stable Diffusion V1.4. However, existing diffusion model datasets suffer from limited data.
In this paper, we generate an extensive collection of general images leveraging the current state-of-the-art Diffusion and GAN models, subsequently constructing our dataset, namely GenImage. Our target is to be on par with awesome million-scale datasets like ImageNet [4] for complete and comprehensive AI-generated image detector training and validation. We use the 1000 class labels in ImageNet to generate 1.3 million fake images, which equals the number of real images in ImageNet. In Table 1, we compare GenImage with the other datasets. Compared with the face forgery datasets, GenImage covers a broader range of image content, such as basketball and guitar. Besides, GenImage employs state-of-the-art diffusion generators, such as Midjourney [20] and Stable Diffusion [25]. The richer image content and generator categories ensure the diversity of images in GenImage. Compared with general fake image detection datasets, GenImage also demonstrates the advantages of the dataset scale. We perform a comprehensive analysis of GenImage using existing SOTA detection methods and then propose two tasks resembling real-world detection problems: (1) Cross-Generator Image Classification: training the detectors on the images generated by one generator and evaluating the detectors on the images generated by the other generators. (2) Degraded Image Classification: evaluating the detectors on the degraded images, such as low resolution, JPEG compression, and Gaussian Blur. The GenImage is promising to significantly contribute to the advancement of detectors specifically designed for detecting AI-generated images.
2.1 AI-generated Image Detection Datasets
The rapid growth of generative neural networks has facilitated the generation of images, raising concerns over the propagation of misinformation due to the low-cost production of such images. Generative networks primarily employ GANs for image generation, including CycleGAN [39], StyleGAN [13], ProGAN [12]. These generators produce images bearing strong resemblance to real images, although humans could often detect their synthetic nature. However, the recent advent of alternative generators, such as diffusion models, significantly enhances the quality of generated images, rendering the task of distinguishing real from fake images increasingly challenging. To aid in the development of detectors, initial synthetic image detection datasets [14, 16] predominantly
Figure 1: Visualization of images on GenImage dataset. SD is short for Stable Diffusion.
comprised a large number of facial images. The detectors based on these datasets cannot effectively identify the general images such as houses. Despite the limitations of early GANs in producing general images, pioneering work has made strides, such as CNNSpot [31], which solely employs ProGAN for training dataset generation and subsequently evaluates detector performance across a variety of GAN-based testing sets. A recent trend in this space involves the introduction of diffusion models as generators. For instance, DeepArt [32] leverages advanced generators such as Stable Diffusion, DALL-E2, Imagen, Midjourney, and Parti to produce art-like images. Similarly, initiatives like the IEEE VIP Cup [29] and DE-FAKE [27] have employed diffusion models to generate more general images. Based on a small-scale Cifar10 dataset [15], CiFAKE [1] generates fake images with Stable Diffusion V1.4. Nonetheless, these datasets often focus on GAN, and they are data-limited.
2.2 AI-generated Image Detection Methods
Numerous approaches have emerged in the pursuit of spotting generated images based on fake image detection datasets. Among the conventional methods, image classifiers have served as the most direct detectors, leveraging architectures like CNN-based ResNet50 [9], Transformer-based DeiT-S [28], and Swin-T [17] for binary classification of images. These detectors offer solid baseline techniques. In the early stages, emphasis was placed on detectors that relied on facial features. F3Net [23]] proposes to simultaneously explore frequency components partition and discrepancy of frequency statistics between real and fake images for face forgery detection. GramNet [18] uses global texture features to make fake face detection more robust and generalizable. These methods can, to some extent, be useful for the design of general image detectors. Past general image detectors have been developed and evaluated on images generated by GAN generators. Spec [38] takes the frequency spectrum as input and synthesizes GAN artifacts in real images without the necessity of specific GAN models to generate fake images as training data. DIRE [33] computes an error between the input and its reconstruction counterpart by a diffusion model.CNNSpot [31] uses ResNet-50 [9] as a binary classifier, with specific pre- and post-processing and data augmentation. Most of the detectors are for GAN. The development of dedicated detectors tailored to the unique characteristics of mixed GAN and diffusion data is imperative.
3.1 Dataset Details
To facilitate a precise evaluation of a detector's capacity to discern between AI-generated and real images, we construct a dataset, GenImage, comprising over one million pairs of real and fake images. Considering that ImageNet is an awesome dataset that we want to be on par with, GenImage employs
all the real images in ImageNet. Image generation in GenImage leverages 1000 distinct labels in ImageNet, ensuring a near-equal distribution of real and generated images across each class. Our dataset, GenImage, comprises 2,681,167 images, segregated into 1,331,167 real and 1,350,000 fake images. The real images are subdivided into 1,281,167 images for training and 50,000 for testing. With ImageNet [4] providing 1000 distinct image classes, we generate 1350 images for each class, out of which 1300 are allocated for training and the remaining 50 for testing.
To address the problem of detecting images generated by SOTA generators, we employ eight generative models for image generation, namely BigGAN [2], GLIDE [21], VQDM [8], Stable Diffusion V1.4 [25], Stable Diffusion V1.5 [25], ADM [5], Midjourney [20], and Wukong [35]. Each generator produces nearly the same number of images for each class, with 162 images for training and 6 for testing, with the exception of Stable Diffusion V1.5, which generates 166 images for training and 8 for testing. A combination of the fake images generated by a generator and their corresponding real images can be considered as a subset, such as Stable Diffusion V1.4 subset. The real images are not shared across subsets. The number of generated images approximates the number of real images for the whole dataset and for each subset. The almost equal and high number of images generated by each generator in this dataset allows the properties of each generator to be fully explored when developing detection models without being affected by the imbalances in numbers. Our model input sentences follow the template "photo of class", with "class" being substituted by ImageNet labels. For Wukong, Chinese sentences often achieve better generation quality. Thus, the sentences are translated into Chinese for the web API. For ADM and BIGGAN, we employ their pre-trained models on ImageNet, inputting the labels to generate images.
The generated images are shown in Figure 1. More visualized images are provided in the supplementary materials. It can be observed that overall the generated images are similar to the real images in ImageNet. Images with the same labels are analyzed in more detail. Animals and plants succeed in keeping the appearance of the target object consistent, e.g., samoyed with a similar appearance, and they differ in movement, perspective, and background. The appearance of the targets also varies for objects such as candles and lighthouses. Therefore, the generated images have a high degree of variability and reasonableness.
3.2 Fake Image Generators
Diffusion Model has recently achieved remarkable performances in image synthesis. Midjourney [20] is one of the most renowned commercial software programs, known for its exceptional image generation performance. We utilize Midjourney V5 for image generation, which offers more intricate details compared to previous versions, resulting in images that closely resemble real-world photographs. The resolution of images generated by Midjourney is  $1024 \times 1024$ . Wukong [35] is a large-scale text-to-image generative model based on the diffusion model. This model is trained on the largest Chinese open-source multimodal dataset, the Wukong dataset, making it particularly suitable for Chinese language processing. The image resolution is  $512 \times 512$ . Stable Diffusion [25] is an advanced text-to-image diffusion model capable of generating highly realistic images based on any given text input. Stable Diffusion V1.4 is pretrained from the Stable Diffusion V1.2 checkpoint and fine-tuned on 225k steps at resolution 512x512 on Laion-Aesthetics V2 5+ dataset and drops  $10\%$  of the text-conditioning. The training settings of Stable Diffusion V1.5 is the same as Stable Diffusion V1.4, except that Stable Diffusion V1.5 is fine-tuned on 595,000 steps. Both Stable Diffusion V1.4 and Stable Diffusion V1.5 generate images with a resolution of  $512 \times 512$ . ADM [5] proposes a diffusion model which achieves better sample quality than GANs. We use a model with classifier guidance, which is pretrained on ImageNet. GLIDE [21] is a diffusion model for text-conditional image synthesis. GLIDE uses a text encoder to train a 3.5 billion diffusion model. We use classifier-free guidance for generating images. Its resolution is  $256 \times 256$ . VQDM [8] proposes a latent-space method that eliminates the undirectional bias with previous methods and incorporates a mask-and-replace diffusion mechanism to alleviate the accumulation of errors. The resolution is  $256 \times 256$ .
GAN has brought significant quality improvements in image generation in the past decades. BigGAN [2] is a representative method in GAN family. BigGAN makes three contributions, including architectural changes, sampling techniques, and instabilities reduction techniques. We use the BigGAN model pretrained on ImageNet. The image resolution is  $128 \times 128$ .
Table 2: Results of cross-validation on different training and testing subsets using ResNet-50.
Training Subset	Testing Subset	Avg Acc.(%)
Midjourney	SD V1.4	SD V1.5	ADM	GLIDE	Wukong	VQDM	BigGAN
Midjourney	98.8	76.4	76.9	64.1	78.9	71.4	52.5	50.1	71.1
SD V1.4	54.9	99.9	99.7	53.5	61.9	98.2	56.6	52.0	72.1
SD V1.5	54.4	99.8	99.9	52.7	60.1	98.5	56.9	51.3	71.7
ADM	58.6	53.1	53.2	99.0	97.1	53.0	61.5	88.3	70.4
GLIDE	50.7	50.0	50.1	56.0	99.9	50.3	51.0	74.0	60.2
Wukong	54.5	99.7	99.6	51.4	58.3	99.9	58.7	50.9	71.6
VQDM	50.1	50.0	50.0	50.7	60.1	50.2	99.9	66.8	59.7
BigGAN	49.9	49.9	49.9	50.6	68.4	49.9	50.6	99.9	58.6
4 GenImage Benchmark
4.1 Fake Image Detectors
In order to evaluate our dataset, we investigate and select some existing fake image detection methods.
Backbone Model can be directly utilized as the detector for the binary classification of real and fake images. We use ResNet-50 [9], DeiT-S [28] and Swin-T [17] as the fake image detector. ResNet [9] is based on convolutional neural network. DeiT-S [28] and Swin-T [17] are based on Transformer. Without a specific design for the fake image detection task, the backbone models can be considered baseline methods.
Fake Face Detector has been developed for a long time. F3Net [23] proposes to simultaneously explore frequency components partition and discrepancy of frequency statistics between real and fake images for face forgery detection. GramNet [18] uses global texture features to make fake face detection more robust and generalizable. These methods train models on face images. These models are difficult to directly work well with images beyond the face domain. However, these methods can still inspire the design of general image detectors.
General Fake Image Detector employs special designs for classifying general images getting rid of the limitation of face content. Spec [38] takes the frequency spectrum as input and synthesizes GAN artifacts in real images without the necessity of specific GAN models to generate fake images as training data. CNNSpot [31] uses ResNet-50 as a binary classifier, with specific pre- and post-processing and data augmentation. However, the performance of existing methods on datasets comprising a combination of GAN and diffusion-generated images requires further improvement. Consequently, the development of detectors tailored to the unique characteristics of mixed GAN and diffusion data becomes imperative.
4.2 Task 1: Cross-Generator Image Classification
We first evaluate the performance of the detector when trained and tested on images generated by the same generator. We perform our analysis with the most commonly used Resnet-50 [9]. Our GenImage dataset consists of eight distinct subsets, each corresponding to a specific generator. Within each subset, we further divide the data into training and testing sets, each comprising 1000 classes of images. As shown in Table 2, training and testing within each subset consistently yield accuracy rates surpassing  $98.5\%$ . Notably, the Stable Diffusion V1.4 and Stable Diffusion V1.5 subsets achieve an exceptional accuracy of  $99.9\%$ . However, we observe a substantial performance degradation when training and testing are conducted using different generators. For instance, when the ResNet-50 is trained on Stable Diffusion V1.4 and tested on Midjourney, the binary classification accuracy drops to  $54.9\%$ .
Based on this observation, detecting a fake image synthesized by a specific generator is relatively straightforward, simply by training the binary classifier on a dataset consisting of real images and fake images. However, this approach is likely to be tied to this generator and will not perform well on unknown generators. In real-world scenarios, the generator is often unknown at training. In this work, we hope to be able to effectively evaluate the generalization ability of the detector, i.e. the ability to distinguish between real and fake images independent of the used generator. We propose the cross-generator image classification task to evaluate the recognition ability of the AI-generator detector. In Table 2, training on Stable Diffusion V1.4 achieves the best results. To this end, we train the model on Stable Diffusion V1.4 and subsequently test it on the testing subsets from different
Table 3: Results of different methods trained on SD V1.4 and evaluated on different testing subsets.
Method	Testing Subset	Avg Acc.(%)
Midjourney	SD V1.4	SD V1.5	ADM	GLIDE	Wukong	VQDM	BigGAN
ResNet-50 [9]	54.9	99.9	99.7	53.5	61.9	98.2	56.6	52.0	72.1
DeiT-S [28]	55.6	99.9	99.8	49.8	58.1	98.9	56.9	53.5	71.6
Swin-T [17]	62.1	99.9	99.8	49.8	67.6	99.1	62.3	57.6	74.8
CNNSpot [31]	52.8	96.3	95.9	50.1	39.8	78.6	53.4	46.8	64.2
Spec [38]	52.0	99.4	99.2	49.7	49.8	94.8	55.6	49.8	68.8
F3Net [23]	50.1	99.9	99.9	49.9	50.0	99.9	49.9	49.9	68.7
GramNet [18]	54.2	99.2	99.1	50.3	54.6	98.9	50.8	51.7	69.9
generators in this task. We then compute the average accuracy across the various test subsets, as shown in Table 3. In Table 3, for each method, we train one model on one generator and evaluate this model on eight generators. We average eight results for one method. In Table 4, for each method, we train eight models on eight generators respectively. We evaluate each model on eight generators. We average sixty-four results for one method. For example, we respectively train eight ResNet-50 models using eight generators and average their evaluation results on Midjourney, yielding an accuracy of  $59.0\%$ . The evaluation is also performed on the other generators, such as Stable Diffusion V1.4, which leads to another fifty-six evaluation results. All the sixty-four testing results are then averaged to achieve  $66.9\%$ . In summary, the cross-generator training and evaluation contains two settings. The first setting is training a model on SD V1.4, and evaluating the eight generators. The second setting is the same as the training and evaluation in Table 2. We average the eight average accuracies in Table 2 to obtain the results of ResNet-50 in Table 4. Our evaluation offers comprehensive insights into the capabilities of the detectors. We conduct a thorough evaluation of various backbone architectures on our dataset, including the CNN-based ResNet50 [9], as well as the Transformer-based DeiT-S [28] and Swin-T [17]. This evaluation aims to assess the performance and effectiveness of these architectures in AI-generated image detection task. Additionally, we also evaluate the performance of existing AI-generated image detectors, such as CNNSpot [31] and Spec [38].
In Table 3 and Table 4, current CNN-based models like ResNet perform similarly to Transformer-based models like DeiT-S and Swin-T. These backbone models share similar computation costs and parameters, and they are often used for 1000-class image classification on ImageNet. For ImageNet 1000 class image classification, the backbone models tend to focus more on the classification of the content of the image. For GenImage, the focus is more on the pattern of discriminating between real and fake images. We train them from scratch for binary classification. In the cross-generator image classification task, the best result is achieved by Swin-T, while the other two methods are close in accuracy. Improving Transformer-based methods is a promising direction in our dataset. We also evaluate the existing AI-generated image detectors, e.g., CNNSpot [31], and Spec [38]. We train these models on our dataset and evaluate them. CNNSpot proposes that the recognition performance can be improved by augmenting the training data: (1) Images are blurred with  $\sigma \sim$  Uniform[0,3] with  $50\%$  probability. (2) Images are JPEG-ed with  $50\%$  probability. GAN often causes unique artifacts in the up-sampling component. Spec show that such artifacts are manifested as replications of spectra in the frequency domain. Thus, Spec takes spectrum instead of pixel as its input for classification. CNNSpot and Spec work well on their GAN-based datasets. However, they perform even worse than the baseline backbone models on our dataset, mainly composed of images generated by the diffusion model. F3Net [23] contains two branches, namely Frequency-aware Image Decomposition (FAD) and Local Frequency Statistics (LFS). FAD studies manipulation patterns through frequency-aware image decomposition. LFS extracts local frequency statistics. Besides, a mixed block is utilized for collaborative feature interaction. GramNet [18] observes the difference between fake and real faces. Then it leverages global texture features to enhance robustness and generalization. Both methods are inferior to training directly with a binary classification backbone neural network model. Considering the advantages of all these approaches, designing a special backbone network could be a promising solution for GenImage.
4.3 Task 2: Degraded Image Classification