# setsuna25th3/graduation-thesis architecture

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

- Interactive diagram: https://gitdiagram.com/setsuna25th3/graduation-thesis
- Repository: https://github.com/setsuna25th3/graduation-thesis

## Overview

This is an image-based deepfake detection application. Its primary workflow scans an image folder, loads the selected GenConViT inference mode and checkpoint, classifies images, computes metrics when folder names reveal ground truth, and exports JSON results. The repository also supports training and testing separate ED and VAE variants. Source excerpts show the model and training calls; some prediction-script sections are omitted, so connections beyond those visible in the excerpts or documented in the README are not asserted.

Main entry points: [`train.py`](https://github.com/setsuna25th3/graduation-thesis/blob/main/train.py) (Training orchestration), [`prediction.py`](https://github.com/setsuna25th3/graduation-thesis/blob/main/prediction.py) (Prediction CLI), [`model/genconvit.py`](https://github.com/setsuna25th3/graduation-thesis/blob/main/model/genconvit.py) (Mode dispatcher), [`model/pred_func.py`](https://github.com/setsuna25th3/graduation-thesis/blob/main/model/pred_func.py) (Inference utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["Image inference"]
  node_prediction["Prediction CLI<br/>[prediction.py]"]
  node_inference_utils["Inference utilities<br/>[pred_func.py]"]
  node_metrics_export["Metrics and export<br/>[prediction.py]"]
end

subgraph group_models["Detection models"]
  node_config["Model configuration<br/>[config.py]"]
  node_genconvit["Mode dispatcher<br/>[genconvit.py]"]
  node_ed_model["ED detector<br/>[genconvit_ed.py]"]
  node_vae_model["VAE detector<br/>[genconvit_vae.py]"]
  node_embedder["Hybrid embedding<br/>[model_embedder.py]"]
end

subgraph group_training["Model training"]
  node_training_cli["Training orchestration<br/>[train.py]"]
  node_ed_training["ED train loop<br/>[train_ed.py]"]
  node_vae_training["VAE train loop<br/>[train_vae.py]"]
end

subgraph group_artifacts["Data and artifacts"]
  node_dataset["Image datasets<br/>[loader.py]"]
  node_checkpoints[("Model checkpoints")]
  node_results[("Prediction results")]
end

node_user(("User / image folder"))

node_user -->|"selects folder"| node_prediction
node_prediction -->|"loads model"| node_inference_utils
node_prediction -->|"loads configuration"| node_config
node_inference_utils -->|"normalizes frames"| node_dataset
node_inference_utils -->|"constructs model"| node_genconvit
node_genconvit -->|"dispatches ED"| node_ed_model
node_genconvit -->|"dispatches VAE"| node_vae_model
node_ed_model -->|"uses embedding"| node_embedder
node_vae_model -->|"uses embedding"| node_embedder
node_prediction -->|"evaluates results"| node_metrics_export
node_metrics_export -->|"writes JSON"| node_results
node_training_cli -->|"loads datasets"| node_dataset
node_training_cli -->|"builds ED model"| node_ed_model
node_training_cli -->|"builds VAE model"| node_vae_model
node_training_cli -->|"selects ED loop"| node_ed_training
node_training_cli -->|"selects VAE loop"| node_vae_training
node_training_cli -->|"saves weights"| node_checkpoints
node_training_cli -->|"loads configuration"| node_config
node_genconvit -->|"loads weights"| node_checkpoints

click node_prediction "https://github.com/setsuna25th3/graduation-thesis/blob/main/prediction.py"
click node_inference_utils "https://github.com/setsuna25th3/graduation-thesis/blob/main/model/pred_func.py"
click node_metrics_export "https://github.com/setsuna25th3/graduation-thesis/blob/main/prediction.py"
click node_config "https://github.com/setsuna25th3/graduation-thesis/blob/main/model/config.py"
click node_genconvit "https://github.com/setsuna25th3/graduation-thesis/blob/main/model/genconvit.py"
click node_ed_model "https://github.com/setsuna25th3/graduation-thesis/blob/main/model/genconvit_ed.py"
click node_vae_model "https://github.com/setsuna25th3/graduation-thesis/blob/main/model/genconvit_vae.py"
click node_embedder "https://github.com/setsuna25th3/graduation-thesis/blob/main/model/model_embedder.py"
click node_training_cli "https://github.com/setsuna25th3/graduation-thesis/blob/main/train.py"
click node_ed_training "https://github.com/setsuna25th3/graduation-thesis/blob/main/train/train_ed.py"
click node_vae_training "https://github.com/setsuna25th3/graduation-thesis/blob/main/train/train_vae.py"
click node_dataset "https://github.com/setsuna25th3/graduation-thesis/blob/main/dataset/loader.py"
click node_checkpoints "https://github.com/setsuna25th3/graduation-thesis/tree/main/weight"
click node_results "https://github.com/setsuna25th3/graduation-thesis/tree/main/result"

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_prediction,node_inference_utils,node_metrics_export,node_user toneBlue
class node_config,node_genconvit,node_ed_model,node_vae_model,node_embedder toneAmber
class node_training_cli,node_ed_training,node_vae_training toneMint
class node_dataset,node_checkpoints,node_results toneRose
```

## Components

### Image inference

- [Prediction CLI](https://github.com/setsuna25th3/graduation-thesis/blob/main/prediction.py): `prediction.py`
- [Inference utilities](https://github.com/setsuna25th3/graduation-thesis/blob/main/model/pred_func.py): `model/pred_func.py`
- [Metrics and export](https://github.com/setsuna25th3/graduation-thesis/blob/main/prediction.py): `prediction.py`

### Detection models

- [Model configuration](https://github.com/setsuna25th3/graduation-thesis/blob/main/model/config.py): `model/config.py`
- [Mode dispatcher](https://github.com/setsuna25th3/graduation-thesis/blob/main/model/genconvit.py): `model/genconvit.py`
- [ED detector](https://github.com/setsuna25th3/graduation-thesis/blob/main/model/genconvit_ed.py): `model/genconvit_ed.py`
- [VAE detector](https://github.com/setsuna25th3/graduation-thesis/blob/main/model/genconvit_vae.py): `model/genconvit_vae.py`
- [Hybrid embedding](https://github.com/setsuna25th3/graduation-thesis/blob/main/model/model_embedder.py): `model/model_embedder.py`

### Model training

- [Training orchestration](https://github.com/setsuna25th3/graduation-thesis/blob/main/train.py): `train.py`
- [ED train loop](https://github.com/setsuna25th3/graduation-thesis/blob/main/train/train_ed.py): `train/train_ed.py`
- [VAE train loop](https://github.com/setsuna25th3/graduation-thesis/blob/main/train/train_vae.py): `train/train_vae.py`

### Data and artifacts

- [Image datasets](https://github.com/setsuna25th3/graduation-thesis/blob/main/dataset/loader.py): `dataset/loader.py`
- [Model checkpoints](https://github.com/setsuna25th3/graduation-thesis/tree/main/weight): `weight`
- [Prediction results](https://github.com/setsuna25th3/graduation-thesis/tree/main/result): `result`

### Other components

- **User / image folder**

## Connections

- User / image folder → Prediction CLI: selects folder (evidence: `README.md`)
- Prediction CLI → Inference utilities: loads model (evidence: `prediction.py`)
- Prediction CLI → Model configuration: loads configuration (evidence: `prediction.py`)
- Inference utilities → Image datasets: normalizes frames (evidence: `model/pred_func.py`)
- Inference utilities → Mode dispatcher: constructs model (evidence: `model/pred_func.py`)
- Mode dispatcher → ED detector: dispatches ED (evidence: `model/genconvit.py`)
- Mode dispatcher → VAE detector: dispatches VAE (evidence: `model/genconvit.py`)
- ED detector → Hybrid embedding: uses embedding (evidence: `model/genconvit_ed.py`)
- VAE detector → Hybrid embedding: uses embedding (evidence: `model/genconvit_vae.py`)
- Prediction CLI → Metrics and export: evaluates results (evidence: `prediction.py`)
- Metrics and export → Prediction results: writes JSON (evidence: `prediction.py`)
- Training orchestration → Image datasets: loads datasets (evidence: `train.py`)
- Training orchestration → ED detector: builds ED model (evidence: `train.py`)
- Training orchestration → VAE detector: builds VAE model (evidence: `train.py`)
- Training orchestration → ED train loop: selects ED loop (evidence: `train.py`)
- Training orchestration → VAE train loop: selects VAE loop (evidence: `train.py`)
- Training orchestration → Model checkpoints: saves weights (evidence: `train.py`)
- Training orchestration → Model configuration: loads configuration (evidence: `train.py`)
- Mode dispatcher → Model checkpoints: loads weights (evidence: `model/genconvit.py`)
