DeepShield-Detectors / README_HF.md
AMontiB
Add utilities and CLI for PGC pipeline
c55595d
|
Raw History Blame Contribute Delete
4.8 kB

A newer version of the Gradio SDK is available: 6.31.0

Upgrade
metadata
title: Deepfake Detection Space
emoji: πŸ”
colorFrom: red
colorTo: yellow
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
license: mit

Deepfake Detection Space (Open-Source Demonstrator)

Welcome to the Truebees Deepfake Detection Space! This Space provides an educational, open-source demonstrator collecting a series of baseline state-of-the-art methods for deepfake detection, allowing for free and unlimited use.

If you want to train the detectors in this Space yourself, check out our GitHub repository.

🎯 Goal and Context

This demonstrator is designed as an open-source contribution to the community. We want to allow users, researchers, and developers to experiment with baseline forensic models for free, familiarize themselves with AI detection tools, and understand both their capabilities and their limitations.

⚠️ Important:

  • Not Proprietary Software: This tool showcases open-source detectors. It does not reflect the performance, robustness, or accuracy of Truebees' commercial detection methods. Want to give it a try? check Truebees Website.
  • Non-Social Training Data: These models were trained on images not shared on social networks from the DeepShield dataset. You may experience a drop in accuracy when testing highly compressed images downloaded from social media platforms or messaging apps (e.g., WhatsApp).
  • Expected Performance: You can expect performance comparable to the results shown in Dell'Anna et al. (2025).

πŸ› οΈ Available Detectors

  • ALL: Runs all available detectors sequentially. Shows the result of each detector and generates a Confidence Plot.
  • R50_TF: ResNet-50 based detector trained on the TrueFake dataset.
  • R50_nodown: ResNet-50 without downsampling operations.
  • CLIP-D: CLIP-based deepfake detector.
  • P2G: Prompt2Guard: Conditioned prompt-optimization for continual deepfake detection.
  • NPR: Neural Posterior Regularization.
  • PGC: Peak-guided calibration on DINOv2-L (official pre-trained weights).
  • ForensicConcept: CLIP ViT-L/14 with a forensic concept codebook (official pre-trained weights).
  • MDMF: Local distribution shift (MMD) on DINOv2-L patch embeddings (official pre-trained weights; reference bank and threshold computed on DeepShield data).

πŸš€ Usage Guide

  1. Upload an image: Choose an image you want to analyze.
  2. Select a detector: Choose one of the open-source models (or "ALL") from the dropdown menu.
  3. Detect: Click the "Detect" button to generate the prediction.

Understanding the Results:

  • Prediction: Tells if an image is Real or Fake.
  • Confidence: The confidence with which the model determines if the image is real or fake.
  • Elapsed Time: The time the model needed to make the prediction (excluding preprocessing or model building).

Understanding the Results produced by "ALL":

  • Lists the prediction and confidence of each detector and generates a Confidence Plot visualizing each model's score. No aggregated verdict is produced. In the plot, Green bars indicate a Real prediction, while Red bars indicate a Fake prediction.

🧠 Training Data Overview

R50_TF, R50_nodown, CLIP-D, P2G and NPR have been pretrained using the DeepShield dataset:

  • Fake Images: Generated using StyleGAN 2 and Stable Diffusion XL.
  • Real Images: Sourced from the FFHQ Dataset and the FORLAB Dataset.

πŸ“š References

For technical details, full code to train and test these models on your own dataset, and benchmarking data, please visit our GitHub repository.

  1. Dell'Anna, S., Montibeller, A., & Boato, G. (2025). TrueFake: A Real World Case Dataset of Last Generation Fake Images also Shared on Social Networks. arXiv preprint arXiv:2504.20658.

🀝 Acknowledgment

This work has been funded by the European Union under Horizon Europe Grant Agreement no. 101092887 (NGI Sargasso – Open Call OC5 | Deepshield Project).

⏳ Note

  • ⚠️ Due to file size limitations, model weights need to be downloaded automatically on first use. This may take a few moments.
  • ⚠️ To provide a free service, all models run on CPU. The detection process may take a few seconds, depending on the image size and the selected detector.