# tumftm/camradepth architecture

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

- Interactive diagram: https://gitdiagram.com/tumftm/camradepth
- Repository: https://github.com/tumftm/camradepth

## Overview

CamRaDepth estimates dense depth from monocular images and sparse radar, with optional semantic supervision. Its main workflow prepares NuScenes inputs, loads multimodal samples, trains or tests the fusion model, and can visualize predictions. The graph also preserves the documented LiDAR/radar preparation and semantic-label branches. Source excerpts show the runner’s principal dependencies and selected preprocessing calls; README statements support the broader preparation workflow, while unsampled integrations are not asserted as direct calls.

Main entry points: [`src/main/runner.py`](https://github.com/tumftm/camradepth/blob/main/src/main/runner.py) (Train and test runner), [`scripts`](https://github.com/tumftm/camradepth/tree/main/scripts) (Preparation scripts), [`src/models/CamRaDepth.py`](https://github.com/tumftm/camradepth/blob/main/src/models/CamRaDepth.py) (CamRaDepth model), [`src/visualization/visualization.py`](https://github.com/tumftm/camradepth/blob/main/src/visualization/visualization.py) (Prediction visualization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_preparation["Data preparation"]
  node_prep_scripts["Preparation scripts"]
  node_path_setup["Library path setup<br/>[_init_paths.py]"]
  node_lidar_fusion["LiDAR fusion<br/>[fuse_lidar.py]"]
  node_radar_fusion["Radar fusion<br/>[fuse_radar.py]"]
  node_semantic_labels["Semantic labels<br/>[vehicle_seg.py]"]
end

subgraph group_runtime["Model runtime"]
  node_runner["Train and test runner<br/>[runner.py]"]
  node_config["Runtime arguments<br/>[args.py]"]
  node_dataset["Multimodal dataset<br/>[dataloader.py]"]
end

subgraph group_architecture["Network and objectives"]
  node_model["CamRaDepth model<br/>[CamRaDepth.py]"]
  node_attention["Transformer backbone"]
  node_model_utils["Decoder blocks<br/>[utils.py]"]
  node_losses["Depth and smoothness losses<br/>[loss_funcs.py]"]
  node_optimizer["diffGradNorm optimizer<br/>[diffGradNorm.py]"]
end

subgraph group_inspection["Evaluation and visualization"]
  node_visualization["Prediction visualization<br/>[visualization.py]"]
end

node_user(("Research user"))
node_nuscenes[("NuScenes data")]

node_user -->|"prepares data"| node_prep_scripts
node_nuscenes -->|"supplies samples"| node_prep_scripts
node_prep_scripts -->|"calls LiDAR fusion"| node_lidar_fusion
node_prep_scripts -->|"calls radar fusion"| node_radar_fusion
node_prep_scripts -->|"loads paths"| node_path_setup
node_user -->|"generates labels"| node_semantic_labels
node_user -->|"starts run"| node_runner
node_runner -->|"reads settings"| node_config
node_runner -->|"creates loaders"| node_dataset
node_dataset -->|"reads options"| node_config
node_runner -->|"trains or evaluates"| node_model
node_model -->|"uses backbone"| node_attention
node_model -->|"uses decoder blocks"| node_model_utils
node_model -->|"reads settings"| node_config
node_runner -->|"computes objectives"| node_losses
node_runner -->|"uses optimizer"| node_optimizer
node_runner -.->|"offers inspection"| node_visualization
node_visualization -->|"loads samples"| node_dataset
node_visualization -->|"runs predictions"| node_model

click node_prep_scripts "https://github.com/tumftm/camradepth/tree/main/scripts"
click node_path_setup "https://github.com/tumftm/camradepth/blob/main/scripts/_init_paths.py"
click node_lidar_fusion "https://github.com/tumftm/camradepth/blob/main/lib/fuse_lidar.py"
click node_radar_fusion "https://github.com/tumftm/camradepth/blob/main/lib/fuse_radar.py"
click node_semantic_labels "https://github.com/tumftm/camradepth/blob/main/scripts/vehicle_seg.py"
click node_runner "https://github.com/tumftm/camradepth/blob/main/src/main/runner.py"
click node_config "https://github.com/tumftm/camradepth/blob/main/src/utils/args.py"
click node_dataset "https://github.com/tumftm/camradepth/blob/main/src/data/dataloader.py"
click node_model "https://github.com/tumftm/camradepth/blob/main/src/models/CamRaDepth.py"
click node_attention "https://github.com/tumftm/camradepth/blob/main/src/models/simplified_attention.py"
click node_model_utils "https://github.com/tumftm/camradepth/blob/main/src/utils/utils.py"
click node_losses "https://github.com/tumftm/camradepth/blob/main/src/utils/loss_funcs.py"
click node_optimizer "https://github.com/tumftm/camradepth/blob/main/src/models/diffGradNorm.py"
click node_visualization "https://github.com/tumftm/camradepth/blob/main/src/visualization/visualization.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_prep_scripts,node_path_setup,node_lidar_fusion,node_radar_fusion,node_semantic_labels,node_user toneBlue
class node_runner,node_config,node_dataset,node_nuscenes toneAmber
class node_model,node_attention,node_model_utils,node_losses,node_optimizer toneMint
class node_visualization toneRose
```

## Components

### Data preparation

- [Preparation scripts](https://github.com/tumftm/camradepth/tree/main/scripts): `scripts`
- [Library path setup](https://github.com/tumftm/camradepth/blob/main/scripts/_init_paths.py): `scripts/_init_paths.py`
- [LiDAR fusion](https://github.com/tumftm/camradepth/blob/main/lib/fuse_lidar.py): `lib/fuse_lidar.py`
- [Radar fusion](https://github.com/tumftm/camradepth/blob/main/lib/fuse_radar.py): `lib/fuse_radar.py`
- [Semantic labels](https://github.com/tumftm/camradepth/blob/main/scripts/vehicle_seg.py): `scripts/vehicle_seg.py`

### Model runtime

- [Train and test runner](https://github.com/tumftm/camradepth/blob/main/src/main/runner.py): `src/main/runner.py`
- [Runtime arguments](https://github.com/tumftm/camradepth/blob/main/src/utils/args.py): `src/utils/args.py`
- [Multimodal dataset](https://github.com/tumftm/camradepth/blob/main/src/data/dataloader.py): `src/data/dataloader.py`

### Network and objectives

- [CamRaDepth model](https://github.com/tumftm/camradepth/blob/main/src/models/CamRaDepth.py): `src/models/CamRaDepth.py`
- [Transformer backbone](https://github.com/tumftm/camradepth/blob/main/src/models/simplified_attention.py): `src/models/simplified_attention.py`
- [Decoder blocks](https://github.com/tumftm/camradepth/blob/main/src/utils/utils.py): `src/utils/utils.py`
- [Depth and smoothness losses](https://github.com/tumftm/camradepth/blob/main/src/utils/loss_funcs.py): `src/utils/loss_funcs.py`
- [diffGradNorm optimizer](https://github.com/tumftm/camradepth/blob/main/src/models/diffGradNorm.py): `src/models/diffGradNorm.py`

### Evaluation and visualization

- [Prediction visualization](https://github.com/tumftm/camradepth/blob/main/src/visualization/visualization.py): `src/visualization/visualization.py`

### Other components

- **Research user**
- **NuScenes data**

## Connections

- Research user → Preparation scripts: prepares data (evidence: `README.md`)
- NuScenes data → Preparation scripts: supplies samples (evidence: `README.md`)
- Preparation scripts → LiDAR fusion: calls LiDAR fusion (evidence: `scripts/cal_gt.py`)
- Preparation scripts → Radar fusion: calls radar fusion (evidence: `scripts/cal_radar.py`)
- Preparation scripts → Library path setup: loads paths (evidence: `scripts/cal_gt.py`)
- Research user → Semantic labels: generates labels (evidence: `README.md`)
- Research user → Train and test runner: starts run (evidence: `README.md`)
- Train and test runner → Runtime arguments: reads settings (evidence: `src/main/runner.py`)
- Train and test runner → Multimodal dataset: creates loaders (evidence: `src/main/runner.py`)
- Multimodal dataset → Runtime arguments: reads options (evidence: `src/data/dataloader.py`)
- Train and test runner → CamRaDepth model: trains or evaluates (evidence: `src/main/runner.py`)
- CamRaDepth model → Transformer backbone: uses backbone (evidence: `src/models/CamRaDepth.py`)
- CamRaDepth model → Decoder blocks: uses decoder blocks (evidence: `src/models/CamRaDepth.py`)
- CamRaDepth model → Runtime arguments: reads settings (evidence: `src/models/CamRaDepth.py`)
- Train and test runner → Depth and smoothness losses: computes objectives (evidence: `src/main/runner.py`)
- Train and test runner → diffGradNorm optimizer: uses optimizer (evidence: `src/main/runner.py`)
- Train and test runner → Prediction visualization: offers inspection
- Prediction visualization → Multimodal dataset: loads samples (evidence: `src/visualization/visualization.py`)
- Prediction visualization → CamRaDepth model: runs predictions (evidence: `src/visualization/visualization.py`)
