A real-time deepfake detection system built with EfficientNetV2B0 + CBAM Attention, deployed as both a Chrome Extension and a Streamlit web app for AI-generated content detection — directly in the browser, with zero data leaving your device.
Final Model Performance:
| Metric | Score |
|---|---|
| Accuracy | 88.28% |
| AUC-ROC | 0.9571 |
| Average Precision | 0.9585 |
| F1 Score (optimized threshold) | 0.8880 |
Evaluated on a balanced test set of 20,000 samples (10,000 real, 10,000 fake), trained on ~140K real/fake face images.
- Real-time page scanning — Automatically detects AI-generated images and videos on any web page
- 100% local inference — All analysis runs on-device using TensorFlow.js; no data ever leaves your machine
- Smart detection — MutationObserver-based scanning catches dynamically loaded content (infinite scroll, SPAs)
- Video frame analysis — Extracts and analyzes video frames at configurable intervals
- Premium UI — Glassmorphism popup dashboard with real-time stats, detection history, and configurable settings
- In-page overlays — Non-intrusive badges on scanned images showing Real/AI-Generated status with confidence scores
- User-configurable — Toggle auto-scan, adjust sensitivity, show/hide overlays, enable/disable video scanning
-
Convert the trained model to TensorFlow.js format:
pip install tensorflowjs python scripts/convert_model.py
This produces
extension/model/model.json+ weight.binfiles. -
Load the extension in Chrome:
- Open
chrome://extensions/ - Enable Developer mode (top-right toggle)
- Click Load unpacked
- Select the
extension/folder
- Open
-
Usage:
- Click the 🛡️ DeepGuard AI icon in the toolbar
- Click "Scan This Page" to analyze all images/videos
- Toggle Auto-Scan in settings to scan pages automatically
- Hover over badges on images to see detailed confidence scores
extension/
├── manifest.json # Manifest V3 configuration
├── background.js # Service worker (message routing, state management)
├── content/
│ ├── content.js # DOM scanner, MutationObserver, overlay injection
│ └── overlay.css # In-page glassmorphism badges
├── offscreen/
│ ├── offscreen.html # Hidden document for TF.js inference
│ └── offscreen.js # Model loading, preprocessing, prediction
├── popup/
│ ├── popup.html # Dashboard UI
│ ├── popup.css # Premium glassmorphism styles
│ └── popup.js # Settings, stats, scan control
├── lib/
│ └── tf.min.js # TensorFlow.js library (~1.4 MB)
├── model/
│ ├── model.json # Converted model topology
│ └── *.bin # Weight shards (~10-15 MB)
└── assets/
└── icons/ # Extension icons (16, 48, 128px)
For deeper, manual analysis beyond the extension's automatic scanning. Powered by the same detection engine.
- Image Analysis — Upload a single image and get an instant Real/AI-Generated verdict with confidence score
- Video Analysis — Upload a video for full per-frame breakdown, aggregated prediction, and fake-frame percentage
- Live Capture — Use your webcam to capture a photo and get instant on-the-spot deepfake verification
Each mode returns face detection results, confidence scoring, and a downloadable result summary/card.
streamlit run app.pydata/raw: Original dataset images/videos (managed bydownload_data.py)data/processed: Cropped faces and preprocessed datamodels/: Saved model weights (.h5,.keras)src/: Source code for preprocessing, training, and inferencenotebooks/: Jupyter notebooks for experimentationscripts/: Model conversion utilitiesdownload_data.py: Script to download and set up the dataset
- Create a virtual environment:
python -m venv venv
- Activate the environment:
- Windows:
.\venv\Scripts\activate - Mac/Linux:
source venv/bin/activate
- Windows:
- Install dependencies:
pip install -r requirements.txt
- Kaggle API:
- Go to Kaggle Account
- Click "Create New API Token" to download
kaggle.json - Place
kaggle.jsoninC:\Users\<YourUser>\.kaggle\OR in this project folder
- Download Data:
This downloads the dataset and organizes it into
python download_data.py
data/raw/realanddata/raw/fake.
Extract faces from videos/images using MTCNN:
python src/preprocess.pyThis populates data/processed/real and data/processed/fake.
Train the EfficientNetV2B0 + CBAM model with two-phase training (frozen backbone → fine-tuning):
python src/train.pyThis saves the model to models/deepfake_detector.keras.
Generate a comprehensive evaluation report (confusion matrix, ROC curve, PR curve, threshold analysis):
python src/evaluate.py- Base Model: EfficientNetV2B0 (pre-trained on ImageNet)
- Preprocessing: MTCNN for face detection and extraction
- Attention: CBAM (Convolutional Block Attention Module) — focuses on facial regions like eyes, skin texture, and lighting seams
- Custom Head: GAP → Dense(512) → BN → Dropout → Dense(256) → BN → Dropout → Sigmoid
- Training Strategy: Two-phase (Phase 1: frozen backbone, classification head only → Phase 2: fine-tuning top layers)
- Loss Function: Binary Focal Crossentropy
- Metrics Tracked: Accuracy, AUC-ROC, Precision, Recall, F1-Score
- Deployment Optimization: Float16 quantization for TensorFlow.js, enabling fast browser-based inference via WebGL
| Metric | Value |
|---|---|
| Test Set Size | 20,000 samples (balanced) |
| Accuracy | 88.28% |
| AUC-ROC | 0.9571 |
| Average Precision | 0.9585 |
| F1 @ 0.5 threshold | 0.8782 |
| Best F1 (optimized threshold = 0.438) | 0.8880 |
| True Positives / True Negatives | 8,450 / 9,206 |
| False Positives / False Negatives | 794 / 1,550 |
This project has been submitted to ICIAEM-2026 for academic review.
- Python 3.10+
- TensorFlow 2.12+
- Chrome 120+ (for extension)
- See
requirements.txtfor full dependency list
- Temporal (RNN/LSTM) modeling for video-native deepfake detection
- Larger, more diverse training datasets for improved generalization
- Cross-browser and mobile support
- Explainable AI features to visualize why content is flagged as fake
Built by Prathamesh Zagade (@prathamxz) as a final year B.E. project (Artificial Intelligence & Data Science).