Upload 4 files
Browse files- README.md +22 -0
- config.json +44 -0
- label_map.json +4 -0
- preprocess.json +16 -0
README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- vision-transformer
|
| 5 |
+
- deepfake-detection
|
| 6 |
+
- image-classification
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# DeiT Base Distilled – DeepFakeDetector
|
| 10 |
+
|
| 11 |
+
Data-efficient Image Transformer (DeiT-B/16) fine-tuned for binary deepfake detection. This model utilizes distillation to improve performance and efficiency.
|
| 12 |
+
|
| 13 |
+
- Retrained using a mix of OpenFake, WildFake, Dragon, and manual images (with a focus on classifying real images)
|
| 14 |
+
|
| 15 |
+
## Labels
|
| 16 |
+
|
| 17 |
+
- **0**: real
|
| 18 |
+
- **1**: fake
|
| 19 |
+
|
| 20 |
+
## Output
|
| 21 |
+
|
| 22 |
+
- **prob_fake** ∈ [0, 1] (via softmax or sigmoid)
|
config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_name": "deit_base_distilled_patch16_224",
|
| 3 |
+
"library": "timm",
|
| 4 |
+
"input_size": 224,
|
| 5 |
+
"num_classes": 2,
|
| 6 |
+
"class_mapping": {
|
| 7 |
+
"0": "real",
|
| 8 |
+
"1": "fake"
|
| 9 |
+
},
|
| 10 |
+
"distilled": true,
|
| 11 |
+
"logits_handling": {
|
| 12 |
+
"mode": "first",
|
| 13 |
+
"description": "During training, model returns tuple (logits, dist_logits). Use outputs[0] for predictions. During eval with model.eval(), single tensor is returned."
|
| 14 |
+
},
|
| 15 |
+
"normalization": {
|
| 16 |
+
"scheme": "imagenet",
|
| 17 |
+
"mean": [0.485, 0.456, 0.406],
|
| 18 |
+
"std": [0.229, 0.224, 0.225]
|
| 19 |
+
},
|
| 20 |
+
"head": {
|
| 21 |
+
"architecture": [
|
| 22 |
+
{"type": "LayerNorm", "features": 768},
|
| 23 |
+
{"type": "Linear", "in_features": 768, "out_features": 512},
|
| 24 |
+
{"type": "GELU"},
|
| 25 |
+
{"type": "Dropout", "p": 0.2},
|
| 26 |
+
{"type": "Linear", "in_features": 512, "out_features": 2}
|
| 27 |
+
],
|
| 28 |
+
"note": "Custom MLP head replaces both model.head and model.head_dist (shared weights)"
|
| 29 |
+
},
|
| 30 |
+
"training": {
|
| 31 |
+
"optimizer": "AdamW",
|
| 32 |
+
"learning_rates": {
|
| 33 |
+
"backbone": 2e-5,
|
| 34 |
+
"head": 5e-5
|
| 35 |
+
},
|
| 36 |
+
"weight_decay": 1e-4,
|
| 37 |
+
"gradient_clipping": {
|
| 38 |
+
"max_norm": 1.0
|
| 39 |
+
},
|
| 40 |
+
"epochs": 2,
|
| 41 |
+
"batch_size": 16,
|
| 42 |
+
"criterion": "CrossEntropyLoss"
|
| 43 |
+
}
|
| 44 |
+
}
|
label_map.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"0": "real",
|
| 3 |
+
"1": "fake"
|
| 4 |
+
}
|
preprocess.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"input_size": 224,
|
| 3 |
+
"interpolation": "bicubic",
|
| 4 |
+
"normalize": {
|
| 5 |
+
"mean": [
|
| 6 |
+
0.485,
|
| 7 |
+
0.456,
|
| 8 |
+
0.406
|
| 9 |
+
],
|
| 10 |
+
"std": [
|
| 11 |
+
0.229,
|
| 12 |
+
0.224,
|
| 13 |
+
0.225
|
| 14 |
+
]
|
| 15 |
+
}
|
| 16 |
+
}
|