Views
No views yet
google/vit-base-patch16-224-in21k model (specifically initialized from prithivMLmods/Deep-Fake-Detector-v2-Model) to classify images as either "Real" or "Fake".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, and RandomHorizontalFlip to improve model generalization.google/vit-base-patch16-224-in21kprithivMLmods/Deep-Fake-Detector-v2-Modelquery, valueOpenRL/DeepFakeFace. A balanced subset of 12,000 images was curated using a custom selection script (select_dataset.py).| 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 |
Trainer API.

1# Use a pipeline as a high-level helper
2from transformers import pipeline
3
4# Load the model
5pipe = pipeline("image-classification", model="shunda012/vit-deepfake-detector")
6
7# Predict on an image
8result = pipe("path_to_image.jpg")
9print(result)1from transformers import ViTForImageClassification, ViTImageProcessor
2import torch
3from PIL import Image
4
5# Load Base Model & processor
6model = ViTForImageClassification.from_pretrained("shunda012/vit-deepfake-detector")
7processor = ViTImageProcessor.from_pretrained("shunda012/vit-deepfake-detector")
8
9# Load and preprocess the image
10image = Image.open("path_to_image.jpg").convert("RGB")
11inputs = processor(images=image, return_tensors="pt")
12
13# Predict
14with torch.no_grad():
15 outputs = model(**inputs)
16 logits = outputs.logits
17 probs = torch.softmax(logits, dim=-1)
18 predicted_class = torch.argmax(probs, dim=-1).item()
19
20# Print probabilities for each class
21print(f"Fake Prob: {probs[0][0]:.2f}, Real Prob: {probs[0][1]:.2f}")
22
23# Map class index to label
24label = model.config.id2label[predicted_class]
25print(f"Predicted Label: {label}")