Downloads · 30 days
32
4% of all-time downloads
shunda012/siglip-deepfake-detector
siglip-deepfake-detector is a image classification model from shunda012. Use it when you need a label for an image. It is set up for transformers. The card lists the license as apache-2.0.
This project focuses on fine-tuning a pre-trained SigLIP (Sigmoid Loss for Language Image Pre-Training) model for the task of deepfake detection. Leveraging the power of Transfer Learning and Low-Rank Adaptation (LoRA…
Downloads · 30 days
32
4% of all-time downloads
All-time downloads
743
Public
Parameters
92.9M
372 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors372 MB · 100%
From the Hugging Face model README
This project focuses on fine-tuning a pre-trained SigLIP (Sigmoid Loss for Language Image Pre-Training) model for the task of deepfake detection. Leveraging the power of Transfer Learning and Low-Rank Adaptation (LoRA), we adapt a google/siglip-base-patch16-512 model (specifically initialized from prithivMLmods/deepfake-detector-model-v1) to classify images as either "Real" or "Fake".
The model is trained on a balanced subset of the OpenRL/DeepFakeFace dataset, containing 12,000 images. Due to hardware constraints, this subset was carefully selected to ensure diverse representation of various generative techniques (Stable Diffusion, Inpainting, InsightFace).
r=16), making training feasible on consumer GPUs.ColorJitter, RandomResizedCrop, RandomRotation, RandomAdjustSharpness, and GaussianBlur to improve model generalization.google/siglip-base-patch16-512prithivMLmods/deepfake-detector-model-v1q_proj, v_projThe project uses the DeepFakeFace (DFF) dataset OpenRL/DeepFakeFace. A balanced subset of 12,000 images was curated using a custom selection script.
| Class | Count | Source / Generator | Description |
|---|---|---|---|
| Real | 6,000 | wiki dataset | Real human faces from Wikipedia |
| Fake | 2,000 | text2img | Generated via Stable Diffusion v1.5 |
| Fake | 2,000 | inpainting | Generated via SD Inpainting |
| Fake | 2,000 | insight | Generated via InsightFace |
The model was trained using the Hugging Face Trainer API with the following configuration:
To prevent overfitting, the following transformations are applied during training:


from transformers import pipeline
# Load the pipeline
pipe = pipeline("image-classification", model="shunda012/siglip-deepfake-detector")
# Predict on an image
image_path = "path_to_image.jpg"
result = pipe(image_path)
print(result)
from transformers import SiglipForImageClassification, AutoImageProcessor
import torch
from PIL import Image
# Load Model & Processor
model = SiglipForImageClassification.from_pretrained("shunda012/siglip-deepfake-detector")
processor = AutoImageProcessor.from_pretrained("shunda012/siglip-deepfake-detector")
# Move model to GPU if available
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
# Load and preprocess the image
image = Image.open("path_to_image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt").to(device)
# Predict
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.softmax(logits, dim=-1)
predicted_class_idx = torch.argmax(probs, dim=-1).item()
# Get label
id2label = model.config.id2label
predicted_label = id2label[predicted_class_idx]
confidence = probs[0][predicted_class_idx].item()
print(f"Prediction: {predicted_label} ({confidence:.2%})")
print(f"Probabilities: {probs[0].tolist()}")