# sclbd/deepfakebench architecture

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

- Interactive diagram: https://gitdiagram.com/sclbd/deepfakebench
- Repository: https://github.com/sclbd/deepfakebench

## Overview

DeepfakeBench is a unified deepfake-detection benchmark: the principal workflow prepares and standardizes datasets, trains or evaluates a selected detector, and reports comparable metrics. Its runtime spans preprocessing, data loading and augmentation, detector/model implementations, training, and evaluation; analysis scripts support additional result inspection. The README documents the integrated workflow and capabilities. Some connections below are based on README statements or SOURCE INDEX references; unsampled implementations and their detailed call paths are not assumed.

Main entry points: [`training/detectors`](https://github.com/sclbd/deepfakebench/tree/main/training/detectors) (Detector methods), [`training/train.py`](https://github.com/sclbd/deepfakebench/blob/main/training/train.py) (Training entry), [`training/trainer/trainer.py`](https://github.com/sclbd/deepfakebench/blob/main/training/trainer/trainer.py) (Training and inference), [`training/dataset/abstract_dataset.py`](https://github.com/sclbd/deepfakebench/blob/main/training/dataset/abstract_dataset.py) (Dataset loading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_preprocess["Preprocess data<br/>[preprocess.py]"]
  node_rearrange["Rearrange datasets<br/>[rearrange.py]"]
  node_dataset["Dataset loading"]
  node_augmentation["Augmentation<br/>[albu.py]"]
  node_specialdata["Specialized datasets"]
end

subgraph group_detection["Detection models"]
  node_detectors["Detector methods"]
  node_video["Video architectures"]
  node_videohelpers["Video model helpers"]
  node_networks["Neural networks"]
  node_components["Model components"]
end

subgraph group_learning["Training and evaluation"]
  node_trainentry["Training entry<br/>[train.py]"]
  node_trainer["Training and inference<br/>[trainer.py]"]
  node_losses["Training losses"]
  node_optimizers["Optimization"]
  node_metrics["Evaluation metrics"]
end

subgraph group_insights["Results analysis"]
  node_analysis["Result analysis"]
end

node_engineer(("Benchmark user"))

node_engineer -->|"prepares data"| node_preprocess
node_engineer -->|"runs benchmark"| node_trainentry
node_preprocess -->|"precedes rearrangement"| node_rearrange
node_rearrange -->|"standardizes input"| node_dataset
node_dataset -->|"uses transforms"| node_augmentation
node_dataset -.->|"supports variants"| node_specialdata
node_trainentry -->|"builds loaders"| node_dataset
node_trainentry -->|"selects detector"| node_detectors
node_trainentry -->|"starts training"| node_trainer
node_trainer -->|"computes metrics"| node_metrics
node_trainer -.->|"optimizes losses"| node_losses
node_trainer -.->|"updates weights"| node_optimizers
node_detectors -.->|"uses architectures"| node_networks
node_detectors -.->|"uses components"| node_components
node_video -->|"builds from"| node_videohelpers
node_detectors -.->|"includes video models"| node_video
node_metrics -.->|"reports results"| node_analysis
node_engineer -.->|"explores results"| node_analysis

click node_preprocess "https://github.com/sclbd/deepfakebench/blob/main/preprocessing/preprocess.py"
click node_rearrange "https://github.com/sclbd/deepfakebench/blob/main/preprocessing/rearrange.py"
click node_dataset "https://github.com/sclbd/deepfakebench/blob/main/training/dataset/abstract_dataset.py"
click node_augmentation "https://github.com/sclbd/deepfakebench/blob/main/training/dataset/albu.py"
click node_specialdata "https://github.com/sclbd/deepfakebench/tree/main/training/dataset"
click node_detectors "https://github.com/sclbd/deepfakebench/tree/main/training/detectors"
click node_video "https://github.com/sclbd/deepfakebench/blob/main/training/detectors/utils/slowfast/models/video_model_builder.py"
click node_videohelpers "https://github.com/sclbd/deepfakebench/tree/main/training/detectors/utils/slowfast/models"
click node_networks "https://github.com/sclbd/deepfakebench/tree/main/training/networks"
click node_components "https://github.com/sclbd/deepfakebench/tree/main/training/lib/component"
click node_trainentry "https://github.com/sclbd/deepfakebench/blob/main/training/train.py"
click node_trainer "https://github.com/sclbd/deepfakebench/blob/main/training/trainer/trainer.py"
click node_losses "https://github.com/sclbd/deepfakebench/tree/main/training/loss"
click node_optimizers "https://github.com/sclbd/deepfakebench/tree/main/training/optimizor"
click node_metrics "https://github.com/sclbd/deepfakebench/blob/main/training/metrics/base_metrics_class.py"
click node_analysis "https://github.com/sclbd/deepfakebench/tree/main/analysis"

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_preprocess,node_rearrange,node_dataset,node_augmentation,node_specialdata,node_engineer toneBlue
class node_detectors,node_video,node_videohelpers,node_networks,node_components toneAmber
class node_trainentry,node_trainer,node_losses,node_optimizers,node_metrics toneMint
class node_analysis toneRose
```

## Components

### Data preparation

- [Preprocess data](https://github.com/sclbd/deepfakebench/blob/main/preprocessing/preprocess.py): `preprocessing/preprocess.py`
- [Rearrange datasets](https://github.com/sclbd/deepfakebench/blob/main/preprocessing/rearrange.py): `preprocessing/rearrange.py`
- [Dataset loading](https://github.com/sclbd/deepfakebench/blob/main/training/dataset/abstract_dataset.py): `training/dataset/abstract_dataset.py`
- [Augmentation](https://github.com/sclbd/deepfakebench/blob/main/training/dataset/albu.py): `training/dataset/albu.py`
- [Specialized datasets](https://github.com/sclbd/deepfakebench/tree/main/training/dataset): `training/dataset`

### Detection models

- [Detector methods](https://github.com/sclbd/deepfakebench/tree/main/training/detectors): `training/detectors`
- [Video architectures](https://github.com/sclbd/deepfakebench/blob/main/training/detectors/utils/slowfast/models/video_model_builder.py): `training/detectors/utils/slowfast/models/video_model_builder.py`
- [Video model helpers](https://github.com/sclbd/deepfakebench/tree/main/training/detectors/utils/slowfast/models): `training/detectors/utils/slowfast/models`
- [Neural networks](https://github.com/sclbd/deepfakebench/tree/main/training/networks): `training/networks`
- [Model components](https://github.com/sclbd/deepfakebench/tree/main/training/lib/component): `training/lib/component`

### Training and evaluation

- [Training entry](https://github.com/sclbd/deepfakebench/blob/main/training/train.py): `training/train.py`
- [Training and inference](https://github.com/sclbd/deepfakebench/blob/main/training/trainer/trainer.py): `training/trainer/trainer.py`
- [Training losses](https://github.com/sclbd/deepfakebench/tree/main/training/loss): `training/loss`
- [Optimization](https://github.com/sclbd/deepfakebench/tree/main/training/optimizor): `training/optimizor`
- [Evaluation metrics](https://github.com/sclbd/deepfakebench/blob/main/training/metrics/base_metrics_class.py): `training/metrics/base_metrics_class.py`

### Results analysis

- [Result analysis](https://github.com/sclbd/deepfakebench/tree/main/analysis): `analysis`

### Other components

- **Benchmark user**

## Connections

- Benchmark user → Preprocess data: prepares data
- Benchmark user → Training entry: runs benchmark
- Preprocess data → Rearrange datasets: precedes rearrangement
- Rearrange datasets → Dataset loading: standardizes input
- Dataset loading → Augmentation: uses transforms (evidence: `training/dataset/abstract_dataset.py`)
- Dataset loading → Specialized datasets: supports variants (evidence: `training/dataset/abstract_dataset.py`)
- Training entry → Dataset loading: builds loaders (evidence: `training/train.py`)
- Training entry → Detector methods: selects detector (evidence: `training/train.py`)
- Training entry → Training and inference: starts training (evidence: `training/train.py`)
- Training and inference → Evaluation metrics: computes metrics (evidence: `training/trainer/trainer.py`)
- Training and inference → Training losses: optimizes losses
- Training and inference → Optimization: updates weights
- Detector methods → Neural networks: uses architectures
- Detector methods → Model components: uses components
- Video architectures → Video model helpers: builds from (evidence: `training/detectors/utils/slowfast/models/video_model_builder.py`)
- Detector methods → Video architectures: includes video models (evidence: `training/detectors/utils/slowfast/models/video_model_builder.py`)
- Evaluation metrics → Result analysis: reports results
- Benchmark user → Result analysis: explores results
