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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<h1 align="center">DAGE: Dual-Stream Architecture for Efficient and Fine-Grained Geometry Estimation</h1>
|
| 2 |
+
|
| 3 |
+
<div align="center">
|
| 4 |
+
<p>
|
| 5 |
+
<a href="https://ngoductuanlhp.github.io/">Tuan Duc Ngo</a><sup>1</sup>
|
| 6 |
+
<a href="https://gabriel-huang.github.io/">Jiahui Huang</a><sup>2</sup>
|
| 7 |
+
<a href="https://sites.google.com/view/seoungwugoh/">Seoung Wug Oh</a><sup>2</sup>
|
| 8 |
+
<a href="https://www.kmatzen.com/">Kevin Blackburn-Matzen</a><sup>2</sup>
|
| 9 |
+
<br>
|
| 10 |
+
<a href="https://kalo-ai.github.io/">Evangelos Kalogerakis</a><sup>1,3</sup>
|
| 11 |
+
<a href="https://people.csail.mit.edu/ganchuang/">Chuang Gan</a><sup>1</sup>
|
| 12 |
+
<a href="https://joonyoung-cv.github.io/">Joon-Young Lee</a><sup>2</sup>
|
| 13 |
+
</p>
|
| 14 |
+
<p>
|
| 15 |
+
<sup>1</sup>UMass Amherst
|
| 16 |
+
<sup>2</sup>Adobe Research
|
| 17 |
+
<sup>3</sup>TU Crete
|
| 18 |
+
</p>
|
| 19 |
+
<p>
|
| 20 |
+
<strong>CVPR 2026</strong>
|
| 21 |
+
</p>
|
| 22 |
+
</div>
|
| 23 |
+
|
| 24 |
+
<p align="center">
|
| 25 |
+
<a href="https://arxiv.org/abs/2603.03744" target="_blank">
|
| 26 |
+
<img src="https://img.shields.io/badge/Paper-00AEEF?style=plastic&logo=arxiv&logoColor=white" alt="Paper">
|
| 27 |
+
</a>
|
| 28 |
+
<a href="https://ngoductuanlhp.github.io/dage-site/" target="_blank">
|
| 29 |
+
<img src="https://img.shields.io/badge/Project Page-F78100?style=plastic&logo=google-chrome&logoColor=white" alt="Project Page">
|
| 30 |
+
</a>
|
| 31 |
+
</p>
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
<div align="center">
|
| 35 |
+
<a href="https://ngoductuanlhp.github.io/dage-site/">
|
| 36 |
+
<img src="assets/arch.jpg" width="90%">
|
| 37 |
+
</a>
|
| 38 |
+
<p>
|
| 39 |
+
<i>DAGE delivers accurate and consistent 3D geometry, fine-grained and high-resolution depthmaps, while maintaining efficiency and scalability.</i>
|
| 40 |
+
</p>
|
| 41 |
+
</div>
|
| 42 |
+
|
| 43 |
+
## Overview
|
| 44 |
+
|
| 45 |
+
DAGE is a dual-stream transformer that disentangles **global coherence** from **fine detail** for geometry estimation from uncalibrated multi-view/video inputs.
|
| 46 |
+
|
| 47 |
+
- **LR stream** builds view-consistent representations and estimates cameras efficiently.
|
| 48 |
+
- **HR stream** preserves sharp boundaries and fine structures per-frame.
|
| 49 |
+
- **Lightweight adapter** fuses the two via cross-attention without disturbing the pretrained single-frame pathway.
|
| 50 |
+
- Scales resolution and clip length independently, supports inputs up to 2K, and achieves state-of-the-art on video geometry estimation and multi-view reconstruction.
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
## Updates
|
| 54 |
+
* **[TBD]** Initial release with inference code and model checkpoint.
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
## Quick Start
|
| 58 |
+
|
| 59 |
+
### 1. Clone & Install Dependencies
|
| 60 |
+
|
| 61 |
+
```bash
|
| 62 |
+
git clone https://github.com/ngoductuanlhp/DAGE.git
|
| 63 |
+
cd DAGE
|
| 64 |
+
|
| 65 |
+
bash scripts/instal_env.sh
|
| 66 |
+
conda activate dage
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
This creates a conda environment with Python 3.10, PyTorch 2.10.0 (CUDA 13.0), and all required dependencies.
|
| 70 |
+
|
| 71 |
+
### 2. Download Checkpoints
|
| 72 |
+
|
| 73 |
+
Download the model checkpoint and place it in the `checkpoints/` directory:
|
| 74 |
+
|
| 75 |
+
```bash
|
| 76 |
+
mkdir -p checkpoints
|
| 77 |
+
# Download from Hugging Face (TBD)
|
| 78 |
+
gdown --fuzzy https://drive.google.com/file/d/1BsBJ7MTarlBP5RjCVfPQoQMsCxccBabF/view?usp=sharing -O ./checkpoints/
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
### 3. Run Inference
|
| 82 |
+
|
| 83 |
+
Run on the included demo data or your own video/image folder:
|
| 84 |
+
|
| 85 |
+
```bash
|
| 86 |
+
# Run with default settings on demo data
|
| 87 |
+
bash scripts/infer/infer_dage.sh
|
| 88 |
+
|
| 89 |
+
# Or run directly with custom arguments
|
| 90 |
+
|
| 91 |
+
# Default: LR at 252px, HR at 3600 tokens (~840x840 for square images)
|
| 92 |
+
python inference/infer_dage.py --checkpoint checkpoints/model.pt
|
| 93 |
+
|
| 94 |
+
# Higher LR resolution (better camera poses, more compute)
|
| 95 |
+
python inference/infer_dage.py --checkpoint checkpoints/model.pt --lr_max_size 518
|
| 96 |
+
|
| 97 |
+
# Higher HR resolution up to 2K (sharper pointmaps)
|
| 98 |
+
python inference/infer_dage.py --checkpoint checkpoints/model.pt --hr_max_size 1920
|
| 99 |
+
|
| 100 |
+
# Memory-efficient chunking for GPUs with <40GB VRAM (lower chunk_size if OOM)
|
| 101 |
+
python inference/infer_dage.py --checkpoint checkpoints/model.pt --hr_max_size 1920 --chunk_size 8
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
**Arguments:**
|
| 105 |
+
|
| 106 |
+
| Argument | Default | Description |
|
| 107 |
+
| :--- | :--- | :--- |
|
| 108 |
+
| `--checkpoint` | `checkpoints/model.pt` | Path to model checkpoint |
|
| 109 |
+
| `--output_dir` | `quali_results/dage` | Directory to save results |
|
| 110 |
+
| `--lr_max_size` | `252` | Max resolution for the LR stream |
|
| 111 |
+
| `--hr_max_size` | `None` | Max resolution for the HR stream (auto-computed from 3600 tokens if not set) |
|
| 112 |
+
| `--chunk_size` | `None` | Chunk size for HR stream (enables memory-efficient chunked inference) |
|
| 113 |
+
|
| 114 |
+
**Input**: Place videos (`.mp4`, `.MOV`) or image folders in `assets/demo_data/`.
|
| 115 |
+
|
| 116 |
+
**Output**: For each input, the script saves:
|
| 117 |
+
- `<name>_disp_colored.mp4` β colorized disparity video
|
| 118 |
+
- `<name>_depth_colored.mp4` β colorized depth video
|
| 119 |
+
- `<name>.npy` β dictionary with `pointmap`, `pointmap_global`, `pointmap_mask`, `rgb`, and `extrinsics`
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
## Detailed Usage
|
| 123 |
+
|
| 124 |
+
### Model Input & Output
|
| 125 |
+
|
| 126 |
+
* **Input**: `torch.Tensor` of shape `(B, N, 3, H, W)` with pixel values in `[0, 1]`.
|
| 127 |
+
* **Output**: A `dict` with the following keys:
|
| 128 |
+
|
| 129 |
+
| Key | Shape | Description |
|
| 130 |
+
| :--- | :--- | :--- |
|
| 131 |
+
| `local_points` | `(B, N, H, W, 3)` | Per-view 3D point maps in local camera space |
|
| 132 |
+
| `conf` | `(B, N, H, W, 1)` | Confidence logits (apply `torch.sigmoid()` for probabilities) |
|
| 133 |
+
| `camera_poses` | `(B, N, 4, 4)` | Camera-to-world transformation matrices (OpenCV convention) |
|
| 134 |
+
| `metric_scale` | `(B, 1)` | Predicted metric scale factor |
|
| 135 |
+
| `global_points` | `(B, N, H, W, 3)` | 3D points in world space (after `infer()`) |
|
| 136 |
+
| `mask` | `(B, N, H, W)` | Binary confidence mask (after `infer()`) |
|
| 137 |
+
|
| 138 |
+
### Example Code Snippet
|
| 139 |
+
|
| 140 |
+
```python
|
| 141 |
+
import torch
|
| 142 |
+
from dage.models.dage import DAGE
|
| 143 |
+
from dage.utils.data_utils import read_video
|
| 144 |
+
|
| 145 |
+
# --- Setup ---
|
| 146 |
+
device = 'cuda'
|
| 147 |
+
model = DAGE.from_pretrained('checkpoints/model.pt').to(device).eval()
|
| 148 |
+
|
| 149 |
+
# --- Load Data ---
|
| 150 |
+
# read_video returns (frames, H, W, fps)
|
| 151 |
+
# Options: stride=N, max_frames=N, force_num_frames=N
|
| 152 |
+
video, H, W, fps = read_video('path/to/video.mp4', stride=10, max_frames=100)
|
| 153 |
+
|
| 154 |
+
# Prepare tensors (B, N, C, H, W), values in [0, 1]
|
| 155 |
+
from einops import rearrange
|
| 156 |
+
import torch.nn.functional as F
|
| 157 |
+
|
| 158 |
+
lr_video = ... # resize to LR resolution (multiples of 14)
|
| 159 |
+
hr_video = ... # resize to HR resolution (multiples of 14)
|
| 160 |
+
|
| 161 |
+
lr_video = rearrange(torch.from_numpy(lr_video), 't h w c -> 1 t c h w').float().to(device) / 255.0
|
| 162 |
+
hr_video = rearrange(torch.from_numpy(hr_video), 't h w c -> 1 t c h w').float().to(device) / 255.0
|
| 163 |
+
|
| 164 |
+
# --- Inference ---
|
| 165 |
+
with torch.no_grad():
|
| 166 |
+
output = model.infer(
|
| 167 |
+
hr_video=hr_video,
|
| 168 |
+
lr_video=lr_video,
|
| 169 |
+
lr_max_size=252,
|
| 170 |
+
chunk_size=None, # optional, for memory efficiency
|
| 171 |
+
)
|
| 172 |
+
|
| 173 |
+
# Access outputs
|
| 174 |
+
local_points = output['local_points'] # (N, H, W, 3)
|
| 175 |
+
global_points = output['global_points'] # (N, H, W, 3)
|
| 176 |
+
camera_poses = output['camera_poses'] # (N, 4, 4)
|
| 177 |
+
mask = output['mask'] # (N, H, W)
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
### Resolution Handling
|
| 181 |
+
|
| 182 |
+
Both streams require resolutions that are multiples of the patch size (14). The HR stream defaults to 3600 tokens total (e.g., 840x840 for square images, 630x1120 for 9:16), but can be overridden with `--hr_max_size`.
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
## Visualization
|
| 186 |
+
|
| 187 |
+
We use [viser](https://github.com/nerfstudio-project/viser) for interactive 3D point cloud visualization. The inference script saves `.npy` files that can be directly visualized.
|
| 188 |
+
|
| 189 |
+
**Dynamic scenes** β renders pointmaps sequentially with playback controls (timestep slider, play/pause, FPS control):
|
| 190 |
+
|
| 191 |
+
```bash
|
| 192 |
+
python visualization/vis_pointmaps.py --data_path quali_results/dage/<name>.npy
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
**Static scenes** β merges all frames into a single point cloud in a shared coordinate frame:
|
| 196 |
+
|
| 197 |
+
```bash
|
| 198 |
+
python visualization/vis_pointmaps_all.py --data_path quali_results/dage/<name>.npy
|
| 199 |
+
```
|
| 200 |
+
|
| 201 |
+
Both scripts launch a viser server (default port `7891`) accessible via browser. Common options:
|
| 202 |
+
|
| 203 |
+
| Argument | Default | Description |
|
| 204 |
+
| :--- | :--- | :--- |
|
| 205 |
+
| `--downsample_ratio` | `1` | Spatial downsampling for faster rendering |
|
| 206 |
+
| `--point_size` | `0.002` / `0.01` | Point size in the viewer |
|
| 207 |
+
| `--scale_factor` | `1.0` | Scale the point cloud |
|
| 208 |
+
| `--sample_num` | all | Uniformly sample N frames |
|
| 209 |
+
| `--port` | `7891` | Viser server port |
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
## Training
|
| 213 |
+
|
| 214 |
+
See [docs/TRAINING.md](docs/TRAINING.md) for detailed instructions on data preparation, loss functions, and configuration.
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
## Evaluation
|
| 218 |
+
|
| 219 |
+
See [docs/EVALUATION.md](docs/EVALUATION.md) for detailed instructions.
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
## Project Structure
|
| 223 |
+
|
| 224 |
+
```
|
| 225 |
+
DAGE/
|
| 226 |
+
βββ assets/
|
| 227 |
+
β βββ demo_data/ # Demo videos for inference
|
| 228 |
+
βββ configs/
|
| 229 |
+
β βββ model_config_dage.yaml # Model architecture config
|
| 230 |
+
βββ dage/ # Main package
|
| 231 |
+
β βββ models/
|
| 232 |
+
β β βββ dage.py # DAGE model
|
| 233 |
+
β β βββ dinov2/ # DINOv2 backbone
|
| 234 |
+
β β βββ layers/ # Transformer blocks, attention, camera head
|
| 235 |
+
β β βββ moge/ # MoGe encoder components
|
| 236 |
+
β βββ utils/ # Geometry, visualization, data loading
|
| 237 |
+
βββ evaluation/ # Benchmark evaluation
|
| 238 |
+
βββ inference/
|
| 239 |
+
β βββ infer_dage.py # Main inference script
|
| 240 |
+
βββ scripts/
|
| 241 |
+
β βββ eval/ # Evaluation bash scripts
|
| 242 |
+
β βββ infer/ # Inference bash scripts
|
| 243 |
+
β βββ instal_env.sh # Environment setup
|
| 244 |
+
βββ setup.py
|
| 245 |
+
βββ third_party/ # Code for related work (VGGT, Pi3, Cut3r, etc)
|
| 246 |
+
βββ training/
|
| 247 |
+
βββ dataloaders/ # Video dataloaders & dataset configs
|
| 248 |
+
βββ loss/ # Loss functions
|
| 249 |
+
βββ train_dage_stage{1,2,3}.py # Three-stage training scripts
|
| 250 |
+
βββ training_configs/ # YAML configs for trainings
|
| 251 |
+
```
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
## Acknowledgements
|
| 255 |
+
|
| 256 |
+
Our work builds upon several open-source projects:
|
| 257 |
+
|
| 258 |
+
* [DUSt3R](https://github.com/naver/dust3r)
|
| 259 |
+
* [Pi3](https://github.com/yyfz/Pi3)
|
| 260 |
+
* [MoGe](https://github.com/microsoft/MoGe)
|
| 261 |
+
* [VGGT](https://github.com/facebookresearch/vggt)
|
| 262 |
+
* [DINOv2](https://github.com/facebookresearch/dinov2)
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
## Citation
|
| 266 |
+
|
| 267 |
+
If you find our work useful, please consider citing:
|
| 268 |
+
|
| 269 |
+
```bibtex
|
| 270 |
+
@inproceedings{ngo2026dage,
|
| 271 |
+
title={DAGE: Dual-Stream Architecture for Efficient and Fine-Grained Geometry Estimation},
|
| 272 |
+
author={Ngo, Tuan Duc and Huang, Jiahui and Oh, Seoung Wug and Blackburn-Matzen, Kevin and Kalogerakis, Evangelos and Gan, Chuang and Lee, Joon-Young},
|
| 273 |
+
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
|
| 274 |
+
year={2026}
|
| 275 |
+
}
|
| 276 |
+
```
|
| 277 |
+
|
| 278 |
+
|
| 279 |
+
## License
|
| 280 |
+
|
| 281 |
+
TBD
|