File size: 25,787 Bytes
28c8685
 
 
 
 
 
 
68620fe
 
28c8685
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
---
license: apache-2.0
datasets:
- ritianyu/Hypersim
base_model:
- ritianyu/InfiniDepth
pipeline_tag: depth-estimation
tags:
- vits16plus
---


<div align="center">

<h1>
  <img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Objects/Telescope.png" alt="Telescope" width="40" height="40" />
  InfiniDepth: Arbitrary-Resolution and Fine-Grained Depth Estimation with Neural Implicit Fields
</h1>

<div align="center">
  <a href="https://zju3dv.github.io/InfiniDepth/">
    <img src="https://img.shields.io/badge/Project-Page-red?logo=googlechrome&logoColor=red">
  </a>
  <a href="https://arxiv.org/abs/2601.03252">
    <img src="https://img.shields.io/badge/arXiv-Paper-blue?logo=arxiv&logoColor=blue">
  </a>
  <a href="https://huggingface.co/spaces/ritianyu/InfiniDepth">
    <img src="https://img.shields.io/badge/HuggingFace-Demo-yellow?logo=huggingface&logoColor=yellow">
  </a>
  <a href="https://huggingface.co/datasets/ritianyu/game_4k_data">
    <img src="https://img.shields.io/badge/HuggingFace-Dataset-orange?logo=huggingface&logoColor=orange">
  </a>
  <a href="assets/wechat.jpg">
    <img src="https://img.shields.io/badge/微信-WeChat-green?logo=wechat&logoColor=green">
  </a>
</div>
  
<p align="center">
  <a href="https://ritianyu.github.io/">Hao Yu*</a> •
  <a href="https://haotongl.github.io/">Haotong Lin*</a> •
  <a href="https://github.com/PLUS-WAVE">Jiawei Wang*</a> •
  <a href="https://github.com/Dustbin-Li">Jiaxin Li</a> •
  <a href="https://wangyida.github.io/">Yida Wang</a> •
  <a href="#">Xueyang Zhang</a> •
  <a href="https://ywang-zju.github.io/">Yue Wang</a> <br>
  <a href="https://www.xzhou.me/">Xiaowei Zhou</a> •
  <a href="https://csse.szu.edu.cn/staff/ruizhenhu/">Ruizhen Hu</a> •
  <a href="https://pengsida.net/">Sida Peng</a>
</p>

</div>

<div align="center">

<!-- <img src="assets/demo.gif" alt="InfiniDepth Demo" width="90%" /> -->

</div>

## 📢 News
> **[2026-04]** 🎉 Training and evaluation code of InfiniDepth (RGB Only & Depth Sensor Augmentation) is available now!

> **[2026-03]** 🎉 Inference code of InfiniDepth (RGB Only & Depth Sensor Augmentation) is available now!

> **[2026-02]** 🎉 InfiniDepth has been accepted to CVPR 2026! Code coming soon!


## ✨ What can InfiniDepth do?
InfiniDepth supports three practical capabilities for single-image 3D perception and reconstruction:

| Capability | Input | Output |
| --- | --- | --- |
| Monocular & Arbitrary-Resolution Depth Estimation | RGB Image | Arbitrary-Resolution Depth Map |
| Monocular View Synthesis | RGB Image | 3D Gaussian Splatting (3DGS) |
| Depth Sensor Augmentation (Monocular Metric Depth Estimation) | RGB Image + Depth Sensor | Metric Depth + 3D Gaussian Splatting (3DGS) |

## ⚙️ Installation

Please see [INSTALL.md](INSTALL.md) for manual installation.
 
## 🤗 Hugging Face Space Demo

If you want to test InfiniDepth before running local CLI inference, start with the hosted demo:

- Hugging Face Space: https://huggingface.co/spaces/ritianyu/InfiniDepth

This repo also includes a Gradio Space entrypoint at `app.py`:

- Input: RGB image (required), depth map (optional)
- Task Switch: `Depth` / `3DGS`
- Model Switch: `InfiniDepth` / `InfiniDepth_DepthSensor`

### Local run

