Commit ·
9755ed6
0
Parent(s):
fastforks 0.1.0
Browse files- .gitattributes +35 -0
- README.md +104 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: "fastforks"
|
| 3 |
+
pipeline_tag: "image-to-3d"
|
| 4 |
+
license: "apache-2.0"
|
| 5 |
+
tags:
|
| 6 |
+
- "multiview"
|
| 7 |
+
- "multi-view-stereo"
|
| 8 |
+
- "3d-reconstruction"
|
| 9 |
+
- "camera-pose-estimation"
|
| 10 |
+
- "cuda"
|
| 11 |
+
- "pytorch"
|
| 12 |
+
- "fastforks"
|
| 13 |
+
---
|
| 14 |
+
# MapAnything (fastforks)
|
| 15 |
+
|
| 16 |
+
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).
|
| 17 |
+
|
| 18 |
+
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/facebookresearch/map-anything> at `3d10cf7`.
|
| 19 |
+
|
| 20 |
+
Author weight repos: <https://huggingface.co/facebook/map-anything-apache>.
|
| 21 |
+
|
| 22 |
+
Task: multiview. Tier: experimental. Outputs: `depth`, `confidence`, `mask`, `world_points`, `intrinsics`, `cam_to_world`, `metric_scale`. Backends: `portable`, `kernels`.
|
| 23 |
+
|
| 24 |
+
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.
|
| 25 |
+
|
| 26 |
+
## Variants
|
| 27 |
+
|
| 28 |
+
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).
|
| 29 |
+
|
| 30 |
+
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|
| 31 |
+
|---|---|---|---|---|
|
| 32 |
+
| `mapanything-apache@1` | [model.safetensors](https://huggingface.co/facebook/map-anything-apache/resolve/00f9c245bbcb60522d1ed7f9e9d88462c6e3f38a/model.safetensors) | `fa06c0fdccef` | Apache-2.0 | yes |
|
| 33 |
+
|
| 34 |
+
## Licence
|
| 35 |
+
|
| 36 |
+
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Files: `LICENSE`.
|
| 37 |
+
|
| 38 |
+
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..
|
| 39 |
+
|
| 40 |
+
- 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.
|
| 41 |
+
- Licence note: The CC-BY-NC facebook/map-anything checkpoint is not packaged.
|
| 42 |
+
|
| 43 |
+
Licence evidence: https://github.com/facebookresearch/map-anything/blob/3d10cf7/LICENSE and https://huggingface.co/facebook/map-anything-apache/blob/00f9c245bbcb60522d1ed7f9e9d88462c6e3f38a/README.md
|
| 44 |
+
|
| 45 |
+
## Input size
|
| 46 |
+
|
| 47 |
+
any H x W >= 1, resized or padded inside the model
|
| 48 |
+
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `mapanything-apache` 3000x4000 (7.1 GiB peak allocated, 9.2 reserved)
|
| 49 |
+
|
| 50 |
+
## Speed and memory
|
| 51 |
+
|
| 52 |
+
### Multiview, synthetic, 336x518
|
| 53 |
+
|
| 54 |
+
| model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|
| 55 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 56 |
+
| `mapanything-apache` | 2875 | 1967 | 636 | 544 | 3.6x | 1.2x | 10227 / 10952 | 3697 / 4092 | 3697 / 4072 |
|
| 57 |
+
|
| 58 |
+
### Startup and first call
|
| 59 |
+
|
| 60 |
+
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|
| 61 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 62 |
+
| `mapanything-apache` | 6.12 (336x518) | 2.89 (336x518) | 0.57† (336x518) | 2.62 (336x518) | 0.66 (336x518) | 0.54 (336x518) |
|
| 63 |
+
|
| 64 |
+
### torch.compile and TensorRT
|
| 65 |
+
|
| 66 |
+
| 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) |
|
| 67 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 68 |
+
| `mapanything-apache` | 336x518 | 636 | 596.5 | 46.2 | 36.4 | 120 | 544 | 3697 / 4092 | 3347 / 3792 | 2438 |
|
| 69 |
+
|
| 70 |
+
### Fixed-size speed and peak memory, all models
|
| 71 |
+
|
| 72 |
+
| model | mode | 480x640 | 720x1280 | 1080x1920 | 12 MP 3000x4000 |
|
| 73 |
+
| --- | --- | --- | --- | --- | --- |
|
| 74 |
+
| `mapanything-apache` | portable | 680.9 ms / 3914 / 5848 | 493.1 ms / 3635 / 5196 | 498.1 ms / 3846 / 5442 | 734.6 ms / 7240 / 9442 |
|
| 75 |
+
| `mapanything-apache` | kernels | 569.7 ms / 3914 / 5846 | 415.3 ms / 3635 / 5196 | 419.9 ms / 3846 / 5442 | 622.3 ms / 7240 / 9440 |
|
| 76 |
+
|
| 77 |
+
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
|
| 78 |
+
|
| 79 |
+
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.
|
| 80 |
+
|
| 81 |
+
## Accuracy
|
| 82 |
+
|
| 83 |
+
### Parity with the original code
|
| 84 |
+
|
| 85 |
+
Every variant is checked against reference 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`).
|
| 86 |
+
|
| 87 |
+
## Usage
|
| 88 |
+
|
| 89 |
+
```python
|
| 90 |
+
from fastforks import multiview
|
| 91 |
+
|
| 92 |
+
model = multiview.load("mapanything-apache") # mode="auto": the preferred backend from recorded measurements
|
| 93 |
+
result = model(["view0.jpg", "view1.jpg", "view2.jpg"]) # the views of one scene, no cameras needed
|
| 94 |
+
result.depth # [V, H, W] float32 tensor; result.kind says what the maps mean
|
| 95 |
+
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `mapanything-apache`.
|
| 99 |
+
|
| 100 |
+
## Kernels backend
|
| 101 |
+
|
| 102 |
+
`multiview.load("mapanything-apache", mode="kernels")` runs our CUDA kernels (`fastbb`). 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.
|
| 103 |
+
|
| 104 |
+
<!-- staged from fastforks feccac41 (2026-11-06) -->
|