Update README.md
Browse files
README.md
CHANGED
|
@@ -14,7 +14,7 @@ As generative AI (like SDXL, DALL·E, and Midjourney) becomes more accessible, t
|
|
| 14 |
|
| 15 |
## 🚀 Model Overview
|
| 16 |
|
| 17 |
-
**SDXL-Deepfake-Detector** is a fine-tuned vision transformer that classifies human faces as **
|
| 18 |
|
| 19 |
### ✅ Key Highlights
|
| 20 |
- **Architecture**: Fine-tuned Vision Transformer (ViT) via Hugging Face `transformers`
|
|
@@ -32,6 +32,7 @@ pip install transformers torch pillow
|
|
| 32 |
```
|
| 33 |
### Python Script
|
| 34 |
```python
|
|
|
|
| 35 |
import argparse
|
| 36 |
from transformers import AutoModelForImageClassification, AutoFeatureExtractor
|
| 37 |
from PIL import Image
|
|
@@ -80,4 +81,59 @@ def main():
|
|
| 80 |
|
| 81 |
if __name__ == "__main__":
|
| 82 |
main()
|
| 83 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
## 🚀 Model Overview
|
| 16 |
|
| 17 |
+
**SDXL-Deepfake-Detector** is a fine-tuned vision transformer that classifies human faces as **AI-Generated (0)** or **Real (1)**. Trained on the [140k Real and Fake Faces](https://www.kaggle.com/datasets/xhlulu/140k-real-and-fake-faces) dataset.
|
| 18 |
|
| 19 |
### ✅ Key Highlights
|
| 20 |
- **Architecture**: Fine-tuned Vision Transformer (ViT) via Hugging Face `transformers`
|
|
|
|
| 32 |
```
|
| 33 |
### Python Script
|
| 34 |
```python
|
| 35 |
+
#predict.py
|
| 36 |
import argparse
|
| 37 |
from transformers import AutoModelForImageClassification, AutoFeatureExtractor
|
| 38 |
from PIL import Image
|
|
|
|
| 81 |
|
| 82 |
if __name__ == "__main__":
|
| 83 |
main()
|
| 84 |
+
```
|
| 85 |
+
### How to use
|
| 86 |
+
```bash
|
| 87 |
+
python predict.py --image path/to/image
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## 📊 Performance & Limitations
|
| 91 |
+
|
| 92 |
+
> **Note**: Final test accuracy will be reported after full evaluation. Preliminary results show strong generalization on SDXL- and diffusion-based face forgeries.
|
| 93 |
+
|
| 94 |
+
### Known Limitations
|
| 95 |
+
- Trained primarily on **frontal, well-lit, aligned face crops** — may underperform on:
|
| 96 |
+
- Low-resolution or blurry images
|
| 97 |
+
- Heavily occluded or non-frontal faces
|
| 98 |
+
- GAN-generated faces (e.g., StyleGAN2/3)
|
| 99 |
+
- Label mapping:
|
| 100 |
+
- `0` → `"artificial"` (AI-generated / Deepfake)
|
| 101 |
+
- `1` → `"real"` (authentic human face)
|
| 102 |
+
|
| 103 |
+
> ⚠️ This tool is **not a forensic proof**, but a probabilistic detector. Use responsibly.
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
## 🌱 Philosophy & Ethics
|
| 108 |
+
|
| 109 |
+
This model is open-source because:
|
| 110 |
+
- **Transparency** is essential in the fight against synthetic media.
|
| 111 |
+
- **Accessibility** ensures researchers, journalists, and civil society can audit and use detection tools without gatekeeping.
|
| 112 |
+
- **Privacy matters**: The model runs **entirely offline** — your images never leave your device.
|
| 113 |
+
|
| 114 |
+
As a developer from a vulnerable community, I believe AI safety tools must be **inclusive, ethical, and human-centered** — not just technically accurate.
|
| 115 |
+
|
| 116 |
+
---
|
| 117 |
+
|
| 118 |
+
## 🙌 Acknowledgements
|
| 119 |
+
|
| 120 |
+
- **Dataset**: [140k Real and Fake Faces](https://www.kaggle.com/datasets/xhlulu/140k-real-and-fake-faces) by xhlulu
|
| 121 |
+
- **Framework**: [Hugging Face Transformers](https://huggingface.co/docs/transformers)
|
| 122 |
+
- **Model & Code**: [GitHub Repository](https://github.com/SadraCoding/SDXL-Deepfake-Detector) | [Hugging Face Hub](https://huggingface.co/SADRACODING/SDXL-Deepfake-Detector)
|
| 123 |
+
|
| 124 |
+
---
|
| 125 |
+
|
| 126 |
+
## 📬 How to Contribute
|
| 127 |
+
|
| 128 |
+
I welcome:
|
| 129 |
+
- Bug reports and feature requests (via GitHub Issues)
|
| 130 |
+
- Expanding support to **video deepfakes** or **GAN-generated faces**
|
| 131 |
+
- **Bias/fairness audits** across gender, skin tone, and age
|
| 132 |
+
- Multilingual documentation
|
| 133 |
+
|
| 134 |
+
> 💡 **Tip for researchers**: Fine-tune this model on your domain-specific data using Hugging Face `Trainer`.
|
| 135 |
+
|
| 136 |
+
---
|
| 137 |
+
|
| 138 |
+
> *Built with curiosity, ethics, and a 12GB GPU — because impactful AI doesn’t require a data center, just purpose.*
|
| 139 |
+
> — Sadra Milani Moghaddam
|