File size: 2,945 Bytes
d5009bb | 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 88 89 90 91 | ---
language:
- en
license: mit
tags:
- deepfake-detection
- video-deepfake
- face-forensics
- computer-vision
- gend
- pytorch
datasets:
- faceforensics
pipeline_tag: image-classification
base_model: openai/clip-vit-large-patch14
---
# GenD_CLIP_L_14_FF
State-of-the-art Deepfake Detection model trained on **FaceForensics++ (FF++)** based on the **GenD** framework fine-tuned with **Sharpness-Aware Minimization (SAM)** and **Label Smoothing**.
This model uses **openai/clip-vit-large-patch14** as visual foundation backbone and fine-tunes only the **Layer Normalization parameters** (accounting for only ~0.03% of total parameters) while enforcing a **hyperspherical feature manifold** through L2-normalization and metric learning (Uniformity & Alignment losses).
## ๐ Benchmark Results
| Metric | Score |
|:---|:---:|
| Video AUROC | **94.26%** |
| Video mAP | **93.30%** |
| Video Accuracy | **87.56%** |
| Video EER | **12.44%** |
| Frame AUROC | **90.57%** |
| Frame mAP | **89.14%** |
| Frame Accuracy | **82.91%** |
## ๐ Model Details
- **Training Dataset:** `FaceForensics++ (FF++)` (`FF++`)
- **Visual Backbone:** `openai/clip-vit-large-patch14`
- **Classification Head:** `LinearNorm`
- **Optimizer:** `SAM-AdamW` (SAM $\rho=0.05$, adaptive=True)
- **Loss Formulation:** Cross-Entropy with Label Smoothing (0.1), Uniformity (0.5), Alignment (0.1)
- **Training Epochs:** `30`
- **Batch Size:** `96`
- **Precision:** `bf16-mixed`
- **Learning Rate:** `0.0003`
## ๐ Quickstart & Inference
### 1. Using the Model in Python
```python
import torch
from PIL import Image
from transformers import AutoModel
# Load the model directly from Hugging Face Hub
model = AutoModel.from_pretrained("Ant-One/GenD_CLIP_L_14_FF", trust_remote_code=True)
model.eval()
# Preprocess image crop (aligned face)
image = Image.open("path/to/face_crop.png").convert("RGB")
tensor = model.feature_extractor.preprocess(image).unsqueeze(0)
# Run inference
with torch.no_grad():
logits = model(tensor)
# Output class 0: Real, Output class 1: Fake
fake_prob = logits.softmax(dim=-1)[0, 1].item()
print(f"Deepfake Probability: {fake_prob:.2%}")
```
### 2. Using with `src.hf.modeling_gend`
```python
from src.hf.modeling_gend import GenD
model = GenD.from_pretrained("Ant-One/GenD_CLIP_L_14_FF")
model.eval()
```
## ๐๏ธ Architecture & Training Methodology
The **GenD** method achieves superior cross-dataset generalization by avoiding catastrophic overfitting on manipulation-specific artifacts:
1. **Training on FF++:** Trained on face crops from FaceForensics++ (FF++).
2. **LayerNorm Tuning:** Keeps the visual transformer backbone frozen while updating only normalization scaling and bias terms.
3. **Normalized Linear Head:** Normalizes feature vectors onto a hypersphere before linear projection.
4. **SAM Optimization:** Smooths the loss landscape to find flat minima that resist out-of-distribution domain shifts.
|