This project implements a deep learning-based image classification system to detect AI-generated (fake) versus real images. The model is trained on image datasets containing both authentic and synthetically generated content (e.g., from GANs or diffusion models).
To build a binary classifier that can accurately distinguish between real images and those generated by artificial intelligence, using convolutional neural networks and modern evaluation techniques.
- Custom CNN trained from scratch and fine-tuned ResNet/EfficientNet
- Binary classification: Real vs. Fake
- Optional explainability via Grad-CAM
- Robust evaluation with precision, recall, F1-score, and ROC-AUC
- CIFAKE dataset (or your custom dataset)
- Balanced dataset with
real/andfake/folders - Data split: Train / Test
git clone https://github.com/your-username/Fake-Image-Detection.git
cd Fake-Image-Detectionpython -m venv venv
source venv/bin/activate #For Windows: venv\Scripts\activatepip install -r requirements.txt #Additionally for cuda first do: pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118Download the CIFAKE dataset used for this project. Unzip the folder and place it in the root directory of this project and you should be ready to go.
To have a glance at how the data looks like by extracting some of the relevant features for this task, run the EDA.ipynb file.
One of the models used for this project is a CNN built from scratch and custom trained on CIFAKE. To custom train it on other data or use it, check the Baseline_CNN.ipynb file. The model is already available in Models directory of this project by the name of cifake_cnn.pth and can be used directly.
This is the other model used for this project and like CNN, it is also custom trained on CIFAKE data. Just look into the ResNet50.ipynb file. It also contains the Grad-CAM analysis of results.
Below is a sample image of real and AI generated Cat
When performing EDA on this image, it is evident from the comparison of edges and HOG for the image shown below that there are clear differences between the two.
This project is open-source and available under the terms of the MIT License.


