# yu-deeplearning/sayzek-tez architecture

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

- Interactive diagram: https://gitdiagram.com/yu-deeplearning/sayzek-tez
- Repository: https://github.com/yu-deeplearning/sayzek-tez

## Overview

This repository is a research codebase for aerial/satellite image change detection, centered on PMT-CD: a four-phase progression from binary change localization through transfer/generalization and semantic change to damage assessment. Its principal workflow prepares paired imagery, trains the shared-encoder multi-task model, then evaluates task-specific outputs. Separate branches provide a Siamese-CNN baseline, CORAL domain-adaptation experiments, and reviewer/generalist experiments. The graph follows the README and indexed references; several unsampled subsystem links are omitted where call ownership could not be confirmed.

Main entry points: [`experiments/pmtcd/train_phase1.py`](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/train_phase1.py) (Binary training), [`experiments/pmtcd/eval_phase3.py`](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/eval_phase3.py) (Semantic evaluation), [`experiments/pmtcd/datasets/xbd_dataset.py`](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/datasets/xbd_dataset.py) (xBD loader), [`experiments/pmtcd/datasets/levir_dataset.py`](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/datasets/levir_dataset.py) (LEVIR loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data handling"]
  node_preprocess["Preprocessing<br/>[preprocessing.py]"]
  node_transforms["Image transforms<br/>[transforms.py]"]
  node_levir["LEVIR loader<br/>[levir_dataset.py]"]
  node_second["SECOND loader<br/>[second_dataset.py]"]
  node_xbd["xBD loader<br/>[xbd_dataset.py]"]
  node_xbdprep["xBD mask prep<br/>[xbd_preprocess.py]"]
end

subgraph group_model["PMT-CD model"]
  node_encoder["Siamese encoder<br/>[encoder.py]"]
  node_fusion["Feature fusion<br/>[fusion.py]"]
  node_decoder["Feature decoder<br/>[decoder.py]"]
  node_heads["Task heads<br/>[heads.py]"]
  node_pmtcd["PMT-CD model<br/>[pmtcd.py]"]
end

subgraph group_workflow["Training workflow"]
  node_phase1["Binary training<br/>[train_phase1.py]"]
  node_whu["WHU pretraining<br/>[train_whu.py]"]
  node_generalist["Replay training"]
  node_baseline["Siamese baseline<br/>[train_simple.py]"]
  node_coral["CORAL adaptation<br/>[train_coral.py]"]
end

subgraph group_evaluation["Evaluation and experiments"]
  node_eval3["Semantic evaluation<br/>[eval_phase3.py]"]
  node_eval4["Damage evaluation<br/>[eval_phase4.py]"]
  node_losses["Task losses<br/>[losses.py]"]
  node_metrics["Task metrics<br/>[metrics.py]"]
  node_scdmetrics["Semantic metrics<br/>[scd_metrics.py]"]
end

node_engineer(("Researcher"))
node_imagery[("Aerial datasets")]

node_engineer -->|"starts training"| node_phase1
node_engineer -->|"starts pretraining"| node_whu
node_engineer -->|"runs evaluation"| node_eval3
node_imagery -->|"provides pairs"| node_levir
node_imagery -->|"provides labels"| node_second
node_imagery -->|"provides scenes"| node_xbd
node_xbd -->|"renders masks"| node_xbdprep
node_preprocess -.->|"supports"| node_transforms
node_levir -.->|"feeds training"| node_phase1
node_second -->|"feeds replay"| node_generalist
node_xbd -->|"feeds replay"| node_generalist
node_encoder -->|"produces features"| node_fusion
node_fusion -->|"combines features"| node_decoder
node_decoder -->|"supplies maps"| node_heads
node_phase1 -.->|"trains model"| node_pmtcd
node_whu -->|"pretrains"| node_encoder
node_generalist -->|"trains replay"| node_pmtcd
node_phase1 -->|"uses dataset"| node_levir
node_baseline -->|"trains on LEVIR"| node_imagery
node_coral -->|"adapts from"| node_levir
node_coral -.->|"adapts encoder"| node_pmtcd
node_eval3 -->|"evaluates on"| node_second
node_eval4 -->|"evaluates on"| node_xbd
node_eval3 -->|"computes metrics"| node_scdmetrics
node_eval3 -->|"computes metrics"| node_metrics
node_phase1 -.->|"uses task losses"| node_losses

click node_preprocess "https://github.com/yu-deeplearning/sayzek-tez/blob/main/src/data/preprocessing.py"
click node_transforms "https://github.com/yu-deeplearning/sayzek-tez/blob/main/src/data/transforms.py"
click node_levir "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/datasets/levir_dataset.py"
click node_second "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/datasets/second_dataset.py"
click node_xbd "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/datasets/xbd_dataset.py"
click node_xbdprep "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/datasets/xbd_preprocess.py"
click node_encoder "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/models/encoder.py"
click node_fusion "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/models/fusion.py"
click node_decoder "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/models/decoder.py"
click node_heads "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/models/heads.py"
click node_pmtcd "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/models/pmtcd.py"
click node_phase1 "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/train_phase1.py"
click node_whu "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/train_whu.py"
click node_generalist "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/train_generalist_replay.py"
click node_baseline "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/baseline/train_simple.py"
click node_coral "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/coral_adaptation/train_coral.py"
click node_eval3 "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/eval_phase3.py"
click node_eval4 "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/eval_phase4.py"
click node_losses "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/utils/losses.py"
click node_metrics "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/utils/metrics.py"
click node_scdmetrics "https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/utils/scd_metrics.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_preprocess,node_transforms,node_levir,node_second,node_xbd,node_xbdprep toneBlue
class node_encoder,node_fusion,node_decoder,node_heads,node_pmtcd,node_imagery toneAmber
class node_phase1,node_whu,node_generalist,node_baseline,node_coral toneMint
class node_eval3,node_eval4,node_losses,node_metrics,node_scdmetrics toneRose
class node_engineer toneIndigo
```

## Components

### Data handling

- [Preprocessing](https://github.com/yu-deeplearning/sayzek-tez/blob/main/src/data/preprocessing.py): `src/data/preprocessing.py`
- [Image transforms](https://github.com/yu-deeplearning/sayzek-tez/blob/main/src/data/transforms.py): `src/data/transforms.py`
- [LEVIR loader](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/datasets/levir_dataset.py): `experiments/pmtcd/datasets/levir_dataset.py`
- [SECOND loader](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/datasets/second_dataset.py): `experiments/pmtcd/datasets/second_dataset.py`
- [xBD loader](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/datasets/xbd_dataset.py): `experiments/pmtcd/datasets/xbd_dataset.py`
- [xBD mask prep](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/datasets/xbd_preprocess.py): `experiments/pmtcd/datasets/xbd_preprocess.py`

### PMT-CD model

- [Siamese encoder](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/models/encoder.py): `experiments/pmtcd/models/encoder.py`
- [Feature fusion](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/models/fusion.py): `experiments/pmtcd/models/fusion.py`
- [Feature decoder](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/models/decoder.py): `experiments/pmtcd/models/decoder.py`
- [Task heads](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/models/heads.py): `experiments/pmtcd/models/heads.py`
- [PMT-CD model](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/models/pmtcd.py): `experiments/pmtcd/models/pmtcd.py`

### Training workflow

- [Binary training](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/train_phase1.py): `experiments/pmtcd/train_phase1.py`
- [WHU pretraining](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/train_whu.py): `experiments/pmtcd/train_whu.py`
- [Replay training](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/train_generalist_replay.py): `experiments/pmtcd/train_generalist_replay.py`
- [Siamese baseline](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/baseline/train_simple.py): `experiments/baseline/train_simple.py`
- [CORAL adaptation](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/coral_adaptation/train_coral.py): `experiments/coral_adaptation/train_coral.py`

### Evaluation and experiments

- [Semantic evaluation](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/eval_phase3.py): `experiments/pmtcd/eval_phase3.py`
- [Damage evaluation](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/eval_phase4.py): `experiments/pmtcd/eval_phase4.py`
- [Task losses](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/utils/losses.py): `experiments/pmtcd/utils/losses.py`
- [Task metrics](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/utils/metrics.py): `experiments/pmtcd/utils/metrics.py`
- [Semantic metrics](https://github.com/yu-deeplearning/sayzek-tez/blob/main/experiments/pmtcd/utils/scd_metrics.py): `experiments/pmtcd/utils/scd_metrics.py`

### Other components

- **Researcher**
- **Aerial datasets**

## Connections

- Researcher → Binary training: starts training (evidence: `README.md`)
- Researcher → WHU pretraining: starts pretraining (evidence: `README.md`)
- Researcher → Semantic evaluation: runs evaluation (evidence: `README.md`)
- Aerial datasets → LEVIR loader: provides pairs (evidence: `README.md`)
- Aerial datasets → SECOND loader: provides labels (evidence: `README.md`)
- Aerial datasets → xBD loader: provides scenes (evidence: `README.md`)
- xBD loader → xBD mask prep: renders masks (evidence: `experiments/pmtcd/datasets/xbd_dataset.py`)
- Preprocessing → Image transforms: supports
- LEVIR loader → Binary training: feeds training
- SECOND loader → Replay training: feeds replay (evidence: `experiments/pmtcd/train_generalist_replay.py`)
- xBD loader → Replay training: feeds replay (evidence: `experiments/pmtcd/train_generalist_replay.py`)
- Siamese encoder → Feature fusion: produces features (evidence: `README.md`)
- Feature fusion → Feature decoder: combines features (evidence: `README.md`)
- Feature decoder → Task heads: supplies maps (evidence: `README.md`)
- Binary training → PMT-CD model: trains model
- WHU pretraining → Siamese encoder: pretrains (evidence: `README.md`)
- Replay training → PMT-CD model: trains replay (evidence: `experiments/pmtcd/train_generalist_replay.py`)
- Binary training → LEVIR loader: uses dataset (evidence: `README.md`)
- Siamese baseline → Aerial datasets: trains on LEVIR (evidence: `README.md`)
- CORAL adaptation → LEVIR loader: adapts from (evidence: `experiments/coral_adaptation/train_coral.py`)
- CORAL adaptation → PMT-CD model: adapts encoder
- Semantic evaluation → SECOND loader: evaluates on (evidence: `experiments/pmtcd/eval_phase3.py`)
- Damage evaluation → xBD loader: evaluates on (evidence: `README.md`)
- Semantic evaluation → Semantic metrics: computes metrics (evidence: `experiments/pmtcd/eval_phase3.py`)
- Semantic evaluation → Task metrics: computes metrics (evidence: `experiments/pmtcd/eval_phase3.py`)
- Binary training → Task losses: uses task losses
