An AI-powered system to detect Deepfake and AI-Generated faces using Deep Learning and Computer Vision.
With the rise of generative AI (GANs, Diffusion Models), distinguishing real human faces from synthetic ones has become a critical challenge. This project implements a Convolutional Neural Network (CNN) using Transfer Learning to classify images as "Real" or "Fake".
The system includes a Streamlit Web App for easy user interaction.
- Deep Learning: TensorFlow, Keras
- Architecture: MobileNetV2 (Transfer Learning)
- Frontend: Streamlit
- Data Processing: NumPy, PIL
- Visualization: Matplotlib
We use MobileNetV2 pre-trained on ImageNet as a feature extractor, with a custom classification head:
- Input Layer: 128x128x3 (RGB Images)
- Base Model: MobileNetV2 (Frozen Weights)
- GlobalAveragePooling2D: Reduces spatial dimensions
- Dropout (0.2): Prevents overfitting
- Dense (Output): Sigmoid activation (0 = Fake, 1 = Real)
- Image Size: Reduced to 128x128 for speed.
- Batch Size: 32.
- Data Pipeline: Uses
tf.data.AUTOTUNEfor caching and prefetching to prevent memory crashes.
- Training Accuracy: ~80%
- Test Accuracy: ~77% (on unseen data)
- Loss: ~0.45
pip install tensorflow numpy matplotlib streamlit pillowstreamlit run app.pyThe app will open in your browser at http://localhost:8501.
- Drag and drop an image of a face.
- The model analyzes it in real-time.
- Results show REAL (Green) or FAKE (Red) with a confidence score.