Major Project
Bachelor of Technology (B.Tech)
Computer Science & Engineering (Artificial Intelligence & Machine Learning)
Artificial Intelligence has significantly advanced image generation technologies through models such as Stable Diffusion, Midjourney, DALLยทE, and other Generative AI systems. Although these technologies provide remarkable creative capabilities, they also introduce serious concerns regarding misinformation, fake media, identity theft, copyright issues, and digital security.
CIFAKE is a deep learning-based image classification system developed to distinguish between Real and AI-Generated (Fake) images. The project utilizes EfficientNetB0 Transfer Learning for accurate binary image classification and integrates Grad-CAM (Gradient-weighted Class Activation Mapping) to provide visual explanations for every prediction.
Unlike traditional black-box classifiers, this system enables users to understand why the model classified an image as Real or Fake by highlighting the most influential regions within the image.
The rapid advancement of AI-generated synthetic images has made it increasingly difficult for humans to distinguish fake images from authentic photographs.
Traditional deep learning models often provide only predictions without explaining their decision-making process, reducing user trust and interpretability.
This project aims to develop an explainable deep learning system capable of accurately detecting AI-generated images while providing visual evidence supporting every prediction.
The primary objectives of this project are:
- Develop an AI-powered image classification system.
- Detect AI-generated synthetic images with high accuracy.
- Classify uploaded images into REAL or FAKE categories.
- Utilize EfficientNetB0 through Transfer Learning.
- Implement Explainable Artificial Intelligence (Grad-CAM).
- Build an interactive Flask-based web application.
- Provide model evaluation through graphical performance analysis.
This project uses the CIFAKE: Real and AI-Generated Synthetic Images dataset.
- Dataset Name: CIFAKE: Real and AI-Generated Synthetic Images
- Source: https://www.kaggle.com/datasets/birdy654/cifake-real-and-ai-generated-synthetic-images
| Category | Images |
|---|---|
| Training REAL | 50,000 |
| Training FAKE | 50,000 |
| Testing REAL | 10,000 |
| Testing FAKE | 10,000 |
Total Images: 120,000
Note: The dataset is not included in this repository due to its large size. Please download it from the official Kaggle page and place it in the following directory structure:
dataset/
โ
โโโ train/
โ โโโ REAL/
โ โโโ FAKE/
โ
โโโ test/
โโโ REAL/
โโโ FAKE/
The proposed system is developed using Transfer Learning with EfficientNetB0.
- EfficientNetB0 (ImageNet Pre-trained)
- GlobalAveragePooling2D
- BatchNormalization
- Dropout (0.4)
- Dense Layer (256 Neurons, ReLU)
- Dropout (0.3)
- Output Layer (Sigmoid Activation)
224 ร 224 ร 3
The model was trained in two sequential stages.
- EfficientNetB0 kept frozen.
- Only custom classification layers trained.
- Last layers of EfficientNetB0 unfrozen.
- Lower learning rate applied.
- Fine-tuning improves feature representation and overall accuracy.
Deep learning models generally behave as black-box systems where predictions are difficult to interpret.
To improve transparency, this project integrates Grad-CAM (Gradient-weighted Class Activation Mapping).
Grad-CAM highlights the important regions of an image that contributed most toward the model's prediction.
For every uploaded image, the system generates:
- Original Image
- Grad-CAM Heatmap
- Heatmap Overlay
- Human-readable Explanation
This enables users to understand the reasoning behind every prediction.
The project consists of three major modules.
- Upload an image
- Predict REAL or FAKE
- Display prediction confidence
Generates visual explanations using Grad-CAM.
Outputs include:
- Heatmap
- Overlay Visualization
- Explanation of important image regions
Provides comprehensive evaluation of the trained model through:
- Accuracy
- Precision
- Recall
- F1 Score
- Confusion Matrix
- ROC Curve
- Dataset Distribution
- Prediction Confidence Distribution
| Metric | Performance |
|---|---|
| Accuracy | 95.24% |
| Precision | 94.88% |
| Recall | 95.63% |
| F1 Score | 95.25% |
The project includes a dedicated Insights Dashboard containing:
- Model Performance Metrics
- Confusion Matrix
- ROC Curve
- Dataset Distribution
- Prediction Confidence Distribution
These visualizations help evaluate classification quality and overall model reliability.
- Python
- TensorFlow
- Keras
- Scikit-learn
- OpenCV
- Pillow
- NumPy
- Pandas
- Matplotlib
- Flask
- HTML5
- CSS3
- Bootstrap 5
- Font Awesome
CIFAKE/
โ
โโโ app.py
โโโ requirements.txt
โโโ README.md
โ
โโโ dataset/
โ โโโ train/
โ โโโ test/
โ
โโโ explainability/
โ
โโโ models/
โ โโโ best_model.keras
โ โโโ final_model.keras
โ โโโ accuracy_plot.png
โ โโโ loss_plot.png
โ โโโ training_history.csv
โ
โโโ notebooks/
โ โโโ 01_dataset_analysis.py
โ โโโ 02_preprocessing.py
โ โโโ 03_model_building.py
โ โโโ 04_train_final.py
โ โโโ 05_model_evaluation.py
โ โโโ 06_gradcam.py
โ โโโ 07_confusion_matrix.py
โ โโโ 08_roc_curve.py
โ โโโ 09_dataset_distribution.py
โ โโโ 10_prediction_confidence_distribution.py
โ
โโโ reports/
โ
โโโ static/
โ โโโ css/
โ โ โโโ style.css
โ โ
โ โโโ images/
โ โ โโโ confusion_matrix.png
โ โ โโโ roc_curve.png
โ โ โโโ dataset_distribution.png
โ โ โโโ prediction_confidence_distribution.png
โ โ
โ โโโ uploads/
โ
โโโ templates/
โโโ index.html
โโโ result.html
โโโ insights.html
User Uploads Image
โ
โผ
Image Preprocessing
โ
โผ
EfficientNetB0 Classification
โ
โผ
Prediction (REAL / FAKE)
โ
โผ
Confidence Score
โ
โผ
Grad-CAM Heatmap Generation
โ
โผ
Explainable Visualization
โ
โผ
Prediction Result Display
The home page allows users to upload an image for authenticity verification using the trained EfficientNetB0 model.
After uploading an image, the system predicts whether it is REAL or FAKE, displays the confidence score, and provides Grad-CAM visual explanations.
The Insights Dashboard presents important evaluation metrics and analytical visualizations, including:
- Accuracy
- Precision
- Recall
- F1 Score
- Confusion Matrix
- ROC Curve
- Dataset Distribution
- Prediction Confidence Distribution
The project can be further extended by incorporating:
- Detection of multiple AI image generators.
- Real-time webcam-based fake image detection.
- AI-generated video (Deepfake) detection.
- Mobile application deployment.
- Cloud deployment using platforms such as Render or AWS.
- REST API integration.
- Multi-class AI image generator identification.
Riya Rani
Bachelor of Technology (B.Tech)
Computer Science & Engineering (AI & ML)
Major Project
This project was developed using the following technologies and resources:
- TensorFlow & Keras
- EfficientNet Research
- OpenCV
- Scikit-learn
- Flask
- Bootstrap 5
- Font Awesome
- CIFAKE Dataset Contributors


