# ouc-yer/sepl-deepfakedetection architecture

> Architecture diagram of the GitHub repository ouc-yer/sepl-deepfakedetection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ouc-yer/sepl-deepfakedetection
- Repository: https://github.com/ouc-yer/sepl-deepfakedetection
- Video tour (about a minute): https://gitdiagram.com/ouc-yer/sepl-deepfakedetection/video

## Overview

DeepfakeBench’s SePL implementation trains and evaluates a face-forgery detector. The principal workflow is dataset sampling and image preparation, SePL prediction and objective computation, then optimization and metric-based evaluation; the included t-SNE script provides a separate feature-analysis workflow. README documents cross-dataset testing and pretrained-weight evaluation, but the supplied tree omits the referenced test entry point and configuration files. Several internal calls are therefore shown only where supported by the excerpts.

Main entry points: [`DeepfakeBench/training/train.py`](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/train.py) (Training entry), [`DeepfakeBench/training/detectors/sepl_detector.py`](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/detectors/sepl_detector.py) (SePL detector), [`DeepfakeBench/training/trainer/trainer.py`](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/trainer/trainer.py) (Trainer), [`DeepfakeBench/training/dataset/abstract_dataset.py`](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/dataset/abstract_dataset.py) (Dataset loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_dataset["Dataset loader"]
  node_augment["Forgery augmentation"]
end

subgraph group_model["SePL detection"]
  node_detector["SePL detector<br/>[sepl_detector.py]"]
  node_modules["Prompt modules<br/>[sepl_modules.py]"]
  node_losses["Alignment objectives<br/>[sepl_loss.py]"]
end

subgraph group_learning["Training and evaluation"]
  node_train_entry["Training entry<br/>[train.py]"]
  node_trainer["Trainer<br/>[trainer.py]"]
  node_optimizers["Optimizers"]
  node_metrics["Detection metrics"]
  node_logger["Training logger<br/>[logger.py]"]
end

subgraph group_analysis["Feature analysis"]
  node_tsne["Feature analysis<br/>[tsne_sepl.py]"]
end

node_researcher(("Researcher"))
node_datasets[("Face datasets")]
node_clip["Pretrained CLIP"]

node_researcher -->|"starts training"| node_train_entry
node_datasets -->|"provides samples"| node_dataset
node_train_entry -->|"prepares loader"| node_dataset
node_dataset -->|"uses transforms"| node_augment
node_dataset -->|"yields batches"| node_train_entry
node_train_entry -->|"constructs model"| node_detector
node_detector -->|"uses prompts"| node_modules
node_detector -->|"computes objectives"| node_losses
node_detector -.->|"loads pretrained model"| node_clip
node_train_entry -->|"starts training"| node_trainer
node_train_entry -->|"selects optimizer"| node_optimizers
node_trainer -->|"runs batches"| node_detector
node_trainer -->|"updates parameters"| node_optimizers
node_trainer -->|"records scores"| node_metrics
node_trainer -->|"logs progress"| node_logger
node_researcher -->|"requests analysis"| node_tsne
node_tsne -->|"prepares test loaders"| node_dataset
node_tsne -->|"extracts features"| node_detector

click node_train_entry "https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/train.py"
click node_dataset "https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/dataset/abstract_dataset.py"
click node_augment "https://github.com/ouc-yer/sepl-deepfakedetection/tree/main/DeepfakeBench/training/dataset"
click node_detector "https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/detectors/sepl_detector.py"
click node_modules "https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/detectors/sepl_modules.py"
click node_losses "https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/loss/sepl_loss.py"
click node_trainer "https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/trainer/trainer.py"
click node_optimizers "https://github.com/ouc-yer/sepl-deepfakedetection/tree/main/DeepfakeBench/training/optimizor"
click node_metrics "https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/metrics/base_metrics_class.py"
click node_logger "https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/logger.py"
click node_tsne "https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/analysis/tsne_sepl.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset,node_augment toneBlue
class node_detector,node_modules,node_losses,node_datasets toneAmber
class node_train_entry,node_trainer,node_optimizers,node_metrics,node_logger toneMint
class node_tsne toneRose
class node_researcher,node_clip toneIndigo
```

## Components

### Data preparation

- [Dataset loader](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/dataset/abstract_dataset.py): `DeepfakeBench/training/dataset/abstract_dataset.py`
- [Forgery augmentation](https://github.com/ouc-yer/sepl-deepfakedetection/tree/main/DeepfakeBench/training/dataset): `DeepfakeBench/training/dataset`

### SePL detection

- [SePL detector](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/detectors/sepl_detector.py): `DeepfakeBench/training/detectors/sepl_detector.py`
- [Prompt modules](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/detectors/sepl_modules.py): `DeepfakeBench/training/detectors/sepl_modules.py`
- [Alignment objectives](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/loss/sepl_loss.py): `DeepfakeBench/training/loss/sepl_loss.py`

### Training and evaluation

- [Training entry](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/train.py): `DeepfakeBench/training/train.py`
- [Trainer](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/trainer/trainer.py): `DeepfakeBench/training/trainer/trainer.py`
- [Optimizers](https://github.com/ouc-yer/sepl-deepfakedetection/tree/main/DeepfakeBench/training/optimizor): `DeepfakeBench/training/optimizor`
- [Detection metrics](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/metrics/base_metrics_class.py): `DeepfakeBench/training/metrics/base_metrics_class.py`
- [Training logger](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/training/logger.py): `DeepfakeBench/training/logger.py`

### Feature analysis

- [Feature analysis](https://github.com/ouc-yer/sepl-deepfakedetection/blob/main/DeepfakeBench/analysis/tsne_sepl.py): `DeepfakeBench/analysis/tsne_sepl.py`

### Other components

- **Researcher**
- **Face datasets**
- **Pretrained CLIP**

## Connections

- Researcher → Training entry: starts training
- Face datasets → Dataset loader: provides samples
- Training entry → Dataset loader: prepares loader
- Dataset loader → Forgery augmentation: uses transforms
- Dataset loader → Training entry: yields batches
- Training entry → SePL detector: constructs model
- SePL detector → Prompt modules: uses prompts
- SePL detector → Alignment objectives: computes objectives
- SePL detector → Pretrained CLIP: loads pretrained model
- Training entry → Trainer: starts training
- Training entry → Optimizers: selects optimizer
- Trainer → SePL detector: runs batches
- Trainer → Optimizers: updates parameters
- Trainer → Detection metrics: records scores
- Trainer → Training logger: logs progress
- Researcher → Feature analysis: requests analysis
- Feature analysis → Dataset loader: prepares test loaders
- Feature analysis → SePL detector: extracts features