```bash
python app.py
```

### Notes

- In this demo, `InfiniDepth_DepthSensor` requires a depth map input; RGB-only inference should use `InfiniDepth`.
- Supported depth formats in the demo upload: `.png`, `.npy`, `.npz`, `.h5`, `.hdf5`, `.exr`.


## 🚀 Inference

### Quick Command Index

| If you want ... | Recommended command |
| --- | --- |
| Relative Depth from Single RGB Image | `bash example_scripts/infer_depth/courtyard_infinidepth.sh` |
| 3D Gaussian from Single RGB Image | `bash example_scripts/infer_gs/courtyard_infinidepth_gs.sh` |
| Metric Depth from RGB + Depth Sensor | `bash example_scripts/infer_depth/eth3d_infinidepth_depthsensor.sh` |
| 3D Gaussian from RGB + Depth Sensor | `bash example_scripts/infer_gs/eth3d_infinidepth_depthsensor_gs.sh` |
| Multi-View / Video Depth + Global Point Cloud | `bash example_scripts/infer_depth/waymo_multi_view_infinidepth.sh` | 

<details>
<summary><strong> 1. Relative Depth from Single RGB Image</strong> (<code>inference_depth.py</code>)</summary>

Use this when you want a relative depth map from a single RGB image and, optionally, a point cloud export.

**Required input**

- `RGB image`

**Required checkpoints**

- `checkpoints/depth/infinidepth.ckpt`
- `checkpoints/moge-2-vitl-normal/model.pt` recover metric scale for point cloud export

**Optional checkpoint**

- `checkpoints/sky/skyseg.onnx` additional sky filtering

**Recommended command**

```bash
python inference_depth.py \
  --input_image_path=example_data/image/courtyard.jpg \
  --model_type=InfiniDepth \
  --depth_model_path=checkpoints/depth/infinidepth.ckpt \
  --output_resolution_mode=upsample \
  --upsample_ratio=2
```

Replace `example_data/image/courtyard.jpg` with your own image path.

**For the example above, outputs are written to**

- `example_data/pred_depth/` for the colorized depth map
- `example_data/pred_pcd/` for the exported point cloud when `--save_pcd=True`

**Example scripts**

```bash
bash example_scripts/infer_depth/courtyard_infinidepth.sh
bash example_scripts/infer_depth/camera_infinidepth.sh
bash example_scripts/infer_depth/eth3d_infinidepth.sh
bash example_scripts/infer_depth/waymo_infinidepth.sh
```

**Most useful options**

| Argument | What it controls |
| --- | --- |
| `--output_resolution_mode` | Choose `upsample`, `original`, or `specific`. |
| `--upsample_ratio` | Used when `output_resolution_mode=upsample`. |
| `--output_size` | Explicit output size `(H,W)` when `output_resolution_mode=specific`. |
| `--save_pcd` | Export a point cloud alongside the depth map. |
| `--fx_org --fy_org --cx_org --cy_org` | Camera intrinsics in the original image resolution. |

</details>

<details>
<summary><strong>2. 3D Gaussian + Novel-View Video from Single RGB Image</strong> (<code>inference_gs.py</code>)</summary>

Use this when you want a 3D Gaussian export from a single RGB image and an optional novel-view video.

**Required input**

- `RGB image`

**Required checkpoints**

- `checkpoints/depth/infinidepth.ckpt`
- `checkpoints/gs/infinidepth_gs.ckpt`
- `checkpoints/moge-2-vitl-normal/model.pt` recover metric scale for 3D Gaussian export

**Optional checkpoint**

- `checkpoints/sky/skyseg.onnx` additional sky filtering

**Recommended command**

```bash
python inference_gs.py \
  --input_image_path=example_data/image/courtyard.jpg \
  --model_type=InfiniDepth \
  --depth_model_path=checkpoints/depth/infinidepth.ckpt \
  --gs_model_path=checkpoints/gs/infinidepth_gs.ckpt
```

Replace `example_data/image/courtyard.jpg` with your own image path.

**For the example above, outputs are written to**

