Robust-4D:基于 VGGT4D 管道的动态场景重建项目

用户可使用该项目对动态场景进行重建与可视化。它基于VGGT4D管道,输入图像序列后能预测几何与相机运动,估计并优化动态区域,输出深度图、动态掩码、点云等结果。【此简介由AI生成】

Branch1Tags0

Robust 4D

This repository contains a cleaned research codebase for dynamic scene reconstruction built on top of the VGGT4D pipeline. It takes an image sequence for each scene, predicts geometry and camera motion, estimates dynamic regions, refines them with multi-view consistency, and exports results for reconstruction and visualization.

The current tree is a compact release-oriented version of the project. It keeps the main inference path, model code, visualization utilities, and a small set of data-preparation scripts.

Repository Layout

.
├── demo_vggt4d.py
├── prepare_all_scenes.py
├── vis_vggt4d.py
├── requirements.txt
├── training/
├── vggt/
└── vggt4d/
  • demo_vggt4d.py: main inference entry point
  • prepare_all_scenes.py: helper script for preparing sampled image folders from a local dataset layout
  • vis_vggt4d.py: interactive 4D visualization script
  • vggt/: base VGGT components
  • vggt4d/: dynamic-scene model, mask generation, refinement, export, and visualization helpers
  • training/: training-related modules kept for completeness

Environment Setup

Python 3.12 is recommended.

python -m venv .venv
source .venv/bin/activate

pip install torch==2.7.1 torchvision==0.22.1 --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt

If you use a different CUDA or PyTorch build, adjust the torch install command accordingly.

Checkpoint

Create a ckpts/ directory and place the model checkpoint at:

ckpts/model_tracker_fixed_e20.pt

Example:

mkdir -p ckpts
wget -c "https://huggingface.co/facebook/VGGT_tracker_fixed/resolve/main/model_tracker_fixed_e20.pt?download=true" -O ckpts/model_tracker_fixed_e20.pt

Input Format

The demo expects a root directory containing one subdirectory per scene, with RGB frames stored as .jpg or .png.

input_dir/
├── scene1/
│   ├── 0000.jpg
│   ├── 0001.jpg
│   └── ...
└── scene2/
    ├── 0000.png
    ├── 0001.png
    └── ...

Running Inference

Basic usage:

python demo_vggt4d.py --input_dir <path_to_input_dir> --output_dir <path_to_output_dir>

The script processes every scene folder under input_dir and writes one output folder per scene.

The demo also supports optional runtime flags through --improvements and environment variables. If you are preparing a public release, it is usually better to document only the configurations you actually use in experiments.

Output Files

For each processed scene, the pipeline writes results similar to:

output_dir/
└── scene_name/
    ├── frame_0000.npy
    ├── conf_0000.npy
    ├── frame_0000.png
    ├── dynamic_mask_0000.png
    ├── pred_intrinsics.txt
    ├── pred_traj.txt
    └── scene.ply

Typical outputs include:

  • depth maps
  • depth confidence maps
  • RGB frame exports
  • dynamic masks
  • predicted intrinsics
  • predicted camera poses in TUM-style text format
  • reconstructed point cloud in .ply

Depending on runtime settings, additional mask exports may also be produced.

Visualization

You can visualize one predicted scene with:

python vis_vggt4d.py <path_to_scene_output>

This launches a viser-based interactive viewer for cameras, background points, and dynamic foreground points.

Data Preparation Helper

prepare_all_scenes.py is a small utility script for sampling frames from a specific local dataset layout and copying them into the expected scene-folder format. It is not a general-purpose CLI yet: it contains hard-coded source and target paths and should be edited to match your local environment before use.

Notes

  • This codebase assumes GPU inference.
  • Large scenes may use more memory during dynamic-map extraction and refinement.
  • Some helper scripts in this repository are still research-oriented and may require path cleanup before wider public use.

License

This project is released under the MIT License. See LICENSE for details.

Introduction

用户可使用该项目对动态场景进行重建与可视化。它基于VGGT4D管道,输入图像序列后能预测几何与相机运动,估计并优化动态区域,输出深度图、动态掩码、点云等结果。【此简介由AI生成】

Customize your domain