查看 Markdown

ZipDepth

ZipDepth 是一个紧凑的可重参数化 CNN,从 Depth Anything V2 Large 蒸馏而来,预测稠密的相对逆深度图。LibreYOLO 支持它的 depth 任务:预测和零样本验证,没有训练这一步。

任务
depth
尺寸
b, bnpu at 384 px
安装
pip install libreyolo
支持层级
仅推理,自 v1.4.0 起。仅支持预测、验证和导出。训练相关的功能不适用。
上游
ZipDepth,由 University of Bologna 发布,采用 MIT 许可。论文、源码
许可
代码采用 MIT,权重采用 MIT。商用

安装

ZipDepth 不需要任何可选 extra。它导入的一切都在基础安装里。

bash
pip install libreyolo

预测

权重在首次使用时从 Hugging Face 下载,并缓存在本地。

Python
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreZipDepthb-depth.pt")result = model(SAMPLE_IMAGE, save=True) depth = result.depth_mapprint(depth.min, depth.max, depth.mean)
CLI
libreyolo predict model=LibreZipDepthb-depth.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg save=True
NPU/边缘检查点
from libreyolo import LibreYOLO, SAMPLE_IMAGE # 同样的编码器,换成不用 unfold 的上采样 head,面向缺少# gather/unfold 支持的编译器。输出在视觉上与 b 检查点等价model = LibreYOLO("LibreZipDepthbnpu-depth.pt")result = model(SAMPLE_IMAGE, save=True)

result.depth_map 带的是一张稠密的相对逆深度图:值越大表示离相机越近,而且这些 值没有度量单位,也没有跨图像的统一尺度。save=True 会把这张图经过色彩映射的可 视化结果写入磁盘;Results.plot() 会把深度图渲染成一张 PIL 图像,传 pil=False 则改为返回数组。数据源、流式处理和结果处理见预测。

变体

两个检查点(checkpoint),编码器容量相同,区别只在训练出来的上采样 head。b 用的是 convex 上采样,跑在 GPU 或 CPU 上。bnpu 换成了不用 unfold 的解码器,面 向缺少 gather/unfold 支持的 NPU 和边缘编译器;它的输出按文档说明在视觉上与 b 等价。导出目标是受限的运行时就选 bnpu,其他情况选 b。

两个检查点都是从 Depth Anything V2 Large 的伪标注蒸馏来的,所以这个家族是 LibreYOLO depth 任务里紧凑、面向边缘的那一档,和更大的 Depth Anything V2 编码器 并列。

这个家族不提供训练。LibreZipDepth.train() 无条件抛出 NotImplementedError: 上游的配方是在一个很大的图像集合上蒸馏伪标注,没法作为一次 LibreYOLO 训练复现。 请到上游 fabiotosi92/ZipDepth 训练,再 用 weights/convert_zipdepth_weights.py 转换结果。

验证

val() 运行的是共用的深度验证器:它用逐图像的最小二乘尺度和偏移,把每个预测对 齐到它的真值(ground truth),然后报告标准的零样本相对深度指标,AbsRel、RMSE 和三个 delta 阈值。

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreZipDepthb-depth.pt")metrics = model.val(data="my-dataset.yaml") print(metrics["metrics/abs_rel"])print(metrics["metrics/rmse"])print(metrics["metrics/delta1"])
CLI
libreyolo val model=LibreZipDepthb-depth.pt data=my-dataset.yaml

导出

任务ONNXTorchScriptExecuTorchTensorRTOpenVINOPaddleMNNRKNNncnnTFLiteCoreMLCore AI
DepthDepth 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 ncnn:支持Depth to TFLite:不支持Depth to CoreML:不支持Depth to Core AI:支持

导出遵循固定分辨率的稠密约定:源图像被拉伸缩放到导出时的画布尺寸,返回的深度图 之后再缩放回原始画布。导出的产物按文件后缀经由 LibreYOLO() 重新加载,所以一个 .onnx 或 .ncnn 文件的表现和检查点一样,返回同样的 Results,只是把检测框换 成了 depth_map。

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreZipDepthb-depth.pt")model.export(format="onnx")model.export(format="ncnn")
CLI
libreyolo export model=LibreZipDepthb-depth.pt format=onnxlibreyolo export model=LibreZipDepthbnpu-depth.pt format=ncnn
使用导出的文件
from libreyolo import LibreYOLO, SAMPLE_IMAGE # 工厂按文件后缀分发,所以导出的产物加载方式和任何检查点一样,# 返回的也是同一个 Results 对象model = LibreYOLO("LibreZipDepthb-depth.onnx")result = model(SAMPLE_IMAGE) print(result.depth_map.data.shape)

检查点

这个家族已发布的全部权重文件。

上面的每个文件目前都在 LibreYOLO 组织中,并会在首次使用时下载。

许可证

请检查你所下载的具体权重在 Hugging Face 仓库中的许可。LibreYOLO 组织里的每个检查点都附有许可,同一家族内也不一定相同。该仓库是权威来源;以下摘要说明本页上次验证时适用的情况。

这里只说明涉及的许可证,不构成法律意见。如果答案对商用很重要,请自行阅读许可证并咨询法律顾问。

原始工作
ZipDepth, University of Bologna
上游许可
MIT
LibreYOLO 代码
MIT
权重
采用 MIT 许可,重新发布在 huggingface.co/LibreYOLO
解读
MIT is a permissive license, so both checkpoints can be used in commercial and closed-source products with no redistribution restriction beyond keeping the license notice. It places no obligation on your own application code. The weights were trained by distilling pseudo-labels from Depth Anything V2 Large, whose Large checkpoint is itself CC-BY-NC-4.0; the ZipDepth authors publish the distilled student under MIT regardless, and LibreYOLO republishes that same MIT-licensed student.

引用

@inproceedings{tosi2026zipdepth,
  title     = {ZipDepth: Bringing Lightweight Zero-Shot Monocular Depth Anywhere, on Any Device},
  author    = {Tosi, Fabio and Bartolomei, Luca and Poggi, Matteo and Mattoccia, Stefano},
  booktitle = {European Conference on Computer Vision (ECCV)},
  year      = {2026}
}

复制自作者在 github.com/fabiotosi92/ZipDepth#-citation 上提供的引用块。

已针对 LibreYOLO v1.5.0 验证。本页的支持表、检查点和基准测试数据由已发布的库和权重生成,并非手工编写。

选择具体变体或系列概览,然后选择模块查看详情。打开完整架构图可缩放或下载 SVG 和 PNG。图中标签为英文。