- `example_data/pred_gs/InfiniDepth_courtyard_gaussians.ply`
- `example_data/pred_gs/InfiniDepth_courtyard_novel_orbit.mp4`

If `--render_size` is omitted, the novel-view video is rendered at the original input image resolution.

**Example scripts**

```bash
bash example_scripts/infer_gs/courtyard_infinidepth_gs.sh
bash example_scripts/infer_gs/camera_infinidepth_gs.sh
bash example_scripts/infer_gs/fruit_infinidepth_gs.sh
bash example_scripts/infer_gs/eth3d_infinidepth_gs.sh
```

**Most useful options**

| Argument | What it controls |
| --- | --- |
| `--render_novel_video` | Turn novel-view rendering on or off. |
| `--render_size` | Output video resolution `(H,W)`. |
| `--novel_trajectory` | Camera motion type: `orbit` or `swing`. |
| `--sample_point_num` | Number of sampled points used for gaussian construction. |
| `--enable_skyseg_model` | Enable sky masking before gaussian sampling. |
| `--sample_sky_mask_dilate_px` | Dilate the sky mask before filtering. |

> The exported `.ply` files can be visualized in 3D viewers such as [SuperSplat](https://superspl.at/).

</details>

<details>
<summary><strong>3. Depth Sensor Augmentation (Metric Depth and 3D Gaussian from RGB + Depth Sensor)</strong></summary>

Use this mode when you have an RGB image plus metric depth from a depth sensor.

**Required inputs**

- `RGB image`
- `Sparse depth` in `.png`, `.npy`, `.npz`, `.h5`, `.hdf5`, or `.exr`

**Required checkpoints**

- `checkpoints/depth/infinidepth_depthsensor.ckpt`
- `checkpoints/moge-2-vitl-normal/model.pt`
- `checkpoints/gs/infinidepth_depthsensor_gs.ckpt`

**Required flags**

- `--model_type=InfiniDepth_DepthSensor`
- `--input_depth_path=...`


**Metric Depth Inference Command**

```bash
python inference_depth.py \
  --input_image_path=example_data/image/eth3d_office.png \
  --input_depth_path=example_data/depth/eth3d_office.npz \
  --model_type=InfiniDepth_DepthSensor \
  --depth_model_path=checkpoints/depth/infinidepth_depthsensor.ckpt \
  --fx_org=866.39 \
  --fy_org=866.04 \
  --cx_org=791.5 \
  --cy_org=523.81 \
  --output_resolution_mode=upsample \
  --upsample_ratio=1
```

**3D Gaussian Inference Command**

```bash
python inference_gs.py \
  --input_image_path=example_data/image/eth3d_office.png \
  --input_depth_path=example_data/depth/eth3d_office.npz \
  --model_type=InfiniDepth_DepthSensor \
  --depth_model_path=checkpoints/depth/infinidepth_depthsensor.ckpt \
  --gs_model_path=checkpoints/gs/infinidepth_depthsensor_gs.ckpt \
  --fx_org=866.39 \
  --fy_org=866.04 \
  --cx_org=791.5 \
  --cy_org=523.81
```

**Example scripts**

```bash
bash example_scripts/infer_depth/eth3d_infinidepth_depthsensor.sh
bash example_scripts/infer_depth/waymo_infinidepth_depthsensor.sh
bash example_scripts/infer_gs/eth3d_infinidepth_depthsensor_gs.sh
bash example_scripts/infer_gs/waymo_infinidepth_depthsensor_gs.sh
```

**Most useful options**

| Argument | What it controls |
| --- | --- |
| `--fx_org --fy_org --cx_org --cy_org` | Strongly recommended when you know the sensor intrinsics. |
| `--output_resolution_mode` | Output behavior for `inference_depth.py`. |
| `--render_size` | Video resolution for `inference_gs.py`. |
| `--output_ply_dir` | Custom output directory for gaussian export. |

</details>

<details>
<summary><strong>4. Multi-View / Video Depth + Global Point Cloud</strong> (<code>inference_multi_view_depth.py</code>)</summary>

Use this when you want sequence-level depth inference from an RGB image folder or video, plus per-frame aligned point clouds and one merged global point cloud. By default the script runs DA3 once on the whole sequence, then aligns each InfiniDepth depth map to the corresponding DA3 depth map before export. When you already know the camera intrinsics and extrinsics, you can instead provide them directly and skip DA3 entirely.

**Required inputs**

- `RGB image directory`, `single RGB image`, or `video`
- `Sparse depth` directory / single file / depth video when `--model_type=InfiniDepth_DepthSensor`

**Required checkpoints / dependencies**

- `checkpoints/depth/infinidepth.ckpt` for RGB-only inference
- `checkpoints/depth/infinidepth_depthsensor.ckpt` for RGB + depth sensor inference
- `checkpoints/moge-2-vitl-normal/model.pt` recover metric scale for RGB-only frame inference
- `depth-anything-3` installed in the current environment when using the default DA3-based sequence mode; default DA3 model is `depth-anything/DA3-LARGE-1.1`

**Optional checkpoint**

- `checkpoints/sky/skyseg.onnx` additional sky filtering

**RGB-Only Multi-View / Video Command**

```bash
python inference_multi_view_depth.py \
  --input_path=example_data/multi-view/waymo/image \
  --model_type=InfiniDepth \
  --depth_model_path=checkpoints/depth/infinidepth.ckpt \
```

**RGB + Depth Sensor Multi-View / Video Command**

```bash
python inference_multi_view_depth.py \
  --input_path=example_data/multi-view/waymo/image \
  --input_depth_path=example_data/multi-view/waymo/depth \
  --model_type=InfiniDepth_DepthSensor \
  --depth_model_path=checkpoints/depth/infinidepth_depthsensor.ckpt \
```

For video input, replace `--input_path` with a video file. When `--model_type=InfiniDepth_DepthSensor`, `--input_depth_path` can also be a depth video and must contain the same number of frames as the RGB input.

**Explicit Camera-Parameter Multi-View Command**

```bash
python inference_multi_view_depth.py \
  --input_path=example_data/multi-view/waymo/image \
  --camera_intrinsics_dir=/path/to/intrinsics \
  --camera_extrinsics_dir=/path/to/extrinsics \
  --model_type=InfiniDepth \
  --depth_model_path=checkpoints/depth/infinidepth.ckpt \
```

The explicit camera mode expects Waymo-style text files under `intrinsics/` and `extrinsics/`. Files are sorted lexicographically and matched one-to-one against the sorted RGB image list, so the number of camera files must exactly match the number of images. In this mode the script skips DA3 loading, DA3 cache export, DA3 RANSAC conditioning, and DA3 post scale alignment. This mode currently supports image inputs only, not video.

**For the RGB-only example above, outputs are written to**

- `example_data/multi-view/waymo/pred_sequence/image/frames/depth/` for aligned raw depth maps
- `example_data/multi-view/waymo/pred_sequence/image/frames/depth_vis/` for colorized depth maps
- `example_data/multi-view/waymo/pred_sequence/image/frames/pcd/` for per-frame aligned point clouds
- `example_data/multi-view/waymo/pred_sequence/image/frames/meta/` for per-frame camera and alignment metadata
- `example_data/multi-view/waymo/pred_sequence/image/da3/sequence_pose.npz` for cached DA3 predictions
- `example_data/multi-view/waymo/pred_sequence/image/merged/sequence_merged.ply` for the merged global point cloud

**Example scripts**

```bash
bash example_scripts/infer_depth/waymo_multi_view_infinidepth.sh
bash example_scripts/infer_depth/waymo_multi_view_infinidepth_depthsensor.sh
bash example_scripts/infer_depth/waymo_multi_view_infinidepth_explicit_camera.sh
```

**Most useful options**

| Argument | What it controls |
| --- | --- |
| `--input_path` | RGB image directory, single image, or video path. |
| `--input_depth_path` | Depth directory, single depth file, or depth video; required for `InfiniDepth_DepthSensor`. |
| `--camera_intrinsics_dir --camera_extrinsics_dir` | Enable explicit camera mode from sorted Waymo-style txt directories. Image inputs only; file counts must match the RGB frame count. |
| `--input_mode` | Force `images` or `video` instead of auto detection. |
| `--align_to_da3_depth` | Align each InfiniDepth depth map to the corresponding DA3 depth map before export. Ignored in explicit camera mode. |
| `--save_frame_pcd` | Save one aligned point cloud per frame. |
| `--save_merged_pcd` | Save the merged global point cloud across the whole sequence. |
| `--da3_scale_align_conf_threshold` | Minimum DA3 confidence used during per-frame scale estimation. |
| `--output_root` | Override the default `pred_sequence/<sequence_name>/` output directory. |

</details>

<details>
<summary><strong>5. Common Argument Conventions</strong></summary>

| Argument | Used in | Description |
| --- | --- | --- |
| `--input_image_path` | depth + gs | Path to the input RGB image. |
| `--input_path` | multi-view | Path to an RGB image directory, single image, or video. |
| `--input_depth_path` | depth + gs + multi-view | Optional metric depth prompt; required for `InfiniDepth_DepthSensor`. In multi-view mode this can be a depth directory, single depth file, or depth video. |
| `--camera_intrinsics_dir --camera_extrinsics_dir` | multi-view | Optional sequence camera parameter directories. When both are set, multi-view inference skips DA3 and uses the provided sorted txt files directly. |
| `--model_type` | depth + gs + multi-view | `InfiniDepth` for RGB-only, `InfiniDepth_DepthSensor` for RGB + sparse depth. |
| `--depth_model_path` | depth + gs | Path to the depth checkpoint. |
| `--gs_model_path` | gs only | Path to the gaussian predictor checkpoint. |
| `--moge2_pretrained` | depth + gs | MoGe-2 checkpoint used when `--input_depth_path` is missing. |
| `--fx_org --fy_org --cx_org --cy_org` | depth + gs | Camera intrinsics in original image resolution. Missing values fall back to MoGe-2 estimates or image-size defaults. |
| `--input_size` | depth + gs | Network input size `(H,W)` used during inference. |
| `--enable_skyseg_model` | depth + gs + multi-view | Enable sky masking before depth or gaussian sampling. |
| `--sky_model_ckpt_path` | depth + gs | Path to the sky segmentation ONNX checkpoint. |

**Depth output modes**

- `--output_resolution_mode=upsample`: output size = `input_size * upsample_ratio`
- `--output_resolution_mode=original`: output size = original input image size
- `--output_resolution_mode=specific`: output size = `output_size`

**Default output directories**

| Script | Default directory |
| --- | --- |
| `inference_depth.py` depth images | `pred_depth/` next to your input data folder |
| `inference_depth.py` point clouds | `pred_pcd/` next to your input data folder |
| `inference_gs.py` gaussians and videos | `pred_gs/` next to your input data folder |
| `inference_multi_view_depth.py` sequence outputs | `pred_sequence/<sequence_name>/` next to your input data folder |

</details>

## 🏋️ Training and Validation

The repo also provides `main.py` training and validation entrypoints for InfiniDepth and InfiniDepth_DepthSensor.

First, prepare the training/validation data and the pretrained weight as described in [DATA.md](DATA.md).

Before running any command, export the environment variables required by `main.py`:

```bash
export workspace=/path/to/your/experiments
export commonspace=/path/to/your/common_space
```

- `workspace` stores experiment outputs under `outputs/<task>/<exp_name>/`
- `commonspace` stores datasets and pretrained weights shared across experiments


### Quick Command Index

| If you want ... | Recommended command |
| --- | --- |
| Fine-tune from an existing checkpoint | Add `ckpt_path=...` to the training command |
| Train from scratch | Omit `ckpt_path` and use a fresh `exp_name` |
| Validate on the mixed real-data benchmark | Run `main.py` with `--entry val` |

<details>
<summary><strong>1. Fine-Tuning from an Existing Checkpoint</strong> (<code>main.py</code>, default <code>train_net</code> entry)</summary>

Use this when you want to initialize training from an existing InfiniDepth checkpoint. The training config referenced below uses Hypersim as the training set and runs validation on a mixed real-data benchmark at the end of each epoch.

**Required environment**

- `workspace=/path/to/your/experiments`
- `commonspace=/path/to/your/common_space`

**RGB-Only Fine-Tuning Command**

```bash
python3 main.py \
  --cfg_file training/exp_configs/exps/infinidepth.yaml \
  --include training/exp_configs/components/data/train/infinidepth_train_hypersim.yaml \
  ckpt_path=checkpoints/depth/infinidepth.ckpt \
  exp_name=finetune_infinidepth_on_hypersim \
  model.compute_abs_metric=True \
  model.save_orig_pred=True \
  model.save_metrics=True \
  pl_trainer.devices=8
```

**RGB + Depth Sensor Fine-Tuning Command**

```bash
python3 main.py \
  --cfg_file training/exp_configs/exps/infinidepth_depthsensor.yaml \
  --include training/exp_configs/components/data/train/infinidepth_train_hypersim.yaml \
  ckpt_path=checkpoints/depth/infinidepth_depthsensor.ckpt \
  exp_name=finetune_infinidepth_depthsensor_on_hypersim \
  model.compute_abs_metric=True \
  model.save_orig_pred=True \
  model.save_metrics=True \
  pl_trainer.devices=8
```

**Equivalent launch scripts**

```bash
bash launch_scripts/train/infinidepth.sh
bash launch_scripts/train/infinidepth_depthsensor.sh
```

**Outputs**

- `${workspace}/outputs/${task}/${exp_name}/checkpoints/` for saved checkpoints
- `${workspace}/outputs/${task}/${exp_name}/tb/` for TensorBoard logs

**Notes**

- `ckpt_path` must point to an existing checkpoint.
- The training data config is `training/exp_configs/components/data/train/infinidepth_train_hypersim.yaml`.
- If the same `exp_name` already has checkpoints in `${workspace}/outputs/${task}/${exp_name}/checkpoints/`, training will resume from the latest saved checkpoint in that directory.

</details>

<details>
<summary><strong>2. Train from Scratch</strong> (<code>main.py</code>, no <code>ckpt_path</code>)</summary>

Use this when you want to start training without loading an InfiniDepth `.ckpt`. In this mode, do not pass `ckpt_path`. The model will still load the DINOv3 backbone from `${commonspace}/pretrained_models/dinov3/`. You need to download the DINOv3 weights yourself and place them there before running.

**RGB-Only Training-from-Scratch Command**

```bash
python3 main.py \
  --cfg_file training/exp_configs/exps/infinidepth.yaml \
  --include training/exp_configs/components/data/train/infinidepth_train_hypersim.yaml \
  exp_name=train_infinidepth_from_scratch \
  model.compute_abs_metric=True \
  model.save_orig_pred=True \
  model.save_metrics=True \
  pl_trainer.devices=2
```

**RGB + Depth Sensor Training-from-Scratch Command**

```bash
python3 main.py \
  --cfg_file training/exp_configs/exps/infinidepth_depthsensor.yaml \
  --include training/exp_configs/components/data/train/infinidepth_train_hypersim.yaml \
  exp_name=train_infinidepth_depthsensor_from_scratch \
  model.compute_abs_metric=True \
  model.save_orig_pred=True \
  model.save_metrics=True \
  pl_trainer.devices=2
```

**Notes**

- Use a new `exp_name` for a clean scratch run.
- If you intentionally want to reuse an old `exp_name`, set `resume_training=False` to prevent automatic resume. Be careful: when `resume_training=False`, the code will delete the old output directory before training.

</details>

<details>
<summary><strong>3. Validation from a Checkpoint</strong> (<code>main.py</code> with <code>--entry val</code>)</summary>

Use this when you want to run validation metrics on the mixed real-data benchmark defined in `training/exp_configs/components/data/test/infinidepth_mix_data.yaml`.

**RGB-Only Validation Command**

```bash
python3 main.py \
  --cfg_file training/exp_configs/exps/infinidepth.yaml \
  --include training/exp_configs/components/data/test/infinidepth_mix_data.yaml \
  --entry val \
  ckpt_path=checkpoints/depth/infinidepth.ckpt \
  exp_name=eval_infinidepth \
  model.compute_abs_metric=True \
  model.save_orig_pred=True \
  model.save_metrics=True \
  pl_trainer.devices=2
```

**RGB + Depth Sensor Validation Command**

```bash
python3 main.py \
  --cfg_file training/exp_configs/exps/infinidepth_depthsensor.yaml \
  --include training/exp_configs/components/data/test/infinidepth_mix_data.yaml \
  --entry val \
  ckpt_path=checkpoints/depth/infinidepth_depthsensor.ckpt \
  exp_name=eval_infinidepth_depthsensor \
  model.compute_abs_metric=True \
  model.save_orig_pred=True \
  model.save_metrics=True \
  pl_trainer.devices=2
```

**Reference launch scripts**

```bash
bash launch_scripts/eval/infinidepth.sh
bash launch_scripts/eval/infinidepth_depthsensor.sh
```

**Validation datasets**

- Kitti val split
- ETH3D val split
- NYU val split
- ScanNet val split
- DIODE indoor val split
- Synth4K (CyberPunk, DeadIsland, SpiderMan2, SpiderManMM, WatchDogLegion)

These datasets are read from `${commonspace}/datasets/` using the meta files referenced in `training/exp_configs/components/data/test/infinidepth_mix_data.yaml`.

**Outputs**

- `${workspace}/outputs/${task}/${exp_name}/val_metrics/` for validation logs
- `${workspace}/outputs/${task}/${exp_name}/default/metrics/metrics.json` for aggregated validation metrics
- `${workspace}/outputs/${task}/${exp_name}/default/metrics/all_scenes.csv` when `model.save_metrics=True`

</details>

<details>
<summary><strong>4. Common Overrides</strong></summary>

| Argument | What it controls |
| --- | --- |
| `ckpt_path` | Initialization or evaluation checkpoint path. Omit it for training from scratch. |
| `exp_name` | Experiment name used to build `${workspace}/outputs/${task}/${exp_name}`. |
| `pl_trainer.devices` | Number of GPUs used by PyTorch Lightning. |
| `model.compute_abs_metric` | Enable absolute-metric evaluation during training or validation. |
| `model.save_orig_pred` | Save original prediction outputs alongside logs and metrics. |
| `model.save_metrics` | Save metric files for later inspection. |
| `--entry val` | Switch `main.py` from the default training entry to the validation entry. |
| `--include` | Merge an extra data config, such as `training/exp_configs/components/data/test/infinidepth_mix_data.yaml`. |

</details>

## 🙏 Acknowledgments

We thank <a href="https://yuanhongyu.xyz/" target="_blank">Yuanhong Yu</a>, <a href="https://gangweix.github.io/" target="_blank">Gangwei Xu</a>, <a href="https://github.com/ghy0324" target="_blank">Haoyu Guo</a>  and <a href="https://hugoycj.github.io/" target="_blank">Chongjie Ye</a> for their insightful discussions and valuable suggestions, and <a href="https://zhenx.me/" target="_blank">Zhen Xu</a> for his dedicated efforts in curating the synthetic data.


## 📖 Citation

If you find InfiniDepth useful in your research, please consider citing:

```bibtex
@article{yu2026infinidepth,
    title={InfiniDepth: Arbitrary-Resolution and Fine-Grained Depth Estimation with Neural Implicit Fields},
    author={Hao Yu, Haotong Lin, Jiawei Wang, Jiaxin Li, Yida Wang, Xueyang Zhang, Yue Wang, Xiaowei Zhou, Ruizhen Hu and Sida Peng},
    booktitle={arXiv preprint},
    year={2026}
}
```
---

<div align="center">

<img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Hand%20gestures/Folded%20Hands%20Light%20Skin%20Tone.png" alt="Thanks" width="25" height="25" />

**Thank you for your interest in InfiniDepth!**

<sub>⭐ Star this repo if you find it interesting!</sub>

</div>