alrivalda commited on
Commit
0f6d9b7
·
verified ·
1 Parent(s): 109c8cb

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +71 -0
README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - image-classification
4
+ - vision
5
+ - vit
6
+ - deepfake
7
+ - binary-classification
8
+ pipeline_tag: image-classification
9
+ language: en
10
+ license: apache-2.0
11
+ ---
12
+
13
+ # 🧠 Model1-v1-Rival — Deepfake Image Classifier
14
+
15
+ This model is a fine-tuned **Vision Transformer (ViT)** for detecting whether a face image is **REAL** or **FAKE (Deepfake)**.
16
+
17
+ It was trained using a mixed deepfake dataset with augmentations to ensure robustness across manipulation methods and compression artifacts.
18
+
19
+ ---
20
+
21
+ ## 📌 Model Details
22
+
23
+ | Field | Value |
24
+ |-------|-------|
25
+ | Base Model | `google/vit-base-patch16-224-in21k` |
26
+ | Task | Image Classification (Binary) |
27
+ | Labels | `{0: Fake, 1: Real}` |
28
+ | File Format | `safetensors` |
29
+ | Optimizer | AdamW |
30
+ | Epochs | 2 |
31
+ | Learning Rate | `1e-6` |
32
+ | Batch Size | 32 |
33
+
34
+ ---
35
+
36
+ ## 🏷️ Labels
37
+
38
+ The model predicts:
39
+
40
+ | Label | Meaning |
41
+ |-------|---------|
42
+ | `fake` | manipulated / deepfake image |
43
+ | `real` | authentic human face |
44
+
45
+ ---
46
+
47
+ ## 🚀 Usage
48
+
49
+ #### 🔧 With `transformers`
50
+
51
+ ```python
52
+ from transformers import AutoModelForImageClassification, AutoImageProcessor
53
+ from PIL import Image
54
+ import torch
55
+
56
+ model_name = "alrivalda/Model1-v1-Rival"
57
+
58
+ processor = AutoImageProcessor.from_pretrained(model_name)
59
+ model = AutoModelForImageClassification.from_pretrained(model_name)
60
+
61
+ img = Image.open("your_image.jpg")
62
+
63
+ inputs = processor(img, return_tensors="pt")
64
+ outputs = model(**inputs).logits
65
+ probabilities = torch.softmax(outputs, dim=1)
66
+
67
+ pred_id = torch.argmax(probabilities).item()
68
+ label = model.config.id2label[pred_id]
69
+
70
+ print("Prediction:", label)
71
+ print("Confidence:", float(probabilities[0][pred_id]))