# tencent-hunyuan/hunyuanworld-mirror architecture

> Architecture diagram of the GitHub repository tencent-hunyuan/hunyuanworld-mirror, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tencent-hunyuan/hunyuanworld-mirror
- Repository: https://github.com/tencent-hunyuan/hunyuanworld-mirror

## Overview

HunyuanWorld-Mirror is a feed-forward 3D geometry prediction system with an interactive demo, inference utilities, train/evaluation code, and a Gaussian-splat rendering path. The principal workflow accepts image sequences plus optional camera-pose, depth, and intrinsics priors; predicts camera and dense geometry representations; optionally renders 3D Gaussians; and exposes visualized or saved results. Training and evaluation are separate product capabilities. Some subsystem links rely on README claims or SOURCE INDEX references because their implementation excerpts were not provided.

Main entry points: [`src/models/models/worldmirror.py`](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/models/worldmirror.py) (WorldMirror forward pass), [`app.py`](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/app.py) (Interactive demo), [`training/wrapper.py`](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/training/wrapper.py) (Training wrapper), [`src/models/models/rasterization.py`](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/models/rasterization.py) (Gaussian splat preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_demo["Interactive demo<br/>[app.py]"]
  node_input["Image and prior loading<br/>[inference_utils.py]"]
  node_outputs["Visualization and exports<br/>[visual_util.py]"]
  node_save["Result saving<br/>[save_utils.py]"]
end

subgraph group_model["Prediction model"]
  node_world["WorldMirror forward pass<br/>[worldmirror.py]"]
  node_transformer["Visual geometry transformer"]
  node_priors["Prior encoding<br/>[priors.py]"]
  node_camera["Camera prediction<br/>[camera_head.py]"]
  node_dense["Dense geometry prediction<br/>[dense_head.py]"]
  node_geometry["Camera geometry utilities<br/>[camera_utils.py]"]
end

subgraph group_render["3D Gaussian rendering"]
  node_splatmodel["Gaussian splat preparation<br/>[rasterization.py]"]
  node_renderutils["Render and post-process<br/>[render_utils.py]"]
end

subgraph group_training["Training and evaluation"]
  node_train_data["Multiview data"]
  node_train_entry["Training wrapper<br/>[wrapper.py]"]
  node_losses["Training losses<br/>[container.py]"]
  node_evaluation["Task evaluation"]
end

subgraph group_gsplat["gsplat backend"]
  node_gsrender["Gaussian rasterization<br/>[rendering.py]"]
  node_gsops["CUDA and Torch operations<br/>[_wrapper.py]"]
end

node_user(("User"))
node_store[("Saved predictions")]

node_user -->|"submits inputs"| node_demo
node_demo -->|"preprocesses images"| node_input
node_input -.->|"provides tensors"| node_world
node_demo -->|"runs inference"| node_world
node_world -->|"encodes views"| node_transformer
node_world -->|"normalizes priors"| node_priors
node_world -->|"predicts cameras"| node_camera
node_world -->|"predicts geometry"| node_dense
node_world -->|"renders predictions"| node_splatmodel
node_camera -.->|"uses conversions"| node_geometry
node_splatmodel -->|"calls rasterizer"| node_gsrender
node_gsrender -->|"dispatches operations"| node_gsops
node_demo -->|"renders results"| node_renderutils
node_demo -->|"builds scene views"| node_outputs
node_demo -->|"exports outputs"| node_save
node_save -.->|"writes files"| node_store
node_train_data -.->|"supplies batches"| node_train_entry
node_train_entry -->|"trains model"| node_world
node_train_entry -.->|"computes losses"| node_losses
node_train_entry -->|"evaluates tasks"| node_evaluation
node_renderutils -->|"uses rendering"| node_splatmodel

click node_demo "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/app.py"
click node_input "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/utils/inference_utils.py"
click node_outputs "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/utils/visual_util.py"
click node_save "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/utils/save_utils.py"
click node_world "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/models/worldmirror.py"
click node_transformer "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/models/visual_transformer.py"
click node_priors "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/utils/priors.py"
click node_camera "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/heads/camera_head.py"
click node_dense "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/heads/dense_head.py"
click node_geometry "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/utils/camera_utils.py"
click node_splatmodel "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/models/rasterization.py"
click node_renderutils "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/utils/render_utils.py"
click node_train_data "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/training/data/multiview_dataset.py"
click node_train_entry "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/training/wrapper.py"
click node_losses "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/training/losses/container.py"
click node_evaluation "https://github.com/tencent-hunyuan/hunyuanworld-mirror/tree/main/training/utils/eval"
click node_gsrender "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/submodules/gsplat/gsplat/rendering.py"
click node_gsops "https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/submodules/gsplat/gsplat/cuda/_wrapper.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_demo,node_input,node_outputs,node_save,node_user toneBlue
class node_world,node_transformer,node_priors,node_camera,node_dense,node_geometry,node_store toneAmber
class node_splatmodel,node_renderutils toneMint
class node_train_data,node_train_entry,node_losses,node_evaluation toneRose
class node_gsrender,node_gsops toneIndigo
```

## Components

### User interaction

- [Interactive demo](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/app.py): `app.py`
- [Image and prior loading](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/utils/inference_utils.py): `src/utils/inference_utils.py`
- [Visualization and exports](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/utils/visual_util.py): `src/utils/visual_util.py`
- [Result saving](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/utils/save_utils.py): `src/utils/save_utils.py`

### Prediction model

- [WorldMirror forward pass](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/models/worldmirror.py): `src/models/models/worldmirror.py`
- [Visual geometry transformer](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/models/visual_transformer.py): `src/models/models/visual_transformer.py`
- [Prior encoding](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/utils/priors.py): `src/models/utils/priors.py`
- [Camera prediction](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/heads/camera_head.py): `src/models/heads/camera_head.py`
- [Dense geometry prediction](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/heads/dense_head.py): `src/models/heads/dense_head.py`
- [Camera geometry utilities](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/utils/camera_utils.py): `src/models/utils/camera_utils.py`

### 3D Gaussian rendering

- [Gaussian splat preparation](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/models/models/rasterization.py): `src/models/models/rasterization.py`
- [Render and post-process](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/src/utils/render_utils.py): `src/utils/render_utils.py`

### Training and evaluation

- [Multiview data](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/training/data/multiview_dataset.py): `training/data/multiview_dataset.py`
- [Training wrapper](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/training/wrapper.py): `training/wrapper.py`
- [Training losses](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/training/losses/container.py): `training/losses/container.py`
- [Task evaluation](https://github.com/tencent-hunyuan/hunyuanworld-mirror/tree/main/training/utils/eval): `training/utils/eval`

### gsplat backend

- [Gaussian rasterization](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/submodules/gsplat/gsplat/rendering.py): `submodules/gsplat/gsplat/rendering.py`
- [CUDA and Torch operations](https://github.com/tencent-hunyuan/hunyuanworld-mirror/blob/main/submodules/gsplat/gsplat/cuda/_wrapper.py): `submodules/gsplat/gsplat/cuda/_wrapper.py`

### Other components

- **User**
- **Saved predictions**

## Connections

- User → Interactive demo: submits inputs (evidence: `README.md`)
- Interactive demo → Image and prior loading: preprocesses images (evidence: `app.py`)
- Image and prior loading → WorldMirror forward pass: provides tensors
- Interactive demo → WorldMirror forward pass: runs inference (evidence: `app.py`)
- WorldMirror forward pass → Visual geometry transformer: encodes views (evidence: `src/models/models/worldmirror.py`)
- WorldMirror forward pass → Prior encoding: normalizes priors (evidence: `src/models/models/worldmirror.py`)
- WorldMirror forward pass → Camera prediction: predicts cameras (evidence: `src/models/models/worldmirror.py`)
- WorldMirror forward pass → Dense geometry prediction: predicts geometry (evidence: `src/models/models/worldmirror.py`)
- WorldMirror forward pass → Gaussian splat preparation: renders predictions (evidence: `src/models/models/worldmirror.py`)
- Camera prediction → Camera geometry utilities: uses conversions
- Gaussian splat preparation → Gaussian rasterization: calls rasterizer (evidence: `src/models/models/rasterization.py`)
- Gaussian rasterization → CUDA and Torch operations: dispatches operations (evidence: `submodules/gsplat/gsplat/rendering.py`)
- Interactive demo → Render and post-process: renders results (evidence: `app.py`)
- Interactive demo → Visualization and exports: builds scene views (evidence: `app.py`)
- Interactive demo → Result saving: exports outputs (evidence: `app.py`)
- Result saving → Saved predictions: writes files
- Multiview data → Training wrapper: supplies batches
- Training wrapper → WorldMirror forward pass: trains model (evidence: `training/wrapper.py`)
- Training wrapper → Training losses: computes losses
- Training wrapper → Task evaluation: evaluates tasks (evidence: `training/wrapper.py`)
- Render and post-process → Gaussian splat preparation: uses rendering (evidence: `src/utils/render_utils.py`)
