Skip to main content

CIFAKE

A computer vision and deep learning study investigating how accurately artificial intelligence can distinguish authentic photographs from AI-generated images.

  • Data Analysis
  • Computer Vision
  • Deep Learning
  • Machine Learning
  • Model Evaluation
CIFAKE project visual representing real and AI-generated image classification.

Project overview

CIFAKE explores the growing challenge of distinguishing authentic photographs from images produced by generative artificial intelligence.

The project combines exploratory data analysis, visual feature investigation, deep learning, model comparison, robustness testing, and a human-versus-AI experiment.

Instead of considering accuracy alone, the study investigates what visual characteristics the models rely on and how common image transformations affect their reliability.

01

Detect AI-generated images

02

Compare multiple deep learning models

03

Analyze visual characteristics using EDA

04

Test model robustness under image transformations

05

Compare AI classification with human judgment

The CIFAKE dataset

The dataset contains 120,000 labeled images divided equally between authentic and AI-generated samples.

The 60,000 real images originate from the ten CIFAR-10 categories, while the 60,000 synthetic samples were generated using Stable Diffusion.

The balanced dataset includes different animals, vehicles, objects, backgrounds, textures, and lighting conditions.

60KReal images
60KGenerated images
10Image categories
Representative CIFAKE dataset samples showing animals, vehicles, and objects.

Data preparation

Images were organized into training, validation, and testing subsets while preserving an equal distribution of real and synthetic examples.

The preprocessing pipeline resized and normalized the images according to the input requirements of each model.

Additional transformed datasets were created to test whether the models learned meaningful image characteristics or relied too heavily on orientation and low-level patterns.

01Split

Balanced training, validation, and testing subsets.

02Resize

Images adapted to the selected architecture.

03Normalize

Pixel values standardized before training.

04Transform

Flipped, blurred, rotated, and brightness-adjusted tests.

Exploratory data analysis

Exploratory analysis examined pixel intensity, contrast, edge density, and relationships between visual characteristics in real and AI-generated images.

Although both classes shared broadly similar distributions, closer examination revealed subtle differences in smoothness, edge structure, and contrast behavior.

Pixel intensity

Compared RGB intensity behavior across authentic and generated samples.

Contrast distribution

Examined whether overall contrast could independently distinguish the classes.

Feature correlation

Measured the relationship between image contrast and edge density.

Boxplot comparing image contrast in real and AI-generated CIFAKE samples.

Visual feature analysis

Real images generally contain naturally irregular edges and greater texture variation.

Some generated images exhibit smoother surfaces or unnaturally sharp transitions, but contrast alone could not reliably separate the two classes.

Edge density and contrast displayed a moderate correlation, suggesting that combinations of features are more informative than a single isolated measurement.

Model development

Three deep learning approaches were evaluated to compare transfer learning with custom convolutional architectures.

01

Vision Transformer

A pre-trained transformer model using transfer learning to capture global visual relationships.

02

Lightweight CNN

A compact convolutional architecture designed to classify images efficiently.

03

Deeper CNN

A deeper custom network developed to learn more complex spatial and texture patterns.

Classification performance

The pre-trained Vision Transformer achieved the strongest performance, reaching approximately 98.4% classification accuracy.

Training and validation curves showed stable learning, while the CNN architectures also achieved competitive results.

The results demonstrate that both local texture patterns and broader image relationships contribute to authenticity classification.

CIFAKE training and validation loss and accuracy charts.
Comparison between confusion matrices for original and horizontally flipped CIFAKE images.

Robustness evaluation

High accuracy on unchanged test images did not guarantee stable performance under altered conditions.

Horizontal flipping caused a major performance decline, suggesting that the model learned orientation-sensitive patterns.

Blurring also reduced accuracy by removing the fine texture and edge information used by the classifier.

These experiments demonstrate why robustness testing is essential before using image-authenticity models in real-world environments.

Human versus AI

A human classification experiment compared participant judgments with the trained models.

Participants performed only moderately above random guessing, while the strongest model exceeded 98% accuracy on the original test set.

98.4%Best model accuracy
56.1%Human accuracy
120KDataset images
3Models evaluated

Key findings

The experiments revealed several important lessons about model accuracy, image features, and real-world reliability.

01

Fine details matter

Edges and texture provided more useful information than color distribution alone.

02

Contrast is not enough

Real and generated images showed significant overlap in their overall contrast values.

03

Blur reduces reliability

Removing fine texture and edge information caused model performance to decline.

04

Orientation affects predictions

Horizontal flipping exposed strong sensitivity to image orientation.

05

AI outperformed humans

Participants found it considerably harder to distinguish synthetic imagery.

06

Accuracy needs context

High test accuracy did not guarantee robustness under real-world transformations.

Technology stack

The complete experimentation workflow was developed using Python, computer vision libraries, deep learning frameworks, and statistical evaluation tools.

01Python
02PyTorch
03Vision Transformer
04CNN
05OpenCV
06Pandas
07NumPy
08Matplotlib
09Scikit-learn
10Jupyter Notebook

Technical challenges

The project required processing a large balanced dataset and comparing architectures with different image-input requirements.

A major challenge was distinguishing high test accuracy from genuine generalization, which required transformed and degraded image experiments.

Interpreting model behavior also required connecting quantitative results with visual characteristics such as contrast, edges, and texture.

Source and notebook

Explore the full project

View the complete notebook, exploratory analysis, model experiments, evaluation results, and implementation on GitHub.

View CIFAKE on GitHub

Project outcome

CIFAKE demonstrates that deep learning can distinguish authentic and AI-generated imagery with high accuracy under controlled conditions.

It also shows that headline accuracy should not be treated as the only measure of success, because image transformations and real-world variations can significantly affect reliability.

The result is a complete computer vision case study combining data analysis, model development, evaluation, robustness testing, and human comparison.