# cyf-cuber/fdp architecture

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

- Interactive diagram: https://gitdiagram.com/cyf-cuber/fdp
- Repository: https://github.com/cyf-cuber/fdp

## Overview

FDP is a PyTorch micro-expression recognition research model. Its workflow prepares subject-split video datasets from face-frame folders, then trains and evaluates the model on those saved datasets. The model combines a local/global transformer frame representation with 3D classification and dynamic-image components. README documentation establishes dataset preparation and training commands; excerpts show preprocessing, serialization, model construction, and training/evaluation behavior. Some model-forward details and unsampled dataset logic are omitted rather than inferred.

Main entry points: [`fdp.py`](https://github.com/cyf-cuber/fdp/blob/main/fdp.py) (FDP network), [`train.py`](https://github.com/cyf-cuber/fdp/blob/main/train.py) (Training loop), [`data.py`](https://github.com/cyf-cuber/fdp/blob/main/data.py) (Video preprocessing), [`dataset`](https://github.com/cyf-cuber/fdp/tree/main/dataset) (Subject datasets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Dataset preparation"]
  node_prepare["Video preprocessing<br/>[data.py]"]
  node_prepared[("Subject datasets")]
end

subgraph group_model["FDP model"]
  node_fdp["FDP network<br/>[fdp.py]"]
  node_transformer["Frame transformer<br/>[fdp.py]"]
  node_classifier["3D classifier<br/>[fdp.py]"]
  node_segnet["Dynamic-image network<br/>[fdp.py]"]
end

subgraph group_learning["Training and evaluation"]
  node_trainer["Training loop<br/>[train.py]"]
  node_evaluator["Evaluation metrics<br/>[train.py]"]
end

node_researcher(("Researcher"))
node_frames["Face-frame folders"]

node_researcher -->|"runs preparation"| node_prepare
node_frames -->|"provides frames"| node_prepare
node_prepare -->|"saves splits"| node_prepared
node_researcher -->|"runs training"| node_trainer
node_prepared -->|"loads datasets"| node_trainer
node_trainer -->|"calls model"| node_fdp
node_fdp -->|"constructs frame encoder"| node_transformer
node_fdp -->|"constructs classifier"| node_classifier
node_fdp -->|"constructs image network"| node_segnet
node_trainer -->|"evaluates model"| node_evaluator

click node_prepare "https://github.com/cyf-cuber/fdp/blob/main/data.py"
click node_prepared "https://github.com/cyf-cuber/fdp/tree/main/dataset"
click node_trainer "https://github.com/cyf-cuber/fdp/blob/main/train.py"
click node_evaluator "https://github.com/cyf-cuber/fdp/blob/main/train.py"
click node_fdp "https://github.com/cyf-cuber/fdp/blob/main/fdp.py"
click node_transformer "https://github.com/cyf-cuber/fdp/blob/main/fdp.py"
click node_classifier "https://github.com/cyf-cuber/fdp/blob/main/fdp.py"
click node_segnet "https://github.com/cyf-cuber/fdp/blob/main/fdp.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_prepare,node_prepared toneBlue
class node_fdp,node_transformer,node_classifier,node_segnet toneAmber
class node_trainer,node_evaluator toneMint
class node_researcher,node_frames toneIndigo
```

## Components

### Dataset preparation

- [Video preprocessing](https://github.com/cyf-cuber/fdp/blob/main/data.py): `data.py`
- [Subject datasets](https://github.com/cyf-cuber/fdp/tree/main/dataset): `dataset`

### FDP model

- [FDP network](https://github.com/cyf-cuber/fdp/blob/main/fdp.py): `fdp.py`
- [Frame transformer](https://github.com/cyf-cuber/fdp/blob/main/fdp.py): `fdp.py`
- [3D classifier](https://github.com/cyf-cuber/fdp/blob/main/fdp.py): `fdp.py`
- [Dynamic-image network](https://github.com/cyf-cuber/fdp/blob/main/fdp.py): `fdp.py`

### Training and evaluation

- [Training loop](https://github.com/cyf-cuber/fdp/blob/main/train.py): `train.py`
- [Evaluation metrics](https://github.com/cyf-cuber/fdp/blob/main/train.py): `train.py`

### Other components

- **Researcher**
- **Face-frame folders**

## Connections

- Researcher → Video preprocessing: runs preparation (evidence: `README.md`)
- Face-frame folders → Video preprocessing: provides frames (evidence: `README.md`)
- Video preprocessing → Subject datasets: saves splits (evidence: `data.py`)
- Researcher → Training loop: runs training (evidence: `README.md`)
- Subject datasets → Training loop: loads datasets (evidence: `train.py`)
- Training loop → FDP network: calls model (evidence: `train.py`)
- FDP network → Frame transformer: constructs frame encoder (evidence: `fdp.py`)
- FDP network → 3D classifier: constructs classifier (evidence: `fdp.py`)
- FDP network → Dynamic-image network: constructs image network (evidence: `fdp.py`)
- Training loop → Evaluation metrics: evaluates model (evidence: `train.py`)
