File size: 1,432 Bytes
3c68a15
 
737a831
3c68a15
 
 
 
 
 
 
 
 
737a831
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
title: AI Image Detector
emoji: πŸ”
colorFrom: green
colorTo: red
sdk: gradio
sdk_version: 6.0.2
app_file: app.py
pinned: false
license: mit
---

# AI Image Detector

Detect whether an image is **AI-generated** or a **real photograph** using deep learning.

## Model Architecture

- **Base Model:** MobileNetV2 (pretrained on ImageNet)
- **Transfer Learning:** Custom classification head with:
  - Global Average Pooling
  - Batch Normalization
  - Dense layer (256 units) with L2 regularization
  - Dropout (0.7)
  - Sigmoid output for binary classification

## Training Data

The model was trained on a combined dataset of ~128,000 images:
- **CIFAKE Dataset:** 100,000 images (50k real, 50k AI-generated)
- **Tiny GenImage Dataset:** 28,000 additional images from various AI generators including:
  - Midjourney
  - Stable Diffusion
  - BigGAN
  - ADM
  - GLIDE
  - VQDM
  - Wukong

## Usage

Upload any image to the interface, and the model will predict whether it's:
- **Real Image:** A genuine photograph
- **AI-Generated:** Created by an AI model

## Files

- `app.py` - Main Gradio application
- `requirements.txt` - Python dependencies
- `transfer_model.keras` - Trained model weights

## License

MIT License

## Acknowledgments

- CIFAKE Dataset: https://www.kaggle.com/datasets/birdy654/cifake-real-and-ai-generated-synthetic-images
- Tiny GenImage Dataset: https://www.kaggle.com/datasets/yangsangtai/tiny-genimage