add README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
tags:
|
| 4 |
+
- depth-estimation
|
| 5 |
+
- monocular-depth
|
| 6 |
+
- video-depth
|
| 7 |
+
- safetensors
|
| 8 |
+
- comfyui
|
| 9 |
+
library_name: safetensors
|
| 10 |
+
pipeline_tag: depth-estimation
|
| 11 |
+
base_model:
|
| 12 |
+
- depth-anything/Video-Depth-Anything-Large
|
| 13 |
+
- depth-anything/Depth-Anything-V2-Large
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Depth Anything, fp16 safetensors
|
| 17 |
+
|
| 18 |
+
Two depth models converted to fp16 `safetensors`, nothing else changed. They are
|
| 19 |
+
the pair used by the **TS Universal Depth** node in
|
| 20 |
+
[comfyui-timesaver](https://github.com/AlexYez/comfyui-timesaver): one for
|
| 21 |
+
single images, one for video.
|
| 22 |
+
|
| 23 |
+
| file | source | what it is for | size |
|
| 24 |
+
| --- | --- | --- | ---: |
|
| 25 |
+
| `depth_anything_v2_vitl_fp16.safetensors` | [depth-anything/Depth-Anything-V2-Large](https://huggingface.co/depth-anything/Depth-Anything-V2-Large) | a single image | 640 MB |
|
| 26 |
+
| `video_depth_anything_vitl_fp16.safetensors` | [depth-anything/Video-Depth-Anything-Large](https://huggingface.co/depth-anything/Video-Depth-Anything-Large) | a sequence, temporally consistent | 734 MB |
|
| 27 |
+
|
| 28 |
+
## ⚠️ Licence: CC BY-NC 4.0 — non-commercial
|
| 29 |
+
|
| 30 |
+
Both upstream checkpoints are published under
|
| 31 |
+
[CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/), and this
|
| 32 |
+
conversion inherits it unchanged. **You may not use these weights for commercial
|
| 33 |
+
purposes.** Attribution goes to the Depth Anything authors; this repository
|
| 34 |
+
holds no rights of its own beyond the conversion.
|
| 35 |
+
|
| 36 |
+
If you need a permissive licence, the *Small* variant of Depth Anything V2 is
|
| 37 |
+
Apache-2.0 — a different model, not a smaller copy of this one.
|
| 38 |
+
|
| 39 |
+
## What was changed
|
| 40 |
+
|
| 41 |
+
Exactly two things, both mechanical:
|
| 42 |
+
|
| 43 |
+
1. **float32 → float16.** Nothing was pruned, quantised or re-trained.
|
| 44 |
+
2. **`.pth` → `.safetensors`.** The tensors and their names are identical.
|
| 45 |
+
|
| 46 |
+
Every file carries its provenance in the safetensors metadata: the upstream
|
| 47 |
+
repository, the upstream filename and the **sha256 of the original `.pth`** it
|
| 48 |
+
was converted from, so the chain back to the source is checkable rather than
|
| 49 |
+
promised.
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
from safetensors import safe_open
|
| 53 |
+
with safe_open("depth_anything_v2_vitl_fp16.safetensors", framework="pt") as f:
|
| 54 |
+
print(f.metadata())
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
| file | sha256 of the original `.pth` |
|
| 58 |
+
| --- | --- |
|
| 59 |
+
| `depth_anything_v2_vitl_fp16.safetensors` | `a7ea19fa0ed99244e67b624c72b8580b7e9553043245905be58796a608eb9345` |
|
| 60 |
+
| `video_depth_anything_vitl_fp16.safetensors` | `43df27c6b396042ba34ff7b798ab279f64d204d2e86d7a373968f8fa36d0e6fa` |
|
| 61 |
+
|
| 62 |
+
## Does fp16 cost quality?
|
| 63 |
+
|
| 64 |
+
Measured, not assumed. Depth maps were rendered from the same images at 518 px
|
| 65 |
+
on an RTX 3080 Ti, and each variant compared against **pure fp32 with autocast
|
| 66 |
+
disabled**, on the normalised 0..1 depth map:
|
| 67 |
+
|
| 68 |
+
| variant | mean deviation | worst pixel |
|
| 69 |
+
| --- | ---: | ---: |
|
| 70 |
+
| fp32 weights + autocast | 0.020 % | 0.39 % |
|
| 71 |
+
| **fp16 weights (this repo) + autocast** | **0.016 – 0.020 %** | 0.51 % |
|
| 72 |
+
| fp16 weights and fp16 compute | 0.021 % | 0.61 % |
|
| 73 |
+
|
| 74 |
+
The dominant difference is autocast itself; storing the weights in fp16 adds
|
| 75 |
+
almost nothing on top of it. Half the download, half the disk, no visible cost.
|
| 76 |
+
|
| 77 |
+
## Loading
|
| 78 |
+
|
| 79 |
+
```python
|
| 80 |
+
from safetensors.torch import load_file
|
| 81 |
+
state = load_file("video_depth_anything_vitl_fp16.safetensors")
|
| 82 |
+
model.load_state_dict(state) # architecture from the upstream project
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
Architectures live in the original projects —
|
| 86 |
+
[Depth-Anything-V2](https://github.com/DepthAnything/Depth-Anything-V2) and
|
| 87 |
+
[Video-Depth-Anything](https://github.com/DepthAnything/Video-Depth-Anything).
|
| 88 |
+
This repository ships weights only.
|
| 89 |
+
|
| 90 |
+
## Citation
|
| 91 |
+
|
| 92 |
+
```bibtex
|
| 93 |
+
@article{depth_anything_v2,
|
| 94 |
+
title = {Depth Anything V2},
|
| 95 |
+
author = {Yang, Lihe and Kang, Bingyi and Huang, Zilong and Zhao, Zhen
|
| 96 |
+
and Xu, Xiaogang and Feng, Jiashi and Zhao, Hengshuang},
|
| 97 |
+
journal = {arXiv:2406.09414},
|
| 98 |
+
year = {2024}
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
@article{video_depth_anything,
|
| 102 |
+
title = {Video Depth Anything: Consistent Depth Estimation for Super-Long Videos},
|
| 103 |
+
author = {Chen, Sili and Guo, Hengkai and Zhu, Shengnan and Zhang, Feihu
|
| 104 |
+
and Huang, Zilong and Feng, Jiashi and Kang, Bingyi},
|
| 105 |
+
journal = {arXiv:2501.12375},
|
| 106 |
+
year = {2025}
|
| 107 |
+
}
|
| 108 |
+
```
|