# mohammedsunoqrot/nnunet architecture

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

- Interactive diagram: https://gitdiagram.com/mohammedsunoqrot/nnunet
- Repository: https://github.com/mohammedsunoqrot/nnunet

## Overview

nnU-Net is a self-configuring framework for biomedical image segmentation. A user converts a dataset, plans and preprocesses experiments, trains a selected 2D/3D or cascade configuration, then runs inference and evaluates predictions. Planning adapts configuration to dataset properties; training combines prepared data with a U-Net trainer, while inference restores models and exports segmentations. The README documents these workflow stages and broader benchmark/framework capabilities. Some subsystem links are inferred only from source-index references, so uncertain relationships are omitted.

Main entry points: [`nnunet/training/network_training/nnUNetTrainer.py`](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/training/network_training/nnUNetTrainer.py) (Training engine), [`nnunet/inference/predict.py`](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/inference/predict.py) (Prediction pipeline), [`nnunet/preprocessing/preprocessing.py`](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/preprocessing/preprocessing.py) (Image preprocessing), [`nnunet/experiment_planning/experiment_planner_baseline_3DUNet.py`](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/experiment_planning/experiment_planner_baseline_3DUNet.py) (Experiment planning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Dataset preparation"]
  node_conversion["Dataset conversion"]
  node_analyzer["Dataset analysis<br/>[DatasetAnalyzer.py]"]
  node_preprocess["Image preprocessing<br/>[preprocessing.py]"]
  node_crop["Image cropping<br/>[cropping.py]"]
  node_prepared[("Prepared datasets")]
end

subgraph group_model["Planning and training"]
  node_planner["Experiment planning"]
  node_config["Run configuration"]
  node_runner["Training launcher<br/>[run_training.py]"]
  node_trainer["Training engine<br/>[nnUNetTrainer.py]"]
  node_loader["Patch data loading<br/>[dataset_loading.py]"]
  node_network["U-Net architectures<br/>[generic_UNet.py]"]
  node_checkpoint["Model restoration<br/>[model_restore.py]"]
end

subgraph group_predict["Inference and outputs"]
  node_predict["Prediction pipeline<br/>[predict.py]"]
  node_export["Segmentation export"]
  node_postprocess["Postprocessing"]
  node_results["Segmentation results"]
end

subgraph group_assess["Evaluation and selection"]
  node_evaluation["Segmentation evaluation<br/>[evaluator.py]"]
  node_selection["Model selection"]
end

subgraph group_foundation["Runtime foundations"]
  node_paths["Data paths<br/>[paths.py]"]
end

node_user(("Researcher"))

node_user -->|"converts data"| node_conversion
node_conversion -->|"uses paths"| node_paths
node_user -->|"plans experiments"| node_planner
node_planner -->|"analyzes dataset"| node_analyzer
node_planner -->|"runs preprocessing"| node_preprocess
node_preprocess -->|"uses cropping"| node_crop
node_preprocess -.->|"writes arrays"| node_prepared
node_user -->|"starts training"| node_runner
node_runner -->|"loads configuration"| node_config
node_runner -->|"instantiates trainer"| node_trainer
node_trainer -->|"loads batches"| node_loader
node_trainer -->|"builds network"| node_network
node_user -->|"runs inference"| node_predict
node_predict -->|"restores trainer"| node_checkpoint
node_predict -->|"exports segmentation"| node_export
node_predict -->|"applies postprocessing"| node_postprocess
node_export -.->|"writes files"| node_results
node_user -->|"evaluates results"| node_evaluation
node_evaluation -.->|"scores candidates"| node_selection
node_postprocess -->|"compares scores"| node_evaluation
node_trainer -.->|"saves checkpoints"| node_checkpoint

click node_conversion "https://github.com/mohammedsunoqrot/nnunet/tree/master/nnunet/dataset_conversion"
click node_paths "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/paths.py"
click node_analyzer "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/experiment_planning/DatasetAnalyzer.py"
click node_planner "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/experiment_planning/experiment_planner_baseline_3DUNet.py"
click node_preprocess "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/preprocessing/preprocessing.py"
click node_crop "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/preprocessing/cropping.py"
click node_config "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/run/default_configuration.py"
click node_runner "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/run/run_training.py"
click node_trainer "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/training/network_training/nnUNetTrainer.py"
click node_loader "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/training/dataloading/dataset_loading.py"
click node_network "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/network_architecture/generic_UNet.py"
click node_checkpoint "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/training/model_restore.py"
click node_predict "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/inference/predict.py"
click node_export "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/inference/segmentation_export.py"
click node_postprocess "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/postprocessing/connected_components.py"
click node_evaluation "https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/evaluation/evaluator.py"
click node_selection "https://github.com/mohammedsunoqrot/nnunet/tree/master/nnunet/evaluation/model_selection"

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_conversion,node_analyzer,node_preprocess,node_crop,node_prepared toneBlue
class node_planner,node_config,node_runner,node_trainer,node_loader,node_network,node_checkpoint toneAmber
class node_predict,node_export,node_postprocess,node_results toneMint
class node_evaluation,node_selection toneRose
class node_paths,node_user toneIndigo
```

## Components

### Dataset preparation

- [Dataset conversion](https://github.com/mohammedsunoqrot/nnunet/tree/master/nnunet/dataset_conversion): `nnunet/dataset_conversion`
- [Dataset analysis](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/experiment_planning/DatasetAnalyzer.py): `nnunet/experiment_planning/DatasetAnalyzer.py`
- [Image preprocessing](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/preprocessing/preprocessing.py): `nnunet/preprocessing/preprocessing.py`
- [Image cropping](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/preprocessing/cropping.py): `nnunet/preprocessing/cropping.py`
- **Prepared datasets**

### Planning and training

- [Experiment planning](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/experiment_planning/experiment_planner_baseline_3DUNet.py): `nnunet/experiment_planning/experiment_planner_baseline_3DUNet.py`
- [Run configuration](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/run/default_configuration.py): `nnunet/run/default_configuration.py`
- [Training launcher](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/run/run_training.py): `nnunet/run/run_training.py`
- [Training engine](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/training/network_training/nnUNetTrainer.py): `nnunet/training/network_training/nnUNetTrainer.py`
- [Patch data loading](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/training/dataloading/dataset_loading.py): `nnunet/training/dataloading/dataset_loading.py`
- [U-Net architectures](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/network_architecture/generic_UNet.py): `nnunet/network_architecture/generic_UNet.py`
- [Model restoration](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/training/model_restore.py): `nnunet/training/model_restore.py`

### Inference and outputs

- [Prediction pipeline](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/inference/predict.py): `nnunet/inference/predict.py`
- [Segmentation export](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/inference/segmentation_export.py): `nnunet/inference/segmentation_export.py`
- [Postprocessing](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/postprocessing/connected_components.py): `nnunet/postprocessing/connected_components.py`
- **Segmentation results**

### Evaluation and selection

- [Segmentation evaluation](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/evaluation/evaluator.py): `nnunet/evaluation/evaluator.py`
- [Model selection](https://github.com/mohammedsunoqrot/nnunet/tree/master/nnunet/evaluation/model_selection): `nnunet/evaluation/model_selection`

### Runtime foundations

- [Data paths](https://github.com/mohammedsunoqrot/nnunet/blob/master/nnunet/paths.py): `nnunet/paths.py`

### Other components

- **Researcher**

## Connections

- Researcher → Dataset conversion: converts data
- Dataset conversion → Data paths: uses paths (evidence: `nnunet/dataset_conversion/Task037_038_Chaos_Challenge.py`)
- Researcher → Experiment planning: plans experiments
- Experiment planning → Dataset analysis: analyzes dataset (evidence: `nnunet/experiment_planning/experiment_planner_baseline_3DUNet.py`)
- Experiment planning → Image preprocessing: runs preprocessing (evidence: `nnunet/experiment_planning/experiment_planner_baseline_3DUNet.py`)
- Image preprocessing → Image cropping: uses cropping (evidence: `nnunet/preprocessing/preprocessing.py`)
- Image preprocessing → Prepared datasets: writes arrays
- Researcher → Training launcher: starts training
- Training launcher → Run configuration: loads configuration
- Training launcher → Training engine: instantiates trainer
- Training engine → Patch data loading: loads batches (evidence: `nnunet/training/network_training/nnUNetTrainer.py`)
- Training engine → U-Net architectures: builds network (evidence: `nnunet/training/network_training/nnUNetTrainer.py`)
- Researcher → Prediction pipeline: runs inference
- Prediction pipeline → Model restoration: restores trainer (evidence: `nnunet/inference/predict.py`)
- Prediction pipeline → Segmentation export: exports segmentation (evidence: `nnunet/inference/predict.py`)
- Prediction pipeline → Postprocessing: applies postprocessing (evidence: `nnunet/inference/predict.py`)
- Segmentation export → Segmentation results: writes files
- Researcher → Segmentation evaluation: evaluates results
- Segmentation evaluation → Model selection: scores candidates
- Postprocessing → Segmentation evaluation: compares scores (evidence: `nnunet/postprocessing/connected_components.py`)
- Training engine → Model restoration: saves checkpoints (evidence: `nnunet/training/network_training/nnUNetTrainer.py`)
