Deepfake Detector - ONNX Version

This repository contains the ONNX-optimized version of prithivMLmods/deepfake-detector-model-v1. It is a vision-based deepfake detection model built on the SigLIP architecture (SiglipForImageClassification).

Model Details

  • Model Type: Image Classification
  • Backbone: SigLIP (Signal-Language Image Pre-training)
  • Format: ONNX (Open Neural Network Exchange)
  • File Size: ~327.5 MB
  • Precision: FP32
  • Input Size: 224x224
  • Labels:
    • 0: Fake
    • 1: Real

Inference with ONNX Runtime

To run this model, you will need onnxruntime and numpy. If you want to use the standard SigLIP preprocessing, the transformers library's AutoImageProcessor is recommended.

Installation

pip install onnxruntime numpy Pillow transformers

Python Example

import onnxruntime as ort
import numpy as np
from PIL import Image
from transformers import AutoImageProcessor

# 1. Load the model and processor
model_path = "deepfake_detector_v1.onnx"
# You can load the processor from the original repo
processor = AutoImageProcessor.from_pretrained("prithivMLmods/deepfake-detector-model-v1")
session = ort.InferenceSession(model_path, providers=["CPUExecutionProvider"])

# 2. Prepare the image
image = Image.open("path_to_your_image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="np")
pixel_values = inputs["pixel_values"]

# 3. Run inference
outputs = session.run(["logits"], {"pixel_values": pixel_values})
logits = outputs[0]

# 4. Interpret results
probs = np.exp(logits) / np.sum(np.exp(logits), axis=-1, keepdims=True)
predicted_class = np.argmax(probs, axis=-1)[0]

id2label = {0: "Fake", 1: "Real"}
print(f"Prediction: {id2label[predicted_class]}")
print(f"Confidence: {probs[0][predicted_class]:.4f}")

Model Specification

Inputs

  • Name: pixel_values
  • Shape: (batch_size, 3, 224, 224)
  • Type: float32
  • Normalization: Standard SigLIP normalization (rescale 1/255, mean 0.5, std 0.5)

Outputs

  • Name: logits
  • Shape: (batch_size, 2)
  • Type: float32

Export Details

The model was exported using torch.onnx.export with opset 17. It features dynamic batch size support for the first dimension of input and output.


license: mit

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support