This project aims to detect whether a given image is real (photographed) or AI-generated using deep learning techniques. It is built from scratch for better interpretability and understanding of how such classification models work.
With the rise of generative models like DALL·E, MidJourney, and Stable Diffusion, distinguishing between real and AI-generated images has become a major challenge. This system tackles that problem using a custom-built Convolutional Neural Network (CNN).
- 🛠 Built from scratch (no pretrained models used)
- 📊 Custom CNN architecture for explainability
- 📁 Dataset split into Real and AI-Generated images
- 📈 Visualization of training progress (accuracy/loss)
- 🧪 Evaluation using accuracy, precision, recall, F1-score
- 📷 Accepts image input and predicts its authenticity
- Python
- NumPy, Pandas
- Matplotlib, Seaborn
- TensorFlow / Keras
- Scikit-learn
Real-vs-AI-Image-Detection/
│
├── dataset/
│ ├── real/ # Real images
│ └── ai/ # AI-generated images
│
├── model/
│ └── cnn_model.py # Custom CNN architecture
│
├── notebook/
│ └── training.ipynb # Jupyter notebook for training & evaluation
│
├── utils/
│ └── preprocessing.py # Image preprocessing functions
│
├── saved_model/
│ └── model.h5 # Trained model weights
│
├── predict.py # Prediction script for a single image
├── requirements.txt # List of required packages
└── README.md # You're reading it now!
git clone https://github.com/OshankAgrawal/Real-vs-AI-Generated-Image-Detection-System.git
cd Real-vs-AI-Image-Detectionpip install -r requirements.txtRun the training notebook or cnn_model.py script to train the model using the provided dataset.
python predict.py --image path_to_your_image.jpg| Metric | Value |
|---|---|
| Accuracy | 64.93% |
| Precision | 65% |
| Recall | 65% |
| F1-Score | 65% |
Oshank Agrawal B.Tech – Artificial Intelligence & Data Science Samrat Ashok Technological Institute, Vidisha (M.P.) 🌐 LinkedIn • 📧 oshankagrawal@gmail.com
This project is for educational and research purposes. Model performance may vary depending on dataset quality and size.
If you found this project helpful or interesting, consider giving it a ⭐ on GitHub to support the work!