SadraCoding commited on
Commit
a754858
·
verified ·
1 Parent(s): 2ded6cd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +38 -26
README.md CHANGED
@@ -1,47 +1,47 @@
1
  ---
2
  tags:
3
- - image-classification
4
- - computer-vision
5
- - deepfake-detection
6
- - fine-tuned
7
  license: mit
8
  datasets:
9
- - 140k-real-and-fake-faces
10
  metrics:
11
- - accuracy
12
  ---
13
 
14
  # 🎭 SDXL-Deepfake-Detector
15
 
16
- **A high-performance deep learning model fine-tuned for the binary classification of real vs. fake faces, designed for images potentially generated by advanced synthesis models.**
17
 
18
- This project was developed by **[Sadra Milani Moghaddam](https://sadramilani.ir/)**.
19
 
20
- ## 🚀 Model Description
21
 
22
- The **SDXL-Deepfake-Detector** is a specialized image classification model engineered to distinguish between authentic human faces and synthetically generated (deepfake) faces. The model was trained using **transfer learning** principles to provide robust and reliable detection.
23
 
24
- ### Key Features & Performance
25
 
26
- | Metric | Value | Notes |
27
- | :--- | :--- | :--- |
28
- | **Task** | Binary Image Classification | Real Face (0) vs. Deepfake Face (1) |
29
- | **Dataset** | [140K Real and Fake Faces (Kaggle)](https://www.kaggle.com/datasets/xhlulu/140k-real-and-fake-faces) | A large dataset containing 140,000 high-quality images. |
30
- | **Test Accuracy** | **0.91** (91%) | Achieved on the independent test set. |
31
- | **Hardware** | NVIDIA RTX 3060 (12GB VRAM) | Training performed on suitable hardware for efficiency. |
 
32
 
33
  ---
34
 
35
- ## 💻 Usage with Hugging Face Transformers
36
 
37
- To load and use the model in your Python environment, use the standard `transformers` and `PIL` libraries.
38
 
39
  ### Installation
40
 
41
  ```bash
42
  pip install transformers torch pillow
43
  ```
44
-
45
  ```python
46
  import argparse
47
  from transformers import AutoModelForImageClassification, AutoFeatureExtractor
@@ -49,11 +49,12 @@ from PIL import Image
49
  import torch
50
 
51
  def main():
52
- parser = argparse.ArgumentParser(description="Predict image class using fine-tuned model from Hugging Face Hub")
53
- parser.add_argument("--image", type=str, required=True, help="Path to the input image")
 
 
54
  args = parser.parse_args()
55
 
56
- # Load model and feature extractor directly from Hugging Face Hub
57
  model_name = "SADRACODING/SDXL-Deepfake-Detector"
58
  model = AutoModelForImageClassification.from_pretrained(model_name)
59
  feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
@@ -78,6 +79,17 @@ def main():
78
  if __name__ == "__main__":
79
  main()
80
  ```
81
- ---
82
- license: mit
83
- ---
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  tags:
3
+ - image-classification
4
+ - computer-vision
5
+ - deepfake-detection
6
+ - fine-tuned
7
  license: mit
8
  datasets:
9
+ - 140k-real-and-fake-faces
10
  metrics:
11
+ - accuracy
12
  ---
13
 
14
  # 🎭 SDXL-Deepfake-Detector
15
 
16
+ **A high-performance deep learning model for binary classification of real versus synthetically generated (deepfake) human faces.**
17
 
18
+ Developed by **[Sadra Milani Moghaddam](https://sadramilani.ir/)**, this model is designed to detect faces generated by state-of-the-art synthesis models—including those based on SDXL and similar architectures—while maintaining strong generalization across diverse image sources.
19
 
20
+ ## 🚀 Model Overview
21
 
22
+ **SDXL-Deepfake-Detector** is a fine-tuned image classification model built using transfer learning. It leverages a pre-trained vision backbone and is optimized specifically for distinguishing authentic human faces from AI-generated forgeries.
23
 
24
+ ### Key Features
25
 
26
+ - **Task**: Binary image classification (Real = 0, Deepfake = 1)
27
+ - **Training Dataset**: [140k Real and Fake Faces (Kaggle)](https://www.kaggle.com/datasets/xhlulu/140k-real-and-fake-faces)
28
+ - **Test Accuracy**: **91%** on an independent hold-out test set
29
+ - **Hardware Used for Training**: NVIDIA RTX 3060 (12GB VRAM)
30
+ - **License**: [MIT](https://opensource.org/licenses/MIT)
31
+
32
+ This model is suitable for integration into media forensics pipelines, content moderation systems, or any application requiring reliable deepfake detection at the image level.
33
 
34
  ---
35
 
36
+ ## 💻 Usage
37
 
38
+ You can easily load and run inference with this model using the Hugging Face `transformers` library.
39
 
40
  ### Installation
41
 
42
  ```bash
43
  pip install transformers torch pillow
44
  ```
 
45
  ```python
46
  import argparse
47
  from transformers import AutoModelForImageClassification, AutoFeatureExtractor
 
49
  import torch
50
 
51
  def main():
52
+ parser = argparse.ArgumentParser(
53
+ description="Classify an image as 'Real' or 'Deepfake' using the SDXL-Deepfake-Detector."
54
+ )
55
+ parser.add_argument("--image", type=str, required=True, help="Path to the input image file")
56
  args = parser.parse_args()
57
 
 
58
  model_name = "SADRACODING/SDXL-Deepfake-Detector"
59
  model = AutoModelForImageClassification.from_pretrained(model_name)
60
  feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
 
79
  if __name__ == "__main__":
80
  main()
81
  ```
82
+
83
+ ```bash
84
+ python predict.py --image path/to/face_image.jpg
85
+ ```
86
+ ## 📄 License
87
+
88
+ This model is released under the [MIT License](https://opensource.org/licenses/MIT), allowing for both commercial and non-commercial use with proper attribution.
89
+
90
+ ## 🙌 Acknowledgements
91
+
92
+ - **Dataset**: [140k Real and Fake Faces](https://www.kaggle.com/datasets/xhlulu/140k-real-and-fake-faces) by xhlulu
93
+ - **Framework**: [Hugging Face Transformers](https://huggingface.co/docs/transformers)
94
+ - **Github**:
95
+ - **Developer**: [Sadra Milani Moghaddam](https://sadramilani.ir/)