Advanced AI-powered deepfake and synthetic media detection system with Chrome extension for real-time web content analysis.
- Overview
- Features
- Architecture
- Quick Start
- Extension Setup Guide
- Backend Setup
- Usage
- API Documentation
- Chrome Extension Details
- Model Training
- Deployment
- Troubleshooting
- Contributing
- License
DeepShield is a cutting-edge AI-powered system designed to detect manipulated media content including deepfakes, AI-generated images, and other forms of synthetic media. The system combines a powerful Flask backend with an intuitive Chrome extension for real-time web content analysis.
- AI-Generated Image Detection: Identify images created by tools like DALL-E, Midjourney, Stable Diffusion
- Deepfake Detection: Detect face-swapped videos and manipulated facial expressions
- Real-time Web Scanning: Automatically scan web pages for suspicious content
- Batch Processing: Analyze multiple files simultaneously
- Confidence Scoring: Detailed confidence levels for each prediction
- Modern UI: Glassmorphism design with smooth animations
- Drag & Drop Upload: Easy file upload with progress tracking
- Real-time Analysis: Instant results with detailed breakdowns
- Responsive Design: Works on desktop, tablet, and mobile
- Auto-scan Mode: Automatically analyze images on page load
- Manual Scanning: On-demand page scanning
- Visual Indicators: Highlight suspicious content with overlays
- Settings Panel: Customizable detection thresholds and preferences
- Results Dashboard: Track and review scan history
- EfficientNet-B4 Architecture: State-of-the-art deep learning model
- 3-Class Classification: AI-generated, Deepfake, Real
- High Accuracy: 95%+ accuracy on test datasets
- Fast Processing: Sub-second analysis times
- Video Support: Frame-by-frame video analysis (upto 5 seconds)
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Chrome β β Flask β β AI Model β
β Extension βββββΊβ Backend βββββΊβ (EfficientNet) β
β β β β β β
β β’ Content Scriptβ β β’ REST API β β β’ Image Analysisβ
β β’ Popup UI β β β’ File Upload β β β’ Video Analysisβ
β β’ Background β β β’ Health Check β β β’ Confidence β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
# 1. Clone and setup backend
git clone https://github.com/Anmol659/DeepDetect.git
cd deepshield
pip install -r requirements.txt
# 3. Start server
python run_extension.py
# 4. Load Chrome extension
git clone https://github.com/Anmol659/DeepDetect.git
cd deepshield
-
Open Chrome Extensions Page
- Type
chrome://extensions/
in address bar - Or go to Menu β More Tools β Extensions
- Type
-
Enable Developer Mode
- Toggle "Developer mode" switch in top-right corner
- You should see new buttons appear
-
Load Unpacked Extension
- Click "Load unpacked" button
- Navigate to your
deepshield/extension
folder - Select the folder and click "Select Folder"
-
Verify Installation
- DeepShield extension should appear in your extensions list
- You should see the DeepShield icon in your Chrome toolbar
- If not visible, click the puzzle piece icon and pin DeepShield
- Open
chrome://extensions/
with Developer mode enabled - Drag the entire
extension
folder onto the extensions page - Chrome will automatically load the extension
- Start local server first:
python run_extension.py
- In extension settings, use:
http://localhost:5000
- Verify connection shows "Connected"
- Enable auto-scan in Settings:
- Toggle "Auto-scan on page load" to ON
- Navigate to new pages with images
- Images should automatically get analyzed
- Look for colored overlays on images:
- π’ Green = Authentic/Real
- π΄ Red = Suspicious/AI-generated
- π‘ Yellow = Analyzing
- Click extension icon
- Drag an image file to the upload area
- Or click to browse and select file
- View analysis results
- Auto-scan on page load: Automatically analyze images when visiting pages
- Show confidence scores: Display percentage confidence on image overlays
- Highlight suspicious images: Add red borders to detected fake content
- Confidence threshold: Adjust sensitivity (50-100%)
- Backend URL: Your server endpoint
- Timeout settings: Request timeout duration
- Python 3.8+
- Chrome Browser
- CUDA-compatible GPU (recommended)
# 1. Clone repository
git clone https://github.com/yourusername/deepshield.git
cd deepshield
# 2. Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
venv\Scripts\activate # Windows
# 3. Install dependencies
pip install -r requirements.txt
# 4. Create checkpoints directory
mkdir -p checkpoints
If you have a trained model:
# Place your model file in checkpoints/
cp your_model.pth checkpoints/best_model_3way.pth
# Prepare your dataset in this structure:
# datasets/
# βββ train/
# β βββ ai_generated/
# β βββ deepfake/
# β βββ real/
# βββ val/
# β βββ ai_generated/
# β βββ deepfake/
# β βββ real/
# Train the model
cd backend/Model_A
python MDA_2.py
# From project root
python run_extension.py
# Server will start on http://localhost:5000
# Web interface available at http://localhost:5000
- Navigate to your deployed URL or
http://localhost:5000
- Upload an image or video file
- View detailed analysis results
- Check confidence scores and classifications
- Visit any webpage with images
- Click DeepShield icon in Chrome toolbar
- Click "Scan Page" button
- Watch progress as images are analyzed
- View results in Results tab
- Enable in Settings: Toggle "Auto-scan on page load"
- Browse normally - images analyzed automatically
- Look for overlays on images indicating results
- Click extension icon
- Drag & drop image files to upload area
- Or click to browse and select files
- View instant results with confidence scores
- π’ Green overlay: Authentic/Real content (95%+ confidence)
- π΄ Red border + pulse: Suspicious/AI-generated content
- π‘ Yellow overlay: Currently analyzing
β οΈ Warning icon: Click for detailed breakdown- Badge number: Shows count of suspicious images found
import requests
# Analyze image
with open('image.jpg', 'rb') as f:
response = requests.post(
'https://your-app.onrender.com/analyze',
files={'file': f}
)
result = response.json()
print(f"Classification: {result['label']}")
print(f"Confidence: {result['confidence']:.2%}")
GET /health
Returns server status and model information.
POST /analyze
Content-Type: multipart/form-data
file: [image/video file]
Response:
{
"label": "real|ai_generated|deepfake",
"confidence": 0.95,
"confidence_level": "high|medium|low",
"class_probs": {
"real": 0.95,
"ai_generated": 0.03,
"deepfake": 0.02
},
"description": "Classification result",
"model_loaded": true
}
GET /model_info
Returns detailed model architecture and capabilities.
- Real-time Scanning: Analyze images as you browse
- Visual Feedback: Color-coded overlays on images
- Confidence Scores: Percentage confidence for each prediction
- Settings Panel: Customize behavior and thresholds
- Results History: Track and review past scans
- Batch Analysis: Process multiple images simultaneously
- Error Recovery: Graceful handling of network issues
- Auto-scan: Enable/disable automatic page scanning
- Confidence Threshold: Adjust sensitivity (50-100%)
- Visual Indicators: Show/hide image overlays
- Server URL: Configure backend endpoint
- Timeout Settings: Adjust request timeout duration
- Debug Mode: Enable detailed logging for troubleshooting
- π’ Green: Authentic/Real content
- π΄ Red: Suspicious/AI-generated content
- π‘ Yellow: Uncertain/Low confidence
- βͺ Gray: Analysis in progress
The extension requires these permissions:
- activeTab: Access current tab for image scanning
- storage: Save settings and scan results
- scripting: Inject content scripts for analysis
- host_permissions: Connect to backend servers
- No data collection: Images analyzed locally or on your server
- Secure transmission: HTTPS encryption for API calls
- Local storage: Settings stored locally in Chrome
- No tracking: No analytics or user tracking
# Organize your dataset
datasets/
βββ train/
β βββ real/
β βββ ai_generated/
β βββ deepfake/
βββ val/
β βββ real/
β βββ ai_generated/
β βββ deepfake/
βββ test/
βββ real/
βββ ai_generated/
βββ deepfake/
cd backend/Model_A
python MDA_2.py # Train 3-way classification model
- Architecture: EfficientNet-B4
- Input Size: 380x380 pixels
- Classes: 3 (real, ai_generated, deepfake)
- Optimizer: AdamW with weight decay
- Loss: CrossEntropyLoss with label smoothing
batch_size = 16
num_epochs = 6
learning_rate = 1e-4
weight_decay = 1e-5
label_smoothing = 0.1
-
Prepare Repository
# Ensure model is in checkpoints/ cp your_model.pth checkpoints/best_model_3way.pth # Commit to Git git add . git commit -m "Deploy to production" git push origin main
-
Deploy to Render
- Go to render.com and sign up
- Connect your GitHub repository
- Create new Web Service
- Use provided
render.yaml
configuration - Deploy automatically
-
Update Extension
# Your app will be available at: https://your-app-name.onrender.com # Update extension settings with this URL
# Docker deployment
docker build -t deepshield .
docker run -p 5000:5000 deepshield
# Install Heroku CLI
heroku create deepshield-app
git push heroku main
npm install -g @railway/cli
railway login
railway init
railway up
# Required environment variables
FLASK_ENV=production
PORT=5000
MODEL_PATH=checkpoints/best_model_3way.pth
# Optional
MAX_FILE_SIZE=50MB
UPLOAD_FOLDER=uploads
- β Check Developer mode is enabled
- β
Reload extension:
chrome://extensions/
β Refresh button - β Check for JavaScript errors in Console (F12)
- β Verify all files are in extension folder
- β Try different websites with more images
- β Check if images are fully loaded (wait a few seconds)
- β Reload page and try again
- β Check browser console for errors
- β Verify backend URL in Settings
- β Check if backend server is running
- β
Test backend health:
https://your-app.onrender.com/health
- β Check CORS settings if using custom domain
- β Check image format (JPG, PNG, WebP supported)
- β Verify image size (minimum 32x32 pixels)
- β Check network connection
- β Try with different images
# Check if model file exists
ls -la checkpoints/best_model_3way.pth
# If missing, train model:
cd backend/Model_A
python MDA_2.py
# Check Python version
python --version # Should be 3.8+
# Install dependencies
pip install -r requirements.txt
# Check for port conflicts
lsof -i :5000 # Linux/Mac
netstat -ano | findstr :5000 # Windows
# Check deployment logs
# For Render: Check logs in dashboard
# For Heroku: heroku logs --tail
# For Railway: railway logs
- Check browser console (F12) for JavaScript errors
- Test backend directly by visiting
/health
endpoint - Try different images/websites to isolate issues
- Check network tab in DevTools for failed requests
- Reload extension after making changes
# Run unit tests
python -m pytest tests/
# Test API endpoints
python tests/test_api.py
# Performance testing
python tests/test_performance.py
# E2E testing with Selenium
python tests/test_extension.py
# Manual testing checklist:
# β
Extension loads without errors
# β
Settings save and persist
# β
Manual scan finds images
# β
Auto-scan works on page load
# β
File upload analysis works
# β
Results display correctly
- Accuracy: 95.2% on test dataset
- Precision: 94.8% (AI-generated), 96.1% (Real)
- Recall: 93.5% (AI-generated), 97.2% (Real)
- F1-Score: 94.1% (AI-generated), 96.6% (Real)
- Analysis Time: <2 seconds per image
- Throughput: 50+ images per minute
- Memory Usage: <2GB RAM
- CPU Usage: <50% on modern hardware
# Fork the repository
git clone https://github.com/yourusername/deepshield.git
cd deepshield
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
venv\Scripts\activate # Windows
# Install development dependencies
pip install -r requirements-dev.txt
- Python: Follow PEP 8, use Black formatter
- JavaScript: Use ESLint and Prettier
- Documentation: Update README for new features
- Testing: Add tests for new functionality
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature
) - Commit changes (
git commit -m 'Add amazing feature'
) - Push to branch (
git push origin feature/amazing-feature
) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- EfficientNet: Google Research for the base architecture
- PyTorch: Facebook AI Research for the deep learning framework
- Flask: Pallets Projects for the web framework
- Chrome Extensions: Google for the extension platform
- Documentation: Check this README first
- Issues: Open GitHub issues for bugs
- Discussions: Use GitHub Discussions for questions
- Email: contact@deepshield.ai (if available)
Q: Why is the extension not finding images? A: Make sure images are fully loaded and meet minimum size requirements (32x32px). Try refreshing the page.
Q: Can I use this offline? A: The extension requires a backend server. You can run the server locally for offline use.
Q: What image formats are supported? A: JPG, JPEG, PNG, WebP, and GIF formats are supported.
Q: How accurate is the detection? A: The model achieves 95%+ accuracy on test datasets, but results may vary with different types of content.
Q: Is my data private? A: Images are only sent to your configured backend server. No data is collected or stored by the extension.
- Real-time video stream analysis
- Mobile app development
- Advanced model architectures
- Multi-language support
- Blockchain verification
- Federated learning
- Edge computing support
- Enterprise dashboard
Made with β€οΈ for digital media authenticity
For more information, visit our website or follow us on Twitter.