pi3 / README.md
Flor's picture
card: update from fastforks 1cbf1671
a9a4ae0 verified
|
Raw History Blame Contribute Delete
6.55 kB
---
library_name: "fastforks"
pipeline_tag: "image-to-3d"
license: "cc-by-nc-4.0"
tags:
- "multiview"
- "multi-view-stereo"
- "3d-reconstruction"
- "camera-pose-estimation"
- "cuda"
- "pytorch"
- "fastforks"
- "fastforks-card"
---
# Pi3 (fastforks)
π³, permutation-equivariant visual geometry learning (Wang et al. 2025): cameras, depth and point maps of every view from unposed images in one forward pass, with no reference view. A DINOv2 ViT-L/14 encoder feeds 36 alternating frame / global attention blocks (q/k norm, 2-D RoPE); three small transformer decoders give local point maps, confidences and camera poses.
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/yyfz/Pi3> at `9fa3ddb`.
Author weight repos: <https://huggingface.co/yyfz233/Pi3>.
Task: multiview. Tier: experimental. Outputs: `depth`, `confidence`, `world_points`, `cam_to_world`. 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/pi3/card.toml).
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
| `pi3@1` | [model.safetensors](https://huggingface.co/yyfz233/Pi3/resolve/ae722e7039287d0c8fde9f11f197f804f44b510c/model.safetensors) | `33580e4702ac` | CC-BY-NC-4.0 | **no** |
## Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: BSD-3-Clause. Licence files: `LICENSE`.
Training data: Per the paper (arXiv 2507.13347): a mixture of public synthetic and real multi-view datasets; DINOv2 initialisation. The README restricts the weights to non-commercial use because of the training datasets..
- Licence note: The Pi3 code is BSD-3-Clause, but the README licenses the Pi3 weights CC-BY-NC-4.0 (non-commercial); the Hugging Face card's bsd-2-clause tag is overridden by that statement.
Licence evidence: https://github.com/yyfz/Pi3/blob/9fa3ddb/LICENSE and https://github.com/yyfz/Pi3/blob/9fa3ddb/README.md#-license
## Input size
any H x W >= 1, resized or padded inside the model
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `pi3` 3000x4000 (4.8 GiB peak allocated, 6.5 reserved)
## Speed and memory
### Multiview, 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 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `pi3` | 336x518 | – | 1057 | 821 | 560 | 1.9x | 1.5x | 5926 / 6016 | 2360 / 2416 | 2367 / 2456 |
### Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
| --- | --- | --- | --- | --- | --- | --- |
| `pi3` | 10.64 (336x518) | 2.35 (336x518) | 3.54 (336x518) | 4.06 (336x518) | 1.24 (336x518) | 0.69 (336x518) |
### 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) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `pi3` | 336x518 | 821 ms | 752 ms | planned for 0.2.1 | 560 ms | 55.6 s | – | 2360 / 2416 | 2205 / 2334 | 2367 / 2456 | – |
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 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
640x512 crops, the 7 most co-visible views as sources; GT = depth rendered from the structured-light points. AbsRel / delta1 over GT pixels, after per-image median scaling unless the model takes the cameras (calibrated MVS: cameras, error in mm; PatchMatchNet also the depth range 425-935 mm, MVSAnywhere its own range from the camera baselines). Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|---|---|---|---|---|---|---|
| `pi3` | DTU scans 1, 9, 24, 33, 75, view 24 + 7 sources, AbsRel / delta1 % | 0.0070 / 99.94 | 0.0071 / 99.94 | 0.0070 / 99.94 | 0.0070 / 99.94 | |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 28db82cb, 2026-11-13.
### 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.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.25 (absolute error of the output `depth`).
## Usage
```python
from fastforks import multiview
# non-commercial weights: run with FASTFORKS_NONCOMMERCIAL=1 in the environment
model = multiview.load("pi3") # 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 <https://github.com/kleinicke/fastforks>). Other variants: `pi3`.
## Kernels backend
`multiview.load("pi3", 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.
<!-- staged from fastforks 1cbf1671 (2026-11-15) -->