查看 Markdown

MoGe-2

MoGe-2 是一个单次前向的单目几何模型,从一张 RGB 图像预测稠密的表面法线场。LibreYOLO 只把它用于法线估计,通过官方的 ViT-S、ViT-B 和 ViT-L 检查点。

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

安装

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

bash
pip install libreyolo

预测

权重在首次使用时自动下载。s 和 l 尺寸使用 LibreYOLO 镜像;b 继续使用上游检查点。

Python
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreMoGe2s-normal.pt")result = model(SAMPLE_IMAGE, save=True) normal = result.normal_mapprint(normal.array.shape)   # (H, W, 3) float32 单位向量
CLI
libreyolo predict model=LibreMoGe2s-normal.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg save=True

MoGe-2 返回的是一个稠密场,而不是一组检测结果,所以 result.boxes 是空的, conf、iou 和 max_det 都不起作用。result.normal_map 装的是结果:一个 (H, W, 3) 的单位向量数组,位于 OpenCV 相机坐标系中,其中 +x 向右,+y 向下, +z 指向场景内部,正对相机的表面读作 (0, 0, -1)。对一个图像列表做预测时,每张 图像跑一次前向;这个家族没有堆叠成批的快速路径。数据源、流式处理和结果处理见 预测。

变体

三种编码器尺寸以独立的检查点(checkpoint)发布:ViT-S、ViT-B 和 ViT-L,输入 分辨率都相同。LibreYOLO 的基准测试工具尚未测过这个家族,所以没有公开的精度数字 可供比较;请按你自己的算力预算挑一个尺寸。

验证

val() 在成对的法线图数据集上测量角度误差:图像旁边放文件名主干相同的 16 位法线 PNG,还可以带一个可选的有效性掩码,让填充像素和无效像素都不计入。它返回以度为 单位的平均角度误差和中位角度误差,外加落在 11.25、22.5 和 30 度以内的像素百分比。

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreMoGe2s-normal.pt")metrics = model.val(data="my-dataset.yaml", imgsz=518) print(metrics["metrics/mean_angular_error"])   # 单位为度print(metrics["metrics/median_angular_error"])print(metrics["metrics/within_11_25"])          # 像素百分比
CLI
libreyolo val model=LibreMoGe2s-normal.pt data=my-dataset.yaml imgsz=518

导出

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

法线导出使用固定分辨率、批大小为 1 的运行时契约:dynamic 以及 1 以外的 batch 都会被拒绝,而且 imgsz 必须能被 ViT 编码器的 patch size 整除,LibreYOLO 会在 运行开始前检查这一点。导出的产物按文件后缀经由 LibreYOLO() 重新加载,所以一个 .onnx 文件的表现和检查点一样,返回同样的 Results。

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreMoGe2s-normal.pt")model.export(format="onnx", imgsz=518)model.export(format="tensorrt", imgsz=518, half=True)
CLI
libreyolo export model=LibreMoGe2s-normal.pt format=onnx imgsz=518libreyolo export model=LibreMoGe2s-normal.pt format=tensorrt imgsz=518 half=True
使用导出的文件
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreMoGe2s-normal.onnx")result = model(SAMPLE_IMAGE) print(result.normal_map.array.shape)

许可证

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

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

原始工作
MoGe-2, Microsoft
上游许可
MIT
LibreYOLO 代码
MIT
权重
采用 MIT 许可,重新发布在 huggingface.co/LibreYOLO
解读
The publisher declares MIT for the model and checkpoints. LibreYOLO mirrors s and l; b remains an upstream download. The DINOv2 encoder retains its separate Apache-2.0 attribution.

s 和 l 检查点由 LibreYOLO 镜像;b 保留在上游。下载的产物保留发布者的许可证。

引用

@inproceedings{wang2025moge,
  title={Moge: Unlocking accurate monocular geometry estimation for open-domain images with optimal training supervision},
  author={Wang, Ruicheng and Xu, Sicheng and Dai, Cassie and Xiang, Jianfeng and Deng, Yu and Tong, Xin and Yang, Jiaolong},
  booktitle={Proceedings of the Computer Vision and Pattern Recognition Conference},
  pages={5261--5271},
  year={2025}
}

@misc{wang2025moge2,
      title={MoGe-2: Accurate Monocular Geometry with Metric Scale and Sharp Details}, 
      author={Ruicheng Wang and Sicheng Xu and Yue Dong and Yu Deng and Jianfeng Xiang and Zelong Lv and Guangzhong Sun and Xin Tong and Jiaolong Yang},
      year={2025},
      eprint={2507.02546},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2507.02546}, 
}

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

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

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