查看 Markdown

MoGe-3

MoGe-3 是微软(Microsoft)的单目几何模型。它从一张 RGB 图像预测以米为单位的度量深度、相机坐标系下的点图、相机内参、有效性掩码和表面法线。它是 MoGe-2 加上一个稀疏 3D UNet,后者在体素网格上细化预测的深度。LibreYOLO 提供官方的 ViT-L 和 ViT-g 检查点,用于推理、验证和法线导出。

任务
depth, surface normals
尺寸
l, g at 840 px
安装
pip install libreyolo
支持层级
仅推理,自 v1.8.0 起。仅支持预测、验证和导出。训练相关的功能不适用。
上游
MoGe-3,由 Microsoft 发布,采用 MIT 许可。论文、源码
许可
代码采用 MIT,权重采用 MIT。商用

安装

MoGe-3 不需要任何可选 extra。稀疏细化器是纯 PyTorch,相机参数恢复用的是 SciPy, 它在基础安装里。

bash
pip install libreyolo

预测

权重在首次使用时从 LibreYOLO 的 Hugging Face 镜像下载。

Python
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreMoGe3l-depth.pt")depth = model(SAMPLE_IMAGE).depth_map print(depth.data.shape)        # (H, W),单位为米,有效掩码之外为 infprint(depth.point_map.shape)   # (H, W, 3),相机坐标系下的点,单位为米print(depth.intrinsics)        # (3, 3),OpenCV 像素内参print(depth.valid_mask.shape)  # (H, W) bool
法线
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreMoGe3l-normal.pt")normal = model(SAMPLE_IMAGE).normal_mapprint(normal.array.shape)      # (H, W, 3) 单位向量,OpenCV 坐标系
CLI
libreyolo predict model=LibreMoGe3l-depth.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/guggenheim-bilbao.jpg save=True

使用 -depth 检查点时,result.depth_map 存放以米为单位的度量深度 (encoding="depth"、metric=True)。点图、内参和有效性掩码作为 depth_map.point_map、depth_map.intrinsics 和 depth_map.valid_mask 附在它 上面;掩码之外的像素为 inf。点使用 OpenCV 坐标轴,内参把像素中心放在整数坐标上。 使用 -normal 检查点时,result.normal_map 存放 OpenCV 相机坐标系下的单位法线。

imgsz 设置 ViT 的 token 预算,即按图像宽高比排布的 (imgsz // 14) ** 2 个 token。 默认值 840 是上游的最高分辨率档(3600 个 token);490 接近它的最低档。输入保持原生 分辨率,每个输出都会插值回这个分辨率。推理以 FP32 运行,并且像上游默认做法一样总是 执行三步细化。每次前向传播处理一张图像;没有堆叠批处理的路径。

CPU、CUDA 和 MPS 都能运行,不需要编译扩展。细化器的内存随 imgsz 增长,而不是随 输入分辨率增长。

变体

权重文件骨干任务
LibreMoGe3l-depth.ptDINOv2 ViT-L/14深度、点图、内参、掩码
LibreMoGe3l-normal.ptDINOv2 ViT-L/14法线
LibreMoGe3g-depth.ptDINOv2 ViT-g/14深度、点图、内参、掩码
LibreMoGe3g-normal.ptDINOv2 ViT-g/14法线

同一尺寸的 -depth 和 -normal 文件存放的是相同的张量;后缀决定任务。在 RTX 3090 上以 FP32 与上游对比,单次前向的计算图逐位一致,细化后的深度一致到浮点舍入误差 (l 的 p99 相对差异为 4.7e-6,g 为 3.7e-5)。

MoGe-3 在 LibreYOLO 里不可训练:train() 会抛出异常。零样本 val() 运行共用的 深度和法线验证器。

导出

任务ONNXTorchScriptExecuTorchTensorRTOpenVINOPaddleMNNRKNNAxelerancnnTFLiteCoreMLCore 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 Axelera:不支持Depth to ncnn:不支持Depth to TFLite:不支持Depth to CoreML:不支持Depth to Core AI:不支持
Surface normalsSurface normals to ONNX:支持Surface normals to TorchScript:支持Surface normals to ExecuTorch:不支持Surface normals to TensorRT:不支持Surface normals to OpenVINO:不支持Surface normals to Paddle:不支持Surface normals to MNN:不支持Surface normals to RKNN:不支持Surface normals to Axelera:不支持Surface normals to ncnn:不支持Surface normals to TFLite:不支持Surface normals to CoreML:不支持Surface normals to Core AI:不支持

只有法线计算图能导出,支持 ONNX 和 TorchScript,使用固定的正方形画布。深度导出被 阻止:细化器构建的体素集合依赖数据,而相机参数恢复是在 CPU 上求解的。

Python
from libreyolo import LibreYOLO # 只有法线计算图能导出;深度导出被阻止model = LibreYOLO("LibreMoGe3l-normal.pt")model.export(format="onnx")model.export(format="torchscript")

检查点

文件输入(px)权重许可
Depth
LibreMoGe3l-depth.ptmit
LibreMoGe3g-depth.ptmit
Surface normals
LibreMoGe3l-normal.pt840mit
LibreMoGe3g-normal.pt840mit

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

许可证

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

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

原始工作
MoGe-3, Microsoft
上游许可
MIT
LibreYOLO 代码
MIT
权重
采用 MIT 许可,重新发布在 huggingface.co/LibreYOLO
解读
MIT is a permissive license, so the MoGe-3 code and weights can be used in commercial and closed-source products; the only obligation is to keep the copyright and license notice with copies. LibreYOLO ports the forward pass, sparse refinement and camera recovery from microsoft/MoGe at commit 74fbce054ebed49800de42d0ad0e83495065719a (MIT, Copyright Microsoft Corporation), re-expresses the FlexGEMM sparse kernels in plain PyTorch without vendoring them (FlexGEMM is MIT), and follows MIT utils3d helpers; the DINOv2 backbone keeps its separate Apache-2.0 attribution (libreyolo/models/moge3/NOTICE). The official checkpoints Ruicheng/moge-3-vitl (revision 184008f877d7ad1ad4c2cd2182a9bd1f63d0e5be) and Ruicheng/moge-3-vitg (revision 6ef26c5a4b4148dab5ccaacdb08b72dc66380475) declare MIT; LibreYOLO mirrors them unchanged, plus checkpoint metadata, as LibreYOLO/LibreMoGe3{l,g}-{depth,normal}, not gated.

MoGe-3 出自微软(microsoft/MoGe)。代码和 权重采用 MIT 许可,所以可以商用。DINOv2 骨干保留其 Apache-2.0 署名。LibreYOLO 把 官方的 Ruicheng/moge-3-vitl 和 Ruicheng/moge-3-vitg 检查点(checkpoint)原样 镜像为 LibreYOLO/LibreMoGe3{l,g}-{depth,normal},不需要申请访问。

引用

@misc{kong2026finedetailmonoculargeometryestimation,
      title={Fine-Detail Monocular Geometry Estimation with Self-Guided Sparse Volumetric Refinement},
      author={Lingyu Kong and Ruicheng Li and Ruicheng Wang and Sicheng Xu and Chengtang Yao and Jianfeng Xiang and Jiaolong Yang},
      year={2026},
      eprint={2607.17967},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2607.17967},
}

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

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