MoGe (fastforks)
MoGe-2 / MoGe-3 (Wang et al., Microsoft): monocular metric geometry; a DINOv2 ViT with conv heads predicts an affine point map, a validity mask, normals and a metric scale, and the focal length and shift are recovered from the points (MoGe-3 adds a sparse 3-D refiner).
This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/microsoft/MoGe at 74fbce0.
Author weight repos: https://huggingface.co/Ruicheng/moge-2-vitb-normal, https://huggingface.co/Ruicheng/moge-2-vitl-normal, https://huggingface.co/Ruicheng/moge-2-vits-normal, https://huggingface.co/Ruicheng/moge-3-vitl.
Task: depth. Tier: stable. Outputs: depth, points, intrinsics, mask, normals. Backends: portable, kernels.
Input: one RGB image. Output: a depth or inverse-depth map. kind (a card field, result.kind) says what the numbers mean: metric = metres; scale_invariant, affine_invariant, affine_invariant_log (log depth) and affine_invariant_inverse are relative (unknown scale or shift, not metres). Metric models that use the focal length take model(image, intrinsics=K) (K [3, 3], pixels of the input): metric3d-vit-large and da3metric-large need it for correct metres (da3metric-large: metres = output x focal / 300; without intrinsics= a 300 px focal length is assumed, wrong for a real camera). unidepth-v2-vitl14, unik3d-vitl, depth-pro and MoGe estimate the camera themselves (given intrinsics= replace fx); zoedepth-nk and the relative models (da3mono-large too) take none. Normals-only models (kind none) return result.normals [B, H, W, 3] (unit vectors, camera frame: x right, y down, z forward).
Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
moge-2-vitb-normal@1 |
moge-2-vitb-normal/model.pt | 16b8110e86d5 |
MIT | yes |
moge-2-vitl-normal@1 |
moge-2-vitl-normal/model.pt | 280741fd09bc |
MIT | yes |
moge-2-vits-normal@1 |
moge-2-vits-normal/model.pt | 79a16621928c |
MIT | yes |
moge-3-vitl@1 |
moge-3-vitl/model.pt | 9b41b7b9f65a |
MIT | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Licence files: LICENSE.
Training data: Mixture of public synthetic and real RGB-D / multi-view datasets per the MoGe-2 and MoGe-3 papers.
Licence evidence: https://github.com/microsoft/MoGe/blob/main/README.md (License section) and the Hugging Face model cards (license: mit)
Input size
moge-2-vitb-normal: any H x W >= 1, resized or padded inside the model (ViT patch 14)moge-2-vitl-normal,moge-2-vits-normal,moge-3-vitl: any H x W >= 8, resized or padded inside the model (ViT patch 14) Tested up to (portable, fp16, RTX 5060 Ti 16 GB):moge-2-vitb-normal3000x4000 (1.3 GiB peak allocated, 1.4 reserved);moge-2-vitl-normal3000x4000 (2.4 GiB peak allocated, 2.5 reserved);moge-2-vits-normal3000x4000 (1.2 GiB peak allocated, 1.4 reserved);moge-3-vitl3000x4000 (2.6 GiB peak allocated, 3.0 reserved)
Speed and memory
Depth, synthetic
| model | input | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|---|---|---|
moge-2-vitb-normal |
994x1482 | β | β | 83.9 | 40.7 | β | 2.1x | β | 1163 / 1312 | 1093 / 1208 |
moge-2-vitl-normal |
518x770 | 500 | 169 | 145 | 73.9 | 2.3x | 2.0x | 2326 / 2418 | 1645 / 1836 | 1481 / 1610 |
moge-2-vits-normal |
994x1482 | β | β | 61.6 | 33.3 | β | 1.9x | β | 1007 / 1172 | 932 / 1048 |
moge-3-vitl |
994x1482 | β | β | 332 | 149 | β | 2.2x | β | 1678 / 1926 | 1626 / 1762 |
Depth, Middlebury 2014 half, 994x1482
| model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|---|---|
moge-2-vitb-normal |
237 | 102 | β | β | β | β | 1469 / 1596 | β | β |
moge-2-vitl-normal |
501 | 171 | 144 | 73.4 | 2.3x | 2.0x | 2339 / 2438 | 1661 / 1836 | 1498 / 1610 |
moge-2-vits-normal |
162 | 82.6 | β | β | β | β | 1193 / 1268 | β | β |
moge-3-vitl |
843 | 486 | β | β | β | β | 2505 / 2630 | β | β |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
moge-2-vitb-normal |
1.26 | 0.49 (518x770) | 1.24 (518x770) | 0.24 | 0.40 (518x770) | 0.28 (518x770) |
moge-2-vitl-normal |
7.24 | 1.37 | 0.63β | 0.17 | 0.14 | 0.13 |
moge-2-vits-normal |
0.88 | 1.18 (518x770) | 0.21 (518x770) | 1.50 | 0.30 (518x770) | 0.44 (518x770) |
moge-3-vitl |
10.60 | 2.31 (518x770) | 1.16 (518x770) | 2.92 | 0.69 (518x770) | 0.74 (518x770) |
torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT fp16 | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
|---|---|---|---|---|---|---|---|---|---|---|---|
moge-2-vitb-normal |
994x1482 | 83.9 ms | 60.9 ms | 35.5 ms | 40.7 ms | 133 s | 127 s | 1163 / 1312 | 972 / 1172 | 1093 / 1208 | 1044 / 1092 |
moge-2-vitl-normal |
994x1482 | 144 ms | 124 ms | 75.6 ms | 73.4 ms | 152 s | 173 s | 1661 / 1836 | 1411 / 1634 | 1498 / 1610 | 1882 / 1936 |
moge-2-vits-normal |
994x1482 | 61.6 ms | 43.9 ms | 24.5 ms | 33.3 ms | 124 s | 131 s | 1007 / 1172 | 836 / 992 | 932 / 1048 | 768 / 852 |
moge-3-vitl |
994x1482 | 332 ms | planned for 0.2.1 | planned for 0.2.1 | 149 ms | β | β | 1678 / 1926 | β | 1626 / 1762 | β |
Fixed-size speed and peak memory, all models
| model | mode | 480x640 | 720x1280 | 1080x1920 | 12 MP 3000x4000 |
|---|---|---|---|---|---|
moge-2-vitl-normal |
portable | 175.5 ms / 2275 / 2508 | 178.8 ms / 2286 / 2518 | 179.2 ms / 2299 / 2528 | 191.5 ms / 2410 / 2562 |
moge-2-vitl-normal |
kernels | 74.3 ms / 1435 / 1572 | 77.5 ms / 1444 / 1588 | 76.0 ms / 1459 / 1644 | 90.5 ms / 1755 / 2174 |
moge-2-vits-normal |
portable | 88.6 ms / 1123 / 1418 | 85.4 ms / 1132 / 1392 | 86.7 ms / 1146 / 1446 | 98.6 ms / 1257 / 1464 |
moge-2-vits-normal |
kernels | 33.9 ms / 818 / 970 | 33.1 ms / 826 / 976 | 31.0 ms / 839 / 1010 | 46.9 ms / 1144 / 1566 |
moge-3-vitl |
portable | 657.4 ms / 2580 / 3070 | 633.4 ms / 2577 / 2792 | 620.0 ms / 2588 / 2804 | 655.1 ms / 2701 / 3066 |
moge-3-vitl |
kernels | 386.2 ms / 1570 / 1836 | 374.2 ms / 1557 / 1840 | 362.3 ms / 1566 / 1890 | 390.6 ms / 1838 / 2300 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
Accuracy
On public datasets
AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Normals: angle to the ground-truth normal over the pixels with ground truth (Marigold's evaluation sets), mean over images. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|---|---|---|---|---|---|---|
moge-2-vits-normal |
NYUv2 test, AbsRel / delta1 | 0.0484 / 0.9757 | 0.0484 / 0.9757 | 0.0484 / 0.9757 | 0.0484 / 0.9757 | |
moge-2-vits-normal |
iBims-1, AbsRel / delta1 | 0.0430 / 0.9793 | 0.0430 / 0.9793 | 0.0430 / 0.9793 | 0.0430 / 0.9793 | |
moge-2-vits-normal |
ETH3D two-view train left, AbsRel / delta1 | 0.0700 / 0.9412 | 0.0700 / 0.9411 | 0.0700 / 0.9411 | 0.0701 / 0.9412 | possibly in the training data |
moge-2-vits-normal |
Middlebury 2014 trainingH left, AbsRel / delta1 | 0.0356 / 0.9947 | 0.0356 / 0.9947 | 0.0356 / 0.9947 | 0.0356 / 0.9947 | possibly in the training data |
moge-2-vits-normal |
NYUv2 test normals, mean / median angle deg, % < 11.25 / < 30 deg | 15.87 / 9.25 / 58.32 / 83.97 | 15.87 / 9.25 / 58.32 / 83.97 | |||
moge-2-vits-normal |
iBims-1 normals, mean / median angle deg, % < 11.25 / < 30 deg | 15.95 / 7.19 / 66.56 / 83.74 | 15.95 / 7.19 / 66.56 / 83.74 | |||
moge-2-vitb-normal |
NYUv2 test, AbsRel / delta1 | 0.0404 / 0.9812 | 0.0404 / 0.9812 | 0.0404 / 0.9812 | 0.0404 / 0.9812 | |
moge-2-vitb-normal |
iBims-1, AbsRel / delta1 | 0.0337 / 0.9855 | 0.0337 / 0.9854 | 0.0337 / 0.9854 | 0.0337 / 0.9854 | |
moge-2-vitb-normal |
ETH3D two-view train left, AbsRel / delta1 | 0.0667 / 0.9492 | 0.0667 / 0.9492 | 0.0667 / 0.9492 | 0.0663 / 0.9496 | possibly in the training data |
moge-2-vitb-normal |
Middlebury 2014 trainingH left, AbsRel / delta1 | 0.0260 / 0.9962 | 0.0260 / 0.9962 | 0.0260 / 0.9962 | 0.0261 / 0.9962 | possibly in the training data |
moge-2-vitb-normal |
NYUv2 test normals, mean / median angle deg, % < 11.25 / < 30 deg | 15.25 / 8.61 / 60.32 / 84.90 | 15.25 / 8.61 / 60.33 / 84.90 | |||
moge-2-vitb-normal |
iBims-1 normals, mean / median angle deg, % < 11.25 / < 30 deg | 15.28 / 6.98 / 68.57 / 85.01 | 15.28 / 6.98 / 68.56 / 85.01 | |||
moge-2-vitl-normal |
NYUv2 test, AbsRel / delta1 | 0.0357 / 0.9836 | 0.0357 / 0.9836 | 0.0357 / 0.9836 | 0.0357 / 0.9836 | |
moge-2-vitl-normal |
iBims-1, AbsRel / delta1 | 0.0261 / 0.9892 | 0.0261 / 0.9892 | 0.0261 / 0.9892 | 0.0261 / 0.9892 | |
moge-2-vitl-normal |
ETH3D two-view train left, AbsRel / delta1 | 0.0518 / 0.9789 | 0.0518 / 0.9789 | 0.0519 / 0.9789 | 0.0518 / 0.9790 | possibly in the training data |
moge-2-vitl-normal |
Middlebury 2014 trainingH left, AbsRel / delta1 | 0.0235 / 0.9972 | 0.0235 / 0.9972 | 0.0235 / 0.9972 | 0.0235 / 0.9972 | possibly in the training data |
moge-2-vitl-normal |
NYUv2 test normals, mean / median angle deg, % < 11.25 / < 30 deg | 14.81 / 8.07 / 61.96 / 85.54 | 14.81 / 8.07 / 61.96 / 85.55 | |||
moge-2-vitl-normal |
iBims-1 normals, mean / median angle deg, % < 11.25 / < 30 deg | 14.70 / 6.49 / 70.49 / 85.80 | 14.69 / 6.49 / 70.49 / 85.80 | |||
moge-3-vitl |
NYUv2 test, AbsRel / delta1 | 0.0356 / 0.9836 | 0.0356 / 0.9836 | 0.0356 / 0.9836 | ||
moge-3-vitl |
iBims-1, AbsRel / delta1 | 0.0261 / 0.9884 | 0.0261 / 0.9884 | 0.0261 / 0.9883 | ||
moge-3-vitl |
ETH3D two-view train left, AbsRel / delta1 | 0.0496 / 0.9847 | 0.0496 / 0.9847 | 0.0496 / 0.9847 | possibly in the training data | |
moge-3-vitl |
Middlebury 2014 trainingH left, AbsRel / delta1 | 0.0235 / 0.9970 | 0.0235 / 0.9970 | 0.0235 / 0.9970 | possibly in the training data |
Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 24f9c9c8 / 3d00db1d / 4e890760 / 939adfe8, 2026-11-06 to 2026-11-12; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 3d00db1d / 4e890760 / 939adfe8 / f3195fb2, 2026-11-06 to 2026-11-12.
Parity with the original code
Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.005 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 1.5 % and p99 <= 1.5 % of the reference's median |value| (absolute error of the output depth).
Usage
from fastforks import depth
model = depth.load("moge-2-vitb-normal") # mode="auto": the preferred backend from recorded measurements
result = model("room.jpg")
result.depth # [H, W] float32 tensor; result.kind says what the maps mean
# models that take a camera: model("room.jpg", intrinsics=K), K [3, 3] in pixels
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: moge-2-vitb-normal, moge-2-vitl-normal, moge-2-vits-normal, moge-3-vitl.
Kernels backend
depth.load("moge-2-vitb-normal", mode="kernels") runs our CUDA kernels (fastbb, dpt_fused, sparse_conv). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.