Deepfake Image Detector

Model repository: https://huggingface.co/Arko007/deepfake-image-detector

This repository contains a pretrained deepfake image detector intended for research and experimentation. The model was provided as a PyTorch checkpoint and a small Colab-friendly inference script. The original training code and full training logs are not available; the best available evaluation result from the retained artifacts is included below.

Model Summary

  • Model name: Deepfake Image Detector (EfficientNetV2-S backbone)
  • HF repo id: Arko007/deepfake-image-detector
  • Framework: PyTorch (+ timm)
  • Backbone: tf_efficientnetv2_s (timm)
  • Input size: 380 Γ— 380 RGB
  • Output: single logit for binary fake/real classification (sigmoid applied at inference)
  • Checkpoint file: pytorch_model.bin
  • Config file: config.json
  • License: Apache-2.0

Reported Evaluation (available artifact)

  • Reported snapshot evaluation: Epoch 6 | AUC: 0.9986
  • Note: This is the only retained per-epoch metric available from the artifacts. Full training logs, dataset split details, and other epoch metrics were not provided and appear to be lost.

Intended Use

This model predicts whether an input face/image is likely a manipulated/deepfake (label = FAKE) or a real image (label = REAL). Intended uses include:

  • Research and benchmarking of image-level deepfake detection.
  • Prototyping content-moderation pipelines (with human-in-the-loop review).

Not intended for:

  • High-stakes automated decisions without human review.
  • Medical, legal, or forensic conclusions without expert validation.

Limitations & Known Issues

  • Training code and dataset provenance are not available in this repository. Use caution when interpreting metrics and generalization claims.
  • The model was trained on a dataset that is not provided here; distributional shift to other datasets, domains, or manipulated types may significantly degrade performance.
  • The only retained evaluation metric is Epoch 6 AUC = 0.9986; other performance numbers, class breakdowns, and training curves are not available.
  • Model assumes centered face or face-like crop. Performance may drop on full-frame images or unseen camera artifacts.

Model Files

  • pytorch_model.bin β€” PyTorch checkpoint (state_dict)
  • config.json β€” Minimal config used by the inference script (contains model_name, epoch, and other metadata)
  • deepfake_detector.py β€” Colab-ready inference script (example usage)
  • README.md β€” This model card

Example config.json (expected fields)

A minimal example of the config.json that pairs with pytorch_model.bin:

{ "model_name": "tf_efficientnetv2_s", "image_size": 380, "epoch": 6, "notes": "Only a single evaluation snapshot remains. Training artifacts incomplete." }

Inference (Colab / local)

The repository includes a simple Colab-ready script deepfake_detector.py which implements:

  • Download of checkpoint and config from the HF hub
  • Initialization of a timm EfficientNetV2-S backbone with a custom classifier head
  • Image preprocessing via albumentations (Resize β†’ Normalize β†’ ToTensorV2)
  • Sigmoid on the model logit to produce a probability of "fake"

High-level steps to run inference:

  1. Install dependencies (example): pip install torch torchvision timm albumentations pillow huggingface-hub matplotlib

  2. Download the model files from the Hub (the script calls huggingface_hub.hf_hub_download).

  3. Run the included script in Colab or locally:

    • Upload an image (PNG/JPG)
    • The script resizes to 380Γ—380, normalizes, and runs the model.
    • Output: probability (0..1) of the image being FAKE. Threshold 0.5 by default.

Example minimal inference snippet (matches the repository script):

import torch
import cv2
from PIL import Image
from deepfake_detector import DeepfakeDetector, TestConfig, get_inference_transform, load_model, predict_deepfake

# load model (downloads checkpoint via hf_hub_download inside)
model = load_model()  # returns a model already set to eval on TestConfig.DEVICE
transform = get_inference_transform(TestConfig.IMAGE_SIZE)

is_fake, prob, confidence = predict_deepfake(model, "example.jpg", transform)
print(f"Prediction: {'FAKE' if is_fake else 'REAL'}")
print(f"Probability (fake): {prob:.4f}, Confidence: {confidence:.4f}")

Reproducibility Notes

  • The repository does not contain the original training script or dataset. The inference script is intended for running the provided checkpoint only.
  • If you require retraining or further experiments, replace the placeholder classifier with the same architecture used in training and retrain using your own dataset, ensuring appropriate splits and class balance.

Responsible Use & Ethics

Deepfake detection models have social impact. Use responsibly:

  • Disclose limitations to stakeholders.
  • Avoid over-reliance on model outputs for high-stakes decisions.
  • Combine with manual verification and multi-modal signals when possible.

Contact / Attribution

Model owner: Arko007
HF model page: https://huggingface.co/Arko007/deepfake-image-detector

If you have additional training artifacts (logs, dataset details, training script), please add them to the repository to improve reproducibility and transparency.

Downloads last month
187
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support