Unmask / README.md
PixelNavigation's picture
Add Hugging Face Space config
03de451
|
Raw History Blame Contribute Delete
4.63 kB
metadata
title: Unmask
emoji: ๐Ÿ•ต๏ธโ€โ™‚๏ธ
colorFrom: purple
colorTo: indigo
sdk: docker
sdk_version: '1.0'
app_file: app.py
pinned: false

UnMask - Enhanced Deepfake Detection

This project integrates multiple deepfake detection models with a modern web interface.

๐Ÿš€ Quick Start

Backend Setup

Updated the model to tf_efficientnet_b7_ns_0_40

  1. Navigate to backend directory:

    cd backend
    
  2. Install Python dependencies:

    pip install opencv-python numpy flask flask-cors torch torchvision dlib
    
  3. Start the server:

    Option A: Using the batch file (Windows):

    start_server.bat
    

    Option B: Using Python directly:

    python simple_server.py
    

    Option C: Using the Flask API (if dependencies available):

    python app.py
    

The backend will start on http://localhost:8000 (simple server) or http://localhost:5000 (Flask API).

Frontend Setup

  1. Navigate to frontend directory:

    cd frontend
    
  2. Install dependencies:

    npm install
    
  3. Start the development server:

    npm run dev
    

The frontend will be available at http://localhost:3000.

๐ŸŽฏ Features

Detection Models

  • MesoNet (Meso4 & MesoInception4): Lightweight CNN architectures
  • Enhanced Xception: Deep learning model optimized for deepfake detection
  • Ensemble Voting: Combines multiple models for better accuracy

Web Interface

  • Drag & Drop Upload: Easy file upload interface
  • Real-time Processing: Live feedback during analysis
  • Detailed Results: Comprehensive detection metrics
  • Multi-model Analysis: Shows individual model predictions

๐Ÿ“Š API Endpoints

Flask API (app.py)

  • GET / - Server status and information
  • POST /api/detect - Upload video for deepfake detection
  • GET /api/models - Get information about loaded models

Simple Server (simple_server.py)

  • GET / - API status (JSON)
  • GET /detect - Upload interface (HTML)
  • POST /upload - Process uploaded video

๐Ÿ”ง Technical Details

Supported Formats

  • Video: MP4, AVI, MOV, MKV, WebM
  • Maximum Size: 100MB
  • Processing: Automatic face detection and analysis

Models Integration

The project integrates the HongguLiu/Deepfake-Detection repository, providing:

  1. MesoNet Models: Specialized for deepfake detection
  2. Transfer Learning: Pre-trained Xception networks
  3. Face Detection: Automatic face extraction from videos
  4. Statistical Analysis: Advanced frame-level analysis

Architecture

frontend/          # Next.js React application
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/       # Main application pages
โ”‚   โ””โ”€โ”€ Components/ # Reusable UI components
โ”‚
backend/           # Python detection server
โ”œโ”€โ”€ Deepfake-Detection/  # Cloned detection models
โ”œโ”€โ”€ app.py         # Flask API server
โ”œโ”€โ”€ simple_server.py     # Standalone HTTP server
โ””โ”€โ”€ requirements.txt     # Python dependencies

๐Ÿ› ๏ธ Troubleshooting

Backend Issues

  1. Python dependencies missing: Install required packages:

    pip install -r requirements.txt
    
  2. Port conflicts: Change port in server files if needed

  3. Model loading errors: Ensure the Deepfake-Detection repository is properly cloned

Frontend Issues

  1. CORS errors: Ensure backend server is running and accessible

  2. Upload failures: Check file format and size limits

  3. Connection refused: Verify backend server is running on correct port

๐Ÿ“ˆ Performance

Processing Speed

  • Face Detection: ~1-2 seconds per video
  • Model Inference: ~0.5-1 second per model
  • Total Analysis: ~3-5 seconds average

Accuracy

  • Ensemble Model: Combines multiple approaches for better reliability
  • False Positive Rate: Reduced through multi-model voting
  • Confidence Scoring: Provides reliability metrics

๐Ÿ”ฎ Future Enhancements

  1. Additional Models: Integration of more detection algorithms
  2. Batch Processing: Multiple file uploads
  3. Real-time Streaming: Live video analysis
  4. Model Training: Custom model training interface
  5. Advanced Analytics: Detailed forensic analysis

๐Ÿ“ Notes

  • This is a research/educational tool - results should be verified
  • Processing time depends on video length and system performance
  • GPU acceleration available if PyTorch CUDA is installed
  • Regular model updates recommended for best performance