# canaltinigne/deepheightweight architecture

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

- Interactive diagram: https://gitdiagram.com/canaltinigne/deepheightweight
- Repository: https://github.com/canaltinigne/deepheightweight

## Overview

##### Project Type & Purpose
- A deep-learning pipeline for estimating human height and weight from images.
- Implements two parallel networks (height vs. weight) with shared design pattern.

##### Key Components (from file tree & README)
- Data Layer
– dataset.py / dataset_weight.py: data loading, augmentation, batching
– dataset_test.py / dataset_weight_test.py: unit tests for data pipelines
- Model Layer
– network.py / network_weight.py: PyTorch model definitions
– loss.py: custom loss functions
- Training Orchestration
– train.py / train_weight.py: training loops, optimizer setup, checkpoint saving
– logs/: training logs (e.g., TensorBoard)
- Artifacts & Analysis
– models/: serialized checkpoints (2 GB each)
– Results_HW.ipynb & images/: evaluation, visual results
- Environment & Configuration
– environment.yml: conda environment spec

##### Component Relationships & Data Flow
Data Ingestion → Model Definition → Training Loop →
Logs & Checkpoints → Evaluation Notebook
(Two parallel branches for height and weight networks, sharing the same flow)

##### Architectural Patterns & Principles
- Modular separation: data / model / training / evaluation
- Reproducibility: environment.yml, unit tests, fixed directory layout
- Experiment tracking: logs/ + models/ persistence

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Environment & Configuration"
        env["environment.yml"]:::code
    end

    subgraph "Data Layer"
        direction TB
        raw["Raw Images"]:::data
        subgraph "Height Pipeline"
            direction TB
            dh["dataset.py"]:::code
            dht["dataset_test.py"]:::code
        end
        subgraph "Weight Pipeline"
            direction TB
            dw["dataset_weight.py"]:::code
            dwt["dataset_weight_test.py"]:::code
        end
        raw -->|"Images"| dh
        raw -->|"Images"| dw
        dh -->|"Batches"| dht
        dw -->|"Batches"| dwt
    end

    subgraph "Model Layer"
        direction TB
        nh["network.py"]:::code
        nw["network_weight.py"]:::code
        loss["loss.py"]:::code
    end

    subgraph "Training Orchestration"
        direction TB
        th["train.py"]:::code
        tw["train_weight.py"]:::code
    end

    subgraph "Artifacts & Tracking"
        direction TB
        logs[(logs/)]:::artifacts
        models[(models/)]:::artifacts
        img[(images/)]:::artifacts
        nb["Results_HW.ipynb"]:::artifacts
    end

    %% Data to Model
    dh -->|"Tensor(batch,C,H,W)"| nh
    dw -->|"Tensor(batch,C,H,W)"| nw

    %% Model to Loss
    nh -->|"features"| loss
    nw -->|"features"| loss

    %% Loss to Training
    loss -->|"loss scalar"| th
    loss -->|"loss scalar"| tw

    %% Training outputs
    th -->|"Checkpoint .pt"| models
    tw -->|"Checkpoint .pt"| models
    th -->|".log"| logs
    tw -->|".log"| logs

    %% Artifacts to Analysis
    models -->|"checkpoints"| nb
    logs -->|"metrics"| nb
    nb -->|"plots"| img

    %% Config link
    env -.-> dh
    env -.-> dw
    env -.-> th
    env -.-> tw

    %% Click events
    click dh "https://github.com/canaltinigne/deepheightweight/blob/master/dataset.py"
    click dw "https://github.com/canaltinigne/deepheightweight/blob/master/dataset_weight.py"
    click dht "https://github.com/canaltinigne/deepheightweight/blob/master/dataset_test.py"
    click dwt "https://github.com/canaltinigne/deepheightweight/blob/master/dataset_weight_test.py"
    click nh "https://github.com/canaltinigne/deepheightweight/blob/master/network.py"
    click nw "https://github.com/canaltinigne/deepheightweight/blob/master/network_weight.py"
    click loss "https://github.com/canaltinigne/deepheightweight/blob/master/loss.py"
    click th "https://github.com/canaltinigne/deepheightweight/blob/master/train.py"
    click tw "https://github.com/canaltinigne/deepheightweight/blob/master/train_weight.py"
    click logs "https://github.com/canaltinigne/deepheightweight/tree/master/logs/"
    click models "https://github.com/canaltinigne/deepheightweight/tree/master/models/"
    click nb "https://github.com/canaltinigne/deepheightweight/blob/master/Results_HW.ipynb"
    click img "https://github.com/canaltinigne/deepheightweight/tree/master/images/"
    click env "https://github.com/canaltinigne/deepheightweight/blob/master/environment.yml"

    %% Styles
    classDef code fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef data fill:#98FB98,stroke:#333,stroke-width:1px;
    classDef artifacts fill:#FFA500,stroke:#333,stroke-width:1px;
```
