# CIFAKE: Image Classification and Explainable Identification of AI-Generated Synthetic Images

Jordan J. Bird, Ahmad Lotfi · arXiv · 2023-3-24

- **Problem** Photorealistic latent-diffusion images make it hard for people to tell generated photographs from real ones, so this study asks whether a CNN can separate the two.
- **Method** Builds a 120,000-image set of CIFAR-10 photographs and Stable Diffusion 1.4 images, trains a CNN to separate them, and uses Grad-CAM heatmaps to show which regions drive each decision.
- **Results** The best feature extractor reached 92.98% validation accuracy, and the dense stage's top validation accuracy of 93.55% came from a single layer of 64 neurons, which also had an F1 score of 0.936.

![Figure 5: An example of one of the ﬁnal model architectures following hyperparameter search for the classiﬁcation of real or AI-generated images](https://refivu.com/papers/e594d784-9005-4f7c-810b-586b7b9a7338/figures/figure-450de04ec2e13ec40db6e1c5ce2c78df.png?thumb=512)

**Figure 5** : An example of one of the ﬁnal model architectures following hyperparameter search for the classiﬁcation of real or AI-generated images.

[Original paper](https://arxiv.org/abs/2303.14126v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Jordan J. Bird, Ahmad Lotfi · CIFAKE: Image Classification and Explainable Identification of AI-Generated Synthetic Images · Original paper figure · Extracted the figure area from page 11 of the original PDF.

## Why detecting generated photographs matters

Latent diffusion models now produce photorealistic pictures, and the authors contend that viewers can no longer reliably separate them from camera photographs. Because of this, checking whether an image is authentic has become a practical requirement rather than a niche concern.

The authors link this to concrete harms, such as a generated photograph serving as false alibi evidence or feeding misinformation. They also report that synthetic faces can pass false-acceptance checks and that synthetic signatures can defeat signature verification.

The study frames the question as a binary classification problem, with real photographs and latent-diffusion output as the two classes. Its main question is whether a convolutional network trained on such pairs can make the split, and which network topology performs best. A second question is which image regions the network relies on for each decision, which the study addresses with Grad-CAM.

## Building the real and synthetic classes

The real class is drawn from CIFAR-10, which holds 60,000 images in ten classes with 6,000 images per class. Each class contributes 5,000 images to training and 1,000 to testing, and all training images are used for the real class, giving 50,000 training and 10,000 test images. Real images carry label 1 as the positive class.

The synthetic half is generated with Stable Diffusion 1.4, an open-source form of latent diffusion model. The generator is described as reversing a noising process: noise is added to an image until only noise remains, so generation starts from noise and removes it step by step. The study runs this reverse process over 50 steps with the Euler Ancestral scheduler and random seed vectors.

Each prompt starts with "a photograph of" followed by an article and a class-specific modifier, such as "in the forest" for deer.

Generated images are rendered at 512px and then reduced to 32px by bilinear interpolation, so that their resolution matches CIFAR-10.

The two halves give 120,000 images in total, with 60,000 from each source. For classification, 100,000 images are used for training, 50,000 real and 50,000 synthetic, and 20,000 for testing, 10,000 of each.

The authors note that most of the generated samples are hard to tell apart from photographs by eye. The samples also show complex attributes such as depth of field, reflections and motion blur.

Some generated images contain visual glitches, including shapes resembling letters and a jet aircraft with no cockpit window. Anatomical errors also appear on animals, shown through the limbs and eyes of a cat.

Other generated samples show water ripples and reflections of objects that the authors judge realistic.

## The CNN, its output and its metrics

The classifier is a convolutional neural network with two parts: convolutional layers that extract features and fully connected layers that make the decision. Each learned filter is followed by a ReLU, which returns max(0, x). Pooling then reduces the spatial size, and the flattened result passes into dense layers.

For an input image x and a filter w, the output at position (i, j) is a sum over an M by N window of pixel values multiplied by filter weights. \\\\\[ (x \* w)(i,j) = \\\\sum\_{m=1}^{M}\\\\sum\_{n=1}^{N} x(i+m-1,\\\\, j+n-1)\\\\, w(m,n) \\\\\] With a stride of 1 and no padding, the output map has height minus the kernel height plus 1 and width minus the kernel width plus 1.

The network ends in one neuron with a sigmoid activation, which maps any real input into the range between 0 and 1. \\\\\[ \\\\sigma(x) = \\\\frac{1}{1+e^{-x}} \\\\\] FAKE is labelled 0 and REAL 1, so the output reads as a likelihood for each class, and the value is rounded to the nearest class at inference. Training aims to reduce binary cross-entropy loss through backpropagation.

Precision is the share of predicted positives that are truly positive, which tracks false positives. \\\\\[ \\\\text{Precision} = \\\\frac{\\\\text{TP}}{\\\\text{TP}+\\\\text{FP}} \\\\\] Recall is the share of actual positives that are found, which tracks false negatives. \\\\\[ \\\\text{Recall} = \\\\frac{\\\\text{TP}}{\\\\text{TP}+\\\\text{FN}} \\\\\] The authors argue that recall matters most here, because with REAL as the positive class a false negative would wrongly flag a genuine photograph as generated.

The networks are built in TensorFlow, and all seeds are set to 1 for replicability. All training and evaluation runs on a single Nvidia RTX 3080Ti GPU.

## Feature extractor search

The first search leaves out dense layers and asks how many filters and convolutional layers the feature extractor needs. Filter counts of 16, 32, 64 and 128 are crossed with one, two and three layers, and each stack is flattened straight into the output neuron. The best of these extractors is then used as the base for the dense-layer search.

Accuracy averaged 91.79% across the feature extractors. The highest, 92.98%, came from two layers of 128 filters, with a loss of 0.221.

The lowest-loss extractor used two layers of 32 filters, which reached 92.93% accuracy and a binary cross-entropy loss of 0.18. Across the grid, the F1 score averaged 0.929, with a highest value of 0.936 and a standard deviation of 0.003.

The study selects the lowest-loss extractor, two layers of 32 filters, rather than the most accurate one. Loss, not accuracy, is therefore the criterion carried into the next stage.

## Dense layers on top of the extractor

The study reports training 36 network topologies in total.

The top value, 93.55%, comes from a single layer of 64 neurons.

The lowest validation loss, 0.177, comes from three layers of 64 neurons. The top F1 score, 0.936, comes from a single dense layer of 64 neurons. The F1 scores across this search have a standard deviation of 0.003.

The model chosen for its F1 score is drawn as an example architecture in Figure 5. The drawing lists two Conv2D stages with 32 ReLU units, each followed by max pooling, then a dense layer of 64 units and a sigmoid output.

## What Grad-CAM highlights

Grad-CAM uses the gradients of the predicted class with respect to the CNN's feature maps, and averages those gradients spatially to get one weight per map. \\\\\[ L^{c}\_{\\\\text{Grad-CAM}} = \\\\mathrm{ReLU}\\\\Big(\\\\sum\_k \\\\alpha\_k A^k\\\\Big), \\\\qquad \\\\alpha\_k = \\\\frac{1}{Z}\\\\sum\_i\\\\sum\_j \\\\frac{\\\\partial y^c}{\\\\partial A^k\_{ij}} \\\\\] Here the ReLU keeps only positive contributions and Z is the number of spatial locations, so the result is a heatmap over the input image that follows the predicted class.

The top row of Figure 6 shows real images with their overlays and raw heatmaps, and the bottom row shows AI-generated images. The authors describe real-image maps as holistic, with most of the content contributing, whereas maps for synthetic images are sparser and more atomistic. For synthetic images, activation sits on parts that may carry glitches that the human eye finds hard to recognise.

In a frog image, out-of-focus bokeh is the only cue that marks the image as not real.

For the airplane, bird, frog, horse and ship examples, the object itself has little or no class activation overlay. The authors read this as the entity holding almost no useful features for synthetic-image recognition, and infer that the generator can render a near-perfect version of the subject.

## Limitations of the evidence

Grad-CAM readings are visual judgements on selected examples, and the paper gives no quantitative measure of explanation quality.

The text describes 20,000 images as used for testing, but the classifier tables and discussion report validation metrics, so the scores here are validation scores.

The synthetic half comes from one generator, Stable Diffusion 1.4, with the prompt modifiers listed in Table 1. The authors state that newer generators would require updating the dataset.

Attention-based classifiers, human faces and clinical scans are named as future work and are not tested here.

Seeds are fixed to 1, and the paper reports no repeated runs, so run-to-run variation is not part of these results.

## Paper info

- **Authors**: Jordan J. Bird, Ahmad Lotfi
- **Venue**: arXiv · Preprint
- **First published**: 2023-3-24
- **Added**: 2026-11-6
- **Updated**: 2023-3-24
- **Version**: v1
- **arXiv**: 2303.14126
- **Category**: cs.CV · cs.AI · cs.LG
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2303.14126v1) · [PDF ↗](https://arxiv.org/pdf/2303.14126v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Recent technological advances in synthetic data have enabled the generation of images with such high quality that human beings cannot tell the difference between real-life photographs and Artificial Intelligence (AI) generated images. Given the critical necessity of data reliability and authentication, this article proposes to enhance our ability to recognise AI-generated images through computer vision. Initially, a synthetic dataset is generated that mirrors the ten classes of the already available CIFAR-10 dataset with latent diffusion which provides a contrasting set of images for comparison to real photographs. The model is capable of generating complex visual attributes, such as photorealistic reflections in water. The two sets of data present as a binary classification problem with regard to whether the photograph is real or generated by AI. This study then proposes the use of a Convolutional Neural Network (CNN) to classify the images into two categories; Real or Fake. Following hyperparameter tuning and the training of 36 individual network topologies, the optimal approach could correctly classify the images with 92.98% accuracy. Finally, this study implements explainable AI via Gradient Class Activation Mapping to explore which features within the images are useful for classification. Interpretation reveals interesting concepts within the image, in particular, noting that the actual entity itself does not hold useful information for classification; instead, the model focuses on small visual imperfections in the background of the images. The complete dataset engineered for this study, referred to as the CIFAKE dataset, is made publicly available to the research community for future work.

## Quote from the paper

Jordan J. Bird, Ahmad Lotfi (2023). CIFAKE: Image Classification and Explainable Identification of AI-Generated Synthetic Images. arXiv:2303.14126v1. https://arxiv.org/abs/2303.14126v1

**BibTeX**

```
@misc{bird2023cifake,
  title = {{CIFAKE: Image Classification and Explainable Identification of AI-Generated Synthetic Images}},
  author = {Jordan J. Bird and Ahmad Lotfi},
  year = {2023},
  eprint = {2303.14126},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.14126v1}
}
```

## Related papers

- [The Ethics of AI Ethics -- An Evaluation of Guidelines](https://refivu.com/en/papers/36e5de78-c499-4b96-ba0a-9d2daff8bde8-the-ethics-of-ai-ethics-an-evaluation-of.md)
- [Evaluating Object Hallucination in Large Vision-Language Models](https://refivu.com/en/papers/994f787c-7b50-4945-8065-0d6a2ea146e6-evaluating-object-hallucination-in-large-vision-language.md)
- [Evaluation: from precision, recall and F-measure to ROC, informedness, markedness and correlation](https://refivu.com/en/papers/8d51315a-ef79-4c4f-a429-17bee5b397f4-evaluation-from-precision-recall-and-f-measure-to.md)
- [Metrics for Multi-Class Classification: an Overview](https://refivu.com/en/papers/78ca6b47-f74d-4a51-a805-f5f83bb18a77-metrics-for-multi-class-classification-an-overview.md)
- [Improved Denoising Diffusion Probabilistic Models](https://refivu.com/en/papers/3bb46a03-77c5-4d37-8dd5-2e14817051ef-improved-denoising-diffusion-probabilistic-models.md)
- [Absorbing Quantization Error by Deformable Noise Scheduler for Diffusion Models](https://refivu.com/en/papers/10a7b7b0-1927-4b83-a47b-a8a00da5f0c5-absorbing-quantization-error-by-deformable-noise-scheduler.md)

## Other paper commentary

- [U-shape Transformer for Underwater Image Enhancement](https://refivu.com/en/papers/090ea979-276e-4ff3-b5ba-8d3483b8e2e8-u-shape-transformer-for-underwater-image-enhancement.md)
- [MSRF-Net: A Multi-Scale Residual Fusion Network for Biomedical Image Segmentation](https://refivu.com/en/papers/6a391bec-28c7-48c8-b3ae-92ae5788cd01-msrf-net-a-multi-scale-residual-fusion-network.md)
- [Advanced Steel Microstructural Classification by Deep Learning Methods](https://refivu.com/en/papers/40557ea6-2c03-4d59-8884-5b126f8414d1-advanced-steel-microstructural-classification-by-deep.md)
- [Rethinking RGB-D Salient Object Detection: Models, Data Sets, and Large-Scale Benchmarks](https://refivu.com/en/papers/5abc609e-361c-4e17-87a0-9ee4d3898f77-rethinking-rgb-d-salient-object-detection-models-data.md)
- [Video Salient Object Detection via Fully Convolutional Networks](https://refivu.com/en/papers/bc9ebd0c-9bab-4b48-a6aa-5dc69dbeadea-video-salient-object-detection-via-fully-convolutional.md)
- [Analyzing and Improving the Image Quality of StyleGAN](https://refivu.com/en/papers/e2a72d06-1704-43a3-b07f-7a9c61ec260b-analyzing-and-improving-the-image-quality-of-stylegan.md)
- [Deep Reinforcement Learning framework for Autonomous Driving](https://refivu.com/en/papers/baaead94-eeef-4412-9a69-b14b7ab4fe14-deep-reinforcement-learning-framework-for-autonomous-driving.md)
- [Focal Loss for Dense Object Detection](https://refivu.com/en/papers/e443afaf-8dd8-45c6-8192-0357f4961dd2-focal-loss-for-dense-object-detection.md)

## Terms in this paper

- [CIFAR-10](https://refivu.com/en/terms/19035a518d0a-cifar-10)
- [ReLU](https://refivu.com/en/terms/7b22f5612f6c-relu)
- [Image classification](https://refivu.com/en/terms/e15c43f3bb32-image-classification)
- [recall](https://refivu.com/en/terms/3774987267f3-recall)
- [Convolutional Neural Network](https://refivu.com/en/terms/610f2c09337d-convolutional-neural-network)
- [precision](https://refivu.com/en/terms/29bee1303774-precision)
- [classification accuracy](https://refivu.com/en/terms/3c67905d3166-classification-accuracy)
- [bilinear interpolation](https://refivu.com/en/terms/7e615ad35dbd-bilinear-interpolation)
- [binary classification](https://refivu.com/en/terms/800bc06db3f8-binary-classification)
- [feature extractor](https://refivu.com/en/terms/d73e930d7b50-feature-extractor)
- [LAION-5B](https://refivu.com/en/terms/c4513407f9c3-laion-5b)
- [Sigmoid](https://refivu.com/en/terms/9f3c5f7726af-sigmoid)
- [binary cross-entropy loss](https://refivu.com/en/terms/e6ec2f1d9bdf-binary-cross-entropy-loss)
- [TensorFlow](https://refivu.com/en/terms/408a8a74a3dc-tensorflow)
- [explainable AI](https://refivu.com/en/terms/3d646e0093f1-explainable-ai)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/e594d784-9005-4f7c-810b-586b7b9a7338-cifake-image-classification-and-explainable-identification)
