File size: 2,284 Bytes
796428c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d878216
796428c
d878216
796428c
d878216
796428c
d878216
 
 
 
 
 
 
796428c
d878216
796428c
 
d878216
796428c
 
 
d878216
 
 
 
796428c
d878216
 
 
796428c
d878216
796428c
d878216
796428c
 
d878216
 
 
796428c
d878216
 
 
 
 
 
 
 
 
796428c
d878216
 
796428c
d878216
796428c
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
---
license: apache-2.0
tags:
- deepfake-detection
- multimodal
- image-classification
- text-classification
- ensemble
- gradcam
- explainability
datasets:
- Hemg/deepfake-and-real-images
- artem9k/ai-text-detection-pile
pipeline_tag: image-classification
---

# 🕵️ Multimodal Deepfake Detection Model

Modèle d'ensemble multimodal pour détecter les contenus générés par IA (images, vidéos, texte) avec explicabilité GradCAM.

## 🏗️ Architecture

```
Visual Branch    EfficientNet-B0/B4  ──┐
                                       ├──► Fusion pondérée ──► Confidence [0-1]
Text Branch      RoBERTa-base         ──┘

               GradCAM Heatmap (explicabilité)
```

## 🚀 Utilisation Rapide

```python
from inference import load_model, classify_image, classify_text, classify_multimodal

model, config = load_model('multimodal_ensemble.pt', device='cuda')

# Image + GradCAM
result = classify_image(model, 'face.jpg', return_gradcam=True)
print(f"{result['prediction']} — confidence: {result['confidence']:.2%}")
# result['gradcam'] → heatmap (224, 224)

# Texte
result = classify_text(model, 'Cet essai analyse les impacts...')
print(f"{result['prediction']} — confidence: {result['confidence']:.2%}")

# Multimodal (image + texte)
result = classify_multimodal(model, image_path_or_pil='face.jpg', text='Caption...')
print(f"Fusion: {result['prediction']} — poids: {result['fusion_weights']}")
```

## 📊 Jeux de Données
- **Visuel**: [Hemg/deepfake-and-real-images](https://huggingface.co/datasets/Hemg/deepfake-and-real-images) — 528K images
- **Texte**: [artem9k/ai-text-detection-pile](https://huggingface.co/datasets/artem9k/ai-text-detection-pile) — 1.88GB

## 📁 Fichiers
| Fichier | Description |
|---------|-------------|
| `model.py` | Architecture complète |
| `preprocessing.py` | Pipeline de données |
| `inference.py` | API d'inférence |
| `train.py` / `train_optimised.py` | Scripts d'entraînement |
| `multimodal_ensemble.pt` | Checkpoint principal |
| `gradcam_examples/` | Visualisations d'explicabilité |

## 🔗 Space de Démo
[alianassmaaa/multimodal-deepfake-space](https://huggingface.co/spaces/alianassmaaa/multimodal-deepfake-space)

## 📄 Licence
Apache-2.0