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-vitl-normal, https://huggingface.co/Ruicheng/moge-2-vits-normal, https://huggingface.co/Ruicheng/moge-3-vitl.

Task: depth. Tier: experimental. Outputs: depth, points, intrinsics, mask, normals. Backends: portable, kernels.

Input: one RGB image. Output: a depth or inverse-depth map (metric for the models marked metric).

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-vitl-normal@1 model.pt 280741fd09bc MIT yes
moge-2-vits-normal@1 model.pt 79a16621928c MIT yes
moge-3-vitl@1 model.pt 9b41b7b9f65a MIT yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. 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

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-vitl-normal 3000x4000 (2.4 GiB peak allocated, 2.5 reserved); moge-2-vits-normal 3000x4000 (1.2 GiB peak allocated, 1.4 reserved); moge-3-vitl 3000x4000 (2.6 GiB peak allocated, 3.0 reserved)

Speed and memory

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-vitl-normal 502.6 – 144.5 73.43 – 2.0x – 1661 / 1836 1498 / 1610
moge-2-vits-normal 161.5 – 64.19 29.73 – 2.2x – 1066 / 1336 884 / 1008
moge-3-vitl – – 904.91 507.19 – 1.8x – 2157 / 2424 1756 / 1886

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
moge-2-vitl-normal 3.26 1.37 0.63† 0.50 0.14 0.13
moge-2-vits-normal 0.36 0.35 0.11† 0.21 0.08 0.10
moge-3-vitl – 1.47 0.69† – 0.95 0.65

Fixed-size speed and peak memory, all models

model mode 640x480 1280x720 1920x1080 12 MP 4000x3000
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 authors' code 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

Parity with the original code

Every variant is checked against golden 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|.

Usage

from fastforks import depth

model = depth.load("moge-2-vitl-normal")  # portable PyTorch on the GPU if there is one, else the CPU
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-vitl-normal, moge-2-vits-normal, moge-3-vitl.

Kernels backend

depth.load("moge-2-vitl-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.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support