Skip to content

SLUDI/Depfake-Detection-Model

Repository files navigation

Deepfake Detection API

Production-ready deepfake detection service using EfficientNetB4 for Digital Identity Wallet integration.

🚀 Features

  • EfficientNetB4 Model: State-of-the-art deepfake detection
  • Fast Inference: Optimized for production use
  • Grad-CAM Visualization: Visual explanations of predictions
  • RESTful API: Easy integration with mobile/web apps
  • Docker Support: Containerized deployment
  • Health Checks: Built-in monitoring endpoints

📋 API Endpoints

1. Health Check

GET /health

2. Deepfake Detection (Recommended)

POST /api/v1/detect/deepfake
Content-Type: multipart/form-data

Parameters:
  - file: image file (JPEG, PNG)
  - include_visualization: boolean (default: true)

Response:
{
  "is_authentic": true,
  "confidence": 0.9234,
  "label": "Real",
  "probability_fake": 0.0766,
  "probability_real": 0.9234,
  "model": "EfficientNetB4",
  "processing_time_ms": 245.67,
  "visualizations": {
    "original": "base64_encoded_image",
    "gradcam_heatmap": "base64_encoded_image",
    "overlay": "base64_encoded_image"
  }
}

3. Legacy Endpoint (Backward Compatible)

POST /predict
Content-Type: multipart/form-data

Parameters:
  - file: image file

4. Liveness Detection

POST /api/v1/verify/liveness
Content-Type: multipart/form-data

Parameters:
  - file: image file

🛠️ Installation

Local Development

  1. Install dependencies:
pip install -r requirements.txt
  1. Place your model:
# Ensure your model is at: model/effb4_ai_detector.pt
  1. Run the server:
uvicorn app:app --host 0.0.0.0 --port 8080 --reload
  1. Test the API:
curl -X POST "http://localhost:8080/api/v1/detect/deepfake" \
  -F "file=@test_image.jpg"

Docker Deployment

  1. Build the image:
docker build -t deepfake-detector .
  1. Run the container:
docker run -p 8080:8080 deepfake-detector
  1. Test:
curl http://localhost:8080/health

🧪 Testing

# Test with sample image
curl -X POST "http://localhost:8080/api/v1/detect/deepfake" \
  -F "file=@sample_real.jpg" \
  -F "include_visualization=true"

# Health check
curl http://localhost:8080/health

📝 Model Information

  • Architecture: EfficientNetB4
  • Input Size: 380x380 pixels
  • Parameters: ~19M
  • Model Size: ~70MB
  • Training: Fine-tuned on deepfake dataset

Built for Digital Identity Wallet Integration 🔐

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors