# schobs/medimarker architecture

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

- Interactive diagram: https://gitdiagram.com/schobs/medimarker
- Repository: https://github.com/schobs/medimarker

## Overview

##### Project Type and Purpose
- The project is a research/production pipeline for anatomical landmark localization (using models such as U-Net, PHD-Net, and Convolutional Gaussian Processes). It supports uncertainty estimation, ensembling, patch‐based training, and a comprehensive configuration system using .yaml files.

##### File Structure
- There are clear modular divisions by functionality:
- Configuration: Directories such as “configs” (with many subdirectories for dev, GP, legacy, and local) indicate a strong emphasis on easy customization via YAML.
- Data Management and Preprocessing: The “datasets”, “preprocessing”, and “transforms” directories handle data ingestion, JSON generation, and image transformation.
- Model Implementations: Under “models” you find architectures for U-Net, PHD-Net, and GP models grouped in subdirectories.
- Training and Inference: “trainer” contains various training routines for different model types while “inference” holds scripts for inference tasks.
- Evaluation: The “evaluation” folder holds scripts for analyzing model outputs.
- Utilities and Logging: “utils” and “losses” support logging, TensorFlow helper scripts, and loss definitions.
- Deployment/Scripting: “scripts” contains various HPC and training scripts.
- The pattern is clearly modular with a separation between configuration, data, model definitions, training/inference, evaluation, and utilities.

## Diagram (Mermaid)

```mermaid
graph TD
    UI["User Interface & Execution"]:::ui
    configMgr["Configuration Manager"]:::config
    dataLayer["Data Loader (datasets)"]:::data
    preproc["Data Preprocessing (preprocessing)"]:::preprocess
    transforms["Data Transformation (transforms)"]:::preprocess
    modelLayer["Model Architectures (U-Net, PHD-Net, GP)"]:::model
    trainer["Training Module (trainer)"]:::train
    inference["Inference Module (inference)"]:::infer
    eval["Evaluation Module (evaluation)"]:::eval
    utils["Utilities & Logging (utils)"]:::utils
    deploy["Deployment/Scripting (scripts)"]:::deploy
    external["External Dependencies (conda, GPU, Comet.ML)"]:::external

    UI -->|"loads_config"| configMgr
    configMgr -->|"fetches_data"| dataLayer
    dataLayer -->|"raw_data"| preproc
    preproc -->|"processed_data"| transforms
    transforms -->|"model_input"| modelLayer
    modelLayer <-->|"training_loop"| trainer
    trainer -->|"produces_model"| inference
    inference -->|"results"| eval

    configMgr -.->|"logs_to"| utils
    trainer -.->|"logs_to"| utils
    inference -.->|"logs_to"| utils
    eval -.->|"logs_to"| utils

    deploy -->|"triggers_train"| trainer
    deploy -->|"triggers_infer"| inference

    external -.->|"provides_env"| UI

    click UI "https://github.com/schobs/medimarker/blob/main/main.py"
    click UI "https://github.com/schobs/medimarker/blob/main/config.py"
    click configMgr "https://github.com/schobs/medimarker/tree/main/configs/"
    click dataLayer "https://github.com/schobs/medimarker/tree/main/datasets/"
    click preproc "https://github.com/schobs/medimarker/tree/main/preprocessing/"
    click transforms "https://github.com/schobs/medimarker/tree/main/transforms/"
    click modelLayer "https://github.com/schobs/medimarker/tree/main/models/"
    click trainer "https://github.com/schobs/medimarker/tree/main/trainer/"
    click inference "https://github.com/schobs/medimarker/tree/main/inference/"
    click eval "https://github.com/schobs/medimarker/tree/main/evaluation/"
    click utils "https://github.com/schobs/medimarker/tree/main/utils/"
    click deploy "https://github.com/schobs/medimarker/tree/main/scripts/scripts_bess/"

    classDef ui fill:#B3CDE0,stroke:#333,stroke-width:2px;
    classDef config fill:#FBB4AE,stroke:#333,stroke-width:2px;
    classDef data fill:#CCEBC5,stroke:#333,stroke-width:2px;
    classDef preprocess fill:#DECBE4,stroke:#333,stroke-width:2px;
    classDef model fill:#FED9A6,stroke:#333,stroke-width:2px;
    classDef train fill:#FFFFCC,stroke:#333,stroke-width:2px;
    classDef infer fill:#FEEBE2,stroke:#333,stroke-width:2px;
    classDef eval fill:#E5D8BD,stroke:#333,stroke-width:2px;
    classDef utils fill:#D9D9D9,stroke:#333,stroke-width:2px;
    classDef deploy fill:#B3DE69,stroke:#333,stroke-width:2px;
    classDef external fill:#FDE0DD,stroke:#333,stroke-width:2px;
```
