File size: 2,477 Bytes
e12f7cd
 
 
 
 
 
4bc4ab7
 
e12f7cd
 
 
 
4bc4ab7
 
 
e12f7cd
 
 
4bc4ab7
e12f7cd
4bc4ab7
 
e12f7cd
4bc4ab7
e12f7cd
4bc4ab7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e12f7cd
 
 
 
 
4bc4ab7
 
e12f7cd
 
 
4bc4ab7
e12f7cd
 
 
4bc4ab7
 
 
 
e12f7cd
 
 
 
 
4bc4ab7
 
 
e12f7cd
4bc4ab7
 
e12f7cd
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
license: mit
tags:
- deepfake-detection
- computer-vision
- efficientnet
- xai
- explainable-ai
---

# XADE Deepfake Detector

EfficientNet-B4 model trained for deepfake detection as part of the XADE
(eXplainable Automated Deepfake Evaluation) thesis project at Jönköping
University, 2026.

## Model Details

- **Architecture:** EfficientNet-B4 with custom two-layer classifier head
- **Task:** Binary classification (real vs. fake faces)
- **Training:** Progressive mixed training across 4 manipulation types
- **Final checkpoint:** Run 4 (140k + CIPLAB + FF++ + Celeb-DF)

## Cross-Dataset Performance (AUC-ROC)

| Dataset | Manipulation Type | AUC |
|---|---|---|
| 140k Real-Fake (training dist.) | GAN / StyleGAN synthesis | 0.9992 |
| Fake-Vs-Real Hard | StyleGAN2 harder cases | 0.8948 |
| FF++ derived | Neural face swap | 0.8789 |
| CIPLAB | Photoshop manipulation | 0.7563 |
| Celeb-DF v2 | High-quality face swap | 0.8049 |

## Training Details

- **Base dataset:** 140k Real and Fake Faces (StyleGAN-generated)
- **Additional training data:** CIPLAB (~960 images), FF++ derived
  (~1500 frames), Celeb-DF v2 (~1500 images)
- **Training samples:** 100,000 per run (sampled from combined pool)
- **Epochs:** 10 (early stopping patience 7)
- **Optimizer:** AdamW with differential learning rates
  (backbone: 1e-4, classifier: 1e-3)
- **Batch size:** 64
- **Validation accuracy:** 98.51%

## Architecture
```
EfficientNet-B4 (ImageNet pretrained, last 30% unfrozen)
└── Custom classifier head:
    Dropout(0.5)
    Linear(in_features → 512)
    ReLU
    BatchNorm1d(512)
    Dropout(0.4)
    Linear(512 → 2)
```

## Usage
```python
import torch
from huggingface_hub import hf_hub_download
from torchvision.models import efficientnet_b4
import torch.nn as nn

# Download model
model_path = hf_hub_download(
    repo_id="viktorahnstrom/xade-deepfake-detector",
    filename="best_model.pt"
)

# Load checkpoint
checkpoint = torch.load(model_path, map_location="cpu", weights_only=False)
print(f"Trained for {checkpoint['epoch']} epochs")
print(f"Classes: {checkpoint['class_names']}")  # ['fake', 'real']
```

## Citation
```bibtex
@misc{xade2026,
  author = {Viktor Ahnström and Viktor Carlsson},
  title = {XADE: Cross-Platform Explainable Deepfake Detection
           Using Vision-Language Models},
  year = {2026},
  institution = {Jönköping University},
  howpublished = {\url{https://huggingface.co/viktorahnstrom/xade-deepfake-detector}}
}
```