# lmiapc/medical-fl-benchmark architecture

> Architecture diagram of the GitHub repository lmiapc/medical-fl-benchmark, 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/lmiapc/medical-fl-benchmark
- Repository: https://github.com/lmiapc/medical-fl-benchmark

## Overview

This repository benchmarks federated medical-image classification through separate traditional, personalized, elastic-aggregation, and diffusion-augmented training programs. The workflow is to prepare client-partitioned image data, train and coordinate client models, then evaluate them; the diffusion branch additionally trains a conditional generator and samples images for augmented training. Relationships below follow the excerpts, SOURCE INDEX references, or README; unsampled implementation details are not inferred.

Main entry points: [`data/dataset_define.py`](https://github.com/lmiapc/medical-fl-benchmark/blob/main/data/dataset_define.py) (Dataset loading), [`utils.py`](https://github.com/lmiapc/medical-fl-benchmark/blob/main/utils.py) (Model utilities), [`fed_train_with_gen.py`](https://github.com/lmiapc/medical-fl-benchmark/blob/main/fed_train_with_gen.py) (Augmented FL), [`fed_train_main.py`](https://github.com/lmiapc/medical-fl-benchmark/blob/main/fed_train_main.py) (Traditional FL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Medical image data"]
  node_dataset["Dataset loading<br/>[dataset_define.py]"]
  node_partitioning["Data partitioning<br/>[divide.py]"]
end

subgraph group_federated["Federated training"]
  node_traditional["Traditional FL<br/>[fed_train_main.py]"]
  node_personalized["Personalized FL"]
  node_distillation["Distillation FL"]
  node_elastic["Elastic aggregation"]
  node_generated_fl["Augmented FL"]
end

subgraph group_diffusion["Diffusion augmentation"]
  node_ddpm_training["Generator training<br/>[ddpm_train.py]"]
  node_ddpm_sampling["Image sampling<br/>[ddpm_inference.py]"]
  node_ddpm_model["Conditional U-Net<br/>[modules.py]"]
  node_ddpm_helpers["Diffusion utilities<br/>[ddpm_util.py]"]
end

subgraph group_shared["Shared modeling"]
  node_model_helpers["Model utilities<br/>[utils.py]"]
end

node_researcher(("Benchmark user"))
node_medical_images[("Medical images")]

node_researcher -->|"runs benchmark"| node_traditional
node_researcher -->|"runs benchmark"| node_personalized
node_researcher -->|"runs benchmark"| node_distillation
node_researcher -->|"runs benchmark"| node_elastic
node_researcher -->|"runs benchmark"| node_generated_fl
node_medical_images -.->|"provides images"| node_dataset
node_traditional -->|"loads data"| node_dataset
node_personalized -->|"loads data"| node_dataset
node_elastic -->|"loads data"| node_dataset
node_generated_fl -->|"loads data"| node_dataset
node_traditional -->|"uses utilities"| node_model_helpers
node_personalized -->|"uses utilities"| node_model_helpers
node_distillation -->|"uses utilities"| node_model_helpers
node_elastic -->|"uses utilities"| node_model_helpers
node_generated_fl -->|"uses utilities"| node_model_helpers
node_ddpm_training -->|"loads data helpers"| node_ddpm_helpers
node_ddpm_training -->|"trains model"| node_ddpm_model
node_ddpm_sampling -->|"samples with"| node_ddpm_model
node_ddpm_sampling -->|"uses utilities"| node_model_helpers
node_generated_fl -.->|"uses generated data"| node_ddpm_sampling
node_partitioning -.->|"partitions data"| node_dataset

click node_dataset "https://github.com/lmiapc/medical-fl-benchmark/blob/main/data/dataset_define.py"
click node_traditional "https://github.com/lmiapc/medical-fl-benchmark/blob/main/fed_train_main.py"
click node_personalized "https://github.com/lmiapc/medical-fl-benchmark/blob/main/personalized_fed_train.py"
click node_distillation "https://github.com/lmiapc/medical-fl-benchmark/blob/main/distill_fed_train.py"
click node_elastic "https://github.com/lmiapc/medical-fl-benchmark/blob/main/elastic_aggregation.py"
click node_generated_fl "https://github.com/lmiapc/medical-fl-benchmark/blob/main/fed_train_with_gen.py"
click node_ddpm_training "https://github.com/lmiapc/medical-fl-benchmark/blob/main/DDPM/ddpm_train.py"
click node_ddpm_sampling "https://github.com/lmiapc/medical-fl-benchmark/blob/main/DDPM/ddpm_inference.py"
click node_ddpm_model "https://github.com/lmiapc/medical-fl-benchmark/blob/main/DDPM/modules.py"
click node_ddpm_helpers "https://github.com/lmiapc/medical-fl-benchmark/blob/main/DDPM/ddpm_util.py"
click node_model_helpers "https://github.com/lmiapc/medical-fl-benchmark/blob/main/utils.py"
click node_partitioning "https://github.com/lmiapc/medical-fl-benchmark/blob/main/divide.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_dataset,node_partitioning,node_researcher toneBlue
class node_traditional,node_personalized,node_distillation,node_elastic,node_generated_fl,node_medical_images toneAmber
class node_ddpm_training,node_ddpm_sampling,node_ddpm_model,node_ddpm_helpers toneMint
class node_model_helpers toneRose
```

## Components

### Medical image data

- [Dataset loading](https://github.com/lmiapc/medical-fl-benchmark/blob/main/data/dataset_define.py): `data/dataset_define.py`
- [Data partitioning](https://github.com/lmiapc/medical-fl-benchmark/blob/main/divide.py): `divide.py`

### Federated training

- [Traditional FL](https://github.com/lmiapc/medical-fl-benchmark/blob/main/fed_train_main.py): `fed_train_main.py`
- [Personalized FL](https://github.com/lmiapc/medical-fl-benchmark/blob/main/personalized_fed_train.py): `personalized_fed_train.py`
- [Distillation FL](https://github.com/lmiapc/medical-fl-benchmark/blob/main/distill_fed_train.py): `distill_fed_train.py`
- [Elastic aggregation](https://github.com/lmiapc/medical-fl-benchmark/blob/main/elastic_aggregation.py): `elastic_aggregation.py`
- [Augmented FL](https://github.com/lmiapc/medical-fl-benchmark/blob/main/fed_train_with_gen.py): `fed_train_with_gen.py`

### Diffusion augmentation

- [Generator training](https://github.com/lmiapc/medical-fl-benchmark/blob/main/DDPM/ddpm_train.py): `DDPM/ddpm_train.py`
- [Image sampling](https://github.com/lmiapc/medical-fl-benchmark/blob/main/DDPM/ddpm_inference.py): `DDPM/ddpm_inference.py`
- [Conditional U-Net](https://github.com/lmiapc/medical-fl-benchmark/blob/main/DDPM/modules.py): `DDPM/modules.py`
- [Diffusion utilities](https://github.com/lmiapc/medical-fl-benchmark/blob/main/DDPM/ddpm_util.py): `DDPM/ddpm_util.py`

### Shared modeling

- [Model utilities](https://github.com/lmiapc/medical-fl-benchmark/blob/main/utils.py): `utils.py`

### Other components

- **Benchmark user**
- **Medical images**

## Connections

- Benchmark user → Traditional FL: runs benchmark (evidence: `README.md`)
- Benchmark user → Personalized FL: runs benchmark (evidence: `README.md`)
- Benchmark user → Distillation FL: runs benchmark (evidence: `README.md`)
- Benchmark user → Elastic aggregation: runs benchmark (evidence: `README.md`)
- Benchmark user → Augmented FL: runs benchmark (evidence: `README.md`)
- Medical images → Dataset loading: provides images
- Traditional FL → Dataset loading: loads data (evidence: `fed_train_main.py`)
- Personalized FL → Dataset loading: loads data (evidence: `personalized_fed_train.py`)
- Elastic aggregation → Dataset loading: loads data (evidence: `elastic_aggregation.py`)
- Augmented FL → Dataset loading: loads data (evidence: `fed_train_with_gen.py`)
- Traditional FL → Model utilities: uses utilities (evidence: `fed_train_main.py`)
- Personalized FL → Model utilities: uses utilities (evidence: `personalized_fed_train.py`)
- Distillation FL → Model utilities: uses utilities (evidence: `distill_fed_train.py`)
- Elastic aggregation → Model utilities: uses utilities (evidence: `elastic_aggregation.py`)
- Augmented FL → Model utilities: uses utilities (evidence: `fed_train_with_gen.py`)
- Generator training → Diffusion utilities: loads data helpers (evidence: `DDPM/ddpm_train.py`)
- Generator training → Conditional U-Net: trains model (evidence: `DDPM/ddpm_train.py`)
- Image sampling → Conditional U-Net: samples with (evidence: `DDPM/ddpm_inference.py`)
- Image sampling → Model utilities: uses utilities (evidence: `DDPM/ddpm_inference.py`)
- Augmented FL → Image sampling: uses generated data (evidence: `README.md`)
- Data partitioning → Dataset loading: partitions data
