Update README.md
Browse files
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
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
## 🚀 Model
|
| 21 |
|
| 22 |
-
|
| 23 |
|
| 24 |
-
### Key Features
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
| 32 |
|
| 33 |
---
|
| 34 |
|
| 35 |
-
## 💻 Usage
|
| 36 |
|
| 37 |
-
|
| 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(
|
| 53 |
-
|
|
|
|
|
|
|
| 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 |
-
|
| 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/)
|