# dwofk/fast-depth architecture

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

- Interactive diagram: https://gitdiagram.com/dwofk/fast-depth
- Repository: https://github.com/dwofk/fast-depth

## Overview

FastDepth is a monocular depth-estimation project: it turns RGB images into depth maps, with NYU Depth V2 data preparation, model architectures, and accuracy evaluation on a host, plus compiled-model inference on Jetson TX2. The README documents the evaluation and deployment entry points; sampled code shows dataset loading, model composition, metrics, and TX2 runtime behavior. The main evaluation driver and preprocessing implementation were not sampled, so those links are shown only where documented or marked unverified.

Main entry points: [`deploy/tx2_run_tvm.py`](https://github.com/dwofk/fast-depth/blob/master/deploy/tx2_run_tvm.py) (TX2 Inference Runner), [`main.py`](https://github.com/dwofk/fast-depth/blob/master/main.py) (Evaluation Entry), [`dataloaders/nyu.py`](https://github.com/dwofk/fast-depth/blob/master/dataloaders/nyu.py) (NYU Dataset Adapter), [`dataloaders/dataloader.py`](https://github.com/dwofk/fast-depth/blob/master/dataloaders/dataloader.py) (HDF5 Loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Depth Data"]
  node_nyu[("NYU Dataset")]
  node_nyu_dataset["NYU Dataset Adapter<br/>[nyu.py]"]
  node_h5_loader["HDF5 Loader<br/>[dataloader.py]"]
  node_transforms["Image Transforms<br/>[transforms.py]"]
end

subgraph group_inference["Depth Inference"]
  node_model["Depth Models<br/>[models.py]"]
  node_mobilenet["MobileNet Encoder<br/>[mobilenet.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_main["Evaluation Entry<br/>[main.py]"]
  node_metrics["Depth Metrics<br/>[metrics.py]"]
end

subgraph group_deployment["TX2 Deployment"]
  node_compiled["Compiled Model Files"]
  node_tx2_runner["TX2 Inference Runner<br/>[tx2_run_tvm.py]"]
  node_tvm["TVM Runtime"]
  node_arrays["RGB / Depth Arrays"]
  node_visualize["Array Visualizer<br/>[visualize.py]"]
end

node_user(("Engineer"))

node_user -->|"runs evaluation"| node_main
node_nyu -.->|"provides samples"| node_nyu_dataset
node_nyu_dataset -->|"inherits loading"| node_h5_loader
node_h5_loader -->|"uses transforms"| node_transforms
node_main -.->|"loads evaluation data"| node_nyu_dataset
node_main -.->|"runs inference"| node_model
node_model -->|"builds encoder"| node_mobilenet
node_main -.->|"evaluates predictions"| node_metrics
node_user -->|"runs deployment"| node_tx2_runner
node_compiled -->|"provides model files"| node_tx2_runner
node_arrays -->|"provides RGB input"| node_tx2_runner
node_tx2_runner -->|"invokes runtime"| node_tvm
node_tx2_runner -->|"writes depth output"| node_arrays
node_arrays -->|"loads arrays"| node_visualize

click node_nyu_dataset "https://github.com/dwofk/fast-depth/blob/master/dataloaders/nyu.py"
click node_h5_loader "https://github.com/dwofk/fast-depth/blob/master/dataloaders/dataloader.py"
click node_transforms "https://github.com/dwofk/fast-depth/blob/master/dataloaders/transforms.py"
click node_main "https://github.com/dwofk/fast-depth/blob/master/main.py"
click node_model "https://github.com/dwofk/fast-depth/blob/master/models.py"
click node_mobilenet "https://github.com/dwofk/fast-depth/blob/master/imagenet/mobilenet.py"
click node_metrics "https://github.com/dwofk/fast-depth/blob/master/metrics.py"
click node_tx2_runner "https://github.com/dwofk/fast-depth/blob/master/deploy/tx2_run_tvm.py"
click node_visualize "https://github.com/dwofk/fast-depth/blob/master/deploy/data/visualize.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_nyu,node_nyu_dataset,node_h5_loader,node_transforms toneBlue
class node_model,node_mobilenet toneAmber
class node_main,node_metrics toneMint
class node_compiled,node_tx2_runner,node_tvm,node_arrays,node_visualize toneRose
class node_user toneIndigo
```

## Components

### Depth Data

- **NYU Dataset**
- [NYU Dataset Adapter](https://github.com/dwofk/fast-depth/blob/master/dataloaders/nyu.py): `dataloaders/nyu.py`
- [HDF5 Loader](https://github.com/dwofk/fast-depth/blob/master/dataloaders/dataloader.py): `dataloaders/dataloader.py`
- [Image Transforms](https://github.com/dwofk/fast-depth/blob/master/dataloaders/transforms.py): `dataloaders/transforms.py`

### Depth Inference

- [Depth Models](https://github.com/dwofk/fast-depth/blob/master/models.py): `models.py`
- [MobileNet Encoder](https://github.com/dwofk/fast-depth/blob/master/imagenet/mobilenet.py): `imagenet/mobilenet.py`

### Evaluation

- [Evaluation Entry](https://github.com/dwofk/fast-depth/blob/master/main.py): `main.py`
- [Depth Metrics](https://github.com/dwofk/fast-depth/blob/master/metrics.py): `metrics.py`

### TX2 Deployment

- **Compiled Model Files**
- [TX2 Inference Runner](https://github.com/dwofk/fast-depth/blob/master/deploy/tx2_run_tvm.py): `deploy/tx2_run_tvm.py`
- **TVM Runtime**
- **RGB / Depth Arrays**
- [Array Visualizer](https://github.com/dwofk/fast-depth/blob/master/deploy/data/visualize.py): `deploy/data/visualize.py`

### Other components

- **Engineer**

## Connections

- Engineer → Evaluation Entry: runs evaluation (evidence: `README.md`)
- NYU Dataset → NYU Dataset Adapter: provides samples (evidence: `README.md`)
- NYU Dataset Adapter → HDF5 Loader: inherits loading (evidence: `dataloaders/nyu.py`)
- HDF5 Loader → Image Transforms: uses transforms (evidence: `dataloaders/dataloader.py`)
- Evaluation Entry → NYU Dataset Adapter: loads evaluation data
- Evaluation Entry → Depth Models: runs inference
- Depth Models → MobileNet Encoder: builds encoder (evidence: `models.py`)
- Evaluation Entry → Depth Metrics: evaluates predictions
- Engineer → TX2 Inference Runner: runs deployment (evidence: `README.md`)
- Compiled Model Files → TX2 Inference Runner: provides model files (evidence: `deploy/tx2_run_tvm.py`)
- RGB / Depth Arrays → TX2 Inference Runner: provides RGB input (evidence: `deploy/tx2_run_tvm.py`)
- TX2 Inference Runner → TVM Runtime: invokes runtime (evidence: `deploy/tx2_run_tvm.py`)
- TX2 Inference Runner → RGB / Depth Arrays: writes depth output (evidence: `deploy/tx2_run_tvm.py`)
- RGB / Depth Arrays → Array Visualizer: loads arrays (evidence: `deploy/data/visualize.py`)
