# yxjiang0125/mvs architecture

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

- Interactive diagram: https://gitdiagram.com/yxjiang0125/mvs
- Repository: https://github.com/yxjiang0125/mvs

## Overview

MVSAnywhere estimates metric depth from a reference image and posed source views, with demo/inference entry points for scans and user recordings. Dataset adapters supply multi-view imagery and camera geometry; the depth model builds multi-view features and predicts depth, with optional monocular calibration and refinement. Demo options can fuse depth into meshes. The repository also supports training and evaluation, and a separate RegSplatfacto integration uses MVSAnywhere depth for Gaussian-splatting regularization. The README establishes these capabilities; sampled excerpts are partial, so uncertain internal wiring is omitted.

Main entry points: [`src/mvsanywhere/experiment_modules/sr_depth_model.py`](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/experiment_modules/sr_depth_model.py) (Depth Model), [`src/mvsanywhere/run_demo.py`](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/run_demo.py) (Demo Runner), [`src/mvsanywhere/train.py`](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/train.py) (Training Entry), [`src/mvsanywhere/datasets`](https://github.com/yxjiang0125/mvs/tree/main/src/mvsanywhere/datasets) (Dataset Adapters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data and Geometry"]
  node_datasets["Dataset Adapters"]
  node_generic["MVS Tuple Dataset"]
  node_geometry["Geometry Utilities<br/>[geometry_utils.py]"]
end

subgraph group_depth["Depth Estimation"]
  node_model["Depth Model<br/>[sr_depth_model.py]"]
  node_cost["Cost Volume<br/>[cost_volume.py]"]
  node_features["Feature Volumes<br/>[feature_volume.py]"]
  node_networks["Network Blocks<br/>[networks.py]"]
  node_calibration["Metric Calibration"]
end

subgraph group_outputs["Inference and Fusion"]
  node_demo["Demo Runner<br/>[run_demo.py]"]
  node_api["Inference API<br/>[hubconf.py]"]
  node_fusion["Depth Fusion<br/>[partial_fuser.py]"]
  node_tsdf["TSDF Volume<br/>[tsdf.py]"]
  node_mesh["Mesh Rendering<br/>[mesh_renderer.py]"]
end

subgraph group_training["Training and Evaluation"]
  node_losses["Depth Losses<br/>[losses.py]"]
  node_train["Training Entry<br/>[train.py]"]
  node_evaluation["Evaluation<br/>[evaluation.py]"]
end

subgraph group_splat["Splat Regularization"]
  node_regular_data["Splat Data Manager"]
  node_regular_dataset["MVS Splat Dataset"]
  node_regular_model["RegSplatfacto Model"]
  node_splat_output["Splat Rendering"]
end

node_user(("Scan / Recording"))
node_result["Depth / Mesh Output"]

node_user -->|"provides scan"| node_demo
node_demo -->|"configures input"| node_datasets
node_datasets -->|"adapts tuples"| node_generic
node_demo -->|"runs inference"| node_model
node_api -->|"invokes model"| node_model
node_model -->|"builds matching"| node_cost
node_model -->|"uses features"| node_features
node_model -->|"uses blocks"| node_networks
node_model -->|"calibrates depth"| node_calibration
node_model -->|"uses geometry"| node_geometry
node_model -->|"predicts depth"| node_result
node_demo -->|"requests fusion"| node_fusion
node_fusion -->|"integrates depth"| node_tsdf
node_tsdf -->|"extracts mesh"| node_mesh
node_mesh -->|"produces mesh"| node_result
node_train -->|"loads training data"| node_datasets
node_train -->|"trains model"| node_model
node_train -->|"computes losses"| node_losses
node_evaluation -->|"evaluates predictions"| node_model
node_regular_data -->|"creates dataset"| node_regular_dataset
node_regular_dataset -->|"requests depth"| node_api
node_regular_data -->|"supplies training data"| node_regular_model
node_regular_model -->|"renders splats"| node_splat_output
node_splat_output -->|"produces render"| node_result

click node_demo "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/run_demo.py"
click node_api "https://github.com/yxjiang0125/mvs/blob/main/hubconf.py"
click node_datasets "https://github.com/yxjiang0125/mvs/tree/main/src/mvsanywhere/datasets"
click node_generic "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/datasets/generic_mvs_dataset.py"
click node_geometry "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/utils/geometry_utils.py"
click node_model "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/experiment_modules/sr_depth_model.py"
click node_cost "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/modules/cost_volume.py"
click node_features "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/modules/feature_volume.py"
click node_networks "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/modules/networks.py"
click node_calibration "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/modules/metric_calibration.py"
click node_losses "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/losses.py"
click node_train "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/train.py"
click node_evaluation "https://github.com/yxjiang0125/mvs/blob/main/scripts/evaluation.py"
click node_fusion "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/tools/partial_fuser.py"
click node_tsdf "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/tools/tsdf.py"
click node_mesh "https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/tools/mesh_renderer.py"
click node_regular_data "https://github.com/yxjiang0125/mvs/blob/main/src/regsplatfacto/regsplatfacto/data/regsplatfacto_datamanager.py"
click node_regular_dataset "https://github.com/yxjiang0125/mvs/blob/main/src/regsplatfacto/regsplatfacto/data/mvsanywhere_dataset.py"
click node_regular_model "https://github.com/yxjiang0125/mvs/blob/main/src/regsplatfacto/regsplatfacto/regsplatfacto_model.py"
click node_splat_output "https://github.com/yxjiang0125/mvs/blob/main/src/regsplatfacto/regsplatfacto/render_for_meshing.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_datasets,node_generic,node_geometry toneBlue
class node_model,node_cost,node_features,node_networks,node_calibration toneAmber
class node_demo,node_api,node_fusion,node_tsdf,node_mesh toneMint
class node_losses,node_train,node_evaluation toneRose
class node_regular_data,node_regular_dataset,node_regular_model,node_splat_output,node_user,node_result toneIndigo
```

## Components

### Data and Geometry

- [Dataset Adapters](https://github.com/yxjiang0125/mvs/tree/main/src/mvsanywhere/datasets): `src/mvsanywhere/datasets`
- [MVS Tuple Dataset](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/datasets/generic_mvs_dataset.py): `src/mvsanywhere/datasets/generic_mvs_dataset.py`
- [Geometry Utilities](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/utils/geometry_utils.py): `src/mvsanywhere/utils/geometry_utils.py`

### Depth Estimation

- [Depth Model](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/experiment_modules/sr_depth_model.py): `src/mvsanywhere/experiment_modules/sr_depth_model.py`
- [Cost Volume](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/modules/cost_volume.py): `src/mvsanywhere/modules/cost_volume.py`
- [Feature Volumes](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/modules/feature_volume.py): `src/mvsanywhere/modules/feature_volume.py`
- [Network Blocks](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/modules/networks.py): `src/mvsanywhere/modules/networks.py`
- [Metric Calibration](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/modules/metric_calibration.py): `src/mvsanywhere/modules/metric_calibration.py`

### Inference and Fusion

- [Demo Runner](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/run_demo.py): `src/mvsanywhere/run_demo.py`
- [Inference API](https://github.com/yxjiang0125/mvs/blob/main/hubconf.py): `hubconf.py`
- [Depth Fusion](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/tools/partial_fuser.py): `src/mvsanywhere/tools/partial_fuser.py`
- [TSDF Volume](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/tools/tsdf.py): `src/mvsanywhere/tools/tsdf.py`
- [Mesh Rendering](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/tools/mesh_renderer.py): `src/mvsanywhere/tools/mesh_renderer.py`

### Training and Evaluation

- [Depth Losses](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/losses.py): `src/mvsanywhere/losses.py`
- [Training Entry](https://github.com/yxjiang0125/mvs/blob/main/src/mvsanywhere/train.py): `src/mvsanywhere/train.py`
- [Evaluation](https://github.com/yxjiang0125/mvs/blob/main/scripts/evaluation.py): `scripts/evaluation.py`

### Splat Regularization

- [Splat Data Manager](https://github.com/yxjiang0125/mvs/blob/main/src/regsplatfacto/regsplatfacto/data/regsplatfacto_datamanager.py): `src/regsplatfacto/regsplatfacto/data/regsplatfacto_datamanager.py`
- [MVS Splat Dataset](https://github.com/yxjiang0125/mvs/blob/main/src/regsplatfacto/regsplatfacto/data/mvsanywhere_dataset.py): `src/regsplatfacto/regsplatfacto/data/mvsanywhere_dataset.py`
- [RegSplatfacto Model](https://github.com/yxjiang0125/mvs/blob/main/src/regsplatfacto/regsplatfacto/regsplatfacto_model.py): `src/regsplatfacto/regsplatfacto/regsplatfacto_model.py`
- [Splat Rendering](https://github.com/yxjiang0125/mvs/blob/main/src/regsplatfacto/regsplatfacto/render_for_meshing.py): `src/regsplatfacto/regsplatfacto/render_for_meshing.py`

### Other components

- **Scan / Recording**
- **Depth / Mesh Output**

## Connections

- Scan / Recording → Demo Runner: provides scan
- Demo Runner → Dataset Adapters: configures input
- Dataset Adapters → MVS Tuple Dataset: adapts tuples
- Demo Runner → Depth Model: runs inference
- Inference API → Depth Model: invokes model
- Depth Model → Cost Volume: builds matching
- Depth Model → Feature Volumes: uses features
- Depth Model → Network Blocks: uses blocks
- Depth Model → Metric Calibration: calibrates depth
- Depth Model → Geometry Utilities: uses geometry
- Depth Model → Depth / Mesh Output: predicts depth
- Demo Runner → Depth Fusion: requests fusion
- Depth Fusion → TSDF Volume: integrates depth
- TSDF Volume → Mesh Rendering: extracts mesh
- Mesh Rendering → Depth / Mesh Output: produces mesh
- Training Entry → Dataset Adapters: loads training data
- Training Entry → Depth Model: trains model
- Training Entry → Depth Losses: computes losses
- Evaluation → Depth Model: evaluates predictions
- Splat Data Manager → MVS Splat Dataset: creates dataset
- MVS Splat Dataset → Inference API: requests depth
- Splat Data Manager → RegSplatfacto Model: supplies training data
- RegSplatfacto Model → Splat Rendering: renders splats
- Splat Rendering → Depth / Mesh Output: produces render
