--- library_name: "fastforks" pipeline_tag: "image-to-3d" license: "apache-2.0" tags: - "multiview" - "multi-view-stereo" - "3d-reconstruction" - "camera-pose-estimation" - "cuda" - "pytorch" - "fastforks" --- # MapAnything (fastforks) MapAnything (Keetha et al. 2025): metric multi-view reconstruction from unposed images in one forward pass. DINOv2 ViT-g/14 features per view, 16 alternating global / per-view attention blocks with a metric-scale token, a DPT head (ray directions, depth along the ray, confidence, non-ambiguity) and pose / scale heads. Images only (the original code's optional geometric inputs are not supported). Apache-2.0 code and weights (the map-anything-apache checkpoint). 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: . Kernels for the `kernels` backend: . Original code: at `3d10cf7`. Author weight repos: . Task: multiview. Tier: experimental. Outputs: `depth`, `confidence`, `mask`, `world_points`, `intrinsics`, `cam_to_world`, `metric_scale`. Backends: `portable`, `kernels`. Input: several images of one scene (posed and calibrated for multi-view stereo, unposed otherwise). Output: depth maps and, where the model predicts them, cameras and 3-D points. ## Variants Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in [`card.toml`](https://github.com/kleinicke/fastforks/blob/main/src/fastforks/multiview/models/mapanything/card.toml). | variant | weights (author link) | SHA-256 | weights licence | commercial use | |---|---|---|---|---| | `mapanything-apache@1` | [model.safetensors](https://huggingface.co/facebook/map-anything-apache/resolve/00f9c245bbcb60522d1ed7f9e9d88462c6e3f38a/model.safetensors) | `fa06c0fdccef` | Apache-2.0 | yes | ## Licence Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Files: `LICENSE`. Training data: The apache variant is trained on the subset of the paper's 13 datasets whose licences allow commercial use (README 'Models'; the exact list is in the paper). The CC-BY-NC facebook/map-anything checkpoint is not packaged.. - Licence note: The map-anything-apache weights are Apache-2.0, but the repository does not list the datasets they were trained on (the paper names the commercially usable subset), so their training-data terms are unclear here. - Licence note: The CC-BY-NC facebook/map-anything checkpoint is not packaged. Licence evidence: https://github.com/facebookresearch/map-anything/blob/3d10cf7/LICENSE and https://huggingface.co/facebook/map-anything-apache/blob/00f9c245bbcb60522d1ed7f9e9d88462c6e3f38a/README.md ## Input size any H x W >= 1, resized or padded inside the model Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `mapanything-apache` 3000x4000 (7.1 GiB peak allocated, 9.2 reserved) ## Speed and memory ### Multiview, synthetic, 336x518 | model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `mapanything-apache` | 2875.36 | 1966.81 | 635.92 | 543.98 | 3.6x | 1.2x | 10227 / 10952 | 3697 / 4092 | 3697 / 4072 | ### Startup and first call | model | load (s): original | portable | kernels | first call (s): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | | `mapanything-apache` | 6.12 (336x518) | 2.89 (336x518) | 0.57† (336x518) | 2.62 (336x518) | 0.66 (336x518) | 0.54 (336x518) | ### torch.compile and TensorRT | model | input | portable ms | compile ms | compile s (cold) | TensorRT fp16 ms | ONNX + build s | kernels ms | peak MiB (alloc / reserved): portable | compile | TensorRT (device) | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `mapanything-apache` | 336x518 | 635.92 | fails: Inductor: inference tensors | – | 36.4 | 120 | 543.98 | 3697 / 4092 | – | 2438 | ### Fixed-size speed and peak memory, all models | model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 | | --- | --- | --- | --- | --- | --- | | `mapanything-apache` | portable | 680.9 ms / 3914 / 5848 | 493.1 ms / 3635 / 5196 | 498.1 ms / 3846 / 5442 | 734.6 ms / 7240 / 9442 | | `mapanything-apache` | kernels | 569.7 ms / 3914 / 5846 | 415.3 ms / 3635 / 5196 | 419.9 ms / 3846 / 5442 | 622.3 ms / 7240 / 9440 | Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB). Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (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.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 1 % and p99 <= 5 % of the reference's median |value| (absolute error of the output `depth`). ## Usage ```python from fastforks import multiview model = multiview.load("mapanything-apache") # mode="auto": the preferred backend from recorded measurements result = model(["view0.jpg", "view1.jpg", "view2.jpg"]) # the views of one scene, no cameras needed result.depth # [V, H, W] float32 tensor; result.kind says what the maps mean result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16') ``` Install with `pip install fastforks` (see ). Other variants: `mapanything-apache`. ## Kernels backend `multiview.load("mapanything-apache", mode="kernels")` runs our CUDA kernels (`fastbb`). It needs a prebuilt kernel for your GPU architecture (downloaded from 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.