FakeOut / README.md
TropicalBee's picture
Update README.md
3fd0afb verified
|
Raw
History Blame Contribute Delete
3.7 kB

A newer version of the Gradio SDK is available: 6.25.0

Upgrade
metadata
title: FakeOut
emoji: 🐨
colorFrom: gray
colorTo: indigo
sdk: gradio
sdk_version: 6.18.0
python_version: '3.13'
app_file: app.py
pinned: false
short_description: A patch-based DL model detecting microscopic AI artifacts.

FAKEOUT: A Patch-Based Deep Learning Model for AI Image Detection

FAKEOUT is a forensic computer vision application built to expose synthetic modifications and AI-generated image patterns. Unlike traditional classifiers that inspect overall image composition, FAKEOUT operates as a patch-based detector. It isolates microscopic frequency anomalies and localized pixel artifacts left behind by generative architectures.

How It Works

Traditional AI detection models often become confused by an image's overall subject matter or composition. FAKEOUT bypasses this limitation by looking at the world through a fixed window:

  1. Patch Extraction: The engine extracts a strict, deterministic 224x224 pixel crop from the exact center of the uploaded image.
  2. Artifact Scan: A specialized ResNet-50 architecture evaluates this dense sub-grid to scan for subtle, microscopic pixel noise, texture repetitions, and architectural anomalies typical of diffusion models and GANs.
  3. Classification: The model calculates class probabilities to determine whether the high-frequency fingerprint matches a true photograph (REAL) or an AI generation (FAKE).

Dataset & Architecture

  • Core Approach: Original work featuring a strict patch-based training and inference pipeline.
  • Sourced Data: Built by merging and curating two prominent image distribution libraries:
    • Flickr30k Dataset (8.86 GB) for diverse, high-resolution authentic photography.
    • Defactify Image Dataset (7.51 GB) for diverse synthetic and manipulated generations.
  • Volume: Combined infrastructure representing 10,000 source images expanded seamlessly into 100,000 unique validation patches during pipeline engineering.

Performance & Key Metrics

Evaluated against a strictly quarantined, un-leaked holdout test set containing complex wild generations:

  • Overall Classification Accuracy: 76.92%
  • ROC-AUC Score: 0.7143
  • AI-Detection Recall: 83.33% (The model successfully catches and flags over 83% of actual AI-generated fakes).

Model Evaluation Visualized

ROC-AUC Curve Confusion Matrix

Detailed Classification Report

Classification Report


Limitations & Best Results

To get the most accurate results out of FAKEOUT, keep the following mechanical constraints in mind:

  • Resolution Sweet Spot (512px - 1500px): The model performs best on mid-sized dimensions (e.g., 640x832 or 880x1320).
  • The 4K Danger Zone: Ultra-high-resolution images (4K / 3840x2160) will degrade performance. Because the model's 'magnifying glass' is locked to a 224x224 footprint, it ends up scanning less than 0.6% of a 4K frame, completely losing contextual positioning.
  • Centered Subjects: The patch extraction targets the dead-center. Structural AI defects occurring exclusively on frame borders or background edges will not be parsed.
  • Avoid Screenshots: Compression passes from screenshot utilities or social media pipelines strip away the micro-level frequency data the model relies on. Always upload raw, uncompressed source files.

Technology Stack

  • Core Engine: PyTorch, Torchvision
  • Weights Format: Safetensors (Optimized for lazy CPU execution)
  • Frontend: Gradio Web Interface
  • Hosting Container: Hugging Face Spaces

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference