Apple Silicon Core ML conversion of
Microsoft/MoGe
(commit
925b8ed835a7a9cdb7578ba15c658a0afc969030). All variants share the identical op graph
(traced at 1x3x512x768, fp16 compute, macOS 15 target); they differ only in
weight storage (const dequantize ops). At runtime all computation is fp32.
Parity = per-scene median relative depth error vs the author's reference
outputs (03 scenes, same photos/artifacts as the upstream moge infer release
test), computed with this repo's harness (--diff). fp16/int8/pal8 match the
reference; int4 (asymmetric) and int4-sym carry a small-accuracy-gap
documented per scene. The int4 palettized 4-bit variant does NOT meet
parity (~0.90) and is excluded. FOV: int8/pal8 within ~0.3 deg of reference.
Real-hardware latency: single predict on a 1x3x512x768 input, mean of 5 runs
after warmup, measured with the tooling venv (no ANE — this model's ops are
arch-gated to CPU/GPU on A13/M1):
Checkpoint SHA-256 verified against the reference RESULTS.md manifest before
conversion. This repo is an artifact mirror of an MIT-licensed open model;
conversion metadata in provenance.json.
1import coremltools as ct
2model = ct.models.MLModel("moge-2-vits-normal-coreml", compute_units=ct.ComputeUnit.ALL)
3# input: image (1, 3, 512, 768) float32, RGB, 0..1
4out = model.predict({"image": img})
5# out["points"] (1,512,768,3) affine point map, out["normal"], out["mask"], out["metric_scale"]
Numerical post-processing (focal/shift recovery, depth map, intrinsics, FOV,
UV) is pure numpy — see the accompanying harness/postprocess sources in the
publisher's repo (zoo/moge/).