depth-estimation 0.0.9__tar.gz → 0.1.1__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.0.9 → depth_estimation-0.1.1}/LICENSE +0 -0
- {depth_estimation-0.0.9/src/depth_estimation.egg-info → depth_estimation-0.1.1}/PKG-INFO +78 -4
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/README.md +76 -2
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/pyproject.toml +2 -2
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/__init__.py +19 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/cli.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/configuration_utils.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/data/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/data/base_dataset.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/data/diode.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/data/folder.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/data/hub.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/data/kitti.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/data/nyu_depth_v2.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/data/transforms.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/evaluation/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/evaluation/evaluate.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/evaluation/metrics.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/evaluation/profiling.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/losses.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/modeling_utils.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/auto/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/auto/modeling_auto.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/auto/processing_auto.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_anything_v1/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_anything_v1/configuration_depth_anything_v1.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_anything_v1/modeling_depth_anything_v1.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_anything_v2/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_anything_v2/configuration_depth_anything_v2.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_anything_v2/modeling_depth_anything_v2.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_anything_v3/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_anything_v3/configuration_depth_anything_v3.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_anything_v3/modeling_depth_anything_v3.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_pro/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_pro/configuration_depth_pro.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_pro/modeling_depth_pro.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/marigold_dc/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/marigold_dc/configuration_marigold_dc.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/marigold_dc/modeling_marigold_dc.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/midas/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/midas/configuration_midas.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/midas/modeling_midas.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/moge/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/moge/configuration_moge.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/moge/modeling_moge.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/omnivggt/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/omnivggt/configuration_omnivggt.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/omnivggt/modeling_omnivggt.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/pixel_perfect_depth/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/pixel_perfect_depth/configuration_ppd.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/pixel_perfect_depth/modeling_ppd.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/vggt/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/vggt/configuration_vggt.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/vggt/modeling_vggt.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/zoedepth/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/zoedepth/configuration_zoedepth.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/zoedepth/modeling_zoedepth.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/output.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/pipeline_utils.py +80 -1
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/pipelines/__init__.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/pipelines/depth_estimation.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/processing_utils.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/registry.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/trainer.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/training_args.py +0 -0
- depth_estimation-0.1.1/src/depth_estimation/video.py +260 -0
- depth_estimation-0.1.1/src/depth_estimation/viz/__init__.py +45 -0
- depth_estimation-0.1.1/src/depth_estimation/viz/animate.py +84 -0
- depth_estimation-0.1.1/src/depth_estimation/viz/composite.py +80 -0
- depth_estimation-0.1.1/src/depth_estimation/viz/display.py +102 -0
- depth_estimation-0.1.1/src/depth_estimation/viz/error.py +72 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1/src/depth_estimation.egg-info}/PKG-INFO +78 -4
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation.egg-info/SOURCES.txt +9 -1
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation.egg-info/requires.txt +1 -1
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/tests/test_auto.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/tests/test_config.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/tests/test_data.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/tests/test_evaluation.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/tests/test_losses.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/tests/test_model.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/tests/test_pipeline.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/tests/test_processor.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/tests/test_training.py +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/tests/test_transforms.py +0 -0
- depth_estimation-0.1.1/tests/test_video.py +243 -0
- depth_estimation-0.1.1/tests/test_viz.py +179 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/setup.cfg +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation.egg-info/dependency_links.txt +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation.egg-info/entry_points.txt +0 -0
- {depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation.egg-info/top_level.txt +0 -0
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: depth_estimation
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.1.1
|
|
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
|
|
@@ -21,7 +21,7 @@ Classifier: Intended Audience :: Science/Research
|
|
|
21
21
|
Requires-Python: >=3.9
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: torch==2.
|
|
24
|
+
Requires-Dist: torch==2.9.0
|
|
25
25
|
Requires-Dist: torchvision>=0.15
|
|
26
26
|
Requires-Dist: Pillow>=9.0
|
|
27
27
|
Requires-Dist: numpy>=1.24
|
|
@@ -47,17 +47,18 @@ Dynamic: license-file
|
|
|
47
47
|
<a href="https://github.com/shriarul5273/depth_estimation/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/shriarul5273/depth_estimation?color=blue"></a>
|
|
48
48
|
<a href="https://pypi.org/project/depth-estimation/"><img alt="PyPI" src="https://img.shields.io/pypi/v/depth-estimation"></a>
|
|
49
49
|
<a href="https://pypi.org/project/depth-estimation/"><img alt="Python" src="https://img.shields.io/pypi/pyversions/depth-estimation"></a>
|
|
50
|
+
<a href="https://huggingface.co/spaces/shriarul5273/Depth-Estimation-Compare-demo"><img alt="Demo" src="https://img.shields.io/badge/🤗%20Hugging%20Face-Demo-blue"></a>
|
|
50
51
|
</p>
|
|
51
52
|
|
|
52
53
|
<h3 align="center">A unified Python library for monocular depth estimation</h3>
|
|
53
54
|
|
|
54
|
-
<h3 align="center">Inference · Fine-Tuning · Evaluation · Dataset Loading</h3>
|
|
55
|
+
<h3 align="center">Inference · Video & Streaming · Visualization · Fine-Tuning · Evaluation · Dataset Loading</h3>
|
|
55
56
|
|
|
56
57
|
---
|
|
57
58
|
|
|
58
59
|
`depth_estimation` is the model-definition framework for depth estimation. It provides a single, consistent API across **12 model families and 28 variants** — so you can swap models, compare them, and fine-tune them without rewriting your pipeline.
|
|
59
60
|
|
|
60
|
-
It covers the full workflow end-to-end: run inference with one line, evaluate on standard benchmarks, and fine-tune on custom depth data — all with the same library.
|
|
61
|
+
It covers the full workflow end-to-end: run inference with one line, stream depth from video, visualize results, evaluate on standard benchmarks, and fine-tune on custom depth data — all with the same library.
|
|
61
62
|
|
|
62
63
|
## Installation
|
|
63
64
|
|
|
@@ -165,6 +166,79 @@ depth-estimate predict "images/*.jpg" --model depth-anything-v2-vitb --output-di
|
|
|
165
166
|
|
|
166
167
|
</details>
|
|
167
168
|
|
|
169
|
+
<details>
|
|
170
|
+
<summary><b>Video & Streaming</b> — frame-by-frame depth from video, webcam, or image sequences</summary>
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from depth_estimation import pipeline
|
|
174
|
+
|
|
175
|
+
pipe = pipeline("depth-estimation", model="depth-anything-v2-vitb")
|
|
176
|
+
|
|
177
|
+
# Stream a video file — yields DepthOutput per frame
|
|
178
|
+
for result in pipe.stream("video.mp4", temporal_smoothing=0.5):
|
|
179
|
+
depth = result.depth # (H, W) float32
|
|
180
|
+
colored = result.colored_depth # (H, W, 3) uint8
|
|
181
|
+
print(result.metadata["frame_index"])
|
|
182
|
+
|
|
183
|
+
# Webcam stream
|
|
184
|
+
for result in pipe.stream(0): # device index
|
|
185
|
+
...
|
|
186
|
+
|
|
187
|
+
# Frame glob (sorted alphabetically)
|
|
188
|
+
for result in pipe.stream("frames/*.png"):
|
|
189
|
+
...
|
|
190
|
+
|
|
191
|
+
# Write output video to disk
|
|
192
|
+
pipe.process_video(
|
|
193
|
+
"input.mp4",
|
|
194
|
+
"output_depth.mp4",
|
|
195
|
+
colormap="inferno",
|
|
196
|
+
side_by_side=True, # RGB | depth composite
|
|
197
|
+
temporal_smoothing=0.5,
|
|
198
|
+
)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# CLI — video prediction
|
|
203
|
+
depth-estimate predict video.mp4 --model depth-anything-v2-vitb --output depth_video.mp4
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
See [docs/video.md](https://github.com/shriarul5273/depth_estimation/blob/main/docs/video.md).
|
|
207
|
+
|
|
208
|
+
</details>
|
|
209
|
+
|
|
210
|
+
<details>
|
|
211
|
+
<summary><b>Visualization</b> — depth maps, comparisons, overlays, 3D animations, error maps</summary>
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
from depth_estimation.viz import (
|
|
215
|
+
show_depth, compare_depths, overlay_depth,
|
|
216
|
+
create_anaglyph, animate_3d, plot_error_map,
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
# Display a depth result
|
|
220
|
+
show_depth(result, colormap="Spectral_r", title="Depth Anything V2")
|
|
221
|
+
|
|
222
|
+
# Side-by-side comparison of multiple models
|
|
223
|
+
compare_depths([result_v2, result_pro], labels=["DA V2", "DepthPro"], save="compare.png")
|
|
224
|
+
|
|
225
|
+
# Blend depth over RGB image
|
|
226
|
+
overlay = overlay_depth(image, result.depth, alpha=0.5, colormap="inferno")
|
|
227
|
+
|
|
228
|
+
# Red-cyan anaglyph stereo image
|
|
229
|
+
anaglyph = create_anaglyph(image, result.depth, baseline=0.065)
|
|
230
|
+
|
|
231
|
+
# Rotating 3D surface animation
|
|
232
|
+
animate_3d(image, result.depth, "rotation.gif", frames=60)
|
|
233
|
+
|
|
234
|
+
# Per-pixel error heatmap (requires ground truth)
|
|
235
|
+
plot_error_map(pred_depth, gt_depth, metric="abs_rel", save="errors.png")
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
See [docs/viz.md](https://github.com/shriarul5273/depth_estimation/blob/main/docs/viz.md).
|
|
239
|
+
|
|
240
|
+
</details>
|
|
241
|
+
|
|
168
242
|
<details>
|
|
169
243
|
<summary><b>Evaluation</b> — standard benchmarks, custom predictions</summary>
|
|
170
244
|
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
<a href="https://github.com/shriarul5273/depth_estimation/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/shriarul5273/depth_estimation?color=blue"></a>
|
|
5
5
|
<a href="https://pypi.org/project/depth-estimation/"><img alt="PyPI" src="https://img.shields.io/pypi/v/depth-estimation"></a>
|
|
6
6
|
<a href="https://pypi.org/project/depth-estimation/"><img alt="Python" src="https://img.shields.io/pypi/pyversions/depth-estimation"></a>
|
|
7
|
+
<a href="https://huggingface.co/spaces/shriarul5273/Depth-Estimation-Compare-demo"><img alt="Demo" src="https://img.shields.io/badge/🤗%20Hugging%20Face-Demo-blue"></a>
|
|
7
8
|
</p>
|
|
8
9
|
|
|
9
10
|
<h3 align="center">A unified Python library for monocular depth estimation</h3>
|
|
10
11
|
|
|
11
|
-
<h3 align="center">Inference · Fine-Tuning · Evaluation · Dataset Loading</h3>
|
|
12
|
+
<h3 align="center">Inference · Video & Streaming · Visualization · Fine-Tuning · Evaluation · Dataset Loading</h3>
|
|
12
13
|
|
|
13
14
|
---
|
|
14
15
|
|
|
15
16
|
`depth_estimation` is the model-definition framework for depth estimation. It provides a single, consistent API across **12 model families and 28 variants** — so you can swap models, compare them, and fine-tune them without rewriting your pipeline.
|
|
16
17
|
|
|
17
|
-
It covers the full workflow end-to-end: run inference with one line, evaluate on standard benchmarks, and fine-tune on custom depth data — all with the same library.
|
|
18
|
+
It covers the full workflow end-to-end: run inference with one line, stream depth from video, visualize results, evaluate on standard benchmarks, and fine-tune on custom depth data — all with the same library.
|
|
18
19
|
|
|
19
20
|
## Installation
|
|
20
21
|
|
|
@@ -122,6 +123,79 @@ depth-estimate predict "images/*.jpg" --model depth-anything-v2-vitb --output-di
|
|
|
122
123
|
|
|
123
124
|
</details>
|
|
124
125
|
|
|
126
|
+
<details>
|
|
127
|
+
<summary><b>Video & Streaming</b> — frame-by-frame depth from video, webcam, or image sequences</summary>
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from depth_estimation import pipeline
|
|
131
|
+
|
|
132
|
+
pipe = pipeline("depth-estimation", model="depth-anything-v2-vitb")
|
|
133
|
+
|
|
134
|
+
# Stream a video file — yields DepthOutput per frame
|
|
135
|
+
for result in pipe.stream("video.mp4", temporal_smoothing=0.5):
|
|
136
|
+
depth = result.depth # (H, W) float32
|
|
137
|
+
colored = result.colored_depth # (H, W, 3) uint8
|
|
138
|
+
print(result.metadata["frame_index"])
|
|
139
|
+
|
|
140
|
+
# Webcam stream
|
|
141
|
+
for result in pipe.stream(0): # device index
|
|
142
|
+
...
|
|
143
|
+
|
|
144
|
+
# Frame glob (sorted alphabetically)
|
|
145
|
+
for result in pipe.stream("frames/*.png"):
|
|
146
|
+
...
|
|
147
|
+
|
|
148
|
+
# Write output video to disk
|
|
149
|
+
pipe.process_video(
|
|
150
|
+
"input.mp4",
|
|
151
|
+
"output_depth.mp4",
|
|
152
|
+
colormap="inferno",
|
|
153
|
+
side_by_side=True, # RGB | depth composite
|
|
154
|
+
temporal_smoothing=0.5,
|
|
155
|
+
)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# CLI — video prediction
|
|
160
|
+
depth-estimate predict video.mp4 --model depth-anything-v2-vitb --output depth_video.mp4
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
See [docs/video.md](https://github.com/shriarul5273/depth_estimation/blob/main/docs/video.md).
|
|
164
|
+
|
|
165
|
+
</details>
|
|
166
|
+
|
|
167
|
+
<details>
|
|
168
|
+
<summary><b>Visualization</b> — depth maps, comparisons, overlays, 3D animations, error maps</summary>
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from depth_estimation.viz import (
|
|
172
|
+
show_depth, compare_depths, overlay_depth,
|
|
173
|
+
create_anaglyph, animate_3d, plot_error_map,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
# Display a depth result
|
|
177
|
+
show_depth(result, colormap="Spectral_r", title="Depth Anything V2")
|
|
178
|
+
|
|
179
|
+
# Side-by-side comparison of multiple models
|
|
180
|
+
compare_depths([result_v2, result_pro], labels=["DA V2", "DepthPro"], save="compare.png")
|
|
181
|
+
|
|
182
|
+
# Blend depth over RGB image
|
|
183
|
+
overlay = overlay_depth(image, result.depth, alpha=0.5, colormap="inferno")
|
|
184
|
+
|
|
185
|
+
# Red-cyan anaglyph stereo image
|
|
186
|
+
anaglyph = create_anaglyph(image, result.depth, baseline=0.065)
|
|
187
|
+
|
|
188
|
+
# Rotating 3D surface animation
|
|
189
|
+
animate_3d(image, result.depth, "rotation.gif", frames=60)
|
|
190
|
+
|
|
191
|
+
# Per-pixel error heatmap (requires ground truth)
|
|
192
|
+
plot_error_map(pred_depth, gt_depth, metric="abs_rel", save="errors.png")
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
See [docs/viz.md](https://github.com/shriarul5273/depth_estimation/blob/main/docs/viz.md).
|
|
196
|
+
|
|
197
|
+
</details>
|
|
198
|
+
|
|
125
199
|
<details>
|
|
126
200
|
<summary><b>Evaluation</b> — standard benchmarks, custom predictions</summary>
|
|
127
201
|
|
|
@@ -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.1.1"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "shriarul5273" },
|
|
10
10
|
]
|
|
@@ -27,7 +27,7 @@ classifiers = [
|
|
|
27
27
|
]
|
|
28
28
|
keywords = ["depth-estimation", "monocular-depth", "computer-vision", "deep-learning", "pytorch", "fine-tuning", "training"]
|
|
29
29
|
dependencies = [
|
|
30
|
-
"torch==2.
|
|
30
|
+
"torch==2.9.0",
|
|
31
31
|
"torchvision>=0.15",
|
|
32
32
|
"Pillow>=9.0",
|
|
33
33
|
"numpy>=1.24",
|
|
@@ -84,6 +84,20 @@ def __getattr__(name):
|
|
|
84
84
|
from .data.transforms import get_val_transforms
|
|
85
85
|
globals()["get_val_transforms"] = get_val_transforms
|
|
86
86
|
return get_val_transforms
|
|
87
|
+
# Video & streaming
|
|
88
|
+
if name == "VideoStream":
|
|
89
|
+
from .video import VideoStream
|
|
90
|
+
globals()["VideoStream"] = VideoStream
|
|
91
|
+
return VideoStream
|
|
92
|
+
if name == "process_video":
|
|
93
|
+
from .video import process_video
|
|
94
|
+
globals()["process_video"] = process_video
|
|
95
|
+
return process_video
|
|
96
|
+
# Visualization toolkit
|
|
97
|
+
if name == "viz":
|
|
98
|
+
from . import viz
|
|
99
|
+
globals()["viz"] = viz
|
|
100
|
+
return viz
|
|
87
101
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
88
102
|
|
|
89
103
|
|
|
@@ -107,6 +121,11 @@ __all__ = [
|
|
|
107
121
|
"BerHuLoss",
|
|
108
122
|
"get_train_transforms",
|
|
109
123
|
"get_val_transforms",
|
|
124
|
+
# Video & streaming
|
|
125
|
+
"VideoStream",
|
|
126
|
+
"process_video",
|
|
127
|
+
# Visualization
|
|
128
|
+
"viz",
|
|
110
129
|
]
|
|
111
130
|
|
|
112
131
|
__version__ = "0.0.9"
|
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/configuration_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/evaluation/__init__.py
RENAMED
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/evaluation/evaluate.py
RENAMED
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/evaluation/metrics.py
RENAMED
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/evaluation/profiling.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/auto/__init__.py
RENAMED
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/auto/modeling_auto.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/depth_pro/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/midas/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/moge/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/moge/modeling_moge.py
RENAMED
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/omnivggt/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/vggt/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/vggt/modeling_vggt.py
RENAMED
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/models/zoedepth/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -7,7 +7,7 @@ Chains model + processor into a single callable.
|
|
|
7
7
|
|
|
8
8
|
import logging
|
|
9
9
|
import time
|
|
10
|
-
from typing import Any, List, Optional, Union
|
|
10
|
+
from typing import Any, Generator, List, Optional, Union
|
|
11
11
|
|
|
12
12
|
import numpy as np
|
|
13
13
|
import torch
|
|
@@ -125,6 +125,85 @@ class DepthPipeline:
|
|
|
125
125
|
|
|
126
126
|
return outputs[0] if len(outputs) == 1 else outputs
|
|
127
127
|
|
|
128
|
+
def stream(
|
|
129
|
+
self,
|
|
130
|
+
source: Union[str, int],
|
|
131
|
+
batch_size: int = 1,
|
|
132
|
+
colormap: str = "inferno",
|
|
133
|
+
temporal_smoothing: float = 0.0,
|
|
134
|
+
) -> Generator[DepthOutput, None, None]:
|
|
135
|
+
"""Stream depth results frame-by-frame from a video source.
|
|
136
|
+
|
|
137
|
+
Yields a :class:`~depth_estimation.output.DepthOutput` for each frame.
|
|
138
|
+
The ``metadata`` dict includes ``frame_index``, ``timestamp_seconds``,
|
|
139
|
+
and ``fps`` in addition to the standard pipeline keys.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
source: Video file path, webcam device index, or glob pattern
|
|
143
|
+
(e.g. ``"frames/*.png"``).
|
|
144
|
+
batch_size: Frames per forward pass.
|
|
145
|
+
colormap: Matplotlib colormap for ``colored_depth``.
|
|
146
|
+
temporal_smoothing: EMA coefficient (0.0 = disabled, 0.9 = heavy).
|
|
147
|
+
|
|
148
|
+
Yields:
|
|
149
|
+
:class:`~depth_estimation.output.DepthOutput` per frame.
|
|
150
|
+
|
|
151
|
+
Example::
|
|
152
|
+
|
|
153
|
+
pipe = pipeline("depth-estimation", model="depth-anything-v2-vitb")
|
|
154
|
+
for result in pipe.stream("video.mp4", temporal_smoothing=0.5):
|
|
155
|
+
print(result.metadata["frame_index"], result.depth.shape)
|
|
156
|
+
"""
|
|
157
|
+
from .video import VideoStream
|
|
158
|
+
from .processing_utils import DepthProcessor
|
|
159
|
+
|
|
160
|
+
stream = VideoStream(source, batch_size=batch_size,
|
|
161
|
+
temporal_smoothing=temporal_smoothing)
|
|
162
|
+
try:
|
|
163
|
+
for frame_rgb, frame_meta in stream:
|
|
164
|
+
# Infer without colorizing — apply EMA first, then colorize
|
|
165
|
+
result = self(frame_rgb, batch_size=1, colorize=False, colormap=colormap)
|
|
166
|
+
smoothed = stream._temporal_filter(result.depth, temporal_smoothing)
|
|
167
|
+
colored = DepthProcessor._colorize(smoothed, colormap)
|
|
168
|
+
|
|
169
|
+
result.depth = smoothed
|
|
170
|
+
result.colored_depth = colored
|
|
171
|
+
result.metadata.update(frame_meta)
|
|
172
|
+
yield result
|
|
173
|
+
finally:
|
|
174
|
+
stream.close()
|
|
175
|
+
|
|
176
|
+
def process_video(
|
|
177
|
+
self,
|
|
178
|
+
input_path: str,
|
|
179
|
+
output_path: str,
|
|
180
|
+
colormap: str = "inferno",
|
|
181
|
+
side_by_side: bool = True,
|
|
182
|
+
fps: Optional[float] = None,
|
|
183
|
+
temporal_smoothing: float = 0.0,
|
|
184
|
+
batch_size: int = 1,
|
|
185
|
+
) -> None:
|
|
186
|
+
"""Process a video file and write the depth output to disk.
|
|
187
|
+
|
|
188
|
+
Delegates to :func:`depth_estimation.video.process_video`.
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
input_path: Path to the input video file.
|
|
192
|
+
output_path: Destination path for the output video.
|
|
193
|
+
colormap: Matplotlib colormap for depth visualization.
|
|
194
|
+
side_by_side: Write RGB | depth side-by-side when ``True``.
|
|
195
|
+
fps: Output FPS. ``None`` matches the source FPS.
|
|
196
|
+
temporal_smoothing: EMA coefficient (0.0 = disabled).
|
|
197
|
+
batch_size: Frames per forward pass.
|
|
198
|
+
"""
|
|
199
|
+
from .video import process_video as _process_video
|
|
200
|
+
_process_video(
|
|
201
|
+
self, input_path, output_path,
|
|
202
|
+
colormap=colormap, side_by_side=side_by_side,
|
|
203
|
+
fps=fps, temporal_smoothing=temporal_smoothing,
|
|
204
|
+
batch_size=batch_size,
|
|
205
|
+
)
|
|
206
|
+
|
|
128
207
|
|
|
129
208
|
def pipeline(
|
|
130
209
|
task: str = "depth-estimation",
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/pipelines/__init__.py
RENAMED
|
File without changes
|
{depth_estimation-0.0.9 → depth_estimation-0.1.1}/src/depth_estimation/pipelines/depth_estimation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|