yyfz/Pi4

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

What is Pi4?

Pi4 (π⁴) is a foundation model for 4D scene geometry and motion built by the Physical Intelligence Team at Shanghai Artificial Intelligence Laboratory. It takes visual input — a single image, a collection of images, or a video — and produces both 3D geometry and motion in one model run.

The README describes it as going “from pixels to a scene in motion.” It does not need camera calibration information supplied by the user.

Key capabilities

  • One compact model: about 0.5 billion parameters for joint geometry and motion.
  • Strong across tasks: according to the README, it has the best overall average rank among compared methods across the paper’s 16 geometry evaluation settings, and competitive results in single- and multiview 2D/3D tracking and moving-object segmentation.
  • Handles many images at once: it can reconstruct and track from thousands of input images in one forward pass, even though training used at most 64 views.

What does it output?

The model returns several kinds of predictions:

Category Outputs
Scene geometry local_points, camera_poses, metric_scale, confidence
Dense correspondences tracks_2d, tracks_3d, query_frame
Motion and reliability dynamic_mask, visibility, tracking_confidence

In plain terms: it gives you 3D points, camera positions, 2D/3D point tracks, and information about which parts of the scene are moving or reliably tracked.

How do you use it?

Requirements

  • Linux x86-64
  • Python 3.11
  • An NVIDIA GPU with BF16 support
  • A CUDA 12.6-compatible NVIDIA driver
  • Git and a C compiler (such as GCC) for backend compilation

The README says the CUDA runtime comes from the PyTorch dependencies, so you do not need to install a separate CUDA toolkit.

Quickstart example

The basic flow is:

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

This processes 150 frames at 512×288 together in one forward pass. The README also includes examples for a kart clip and a cycling clip, and a command to reproduce the full 750-frame Figure Skating demo.

After inference, you can view the results in a browser:

python viewer/serve.py outputs/quickstart --port 8080

The viewer does not need a GPU or model weights — it uses the Python standard library and bundled Three.js.

Python API

A minimal usage example from the README:

import torch
from pi4 import Pi4
from pi4.io import load_images

model = Pi4.from_pretrained("yyfz233/Pi4").cuda().eval()
frames, metadata = load_images(
    "examples/figure_skating.mp4", stride=1, max_frames=25, max_size=512
)
images = torch.from_numpy(frames.copy()).permute(0, 3, 1, 2)
images = images.float().div(255).unsqueeze(0).cuda()

prediction = model(images, query_frame=0)

Inputs are floating-point RGB images in the range [0, 1], shaped [B, T, 3, H, W], with height and width divisible by 16. Tracking requires at least two images; if you omit query_frame, the model returns geometry only.

Memory and performance notes

The README gives reference measurements:

  • The 150-frame Figure Skating configuration used 12.03 GiB peak GPU memory on an A800 80 GB GPU.
  • A smaller 25-frame configuration is suggested for GPUs with less memory.
  • The full 750-frame demo needs substantially more GPU memory.

These are reference measurements, not hardware guarantees.

License

  • Original Pi4 code: CC BY-NC 4.0 — commercial use not permitted.
  • Pi4 model weights: CC BY-NC 4.0 — commercial use not permitted.
  • Third-party components retain their upstream licenses.

Links and citation

The README links to a project page, an arXiv paper, a dataset called GameRealm, and a Hugging Face demo. It also includes a BibTeX citation for the paper (arXiv:2611.23144).

Related

  • Project
  • Project
  • Project
  • Project