depth-estimation 0.1.3__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {depth_estimation-0.1.3/src/depth_estimation.egg-info → depth_estimation-0.2.0}/PKG-INFO +18 -9
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/README.md +9 -4
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/pyproject.toml +15 -5
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/__init__.py +2 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/evaluation/evaluate.py +1 -1
- depth_estimation-0.2.0/src/depth_estimation/models/depth_pro_2/__init__.py +29 -0
- depth_estimation-0.2.0/src/depth_estimation/models/depth_pro_2/configuration_depth_pro_2.py +124 -0
- depth_estimation-0.2.0/src/depth_estimation/models/depth_pro_2/modeling_depth_pro_2.py +662 -0
- depth_estimation-0.2.0/src/depth_estimation/models/marigold_v2/__init__.py +29 -0
- depth_estimation-0.2.0/src/depth_estimation/models/marigold_v2/configuration_marigold_v2.py +92 -0
- depth_estimation-0.2.0/src/depth_estimation/models/marigold_v2/modeling_marigold_v2.py +452 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/processing_utils.py +3 -1
- {depth_estimation-0.1.3 → depth_estimation-0.2.0/src/depth_estimation.egg-info}/PKG-INFO +18 -9
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation.egg-info/SOURCES.txt +7 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation.egg-info/requires.txt +9 -4
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_auto.py +11 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_config.py +66 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_inference_all_models.py +63 -0
- depth_estimation-0.2.0/tests/test_marigold_v2_loading.py +57 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_processor.py +10 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/LICENSE +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/setup.cfg +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/cli.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/configuration_utils.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/data/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/data/base_dataset.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/data/diode.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/data/folder.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/data/hub.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/data/kitti.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/data/nyu_depth_v2.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/data/transforms.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/evaluation/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/evaluation/metrics.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/evaluation/profiling.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/export.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/losses.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/modeling_utils.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/auto/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/auto/modeling_auto.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/auto/processing_auto.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_anything_v1/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_anything_v1/configuration_depth_anything_v1.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_anything_v1/modeling_depth_anything_v1.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_anything_v2/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_anything_v2/configuration_depth_anything_v2.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_anything_v2/modeling_depth_anything_v2.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_anything_v3/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_anything_v3/configuration_depth_anything_v3.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_anything_v3/modeling_depth_anything_v3.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_pro/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_pro/configuration_depth_pro.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/depth_pro/modeling_depth_pro.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/marigold_dc/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/marigold_dc/configuration_marigold_dc.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/marigold_dc/modeling_marigold_dc.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/midas/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/midas/configuration_midas.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/midas/modeling_midas.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/moge/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/moge/configuration_moge.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/moge/modeling_moge.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/omnivggt/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/omnivggt/configuration_omnivggt.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/omnivggt/modeling_omnivggt.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/pixel_perfect_depth/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/pixel_perfect_depth/configuration_ppd.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/pixel_perfect_depth/modeling_ppd.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/vggt/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/vggt/configuration_vggt.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/vggt/modeling_vggt.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/zoedepth/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/zoedepth/configuration_zoedepth.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/models/zoedepth/modeling_zoedepth.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/output.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/pipeline_utils.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/pipelines/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/pipelines/depth_estimation.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/pruning.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/quantization.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/registry.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/trainer.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/training_args.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/video.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/viz/__init__.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/viz/animate.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/viz/composite.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/viz/display.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/viz/error.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation.egg-info/dependency_links.txt +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation.egg-info/entry_points.txt +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation.egg-info/top_level.txt +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_cli.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_data.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_evaluation.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_export_onnx.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_inference_image.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_losses.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_model.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_package.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_pipeline.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_pruning.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_quantization.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_training.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_transforms.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_video.py +0 -0
- {depth_estimation-0.1.3 → depth_estimation-0.2.0}/tests/test_viz.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: depth_estimation
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A Transformers-style Python library for monocular depth estimation — inference, evaluation, and fine-tuning
|
|
5
5
|
Author: shriarul5273
|
|
6
6
|
License-Expression: MIT
|
|
@@ -20,17 +20,19 @@ Classifier: Intended Audience :: Science/Research
|
|
|
20
20
|
Requires-Python: >=3.10
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: torch>=2.
|
|
24
|
-
Requires-Dist: torchvision>=0.
|
|
23
|
+
Requires-Dist: torch>=2.6
|
|
24
|
+
Requires-Dist: torchvision>=0.21
|
|
25
25
|
Requires-Dist: Pillow>=9.0
|
|
26
26
|
Requires-Dist: numpy>=1.24
|
|
27
27
|
Requires-Dist: matplotlib>=3.6
|
|
28
28
|
Requires-Dist: opencv-python>=4.8
|
|
29
29
|
Requires-Dist: huggingface-hub>=0.16
|
|
30
30
|
Requires-Dist: transformers
|
|
31
|
-
Requires-Dist: diffusers
|
|
31
|
+
Requires-Dist: diffusers>=0.38
|
|
32
32
|
Requires-Dist: accelerate
|
|
33
|
-
Requires-Dist:
|
|
33
|
+
Requires-Dist: peft
|
|
34
|
+
Requires-Dist: safetensors
|
|
35
|
+
Requires-Dist: timm>=1.0.20
|
|
34
36
|
Requires-Dist: einops>=0.6
|
|
35
37
|
Requires-Dist: addict
|
|
36
38
|
Requires-Dist: h5py
|
|
@@ -43,6 +45,8 @@ Requires-Dist: onnxruntime; extra == "dev"
|
|
|
43
45
|
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
44
46
|
Provides-Extra: export
|
|
45
47
|
Requires-Dist: onnx>=1.14; extra == "export"
|
|
48
|
+
Provides-Extra: 4bit
|
|
49
|
+
Requires-Dist: bitsandbytes; extra == "4bit"
|
|
46
50
|
Dynamic: license-file
|
|
47
51
|
|
|
48
52
|
# depth_estimation
|
|
@@ -62,11 +66,11 @@ Dynamic: license-file
|
|
|
62
66
|
|
|
63
67
|
---
|
|
64
68
|
|
|
65
|
-
`depth_estimation` is a unified model framework for monocular depth estimation. It provides one consistent API across **
|
|
69
|
+
`depth_estimation` is a unified model framework for monocular depth estimation. It provides one consistent API across **14 model families and 36 variants**, so you can swap models, compare them, fine-tune them, and prepare them for deployment without rewriting your pipeline.
|
|
66
70
|
|
|
67
71
|
It covers the workflow end-to-end: run inference with one line, process video, visualize results, evaluate standard benchmarks, fine-tune on custom depth data, optimize models, and export them to ONNX.
|
|
68
72
|
|
|
69
|
-
> **Latest release: v0.
|
|
73
|
+
> **Latest release: v0.2.0 — Depth Pro 2, Marigold V2 & Dependency Fixes.** It adds Apple Depth Pro 2 and Marigold V2, and raises the minimum versions (PyTorch 2.6+) so a plain install runs every model. Read the [release notes](https://github.com/shriarul5273/depth_estimation/blob/main/docs/release_notes.md) or view the [GitHub release](https://github.com/shriarul5273/depth_estimation/releases/tag/v0.2.0).
|
|
70
74
|
|
|
71
75
|
## Installation
|
|
72
76
|
|
|
@@ -79,9 +83,12 @@ pip install "depth-estimation[export]"
|
|
|
79
83
|
|
|
80
84
|
# Export verification and ONNX quantization
|
|
81
85
|
pip install "depth-estimation[export]" onnxruntime
|
|
86
|
+
|
|
87
|
+
# Optional: 4-bit Marigold V2 on CUDA (bitsandbytes)
|
|
88
|
+
pip install "depth-estimation[4bit]"
|
|
82
89
|
```
|
|
83
90
|
|
|
84
|
-
Python 3.10–3.12
|
|
91
|
+
Python 3.10–3.12 and PyTorch 2.6+ are supported; the core install includes everything needed to run every model. For GPU execution of exported models, replace `onnxruntime` with `onnxruntime-gpu`. See [docs/dependencies.md](https://github.com/shriarul5273/depth_estimation/blob/main/docs/dependencies.md) for the complete dependency guide.
|
|
85
92
|
|
|
86
93
|
## Documentation
|
|
87
94
|
|
|
@@ -154,7 +161,7 @@ Export verification checks ONNX output against PyTorch, quantization verifies ac
|
|
|
154
161
|
|
|
155
162
|
## Supported Models
|
|
156
163
|
|
|
157
|
-
|
|
164
|
+
14 model families · 36 variants — see [docs/models.md](https://github.com/shriarul5273/depth_estimation/blob/main/docs/models.md) for the full list.
|
|
158
165
|
|
|
159
166
|
All models support inference and CLI. The Trainable column indicates fine-tuning support via `DepthTrainer`.
|
|
160
167
|
|
|
@@ -167,8 +174,10 @@ All models support inference and CLI. The Trainable column indicates fine-tuning
|
|
|
167
174
|
| ZoeDepth | nyu / kitti | Metric | ❌ |
|
|
168
175
|
| MiDaS | dpt-large / dpt-hybrid / beit-large | Relative | ✅ |
|
|
169
176
|
| Apple DepthPro | — | Metric | ✅ |
|
|
177
|
+
| Apple Depth Pro 2 | s / b / l / h | Metric | ✅ |
|
|
170
178
|
| Pixel-Perfect Depth | — | Relative | ❌ |
|
|
171
179
|
| Marigold-DC | — | Relative (depth completion) | ❌ |
|
|
180
|
+
| Marigold V2 | log / log-layered / uniform / disparity | Relative | ❌ |
|
|
172
181
|
| MoGe | v1 vitl / v2 vitl / v2 vitb / v2 vits (+ normal variants) | Metric | ❌ |
|
|
173
182
|
| OmniVGGT | vitl | Metric | ✅ |
|
|
174
183
|
| VGGT | standard / commercial | Metric | ✅ |
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
-
`depth_estimation` is a unified model framework for monocular depth estimation. It provides one consistent API across **
|
|
18
|
+
`depth_estimation` is a unified model framework for monocular depth estimation. It provides one consistent API across **14 model families and 36 variants**, so you can swap models, compare them, fine-tune them, and prepare them for deployment without rewriting your pipeline.
|
|
19
19
|
|
|
20
20
|
It covers the workflow end-to-end: run inference with one line, process video, visualize results, evaluate standard benchmarks, fine-tune on custom depth data, optimize models, and export them to ONNX.
|
|
21
21
|
|
|
22
|
-
> **Latest release: v0.
|
|
22
|
+
> **Latest release: v0.2.0 — Depth Pro 2, Marigold V2 & Dependency Fixes.** It adds Apple Depth Pro 2 and Marigold V2, and raises the minimum versions (PyTorch 2.6+) so a plain install runs every model. Read the [release notes](https://github.com/shriarul5273/depth_estimation/blob/main/docs/release_notes.md) or view the [GitHub release](https://github.com/shriarul5273/depth_estimation/releases/tag/v0.2.0).
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
@@ -32,9 +32,12 @@ pip install "depth-estimation[export]"
|
|
|
32
32
|
|
|
33
33
|
# Export verification and ONNX quantization
|
|
34
34
|
pip install "depth-estimation[export]" onnxruntime
|
|
35
|
+
|
|
36
|
+
# Optional: 4-bit Marigold V2 on CUDA (bitsandbytes)
|
|
37
|
+
pip install "depth-estimation[4bit]"
|
|
35
38
|
```
|
|
36
39
|
|
|
37
|
-
Python 3.10–3.12
|
|
40
|
+
Python 3.10–3.12 and PyTorch 2.6+ are supported; the core install includes everything needed to run every model. For GPU execution of exported models, replace `onnxruntime` with `onnxruntime-gpu`. See [docs/dependencies.md](https://github.com/shriarul5273/depth_estimation/blob/main/docs/dependencies.md) for the complete dependency guide.
|
|
38
41
|
|
|
39
42
|
## Documentation
|
|
40
43
|
|
|
@@ -107,7 +110,7 @@ Export verification checks ONNX output against PyTorch, quantization verifies ac
|
|
|
107
110
|
|
|
108
111
|
## Supported Models
|
|
109
112
|
|
|
110
|
-
|
|
113
|
+
14 model families · 36 variants — see [docs/models.md](https://github.com/shriarul5273/depth_estimation/blob/main/docs/models.md) for the full list.
|
|
111
114
|
|
|
112
115
|
All models support inference and CLI. The Trainable column indicates fine-tuning support via `DepthTrainer`.
|
|
113
116
|
|
|
@@ -120,8 +123,10 @@ All models support inference and CLI. The Trainable column indicates fine-tuning
|
|
|
120
123
|
| ZoeDepth | nyu / kitti | Metric | ❌ |
|
|
121
124
|
| MiDaS | dpt-large / dpt-hybrid / beit-large | Relative | ✅ |
|
|
122
125
|
| Apple DepthPro | — | Metric | ✅ |
|
|
126
|
+
| Apple Depth Pro 2 | s / b / l / h | Metric | ✅ |
|
|
123
127
|
| Pixel-Perfect Depth | — | Relative | ❌ |
|
|
124
128
|
| Marigold-DC | — | Relative (depth completion) | ❌ |
|
|
129
|
+
| Marigold V2 | log / log-layered / uniform / disparity | Relative | ❌ |
|
|
125
130
|
| MoGe | v1 vitl / v2 vitl / v2 vitb / v2 vits (+ normal variants) | Metric | ❌ |
|
|
126
131
|
| OmniVGGT | vitl | Metric | ✅ |
|
|
127
132
|
| VGGT | standard / commercial | Metric | ✅ |
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "depth_estimation"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "shriarul5273" },
|
|
10
10
|
]
|
|
@@ -26,17 +26,22 @@ classifiers = [
|
|
|
26
26
|
]
|
|
27
27
|
keywords = ["depth-estimation", "monocular-depth", "computer-vision", "deep-learning", "pytorch", "fine-tuning", "training"]
|
|
28
28
|
dependencies = [
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
# 2.6 is the oldest torch that current transformers and diffusers accept
|
|
30
|
+
# (they disable or fail to import torch below it), so it is the real
|
|
31
|
+
# floor for ZoeDepth, MiDaS, Marigold-DC and Marigold V2.
|
|
32
|
+
"torch>=2.6",
|
|
33
|
+
"torchvision>=0.21",
|
|
31
34
|
"Pillow>=9.0",
|
|
32
35
|
"numpy>=1.24",
|
|
33
36
|
"matplotlib>=3.6",
|
|
34
37
|
"opencv-python>=4.8",
|
|
35
38
|
"huggingface-hub>=0.16",
|
|
36
39
|
"transformers",
|
|
37
|
-
"diffusers",
|
|
40
|
+
"diffusers>=0.38",
|
|
38
41
|
"accelerate",
|
|
39
|
-
"
|
|
42
|
+
"peft",
|
|
43
|
+
"safetensors",
|
|
44
|
+
"timm>=1.0.20",
|
|
40
45
|
"einops>=0.6",
|
|
41
46
|
"addict",
|
|
42
47
|
"h5py",
|
|
@@ -59,6 +64,11 @@ dev = [
|
|
|
59
64
|
export = [
|
|
60
65
|
"onnx>=1.14",
|
|
61
66
|
]
|
|
67
|
+
# Optional 4-bit (NF4) loading of Marigold V2's Qwen DiT on CUDA; without it
|
|
68
|
+
# the model falls back to bfloat16. bitsandbytes itself needs torch>=2.4.
|
|
69
|
+
4bit = [
|
|
70
|
+
"bitsandbytes",
|
|
71
|
+
]
|
|
62
72
|
|
|
63
73
|
[project.scripts]
|
|
64
74
|
depth-estimate = "depth_estimation.cli:main"
|
|
@@ -20,8 +20,10 @@ from .models import depth_anything_v3
|
|
|
20
20
|
from .models import zoedepth
|
|
21
21
|
from .models import midas
|
|
22
22
|
from .models import depth_pro
|
|
23
|
+
from .models import depth_pro_2
|
|
23
24
|
from .models import pixel_perfect_depth
|
|
24
25
|
from .models import marigold_dc
|
|
26
|
+
from .models import marigold_v2
|
|
25
27
|
from .models import moge
|
|
26
28
|
from .models import omnivggt
|
|
27
29
|
from .models import vggt
|
{depth_estimation-0.1.3 → depth_estimation-0.2.0}/src/depth_estimation/evaluation/evaluate.py
RENAMED
|
@@ -226,7 +226,7 @@ def evaluate(
|
|
|
226
226
|
|
|
227
227
|
# Resize prediction to GT resolution
|
|
228
228
|
pred_resized = F.interpolate(
|
|
229
|
-
raw_preds[b].unsqueeze(0).unsqueeze(0),
|
|
229
|
+
raw_preds[b].float().unsqueeze(0).unsqueeze(0),
|
|
230
230
|
size=(oh, ow),
|
|
231
231
|
mode="bilinear",
|
|
232
232
|
align_corners=False,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Apple Depth Pro 2 model package — self-registers with MODEL_REGISTRY."""
|
|
2
|
+
|
|
3
|
+
from .configuration_depth_pro_2 import DepthPro2Config, _DEPTHPRO2_VARIANT_MAP
|
|
4
|
+
from ...registry import MODEL_REGISTRY
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _load_model_cls():
|
|
8
|
+
from .modeling_depth_pro_2 import DepthPro2Model
|
|
9
|
+
|
|
10
|
+
return DepthPro2Model
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
MODEL_REGISTRY.register(
|
|
14
|
+
model_type="depth-pro-2",
|
|
15
|
+
config_cls=DepthPro2Config,
|
|
16
|
+
model_cls=_load_model_cls,
|
|
17
|
+
variant_ids=list(_DEPTHPRO2_VARIANT_MAP.keys()),
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def __getattr__(name):
|
|
22
|
+
if name == "DepthPro2Model":
|
|
23
|
+
from .modeling_depth_pro_2 import DepthPro2Model
|
|
24
|
+
|
|
25
|
+
return DepthPro2Model
|
|
26
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
__all__ = ["DepthPro2Config", "DepthPro2Model"]
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Apple Depth Pro 2 configuration.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import List, Optional
|
|
6
|
+
|
|
7
|
+
from ...configuration_utils import BaseDepthConfig
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Architecture presets, mirroring the ``config.json`` shipped in each
|
|
11
|
+
# ``apple/DepthPro2-*`` Hub repository (and ``PRESETS`` in ml-depth-pro-2).
|
|
12
|
+
_DEPTHPRO2_VARIANT_MAP = {
|
|
13
|
+
"depth-pro-2-s": {
|
|
14
|
+
"backbone": "vits",
|
|
15
|
+
"hub_repo_id": "apple/DepthPro2-S",
|
|
16
|
+
"backbone_preset": "vit_small_patch16_dinov3",
|
|
17
|
+
"reassembled_blocks": [2, 5, 8, 11],
|
|
18
|
+
"cross_frame_blocks": [5, 7, 9, 11],
|
|
19
|
+
"dims_reassemble": [48, 96, 192, 384],
|
|
20
|
+
"dim_decoder": 64,
|
|
21
|
+
},
|
|
22
|
+
"depth-pro-2-b": {
|
|
23
|
+
"backbone": "vitb",
|
|
24
|
+
"hub_repo_id": "apple/DepthPro2-B",
|
|
25
|
+
"backbone_preset": "vit_base_patch16_dinov3",
|
|
26
|
+
"reassembled_blocks": [2, 5, 8, 11],
|
|
27
|
+
"cross_frame_blocks": [5, 7, 9, 11],
|
|
28
|
+
"dims_reassemble": [96, 192, 384, 768],
|
|
29
|
+
"dim_decoder": 128,
|
|
30
|
+
},
|
|
31
|
+
"depth-pro-2-l": {
|
|
32
|
+
"backbone": "vitl",
|
|
33
|
+
"hub_repo_id": "apple/DepthPro2-L",
|
|
34
|
+
"backbone_preset": "vit_large_patch16_dinov3.lvd1689m",
|
|
35
|
+
"reassembled_blocks": [5, 11, 17, 23],
|
|
36
|
+
"cross_frame_blocks": [9, 11, 13, 15, 17, 19, 21, 23],
|
|
37
|
+
"dims_reassemble": [256, 512, 1024, 1024],
|
|
38
|
+
"dim_decoder": 256,
|
|
39
|
+
},
|
|
40
|
+
"depth-pro-2-h": {
|
|
41
|
+
"backbone": "vith+",
|
|
42
|
+
"hub_repo_id": "apple/DepthPro2-H",
|
|
43
|
+
"backbone_preset": "vit_huge_plus_patch16_dinov3",
|
|
44
|
+
"reassembled_blocks": [7, 15, 23, 31],
|
|
45
|
+
"cross_frame_blocks": [11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31],
|
|
46
|
+
"dims_reassemble": [256, 512, 1024, 1024],
|
|
47
|
+
"dim_decoder": 256,
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class DepthPro2Config(BaseDepthConfig):
|
|
53
|
+
"""Configuration for Apple Depth Pro 2.
|
|
54
|
+
|
|
55
|
+
Sharp, temporally consistent metric monocular depth. A DINOv3 multi-view
|
|
56
|
+
transformer feeds a DPT decoder that predicts focal-normalised inverse
|
|
57
|
+
depth; a separate DINOv3 ViT-S focal-length estimator
|
|
58
|
+
(``apple/DepthPro2-focal``) turns it into metric depth when the focal
|
|
59
|
+
length is unknown. Uses the bundled network implementation — no external
|
|
60
|
+
``depth_pro_2`` package needed.
|
|
61
|
+
|
|
62
|
+
The network runs at any resolution that is a multiple of 32, so
|
|
63
|
+
``patch_size`` is 32 here (the processor's resize multiple) even though
|
|
64
|
+
the ViT itself uses 16-pixel patches. ``input_size`` is the shorter side
|
|
65
|
+
the processor resizes to; raise it for sharper (slower) predictions.
|
|
66
|
+
|
|
67
|
+
``precision`` is the autocast dtype of the backbones and decoder:
|
|
68
|
+
``"auto"`` (bfloat16 on CUDA/MPS as trained, float32 on CPU),
|
|
69
|
+
``"float32"``, ``"bfloat16"`` or ``"float16"``. The heads always run in
|
|
70
|
+
float32.
|
|
71
|
+
|
|
72
|
+
``forward()`` returns 0 (invalid) where depth is infinite (sky) or beyond
|
|
73
|
+
``max_depth`` meters, like MoGe; ``model.infer()`` returns the raw
|
|
74
|
+
prediction with ``inf`` sky.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
model_type = "depth-pro-2"
|
|
78
|
+
|
|
79
|
+
def __init__(
|
|
80
|
+
self,
|
|
81
|
+
backbone: str = "vits",
|
|
82
|
+
input_size: int = 768,
|
|
83
|
+
patch_size: int = 32,
|
|
84
|
+
is_metric: bool = True,
|
|
85
|
+
hub_repo_id: str = "apple/DepthPro2-S",
|
|
86
|
+
hub_filename: str = "model.safetensors",
|
|
87
|
+
fov_repo_id: Optional[str] = "apple/DepthPro2-focal",
|
|
88
|
+
use_fov: bool = True,
|
|
89
|
+
backbone_preset: str = "vit_small_patch16_dinov3",
|
|
90
|
+
reassembled_blocks: Optional[List[int]] = None,
|
|
91
|
+
cross_frame_blocks: Optional[List[int]] = None,
|
|
92
|
+
dims_reassemble: Optional[List[int]] = None,
|
|
93
|
+
dim_decoder: int = 64,
|
|
94
|
+
precision: str = "auto",
|
|
95
|
+
max_depth: Optional[float] = 1000.0,
|
|
96
|
+
**kwargs,
|
|
97
|
+
):
|
|
98
|
+
super().__init__(
|
|
99
|
+
backbone=backbone,
|
|
100
|
+
input_size=input_size,
|
|
101
|
+
patch_size=patch_size,
|
|
102
|
+
is_metric=is_metric,
|
|
103
|
+
max_depth=max_depth,
|
|
104
|
+
**kwargs,
|
|
105
|
+
)
|
|
106
|
+
self.hub_repo_id = hub_repo_id
|
|
107
|
+
self.hub_filename = hub_filename
|
|
108
|
+
self.fov_repo_id = fov_repo_id
|
|
109
|
+
self.use_fov = use_fov
|
|
110
|
+
self.backbone_preset = backbone_preset
|
|
111
|
+
self.reassembled_blocks = list(reassembled_blocks or [2, 5, 8, 11])
|
|
112
|
+
self.cross_frame_blocks = list(cross_frame_blocks or [5, 7, 9, 11])
|
|
113
|
+
self.dims_reassemble = list(dims_reassemble or [48, 96, 192, 384])
|
|
114
|
+
self.dim_decoder = dim_decoder
|
|
115
|
+
self.precision = precision
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def from_variant(cls, variant_id: str) -> "DepthPro2Config":
|
|
119
|
+
if variant_id not in _DEPTHPRO2_VARIANT_MAP:
|
|
120
|
+
raise ValueError(
|
|
121
|
+
f"Unknown Depth Pro 2 variant '{variant_id}'. "
|
|
122
|
+
f"Available: {list(_DEPTHPRO2_VARIANT_MAP.keys())}"
|
|
123
|
+
)
|
|
124
|
+
return cls(**_DEPTHPRO2_VARIANT_MAP[variant_id])
|