Video Depth Anything
Video Depth Anything 出自字节跳动(ByteDance),它在 Depth Anything V2 编码器上加了一个时序 head,让深度在帧与帧之间保持一致。LibreYOLO 把一组帧、一个文件夹、一段视频或一个流当作一个序列来运行,为每一帧返回一张深度图,全部处在同一个相对尺度上。
安装
Video Depth Anything 不需要任何可选 extra。
pip install libreyolo预测
权重在首次使用时从 LibreYOLO 的 Hugging Face 镜像下载。
from libreyolo import LibreYOLO model = LibreYOLO("LibreVideoDepthAnythings-depth.pt") # 每帧一个结果,以流式返回,最多延迟一个窗口for result in model("clip.mp4", stream=True): depth = result.depth_map.data # (H, W) 相对逆深度from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreVideoDepthAnythings-depth.pt")result = model(SAMPLE_IMAGE, save=True) # 只有一帧的序列print(result.depth_map.data.shape)libreyolo predict model=LibreVideoDepthAnythings-depth.pt source=clip.mp4 save=True任何多图像数据源都是一个序列:一组帧、按文件名排序的目录、一个视频文件或一个流。
N 帧给出 N 个结果,每个结果都带有该帧画布尺寸上的 result.depth_map。内部按
上游的做法以相互重叠的 32 帧窗口运行,每个窗口都与之前的窗口做尺度和偏移对齐,所以
整个序列共享同一个相对尺度。单张图像是只有一帧的序列;上游会用它自身的副本把它填满
一个完整窗口。
输出遵循 LibreYOLO 共用的深度约定:相对逆深度,值越大表示越近,这些值没有度量单位。 每个编码器的输入尺寸都是上游默认的 518;宽于 16:9 的帧会像上游一样按比例缩小运行。 载荷说明见深度估计任务页。
变体
三种编码器尺寸 s、b 和 l,各一个检查点。许可证因尺寸而异(见下文),所以在
商业产品里应该用 s。上游的度量深度检查点没有托管,转换脚本也会拒绝它们。
不提供训练:train() 会抛出异常。上游的相对深度检查点可以用库里的
weights/convert_video_depth_anything_weights.py 转换。
导出
| 任务 | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | Axelera | ncnn | TFLite | CoreML | Core AI |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Depth | Depth to ONNX:不支持 | Depth to TorchScript:不支持 | Depth to ExecuTorch:不支持 | Depth to TensorRT:不支持 | Depth to OpenVINO:不支持 | Depth to Paddle:不支持 | Depth to MNN:不支持 | Depth to RKNN:不支持 | Depth to Axelera:不支持 | Depth to ncnn:不支持 | Depth to TFLite:不支持 | Depth to CoreML:不支持 | Depth to Core AI:不支持 |
不支持导出。网络读取的是一个 32 帧窗口,各窗口在主机端拼接,而单图像深度导出约定
无法描述这一点,所以 export() 会抛出异常。
检查点
| 文件 | 权重许可 |
|---|---|
| Depth | |
| LibreVideoDepthAnythings-depth.pt | apache-2.0 |
| LibreVideoDepthAnythingb-depth.pt | cc-by-nc-4.0 |
| LibreVideoDepthAnythingl-depth.pt | cc-by-nc-4.0 |
上面的每个文件目前都在 LibreYOLO 组织中,并会在首次使用时下载。
许可证
请检查你所下载的具体权重在 Hugging Face 仓库中的许可。LibreYOLO 组织里的每个检查点都附有许可,同一家族内也不一定相同。该仓库是权威来源;以下摘要说明本页上次验证时适用的情况。
这里只说明涉及的许可证,不构成法律意见。如果答案对商用很重要,请自行阅读许可证并咨询法律顾问。
- 原始工作
- Video Depth Anything, ByteDance
- 上游许可
- Apache-2.0 (Small checkpoint); CC-BY-NC-4.0 (Base and Large checkpoints)
- LibreYOLO 代码
- MIT
- 权重
- 采用 Apache-2.0 (s); CC-BY-NC-4.0 (b, l) 许可,重新发布在 huggingface.co/LibreYOLO
- 解读
- The licence depends on the size. The s checkpoint (Video-Depth-Anything-Small) is Apache-2.0, a permissive license that allows commercial and closed-source use if you keep the license text and notices. The b and l checkpoints (Base and Large) are CC BY-NC 4.0: attribution is required and commercial use is not allowed. The vendored code is Apache-2.0 from DepthAnything/Video-Depth-Anything at commit 4f5ae23172ba60fd7bc11ef671cca678842c7072 (Copyright ByteDance), including a motion module from AnimateDiff and attention code from Hugging Face diffusers, both Apache-2.0; the DINOv2 encoder and DPT head are shared with LibreYOLO's Depth Anything V2 family, and LibreYOLO's own adapter and streaming stitcher are MIT (libreyolo/models/video_depth_anything/NOTICE). LibreYOLO mirrors the converted checkpoints, tensors unchanged, as LibreYOLO/LibreVideoDepthAnything{s,b,l}-depth with the licence of each upstream size, not gated; metric checkpoints are not hosted.
Video Depth Anything 出自字节跳动 (DepthAnything/Video-Depth-Anything)。 内置的代码采用 Apache-2.0 许可。权重的许可证取决于尺寸:
s(Video-Depth-Anything-Small):Apache-2.0,允许商用。b和l(Base 和 Large):CC BY-NC 4.0,仅限非商用。 它们附带一份非商用声明。
LibreYOLO 镜像了转换后的检查点(checkpoint),张量未作改动,命名为
LibreYOLO/LibreVideoDepthAnything{s,b,l}-depth,不需要申请访问。
引用
@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}
}复制自作者在 github.com/DepthAnything/Video-Depth-Anything#citation 上提供的引用块。