Image Classification
Transformers
Safetensors
swin-frequency-hybrid
deepfake-detection
synthetic-image-detection
swin-transformer
frequency-analysis
Instructions to use SadraCoding/SDXL-Deepfake-Detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SadraCoding/SDXL-Deepfake-Detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="SadraCoding/SDXL-Deepfake-Detector") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import SwinFrequencyHybridDetector model = SwinFrequencyHybridDetector.from_pretrained("SadraCoding/SDXL-Deepfake-Detector", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit ·
1824684
1
Parent(s): bd289c2
README Update
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
tags:
|
| 4 |
- image-classification
|
| 5 |
- deepfake-detection
|
|
@@ -40,25 +40,35 @@ The image processor resizes images to 224 × 224, rescales pixel values, and app
|
|
| 40 |
|
| 41 |
The project references the Kaggle 140k Real and Fake Faces collection, commonly described as real face images and StyleGAN-generated faces. This is a narrow face-image domain. It does not establish performance on face swaps, video, SDXL or other unseen generators, or arbitrary images in the wild. The checkpoint does not include enough dataset version, split construction, and run provenance to reproduce or independently validate its reported result.
|
| 42 |
|
| 43 |
-
The checked-in GitHub metrics artifact
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
| 48 |
-
| --- | ---: | ---: |
|
| 49 |
-
| Clean | 93.27% / 93.27% | 93.26% |
|
| 50 |
-
| JPEG quality 50 | 91.30% / 91.30% | 91.25% |
|
| 51 |
-
| 5 × 5 Gaussian blur | 92.86% / 92.86% | 92.85% |
|
| 52 |
-
| Half resolution, resized back | 92.11% / 92.11% | 92.11% |
|
| 53 |
-
| Gaussian noise, σ = 15 | 91.24% / 91.24% | 91.23% |
|
| 54 |
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
Potential dataset shortcuts, identity or duplicate overlap, source-specific artifacts, compression, preprocessing, demographic coverage, and distribution shift can affect predictions. The project is not a universal deepfake detector. See the linked [technical report](https://github.com/SadraCoding/SDXL-Deepfake-Detector/blob/main/REVISED_PROJECT_REPORT.md) and [research protocol](https://github.com/SadraCoding/SDXL-Deepfake-Detector/blob/main/docs/research_protocol.md) for detailed caveats and recommendations for controlled evaluation.
|
| 58 |
|
| 59 |
## Using the checkpoint
|
| 60 |
|
| 61 |
-
This checkpoint uses the project's custom `SwinFrequencyHybridDetector` architecture; it cannot be loaded as a standard `AutoModelForImageClassification` without the custom model code. Clone the GitHub repository
|
| 62 |
|
| 63 |
```bash
|
| 64 |
git clone https://github.com/SadraCoding/SDXL-Deepfake-Detector.git
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-nc-3.0
|
| 3 |
tags:
|
| 4 |
- image-classification
|
| 5 |
- deepfake-detection
|
|
|
|
| 40 |
|
| 41 |
The project references the Kaggle 140k Real and Fake Faces collection, commonly described as real face images and StyleGAN-generated faces. This is a narrow face-image domain. It does not establish performance on face swaps, video, SDXL or other unseen generators, or arbitrary images in the wild. The checkpoint does not include enough dataset version, split construction, and run provenance to reproduce or independently validate its reported result.
|
| 42 |
|
| 43 |
+
The checked-in [GitHub metrics artifact](https://github.com/SadraCoding/SDXL-Deepfake-Detector/blob/main/model/results/metrics.json) records one evaluation on 10,905 images (`device: cuda`, test directory `dataset/test`). There are 5,492 `artificial` examples (ID 0) and 5,413 `human` examples (ID 1). Percentages below are rounded to two decimals. Full and adaptive inference have identical aggregate and per-class classification metrics and confusion matrices for every listed variant, so classification metrics appear once per variant.
|
| 44 |
|
| 45 |
+
| Variant | Accuracy | Weighted P / R / F1 | Macro P / R / F1 | Artificial P / R / F1 | Human P / R / F1 | Confusion matrix (true rows, predicted columns; IDs 0, 1) |
|
| 46 |
+
| --- | ---: | ---: | ---: | ---: | ---: | --- |
|
| 47 |
+
| Clean | 93.27% | 93.58 / 93.27 / 93.26% | 93.60 / 93.24 / 93.25% | 89.97 / 97.51 / 93.59% | 97.23 / 88.97 / 92.92% | `[[5355, 137], [597, 4816]]` |
|
| 48 |
+
| JPEG quality 50 | 91.30% | 92.07 / 91.30 / 91.25% | 92.11 / 91.25 / 91.25% | 86.44 / 98.11 / 91.91% | 97.77 / 84.39 / 90.59% | `[[5388, 104], [845, 4568]]` |
|
| 49 |
+
| Gaussian blur 5 × 5 | 92.86% | 92.89 / 92.86 / 92.85% | 92.89 / 92.85 / 92.85% | 91.80 / 94.23 / 93.00% | 93.98 / 91.46 / 92.71% | `[[5175, 317], [462, 4951]]` |
|
| 50 |
+
| Half resolution, upscaled | 92.11% | 92.14 / 92.11 / 92.11% | 92.14 / 92.10 / 92.11% | 91.21 / 93.34 / 92.26% | 93.07 / 90.87 / 91.96% | `[[5126, 366], [494, 4919]]` |
|
| 51 |
+
| Gaussian noise, σ = 15 | 91.24% | 91.44 / 91.24 / 91.23% | 91.46 / 91.22 / 91.23% | 88.64 / 94.76 / 91.60% | 94.28 / 87.68 / 90.86% | `[[5204, 288], [667, 4746]]` |
|
| 52 |
|
| 53 |
+
P / R / F1 means precision / recall / F1. Confusion matrices use rows for true labels and columns for predicted labels, ordered `artificial` then `human`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
| Variant | Full latency (ms/image) | Adaptive latency (ms/image) | Early-exit rate (full / adaptive) | Speedup (full / adaptive) |
|
| 56 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 57 |
+
| Clean | 6.60 | 6.24 | 0.00% / 99.06% | 1.058× |
|
| 58 |
+
| JPEG quality 50 | 6.63 | 6.27 | 0.00% / 98.73% | 1.058× |
|
| 59 |
+
| Gaussian blur 5 × 5 | 6.66 | 6.30 | 0.00% / 98.56% | 1.057× |
|
| 60 |
+
| Half resolution, upscaled | 6.65 | 6.28 | 0.00% / 98.59% | 1.057× |
|
| 61 |
+
| Gaussian noise, σ = 15 | 6.59 | 6.22 | 0.00% / 98.42% | 1.060× |
|
| 62 |
+
|
| 63 |
+
For clean inputs, the artifact reports mean blur score **628.65**, mean noise score **6.07**, and mean JPEG-50 MAE **3.57**. It does not include these quality diagnostics for the corrupted variants. They are descriptive measurements, not learned quality or authenticity scores.
|
| 64 |
+
|
| 65 |
+
These controlled degradations are not a comprehensive robustness test. The artifact omits dataset revision, split construction, per-source support, GPU model, software versions, checkpoint hash, and threshold-selection procedure. The project Hugging Face page has also displayed a self-reported 97% accuracy, but available evaluation details do not establish comparability with this artifact; do not combine the figures. The repository has not demonstrated that frequency fusion improves performance over a matched Swin-only baseline.
|
| 66 |
|
| 67 |
Potential dataset shortcuts, identity or duplicate overlap, source-specific artifacts, compression, preprocessing, demographic coverage, and distribution shift can affect predictions. The project is not a universal deepfake detector. See the linked [technical report](https://github.com/SadraCoding/SDXL-Deepfake-Detector/blob/main/REVISED_PROJECT_REPORT.md) and [research protocol](https://github.com/SadraCoding/SDXL-Deepfake-Detector/blob/main/docs/research_protocol.md) for detailed caveats and recommendations for controlled evaluation.
|
| 68 |
|
| 69 |
## Using the checkpoint
|
| 70 |
|
| 71 |
+
This checkpoint uses the project's custom `SwinFrequencyHybridDetector` architecture; it cannot be loaded as a standard `AutoModelForImageClassification` without the custom model code. Clone the GitHub repository and install a PyTorch/torchvision build that matches your platform using the [official PyTorch selector](https://pytorch.org/get-started/locally/). Then install the project dependencies and run inference from the `model/` directory:
|
| 72 |
|
| 73 |
```bash
|
| 74 |
git clone https://github.com/SadraCoding/SDXL-Deepfake-Detector.git
|