depth-fp16 / README.md
hfmaster's picture
add README.md
5d3d475 verified
|
Raw History Blame Contribute Delete
4.11 kB
---
license: cc-by-nc-4.0
tags:
- depth-estimation
- monocular-depth
- video-depth
- safetensors
- comfyui
library_name: safetensors
pipeline_tag: depth-estimation
base_model:
- depth-anything/Video-Depth-Anything-Large
- depth-anything/Depth-Anything-V2-Large
---
# Depth Anything, fp16 safetensors
Two depth models converted to fp16 `safetensors`, nothing else changed. They are
the pair used by the **TS Universal Depth** node in
[comfyui-timesaver](https://github.com/AlexYez/comfyui-timesaver): one for
single images, one for video.
| file | source | what it is for | size |
| --- | --- | --- | ---: |
| `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 |
| `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 |
## ⚠️ Licence: CC BY-NC 4.0 β€” non-commercial
Both upstream checkpoints are published under
[CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/), and this
conversion inherits it unchanged. **You may not use these weights for commercial
purposes.** Attribution goes to the Depth Anything authors; this repository
holds no rights of its own beyond the conversion.
If you need a permissive licence, the *Small* variant of Depth Anything V2 is
Apache-2.0 β€” a different model, not a smaller copy of this one.
## What was changed
Exactly two things, both mechanical:
1. **float32 β†’ float16.** Nothing was pruned, quantised or re-trained.
2. **`.pth` β†’ `.safetensors`.** The tensors and their names are identical.
Every file carries its provenance in the safetensors metadata: the upstream
repository, the upstream filename and the **sha256 of the original `.pth`** it
was converted from, so the chain back to the source is checkable rather than
promised.
```python
from safetensors import safe_open
with safe_open("depth_anything_v2_vitl_fp16.safetensors", framework="pt") as f:
print(f.metadata())
```
| file | sha256 of the original `.pth` |
| --- | --- |
| `depth_anything_v2_vitl_fp16.safetensors` | `a7ea19fa0ed99244e67b624c72b8580b7e9553043245905be58796a608eb9345` |
| `video_depth_anything_vitl_fp16.safetensors` | `43df27c6b396042ba34ff7b798ab279f64d204d2e86d7a373968f8fa36d0e6fa` |
## Does fp16 cost quality?
Measured, not assumed. Depth maps were rendered from the same images at 518 px
on an RTX 3080 Ti, and each variant compared against **pure fp32 with autocast
disabled**, on the normalised 0..1 depth map:
| variant | mean deviation | worst pixel |
| --- | ---: | ---: |
| fp32 weights + autocast | 0.020 % | 0.39 % |
| **fp16 weights (this repo) + autocast** | **0.016 – 0.020 %** | 0.51 % |
| fp16 weights and fp16 compute | 0.021 % | 0.61 % |
The dominant difference is autocast itself; storing the weights in fp16 adds
almost nothing on top of it. Half the download, half the disk, no visible cost.
## Loading
```python
from safetensors.torch import load_file
state = load_file("video_depth_anything_vitl_fp16.safetensors")
model.load_state_dict(state) # architecture from the upstream project
```
Architectures live in the original projects β€”
[Depth-Anything-V2](https://github.com/DepthAnything/Depth-Anything-V2) and
[Video-Depth-Anything](https://github.com/DepthAnything/Video-Depth-Anything).
This repository ships weights only.
## Citation
```bibtex
@article{depth_anything_v2,
title = {Depth Anything V2},
author = {Yang, Lihe and Kang, Bingyi and Huang, Zilong and Zhao, Zhen
and Xu, Xiaogang and Feng, Jiashi and Zhao, Hengshuang},
journal = {arXiv:2406.09414},
year = {2024}
}
@article{video_depth_anything,
title = {Video Depth Anything: Consistent Depth Estimation for Super-Long Videos},
author = {Chen, Sili and Guo, Hengkai and Zhu, Shengnan and Zhang, Feihu
and Huang, Zilong and Feng, Jiashi and Kang, Bingyi},
journal = {arXiv:2501.12375},
year = {2025}
}
```