prithivMLmods commited on
Commit
f76849c
Β·
verified Β·
1 Parent(s): 229e9cb

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +92 -0
README.md CHANGED
@@ -13,6 +13,20 @@ tags:
13
  - ai
14
  - real
15
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  Classification report:
17
 
18
  precision recall f1-score support
@@ -24,5 +38,83 @@ tags:
24
  accuracy 0.9750 4000
25
  macro avg 0.9759 0.9750 0.9749 4000
26
  weighted avg 0.9759 0.9750 0.9750 4000
 
 
27
 
28
  ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/FhUNkuzKxgs9SmwcvR4yP.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  - ai
14
  - real
15
  ---
16
+ # **AI-vs-Deepfake-vs-Real**
17
+
18
+ AI-vs-Deepfake-vs-Real is an image classification model for differentiating between artificial, deepfake, and real images. It is based on Google's ViT model (`google/vit-base-patch32-224-in21k`).
19
+
20
+ A reasonable number of training samples were used to achieve good efficiency in the final training process and its efficiency metrics. Since this task involves classifying images into three categories (artificial, deepfake, and real), the model was trained accordingly. Future improvements will be made based on the complexity of the task.
21
+
22
+ ```python
23
+ id2label: {
24
+ "0": "Artificial",
25
+ "1": "Deepfake",
26
+ "2": "Real"
27
+ }
28
+ ```
29
+ ```python
30
  Classification report:
31
 
32
  precision recall f1-score support
 
38
  accuracy 0.9750 4000
39
  macro avg 0.9759 0.9750 0.9749 4000
40
  weighted avg 0.9759 0.9750 0.9750 4000
41
+ ```
42
+
43
 
44
  ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/FhUNkuzKxgs9SmwcvR4yP.png)
45
+
46
+
47
+
48
+ # **Inference with Hugging Face Pipeline**
49
+ ```python
50
+ from transformers import pipeline
51
+
52
+ # Load the model
53
+ pipe = pipeline('image-classification', model="prithivMLmods/AI-vs-Deepfake-vs-Real", device=0)
54
+
55
+ # Predict on an image
56
+ result = pipe("path_to_image.jpg")
57
+ print(result)
58
+ ```
59
+
60
+ # **Inference with PyTorch**
61
+ ```python
62
+ from transformers import ViTForImageClassification, ViTImageProcessor
63
+ from PIL import Image
64
+ import torch
65
+
66
+ # Load the model and processor
67
+ model = ViTForImageClassification.from_pretrained("prithivMLmods/AI-vs-Deepfake-vs-Real")
68
+ processor = ViTImageProcessor.from_pretrained("prithivMLmods/AI-vs-Deepfake-vs-Real")
69
+
70
+ # Load and preprocess the image
71
+ image = Image.open("path_to_image.jpg").convert("RGB")
72
+ inputs = processor(images=image, return_tensors="pt")
73
+
74
+ # Perform inference
75
+ with torch.no_grad():
76
+ outputs = model(**inputs)
77
+ logits = outputs.logits
78
+ predicted_class = torch.argmax(logits, dim=1).item()
79
+
80
+ # Map class index to label
81
+ label = model.config.id2label[predicted_class]
82
+ print(f"Predicted Label: {label}")
83
+ ```
84
+
85
+ # **Limitations of AI-vs-Deepfake-vs-Real**
86
+ 1. **Limited Generalization** – The model is trained on specific datasets and may not generalize well to unseen deepfake generation techniques or novel deepfake artifacts.
87
+ 2. **Variability in Deepfake Quality** – Different deepfake creation methods introduce varying levels of noise and artifacts, which may affect model performance.
88
+ 3. **Dependence on Training Data** – The model's accuracy is influenced by the quality and diversity of the training data. Biases in the dataset could lead to misclassification.
89
+ 4. **Resolution Sensitivity** – Performance may degrade when analyzing extremely high- or low-resolution images not seen during training.
90
+ 5. **Potential False Positives/Negatives** – The model may sometimes misclassify artificial, deepfake, or real images, limiting its reliability in critical applications.
91
+ 6. **Lack of Explainability** – Being based on a ViT (Vision Transformer), the decision-making process is less interpretable than traditional models, making it harder to analyze why certain classifications are made.
92
+ 7. **Not a Deepfake Detector** – This model categorizes images but does not specifically determine whether an image is fake; rather, it differentiates between artificial, deepfake, and real images.
93
+
94
+ # **Intended Use of AI-vs-Deepfake-vs-Real**
95
+ - **Quality Assessment for Research** – Used by researchers to analyze and improve deepfake generation methods by assessing output quality.
96
+ - **Dataset Filtering** – Helps filter out low-quality deepfake samples in datasets for better training of deepfake detection models.
97
+ - **Forensic Analysis** – Supports forensic teams in evaluating image authenticity and prioritizing high-quality deepfakes for deeper analysis.
98
+ - **Content Moderation** – Assists social media platforms and content moderation teams in assessing image authenticity before deciding on further actions.
99
+ - **Benchmarking Deepfake Models** – Used to compare and evaluate different deepfake generation models based on their output quality and authenticity.
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+