prithivMLmods commited on
Commit
8a3d50f
Β·
verified Β·
1 Parent(s): c4de1d3

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +99 -0
README.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - prithivMLmods/AI-vs-Deepfake-vs-Real
5
+ language:
6
+ - en
7
+ base_model:
8
+ - prithivMLmods/AI-vs-Deepfake-vs-Real
9
+ pipeline_tag: image-classification
10
+ library_name: transformers
11
+ tags:
12
+ - deepfake
13
+ - ai
14
+ - real
15
+ ---
16
+ ![kkk.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/bXfKBT3LQkbeLzPCBHTGT.png)
17
+
18
+ # **AI-vs-Deepfake-vs-Real-ONNX**
19
+
20
+ 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`).
21
+
22
+ 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.
23
+
24
+ ```python
25
+ id2label: {
26
+ "0": "Artificial",
27
+ "1": "Deepfake",
28
+ "2": "Real"
29
+ }
30
+ ```
31
+ ```python
32
+ Classification report:
33
+
34
+ precision recall f1-score support
35
+
36
+ Artificial 0.9897 0.9347 0.9614 1333
37
+ Deepfake 0.9409 0.9910 0.9653 1333
38
+ Real 0.9970 0.9993 0.9981 1334
39
+
40
+ accuracy 0.9750 4000
41
+ macro avg 0.9759 0.9750 0.9749 4000
42
+ weighted avg 0.9759 0.9750 0.9750 4000
43
+ ```
44
+
45
+
46
+ ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/FhUNkuzKxgs9SmwcvR4yP.png)
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.