# biprodip/dfeddg2 architecture

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

- Interactive diagram: https://gitdiagram.com/biprodip/dfeddg2
- Repository: https://github.com/biprodip/dfeddg2

## Overview

DFedDG2 is a decentralized federated-learning system for clients with heterogeneous models and non-IID tasks. The main workflow prepares client data and a peer topology, creates per-client models, performs local DECOOD training, then exchanges class prototypes through vMF-likelihood-weighted gossip and evaluates rounds. The repository also contains point-cloud dataset and processing support. The README describes the gossip phases; several source excerpts are partial, so unverified runtime links are omitted.

Main entry points: [`run_trainer_dfeddg2.py`](https://github.com/biprodip/dfeddg2/blob/main/run_trainer_dfeddg2.py) (Training runner), [`clients/client_decood_vmf.py`](https://github.com/biprodip/dfeddg2/blob/main/clients/client_decood_vmf.py) (DECOOD client), [`models/model_manager.py`](https://github.com/biprodip/dfeddg2/blob/main/models/model_manager.py) (Model factory), [`comm_utils/comm_vmf_gossip.py`](https://github.com/biprodip/dfeddg2/blob/main/comm_utils/comm_vmf_gossip.py) (vMF gossip)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiment["Experiment orchestration"]
  node_trainer["Training runner"]
  node_client_factory["Client factory<br/>[client_manager.py]"]
  node_results["Experiment results"]
end

subgraph group_data["Data and geometry"]
  node_image_data["Image datasets<br/>[data_utils.py]"]
  node_sampling["Client data sampling<br/>[sampling.py]"]
  node_pcl_utils["Point-cloud utilities<br/>[pcl_utils.py]"]
  node_modelnet["ModelNet loader"]
  node_shapenet["ShapeNet loader"]
  node_native_data["Native data utilities"]
  node_point_provider["Point-cloud provider<br/>[provider.py]"]
  node_geometry["3D data utilities<br/>[utils_3d.py]"]
end

subgraph group_learning["Client learning"]
  node_client["DECOOD client"]
  node_fedavg["FedAvg client<br/>[client_fed_avg.py]"]
  node_model_factory["Model factory<br/>[model_manager.py]"]
  node_architectures["Model architectures<br/>[models.py]"]
  node_mobilenet["MobileNet backbone<br/>[mobilenet_v2.py]"]
  node_decood_losses["DECOOD losses<br/>[losses_decood.py]"]
  node_imbalance_loss["Imbalance losses<br/>[imb_losses.py]"]
  node_prototype_utils["Prototype utilities<br/>[utils_proto.py]"]
end

subgraph group_network["Gossip communication"]
  node_topology["Topology manager"]
  node_decentralized["Graph mixing<br/>[decentralized.py]"]
  node_mst["Spanning tree<br/>[mst.py]"]
  node_vmf_gossip["vMF gossip<br/>[comm_vmf_gossip.py]"]
  node_gossip["Prototype gossip<br/>[comm_gossip.py]"]
end

node_operator(("Experiment operator"))

node_operator -->|"runs"| node_trainer
node_trainer -->|"creates models"| node_model_factory
node_model_factory -->|"dispatches to"| node_architectures
node_trainer -->|"configures topology"| node_topology
node_topology -.->|"uses tree utility"| node_mst
node_trainer -.->|"initializes clients"| node_client_factory
node_client_factory -->|"creates"| node_client
node_client -->|"trains with"| node_decood_losses
node_client -.->|"uses"| node_imbalance_loss
node_client -->|"exchanges prototypes"| node_vmf_gossip
node_vmf_gossip -->|"uses graph utilities"| node_decentralized
node_decentralized -->|"computes tree"| node_mst
node_vmf_gossip -->|"uses"| node_prototype_utils
node_client -->|"loads client data"| node_image_data
node_trainer -.->|"partitions data"| node_sampling
node_trainer -.->|"saves outcomes"| node_results
node_trainer -.->|"selects alternative"| node_fedavg
node_trainer -.->|"selects alternative"| node_gossip
node_model_factory -.->|"supports backbone"| node_mobilenet
node_pcl_utils -->|"uses sampling"| node_sampling
node_geometry -->|"loads dataset"| node_modelnet
node_geometry -->|"uses augmentation"| node_point_provider
node_trainer -->|"uses point-cloud support"| node_pcl_utils
node_model_factory -.->|"supports 3D models"| node_modelnet

click node_trainer "https://github.com/biprodip/dfeddg2/blob/main/run_trainer_dfeddg2.py"
click node_client_factory "https://github.com/biprodip/dfeddg2/blob/main/client_manager.py"
click node_topology "https://github.com/biprodip/dfeddg2/blob/main/comm_utils/topology_manager.py"
click node_decentralized "https://github.com/biprodip/dfeddg2/blob/main/comm_utils/decentralized.py"
click node_mst "https://github.com/biprodip/dfeddg2/blob/main/comm_utils/mst.py"
click node_vmf_gossip "https://github.com/biprodip/dfeddg2/blob/main/comm_utils/comm_vmf_gossip.py"
click node_gossip "https://github.com/biprodip/dfeddg2/blob/main/comm_utils/comm_gossip.py"
click node_client "https://github.com/biprodip/dfeddg2/blob/main/clients/client_decood_vmf.py"
click node_fedavg "https://github.com/biprodip/dfeddg2/blob/main/clients/client_fed_avg.py"
click node_model_factory "https://github.com/biprodip/dfeddg2/blob/main/models/model_manager.py"
click node_architectures "https://github.com/biprodip/dfeddg2/blob/main/models/models.py"
click node_mobilenet "https://github.com/biprodip/dfeddg2/blob/main/models/mobilenet_v2.py"
click node_decood_losses "https://github.com/biprodip/dfeddg2/blob/main/utils/losses_decood.py"
click node_imbalance_loss "https://github.com/biprodip/dfeddg2/blob/main/utils/imb_losses.py"
click node_prototype_utils "https://github.com/biprodip/dfeddg2/blob/main/utils/utils_proto.py"
click node_image_data "https://github.com/biprodip/dfeddg2/blob/main/lib/data_utils.py"
click node_sampling "https://github.com/biprodip/dfeddg2/blob/main/lib/sampling.py"
click node_pcl_utils "https://github.com/biprodip/dfeddg2/blob/main/lib/pcl_utils.py"
click node_modelnet "https://github.com/biprodip/dfeddg2/blob/main/data/ModelNetDataLoader.py"
click node_shapenet "https://github.com/biprodip/dfeddg2/blob/main/data/ShapeNetDataLoader.py"
click node_native_data "https://github.com/biprodip/dfeddg2/blob/main/data/native_data_utils.py"
click node_point_provider "https://github.com/biprodip/dfeddg2/blob/main/data/provider.py"
click node_geometry "https://github.com/biprodip/dfeddg2/blob/main/data/utils_3d.py"
click node_results "https://github.com/biprodip/dfeddg2/tree/main/results"

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_trainer,node_client_factory,node_results toneBlue
class node_image_data,node_sampling,node_pcl_utils,node_modelnet,node_shapenet,node_native_data,node_point_provider,node_geometry toneAmber
class node_client,node_fedavg,node_model_factory,node_architectures,node_mobilenet,node_decood_losses,node_imbalance_loss,node_prototype_utils toneMint
class node_topology,node_decentralized,node_mst,node_vmf_gossip,node_gossip toneRose
class node_operator toneIndigo
```

## Components

### Experiment orchestration

- [Training runner](https://github.com/biprodip/dfeddg2/blob/main/run_trainer_dfeddg2.py): `run_trainer_dfeddg2.py`
- [Client factory](https://github.com/biprodip/dfeddg2/blob/main/client_manager.py): `client_manager.py`
- [Experiment results](https://github.com/biprodip/dfeddg2/tree/main/results): `results`

### Data and geometry

- [Image datasets](https://github.com/biprodip/dfeddg2/blob/main/lib/data_utils.py): `lib/data_utils.py`
- [Client data sampling](https://github.com/biprodip/dfeddg2/blob/main/lib/sampling.py): `lib/sampling.py`
- [Point-cloud utilities](https://github.com/biprodip/dfeddg2/blob/main/lib/pcl_utils.py): `lib/pcl_utils.py`
- [ModelNet loader](https://github.com/biprodip/dfeddg2/blob/main/data/ModelNetDataLoader.py): `data/ModelNetDataLoader.py`
- [ShapeNet loader](https://github.com/biprodip/dfeddg2/blob/main/data/ShapeNetDataLoader.py): `data/ShapeNetDataLoader.py`
- [Native data utilities](https://github.com/biprodip/dfeddg2/blob/main/data/native_data_utils.py): `data/native_data_utils.py`
- [Point-cloud provider](https://github.com/biprodip/dfeddg2/blob/main/data/provider.py): `data/provider.py`
- [3D data utilities](https://github.com/biprodip/dfeddg2/blob/main/data/utils_3d.py): `data/utils_3d.py`

### Client learning

- [DECOOD client](https://github.com/biprodip/dfeddg2/blob/main/clients/client_decood_vmf.py): `clients/client_decood_vmf.py`
- [FedAvg client](https://github.com/biprodip/dfeddg2/blob/main/clients/client_fed_avg.py): `clients/client_fed_avg.py`
- [Model factory](https://github.com/biprodip/dfeddg2/blob/main/models/model_manager.py): `models/model_manager.py`
- [Model architectures](https://github.com/biprodip/dfeddg2/blob/main/models/models.py): `models/models.py`
- [MobileNet backbone](https://github.com/biprodip/dfeddg2/blob/main/models/mobilenet_v2.py): `models/mobilenet_v2.py`
- [DECOOD losses](https://github.com/biprodip/dfeddg2/blob/main/utils/losses_decood.py): `utils/losses_decood.py`
- [Imbalance losses](https://github.com/biprodip/dfeddg2/blob/main/utils/imb_losses.py): `utils/imb_losses.py`
- [Prototype utilities](https://github.com/biprodip/dfeddg2/blob/main/utils/utils_proto.py): `utils/utils_proto.py`

### Gossip communication

- [Topology manager](https://github.com/biprodip/dfeddg2/blob/main/comm_utils/topology_manager.py): `comm_utils/topology_manager.py`
- [Graph mixing](https://github.com/biprodip/dfeddg2/blob/main/comm_utils/decentralized.py): `comm_utils/decentralized.py`
- [Spanning tree](https://github.com/biprodip/dfeddg2/blob/main/comm_utils/mst.py): `comm_utils/mst.py`
- [vMF gossip](https://github.com/biprodip/dfeddg2/blob/main/comm_utils/comm_vmf_gossip.py): `comm_utils/comm_vmf_gossip.py`
- [Prototype gossip](https://github.com/biprodip/dfeddg2/blob/main/comm_utils/comm_gossip.py): `comm_utils/comm_gossip.py`

### Other components

- **Experiment operator**

## Connections

- Experiment operator → Training runner: runs (evidence: `README.md`)
- Training runner → Model factory: creates models (evidence: `run_trainer_dfeddg2.py`)
- Model factory → Model architectures: dispatches to (evidence: `models/model_manager.py`)
- Training runner → Topology manager: configures topology (evidence: `run_trainer_dfeddg2.py`)
- Topology manager → Spanning tree: uses tree utility (evidence: `comm_utils/topology_manager.py`)
- Training runner → Client factory: initializes clients (evidence: `run_trainer_dfeddg2.py`)
- Client factory → DECOOD client: creates (evidence: `client_manager.py`)
- DECOOD client → DECOOD losses: trains with (evidence: `clients/client_decood_vmf.py`)
- DECOOD client → Imbalance losses: uses (evidence: `clients/client_decood_vmf.py`)
- DECOOD client → vMF gossip: exchanges prototypes (evidence: `README.md`)
- vMF gossip → Graph mixing: uses graph utilities (evidence: `comm_utils/comm_vmf_gossip.py`)
- Graph mixing → Spanning tree: computes tree (evidence: `comm_utils/decentralized.py`)
- vMF gossip → Prototype utilities: uses (evidence: `comm_utils/comm_vmf_gossip.py`)
- DECOOD client → Image datasets: loads client data (evidence: `clients/client_decood_vmf.py`)
- Training runner → Client data sampling: partitions data
- Training runner → Experiment results: saves outcomes
- Training runner → FedAvg client: selects alternative
- Training runner → Prototype gossip: selects alternative
- Model factory → MobileNet backbone: supports backbone
- Point-cloud utilities → Client data sampling: uses sampling (evidence: `lib/pcl_utils.py`)
- 3D data utilities → ModelNet loader: loads dataset (evidence: `data/utils_3d.py`)
- 3D data utilities → Point-cloud provider: uses augmentation (evidence: `data/utils_3d.py`)
- Training runner → Point-cloud utilities: uses point-cloud support (evidence: `run_trainer_dfeddg2.py`)
- Model factory → ModelNet loader: supports 3D models
