# nhtlongcs/ucc-ai-quest-2023 architecture

> Architecture diagram of the GitHub repository nhtlongcs/ucc-ai-quest-2023, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nhtlongcs/ucc-ai-quest-2023
- Repository: https://github.com/nhtlongcs/ucc-ai-quest-2023

## Overview

- Raw Images → Data Pipeline → Model → Training/Inference → Results

Parallel paths for:
- Training flow
- Validation flow
- Inference flow

##### External Integrations (Gray Hexagons)
- Weights & Biases Integration
- Third-party packages:
- segmentation_models.pytorch
- semantic-segmentation
- ttach

##### Configuration System (Orange Rectangle)
- YAML Config Files (configs/)
- Model Configurations
- Training Parameters
- Augmentation Settings

##### Utility Components (Light Blue Ovals)
- Metrics Calculation (core/metrics)
- Visualization Tools (core/utils/visualization)
- Device Management (core/utils/device.py)
- Logger System (core/utils/logger.py)

Key Design Principles to Highlight:

##### Modularity
- Clear separation between components
- Plugin architecture for models
- Demonstrate configuration flexibility

##### Pipeline Flow
- Feedback loops for training

##### Scalability Features
- Multi-model support
- Ensemble capabilities
- Distributed training potential

##### Integration Points
- Clear interfaces between components
- Extension points
- External service connections

**🔷 Core Components**
**🔶 Configuration**
**↔️ Data Flow**
**⚡ Processing Pipeline**
**🔄 Training Loop**
**📊 Metrics & Logging**

Special Considerations:

##### Where monitoring and metrics collection occur

This system design should effectively communicate both the high-level architecture and the detailed implementation specifics of this semantic segmentation project.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Data_Pipeline
        Input["Input Data Processing"]
        Aug["Augmentation Pipeline"]:::aug
        DataH["Dataset Handlers"]:::datasets
        Collate["Custom Collate"]:::collate
        Input --> Aug --> DataH --> Collate
    end

    subgraph Model_Architecture
        Registry["Model Registry"]:::registry
        Models["Model Implementations"]
        subgraph Models_List
            ConvNext["ConvNext"]:::convnext
            Mask2Former["Mask2Former"]:::mask2former
            ResNet["ResNet"]:::resnet
            SegFormer["SegFormer"]:::segformer
            UNet["UNet"]:::unet
        end
        Registry --> Models
        Models --> Models_List
    end

    subgraph Training_System
        Train["Training Loop"]:::train
        Valid["Validation Loop"]:::valid
        Loss["Loss Functions"]:::losses
        Callback["Callbacks System"]:::callbacks
        Metrics["Metrics Tracking"]
        Train --> Valid
        Train --> Loss
        Train --> Callback
        Train --> Metrics
    end

    subgraph Inference_Pipeline
        Predict["Prediction Module"]:::predict
        PostProc["Post-processing"]
        Ensemble["Ensemble Methods"]:::ensemble
        TTA["Test-Time Augmentation"]
        Predict --> PostProc
        PostProc --> Ensemble
        PostProc --> TTA
    end

    subgraph Config_System
        YAMLConfig["YAML Configs"]:::config
        ModelConfig["Model Configurations"]:::baseconfig
        TrainParams["Training Parameters"]
        AugSettings["Augmentation Settings"]
        YAMLConfig --> ModelConfig
        YAMLConfig --> TrainParams
        YAMLConfig --> AugSettings
    end

    subgraph Utils
        MetricsCalc["Metrics Calculation"]:::metrics
        Viz["Visualization Tools"]:::viz
        Device["Device Management"]:::device
        Logger["Logger System"]:::logger
    end

    subgraph External
        WandB["Weights & Biases"]
        SMP["segmentation_models.pytorch"]
        SS["semantic-segmentation"]
        TTACH["ttach"]
    end

    Data_Pipeline --> Model_Architecture
    Model_Architecture --> Training_System
    Model_Architecture --> Inference_Pipeline
    Config_System --> Training_System
    Config_System --> Model_Architecture
    Config_System --> Data_Pipeline
    Training_System --> External
    Utils --> Training_System
    Utils --> Inference_Pipeline

    classDef aug fill:#a8d5ff,stroke:#333,stroke-width:1px
    classDef datasets fill:#a8d5ff,stroke:#333,stroke-width:1px
    classDef collate fill:#a8d5ff,stroke:#333,stroke-width:1px
    classDef registry fill:#98fb98,stroke:#333,stroke-width:1px
    classDef convnext fill:#98fb98,stroke:#333,stroke-width:1px
    classDef mask2former fill:#98fb98,stroke:#333,stroke-width:1px
    classDef resnet fill:#98fb98,stroke:#333,stroke-width:1px
    classDef segformer fill:#98fb98,stroke:#333,stroke-width:1px
    classDef unet fill:#98fb98,stroke:#333,stroke-width:1px
    classDef train fill:#fff59d,stroke:#333,stroke-width:1px
    classDef valid fill:#fff59d,stroke:#333,stroke-width:1px
    classDef losses fill:#fff59d,stroke:#333,stroke-width:1px
    classDef callbacks fill:#fff59d,stroke:#333,stroke-width:1px
    classDef predict fill:#e6e6fa,stroke:#333,stroke-width:1px
    classDef ensemble fill:#e6e6fa,stroke:#333,stroke-width:1px
    classDef config fill:#ffa07a,stroke:#333,stroke-width:1px
    classDef baseconfig fill:#ffa07a,stroke:#333,stroke-width:1px
    classDef metrics fill:#add8e6,stroke:#333,stroke-width:1px
    classDef viz fill:#add8e6,stroke:#333,stroke-width:1px
    classDef device fill:#add8e6,stroke:#333,stroke-width:1px
    classDef logger fill:#add8e6,stroke:#333,stroke-width:1px

    click Aug "https://github.com/nhtlongcs/ucc-ai-quest-2023/tree/main/core/augmentations/"
    click DataH "https://github.com/nhtlongcs/ucc-ai-quest-2023/tree/main/pkg/datasets/"
    click Collate "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/pkg/datasets/custom_collate.py"
    click Registry "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/core/registry.py"
    click ConvNext "https://github.com/nhtlongcs/ucc-ai-quest-2023/tree/main/pkg/models/supervise/convnext_ssl_sfnet/"
    click Mask2Former "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/pkg/models/supervise/tf/mask2former.py"
    click ResNet "https://github.com/nhtlongcs/ucc-ai-quest-2023/tree/main/pkg/models/supervise/resnet/"
    click SegFormer "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/pkg/models/supervise/tf/segformer.py"
    click UNet "https://github.com/nhtlongcs/ucc-ai-quest-2023/tree/main/pkg/models/supervise/unet/"
    click Train "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/cli/train.py"
    click Valid "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/cli/validate.py"
    click Callback "https://github.com/nhtlongcs/ucc-ai-quest-2023/tree/main/core/callbacks/"
    click Loss "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/core/utils/losses.py"
    click YAMLConfig "https://github.com/nhtlongcs/ucc-ai-quest-2023/tree/main/configs/"
    click ModelConfig "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/configs/unet/base.yml"
    click MetricsCalc "https://github.com/nhtlongcs/ucc-ai-quest-2023/tree/main/core/metrics/"
    click Viz "https://github.com/nhtlongcs/ucc-ai-quest-2023/tree/main/core/utils/visualization/"
    click Device "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/core/utils/device.py"
    click Logger "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/core/utils/logger.py"
    click Predict "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/cli/predict.py"
    click Ensemble "https://github.com/nhtlongcs/ucc-ai-quest-2023/blob/main/notebooks/ensemble.ipynb"
```
