File size: 1,624 Bytes
0f6d9b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
tags:
- image-classification
- vision
- vit
- deepfake
- binary-classification
pipeline_tag: image-classification
language: en
license: apache-2.0
---

# 🧠 Model1-v1-Rival — Deepfake Image Classifier

This model is a fine-tuned **Vision Transformer (ViT)** for detecting whether a face image is **REAL** or **FAKE (Deepfake)**.

It was trained using a mixed deepfake dataset with augmentations to ensure robustness across manipulation methods and compression artifacts.

---

## 📌 Model Details

| Field | Value |
|-------|-------|
| Base Model | `google/vit-base-patch16-224-in21k` |
| Task | Image Classification (Binary) |
| Labels | `{0: Fake, 1: Real}` |
| File Format | `safetensors` |
| Optimizer | AdamW |
| Epochs | 2 |
| Learning Rate | `1e-6` |
| Batch Size | 32 |

---

## 🏷️ Labels

The model predicts:

| Label | Meaning |
|-------|---------|
| `fake` | manipulated / deepfake image |
| `real` | authentic human face |

---

## 🚀 Usage

#### 🔧 With `transformers`

```python
from transformers import AutoModelForImageClassification, AutoImageProcessor
from PIL import Image
import torch

model_name = "alrivalda/Model1-v1-Rival"

processor = AutoImageProcessor.from_pretrained(model_name)
model = AutoModelForImageClassification.from_pretrained(model_name)

img = Image.open("your_image.jpg")

inputs = processor(img, return_tensors="pt")
outputs = model(**inputs).logits
probabilities = torch.softmax(outputs, dim=1)

pred_id = torch.argmax(probabilities).item()
label = model.config.id2label[pred_id]

print("Prediction:", label)
print("Confidence:", float(probabilities[0][pred_id]))