# garvita-tiwari/sizer architecture

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

- Interactive diagram: https://gitdiagram.com/garvita-tiwari/sizer
- Repository: https://github.com/garvita-tiwari/sizer

## Overview

##### Project’s Main Components
- Data & Configuration:
- The “data” directory includes data pre-processing modules (e.g., geometry utilities) that handle 3D garment information.
- “configs” holds configuration files (YAML files for ParserNet and SizerNet) that drive experiments.
- Global environment variables and dataset directory settings are defined in “utils/global_var.py”.
- Model & Training:
- The “models” directory is at the core: it includes modules for loading data, setting up the loss functions, defining the neural network architecture (under models/network), and separate scripts for training ParserNet and SizerNet.
- “trainer.py” is the central entry point that, based on a given configuration, dispatches model training.
- “generate.py” handles evaluation or generation tasks.
- SMPL Utilities:
- The “smpl_lib” folder contains SMPL-related routines (e.g., pose mapping, linear blend skinning, geometric computations) which are essential for handling 3D garment deformations.
- Utilities & Visualisation:
- “utils” contains supplementary functions (e.g., geometry utilities, SMPL paths).
- “visualisation” is likely for rendering or displaying model outputs and intermediate results.
- Supporting Files:
- “requirements.txt” defines dependencies.
- “configs” and other scripts allow switching between training and evaluation (ParserNet vs. SizerNet) via command-line arguments.

##### Architectural Patterns / Design Principles
- Modular Design: The project is structured into clearly separated modules (data, models, configuration, SMPL library, utilities, and visualisation) allowing clear boundaries between data processing, model definition, and evaluation.
- Configuration Driven: The use of YAML config files enables different experiment setups that can directly modify the behavior of training/evaluation scripts.
- Domain-Specific Abstraction: The SMPL library represents an abstraction for handling 3D garment synthesis tasks, which should be clearly highlighted as a core utility shared among processing tasks.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Data
    SIZER["SIZER Dataset (External Input)"]:::external

    %% Data & Configuration Layer
    subgraph "Data & Configuration"
        DPP["Data Preprocessing (data/)"]:::data
        CONF["Configurations (configs/)"]:::config
        GV["Global Variables (utils/global_var.py)"]:::config
    end

    %% Model & Training Layer
    subgraph "Model & Training"
        TP["Entry Point: trainer.py"]:::train
        PT["ParserNet Training (models/train_parser.py)"]:::train
        ST["SizerNet Training (models/train_sizer.py)"]:::train
        DL["Data Loader (models/load_data.py)"]:::train
        LF["Loss Functions (models/loss.py)"]:::train
        subgraph "Neural Network Modules"
            MA["Model Architecture (models/network)"]:::network
            NM["Net Modules (models/network/net_modules.py)"]:::network
        end
    end

    %% SMPL Utility Library
    subgraph "SMPL Utility Library"
        SMPL["SMPL Utilities (smpl_lib/)"]:::smpl
        SMPL_PATHS["SMPL Paths (utils/smpl_paths.py)"]:::smpl
    end

    %% Evaluation & Generation
    Eval["Evaluation/Generation (generate.py)"]:::eval

    %% Utilities & Visualisation Layer
    subgraph "Utilities & Visualisation"
        UTIL["General Utilities (utils/geometry.py)"]:::util
        VIS["Visualisation (visualisation/)"]:::util
    end

    %% Supporting Files
    subgraph "Supporting Files"
        REQ["Dependencies (requirements.txt)"]:::support
        DOC["Documentation (README.md & LICENSE.md)"]:::support
        EVALS["Evaluation Script (eval.sh)"]:::support
    end

    %% Relationships
    SIZER -->|"data_in"| DPP
    CONF -->|"configures"| TP
    GV -->|"sets_env"| DPP

    DPP -->|"prepares_data"| DL
    DPP -->|"feeds_data"| TP

    TP -->|"triggers"| PT
    TP -->|"triggers"| ST
    TP -->|"loads_data"| DL
    TP -->|"computes_loss"| LF

    PT -->|"utilizes"| MA
    ST -->|"utilizes"| MA
    MA -->|"composes"| NM

    SMPL -->|"supports_3D"| TP
    SMPL_PATHS -->|"used_by"| SMPL

    TP -->|"initiates_eval"| Eval
    Eval -->|"outputs_to"| VIS

    UTIL -->|"supports"| DPP
    UTIL -->|"supports"| TP

    %% Supporting files connections (non-functional, for representation)
    REQ --- DOC
    DOC --- EVALS

    %% Click Events
    click DPP "https://github.com/garvita-tiwari/sizer/tree/master/data/"
    click CONF "https://github.com/garvita-tiwari/sizer/tree/master/configs/"
    click GV "https://github.com/garvita-tiwari/sizer/blob/master/utils/global_var.py"
    click TP "https://github.com/garvita-tiwari/sizer/blob/master/trainer.py"
    click PT "https://github.com/garvita-tiwari/sizer/blob/master/models/train_parser.py"
    click ST "https://github.com/garvita-tiwari/sizer/blob/master/models/train_sizer.py"
    click DL "https://github.com/garvita-tiwari/sizer/blob/master/models/load_data.py"
    click LF "https://github.com/garvita-tiwari/sizer/blob/master/models/loss.py"
    click MA "https://github.com/garvita-tiwari/sizer/tree/master/models/network/"
    click NM "https://github.com/garvita-tiwari/sizer/blob/master/models/network/net_modules.py"
    click SMPL "https://github.com/garvita-tiwari/sizer/tree/master/smpl_lib/"
    click SMPL_PATHS "https://github.com/garvita-tiwari/sizer/blob/master/utils/smpl_paths.py"
    click Eval "https://github.com/garvita-tiwari/sizer/blob/master/generate.py"
    click UTIL "https://github.com/garvita-tiwari/sizer/blob/master/utils/geometry.py"
    click VIS "https://github.com/garvita-tiwari/sizer/tree/master/visualisation/"
    click REQ "https://github.com/garvita-tiwari/sizer/blob/master/requirements.txt"
    click DOC "https://github.com/garvita-tiwari/sizer/blob/master/README.md"
    click EVALS "https://github.com/garvita-tiwari/sizer/blob/master/eval.sh"

    %% Styles
    classDef external fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef data fill:#ccffcc,stroke:#006600,stroke-width:2px;
    classDef config fill:#ccffcc,stroke:#006600,stroke-width:2px;
    classDef train fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef network fill:#d1c4e9,stroke:#512da8,stroke-width:2px;
    classDef smpl fill:#ffe6cc,stroke:#e65100,stroke-width:2px;
    classDef eval fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef util fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef support fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
