# djene-mengistu/dseg_models architecture

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

- Interactive diagram: https://gitdiagram.com/djene-mengistu/dseg_models
- Repository: https://github.com/djene-mengistu/dseg_models

## Overview

This repository is a steel-surface defect segmentation research codebase: it trains and compares segmentation models on NEU-Seg and SSDD, with a proposed transformer-encoder/CNN-decoder model among the alternatives. The principal workflow runs dataset-specific training, produces segmentation predictions, and evaluates segmentation quality; the README also highlights processing time and computational complexity. The graph preserves documented dataset, model-family, and evaluation branches. Source excerpts show training setup and selected model internals, but not all runtime wiring, so uncertain calls are omitted.

Main entry points: [`models`](https://github.com/djene-mengistu/dseg_models/tree/main/models) (Comparative models), [`models/proposed_models`](https://github.com/djene-mengistu/dseg_models/tree/main/models/proposed_models) (Hybrid model family), [`NEU_train.py`](https://github.com/djene-mengistu/dseg_models/blob/main/NEU_train.py) (NEU training), [`SSDD_train.py`](https://github.com/djene-mengistu/dseg_models/blob/main/SSDD_train.py) (SSDD training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Datasets"]
  node_neu_data[("NEU-Seg data")]
  node_ssdd_data[("SSDD data")]
  node_neu_loader["NEU loader<br/>[NEU_dataloaders.py]"]
  node_ssdd_loader["SSDD loader"]
end

subgraph group_training["Training"]
  node_neu_train["NEU training<br/>[NEU_train.py]"]
  node_ssdd_train["SSDD training<br/>[SSDD_train.py]"]
  node_neu_utils["NEU utilities<br/>[NEU_utilities.py]"]
  node_ssdd_utils["SSDD utilities<br/>[SSDD_utilities.py]"]
end

subgraph group_architectures["Segmentation Models"]
  node_model_catalog["Comparative models"]
  node_proposed_models["Hybrid model family"]
  node_proposed_heads["Segmentation heads<br/>[upernet_head.py]"]
  node_convnext["ConvNeXt encoder<br/>[convnext.py]"]
  node_mit["MiT encoder<br/>[mit.py]"]
  node_pvt["PVT encoder<br/>[pvt.py]"]
  node_rest["ResT encoder<br/>[rest.py]"]
  node_proposed_resnet["ResNet encoder<br/>[resnet.py]"]
  node_legacy_base["Segmentation base<br/>[base_model.py]"]
  node_legacy_utils["Model operations<br/>[utilities.py]"]
  node_danet["DANet<br/>[DANet.py]"]
  node_ocnet["OCNet<br/>[OCNet.py]"]
  node_fpn["FPN<br/>[FPN.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_losses["Segmentation losses<br/>[losses.py]"]
  node_metrics["Segmentation metrics<br/>[metrics.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"provides data"| node_neu_data
node_researcher -->|"provides data"| node_ssdd_data
node_neu_train -->|"uses utilities"| node_neu_utils
node_ssdd_train -->|"uses utilities"| node_ssdd_utils
node_neu_train -->|"runs model"| node_model_catalog
node_ssdd_train -->|"runs model"| node_model_catalog
node_model_catalog -.->|"evaluates quality"| node_metrics
node_model_catalog -.->|"optimizes with"| node_losses
node_model_catalog -->|"uses base"| node_legacy_base
node_model_catalog -->|"uses base"| node_legacy_base
node_legacy_base -->|"uses operations"| node_legacy_utils
node_proposed_models -->|"offers encoder"| node_convnext
node_proposed_models -->|"offers encoder"| node_mit
node_proposed_models -->|"offers encoder"| node_pvt
node_proposed_models -->|"offers encoder"| node_rest
node_proposed_models -->|"offers encoder"| node_proposed_resnet
node_proposed_models -.->|"uses decoder"| node_proposed_heads
node_neu_data -.->|"loads samples"| node_neu_loader
node_ssdd_data -.->|"loads samples"| node_ssdd_loader
node_neu_loader -.->|"feeds batches"| node_neu_train
node_ssdd_loader -.->|"feeds batches"| node_ssdd_train
node_researcher -->|"compares methods"| node_model_catalog
node_model_catalog -.->|"includes model"| node_danet
node_model_catalog -.->|"includes model"| node_ocnet
node_model_catalog -.->|"includes model"| node_fpn

click node_neu_data "https://github.com/djene-mengistu/dseg_models/tree/main/data"
click node_ssdd_data "https://github.com/djene-mengistu/dseg_models/tree/main/data"
click node_neu_loader "https://github.com/djene-mengistu/dseg_models/blob/main/NEU_dataloaders.py"
click node_ssdd_loader "https://github.com/djene-mengistu/dseg_models/blob/main/SSDD_dataloaders.py"
click node_neu_train "https://github.com/djene-mengistu/dseg_models/blob/main/NEU_train.py"
click node_ssdd_train "https://github.com/djene-mengistu/dseg_models/blob/main/SSDD_train.py"
click node_neu_utils "https://github.com/djene-mengistu/dseg_models/blob/main/NEU_utilities.py"
click node_ssdd_utils "https://github.com/djene-mengistu/dseg_models/blob/main/SSDD_utilities.py"
click node_model_catalog "https://github.com/djene-mengistu/dseg_models/tree/main/models"
click node_proposed_models "https://github.com/djene-mengistu/dseg_models/tree/main/models/proposed_models"
click node_proposed_heads "https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/upernet_head.py"
click node_convnext "https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/convnext.py"
click node_mit "https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/mit.py"
click node_pvt "https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/pvt.py"
click node_rest "https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/rest.py"
click node_proposed_resnet "https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/resnet.py"
click node_legacy_base "https://github.com/djene-mengistu/dseg_models/blob/main/models/utilities/base_model.py"
click node_legacy_utils "https://github.com/djene-mengistu/dseg_models/blob/main/models/utilities/utilities.py"
click node_danet "https://github.com/djene-mengistu/dseg_models/blob/main/models/DANet.py"
click node_ocnet "https://github.com/djene-mengistu/dseg_models/blob/main/models/OCNet.py"
click node_fpn "https://github.com/djene-mengistu/dseg_models/blob/main/models/FPN.py"
click node_losses "https://github.com/djene-mengistu/dseg_models/blob/main/losses.py"
click node_metrics "https://github.com/djene-mengistu/dseg_models/blob/main/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_neu_data,node_ssdd_data,node_neu_loader,node_ssdd_loader toneBlue
class node_neu_train,node_ssdd_train,node_neu_utils,node_ssdd_utils toneAmber
class node_model_catalog,node_proposed_models,node_proposed_heads,node_convnext,node_mit,node_pvt,node_rest,node_proposed_resnet,node_legacy_base,node_legacy_utils,node_danet,node_ocnet,node_fpn toneMint
class node_losses,node_metrics toneRose
class node_researcher toneIndigo
```

## Components

### Datasets

- [NEU-Seg data](https://github.com/djene-mengistu/dseg_models/tree/main/data): `data`
- [SSDD data](https://github.com/djene-mengistu/dseg_models/tree/main/data): `data`
- [NEU loader](https://github.com/djene-mengistu/dseg_models/blob/main/NEU_dataloaders.py): `NEU_dataloaders.py`
- [SSDD loader](https://github.com/djene-mengistu/dseg_models/blob/main/SSDD_dataloaders.py): `SSDD_dataloaders.py`

### Training

- [NEU training](https://github.com/djene-mengistu/dseg_models/blob/main/NEU_train.py): `NEU_train.py`
- [SSDD training](https://github.com/djene-mengistu/dseg_models/blob/main/SSDD_train.py): `SSDD_train.py`
- [NEU utilities](https://github.com/djene-mengistu/dseg_models/blob/main/NEU_utilities.py): `NEU_utilities.py`
- [SSDD utilities](https://github.com/djene-mengistu/dseg_models/blob/main/SSDD_utilities.py): `SSDD_utilities.py`

### Segmentation Models

- [Comparative models](https://github.com/djene-mengistu/dseg_models/tree/main/models): `models`
- [Hybrid model family](https://github.com/djene-mengistu/dseg_models/tree/main/models/proposed_models): `models/proposed_models`
- [Segmentation heads](https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/upernet_head.py): `models/proposed_models/upernet_head.py`
- [ConvNeXt encoder](https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/convnext.py): `models/proposed_models/convnext.py`
- [MiT encoder](https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/mit.py): `models/proposed_models/mit.py`
- [PVT encoder](https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/pvt.py): `models/proposed_models/pvt.py`
- [ResT encoder](https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/rest.py): `models/proposed_models/rest.py`
- [ResNet encoder](https://github.com/djene-mengistu/dseg_models/blob/main/models/proposed_models/resnet.py): `models/proposed_models/resnet.py`
- [Segmentation base](https://github.com/djene-mengistu/dseg_models/blob/main/models/utilities/base_model.py): `models/utilities/base_model.py`
- [Model operations](https://github.com/djene-mengistu/dseg_models/blob/main/models/utilities/utilities.py): `models/utilities/utilities.py`
- [DANet](https://github.com/djene-mengistu/dseg_models/blob/main/models/DANet.py): `models/DANet.py`
- [OCNet](https://github.com/djene-mengistu/dseg_models/blob/main/models/OCNet.py): `models/OCNet.py`
- [FPN](https://github.com/djene-mengistu/dseg_models/blob/main/models/FPN.py): `models/FPN.py`

### Evaluation

- [Segmentation losses](https://github.com/djene-mengistu/dseg_models/blob/main/losses.py): `losses.py`
- [Segmentation metrics](https://github.com/djene-mengistu/dseg_models/blob/main/metrics.py): `metrics.py`

### Other components

- **Researcher**

## Connections

- Researcher → NEU-Seg data: provides data (evidence: `README.md`)
- Researcher → SSDD data: provides data (evidence: `README.md`)
- NEU training → NEU utilities: uses utilities (evidence: `NEU_train.py`)
- SSDD training → SSDD utilities: uses utilities (evidence: `SSDD_train.py`)
- NEU training → Comparative models: runs model (evidence: `NEU_train.py`)
- SSDD training → Comparative models: runs model (evidence: `SSDD_train.py`)
- Comparative models → Segmentation metrics: evaluates quality
- Comparative models → Segmentation losses: optimizes with
- Comparative models → Segmentation base: uses base (evidence: `models/DANet.py`)
- Comparative models → Segmentation base: uses base (evidence: `models/OCNet.py`)
- Segmentation base → Model operations: uses operations (evidence: `models/utilities/base_model.py`)
- Hybrid model family → ConvNeXt encoder: offers encoder (evidence: `models/proposed_models/base.py`)
- Hybrid model family → MiT encoder: offers encoder (evidence: `models/proposed_models/base.py`)
- Hybrid model family → PVT encoder: offers encoder (evidence: `models/proposed_models/base.py`)
- Hybrid model family → ResT encoder: offers encoder (evidence: `models/proposed_models/base.py`)
- Hybrid model family → ResNet encoder: offers encoder (evidence: `models/proposed_models/base.py`)
- Hybrid model family → Segmentation heads: uses decoder (evidence: `README.md`)
- NEU-Seg data → NEU loader: loads samples
- SSDD data → SSDD loader: loads samples
- NEU loader → NEU training: feeds batches
- SSDD loader → SSDD training: feeds batches
- Researcher → Comparative models: compares methods (evidence: `README.md`)
- Comparative models → DANet: includes model (evidence: `models/DANet.py`)
- Comparative models → OCNet: includes model (evidence: `models/OCNet.py`)
- Comparative models → FPN: includes model
