File size: 2,696 Bytes
c5a2873
 
7aa8006
59f3073
7aa8006
59f3073
 
 
 
 
 
c5a2873
7aa8006
5d50e2f
7aa8006
5d50e2f
7aa8006
5d50e2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7aa8006
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5d50e2f
 
7aa8006
 
 
 
5d50e2f
 
7aa8006
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59f3073
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
license: cc-by-nc-4.0
language:
- en
tags:
- pi4
- computer-vision
- 3d-reconstruction
- point-tracking
- video
pipeline_tag: image-to-3d
---

# π⁴: A Foundation Model for 4D Scene Geometry and Motion

**Physical Intelligence Team · Shanghai Artificial Intelligence Laboratory**

Official Pi4 model weights. See the
[citation](https://github.com/yyfz/Pi4#citation).

**From pixels to a scene in motion.** Pi4 brings geometric reconstruction and
motion estimation into a single model. It accepts single images, unordered image
collections, and videos without supplied camera calibration, building a shared
3D scene representation in one forward pass.

- **One compact model.** Approximately **0.5B parameters** for joint geometry
  and motion.
- **Strong across tasks.** The best overall average rank among the compared
  methods across the paper's **16 geometry evaluation settings**, with competitive
  results in single- and multiview 2D/3D tracking and moving-object segmentation.
- **Thousands of images, one forward pass.** Joint reconstruction and tracking
  from **thousands of input images**, despite training with at most **64 views**.

## Usage

Install the [Pi4 repository](https://github.com/yyfz/Pi4#quickstart) first.
Inference requires a CUDA-capable NVIDIA GPU.

```python
import torch
from pi4 import Pi4

model = Pi4.from_pretrained("yyfz233/Pi4").cuda().eval()
images = torch.rand(1, 2, 3, 256, 384, device="cuda")
prediction = model(images, query_frame=0)
```

Replace the example tensor with RGB images in `[0, 1]`, shaped `[B, T, 3, H, W]`.
Height and width must be divisible by 16. Tracking requires at least two
images. Omit `query_frame` for geometry only, including single-image inference.

From the repository root:

```bash
python example.py examples/figure_skating.mp4 \
  --output outputs/quickstart --query-frame 0 --stride 1 --max-frames 150 --viewer
```

Weights are downloaded and cached automatically. You can also
[download model.safetensors manually](https://huggingface.co/yyfz233/Pi4/resolve/main/model.safetensors)
and pass `--weights /path/to/model.safetensors`, or load it with
`Pi4.from_pretrained("/path/to/model.safetensors")`.

See the [inference guide](https://github.com/yyfz/Pi4/blob/main/docs/inference.md)
for input preparation, output formats, memory requirements, and the viewer.

## License

Pi4 model weights are released under
[CC BY-NC 4.0](https://huggingface.co/yyfz233/Pi4/blob/main/LICENSE_MODEL)
for noncommercial use. Third-party materials retain their upstream licenses;
see [NOTICE](https://huggingface.co/yyfz233/Pi4/blob/main/NOTICE) and the bundled
[license texts](https://huggingface.co/yyfz233/Pi4/tree/main/licenses).