Vista4D

repository·main·Indexed 20 days ago

https://github.com/eyeline-labs/vista4d

A video reshooting framework that utilizes 4D point clouds to synthesize dynamic scenes from novel camera trajectories and viewpoints. Vista4D supports 4D scene recomposition, dynamic scene expansion, and point cloud editing (manipulating, duplicating, deleting, or inserting subjects). It integrates with Wan 2.1-T2V-14B, SAM3 for segmentation, and provides an interactive Camera UI for target camera design.

Tokens
11.1K
Snippets
54
Records
62
Agent score
68%

What's inside Vista4D

  1. Run Vista4D inference with DSE

    main

    To perform video reshooting inference using DSE, use the example_inference_dse.sh script. Outputs are saved to ./results/dse/$EXAMPLE/vista4d_$RESOLUTION/.

    Multi-GPU Support: USP multi-GPU inference is supported by setting USE_USP=true and specifying the number of GPUs via NUM_GPUS.

    EXAMPLE=lounge-cup RESOLUTION=720p bash scripts/inference/example_inference_dse.sh
  2. Perform 4D reconstruction and dynamic mask segmentation

    main

    Vista4D uses 4D reconstruction and dynamic mask segmentation as a preprocessing step.

    Requirements:

    • 4D Reconstruction: Choose between pi3 (Pi3X) or da3 (Depth Anything 3). Pi3X is the default and is recommended for less temporal flickering and lower VRAM usage. DA3 supports higher base resolutions.
    • Segmentation: Uses sam3 (Segment Anything 3). You must request access on the Hugging Face repo and authenticate locally using hf auth login.

    Execution: Run the preprocessing script by setting EXAMPLE (one of the provided videos like couple-newspaper, couple-walk, etc.) and RECON_METHOD.

    Results are stored in ./results/single/$EXAMPLE/recon_and_seg/.

    # Authenticate with Hugging Face for SAM3 access
    hf auth login
    
    # Run reconstruction and segmentation
    EXAMPLE=couple-newspaper RECON_METHOD=pi3 bash scripts/preprocess/example_recon_and_seg_single.sh
  3. Install PyTorch and Dependencies for Vista4D

    main

    After setting up the Conda environment and CUDA toolkit, install PyTorch (version 2.10.0 tested) specifically for CUDA 12.8, followed by the project's requirements.

    pip3 install torch==2.10.0 torchvision==0.25.0 --index-url https://download.pytorch.org/whl/cu128
    pip3 install -r requirements.txt
  4. Run Vista4D inference

    main

    Run inference on rendered point clouds using the example_inference_single.sh script. Outputs are stored in ./results/single/$EXAMPLE/vista4d_$RESOLUTION/.

    Unified Sequence Parallel (USP): To speed up inference and reduce per-GPU VRAM usage via multi-GPU inference, use the USE_USP=true flag. You can specify the number of GPUs with NUM_GPUS=? (defaults to 8).

    Execution:

    EXAMPLE=couple-newspaper RESOLUTION=720p bash scripts/inference/example_inference_single.sh
    # Standard inference
    EXAMPLE=couple-newspaper RESOLUTION=720p bash scripts/inference/example_inference_single.sh
    
    # Multi-GPU inference using USP
    USE_USP=true NUM_GPUS=8 EXAMPLE=couple-newspaper RESOLUTION=720p bash scripts/inference/example_inference_single.sh
  5. Use the Camera UI with DSE reconstructions

    main

    The Camera UI supports DSE reconstructions. To load them, enter the reconstruction directory (e.g., ./results/dse/$EXAMPLE/recon_and_seg/) into the Folder path field and click Load.

    While the editable timeline only covers source frames, two DSE-specific controls are available:

    • Show DSE cameras: Overlays the scene-capture camera frustums and their paths.
    • DSE frame interval: Strides through DSE frames when rebuilding the static background overlay. Increasing this value makes the overlay sparser.
  6. Install Vista4D via Conda

    main

    To set up the Vista4D environment, create a new Conda environment with Python 3.12 and install the CUDA 12.8 toolkit. It is recommended to install a self-contained CUDA toolkit into the environment to ensure compatibility. You must also set CUDA_HOME and update LD_LIBRARY_PATH to point to the Conda environment's paths.

    conda create --name vista4d python=3.12
    conda activate vista4d
    
    # Install CUDA 12.8 and C++ compiler
    conda install -c nvidia cuda-toolkit=12.8
    conda install -c conda-forge gxx_linux-64
    
    # Set environment variables
    export CUDA_HOME=$CONDA_PREFIX
    export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH
  7. Download Vista4D and Wan 2.1 checkpoints

    main

    Vista4D inference requires both the Vista4D finetuned checkpoints and the base Wan2.1-T2V-14B model.

    Vista4D Checkpoints: Download to ./checkpoints/vista4d/.

    • To download all: hf download Eyeline-Labs/Vista4D --local-dir ./checkpoints/vista4d
    • To download a specific resolution:
      • 384p: hf download Eyeline-Labs/Vista4D --local-dir ./checkpoints/vista4d --include "384p49_step=30000/*"
      • 720p: hf download Eyeline-Labs/Vista4D --local-dir ./checkpoints/vista4d --include "720p49_step=3000/*"

    Wan 2.1 Base Model: Download to ./checkpoints/wan/Wan2.1-T2V-14B/.

    • hf download Wan-AI/Wan2.1-T2V-14B --local-dir ./checkpoints/wan/Wan2.1-T2V-14B
    # Download Vista4D (all variants)
    hf download Eyeline-Labs/Vista4D --local-dir ./checkpoints/vista4d
    
    # Download Wan 2.1 base model
    hf download Wan-AI/Wan2.1-T2V-14B --local-dir ./checkpoints/wan/Wan2.1-T2V-14B
  8. Run Vista4D evaluation inference

    main

    Run inference on the evaluation dataset using the provided script. The script uses metadata.csv for prompts and seeds.

    Multi-GPU Sharding: To speed up inference across multiple GPUs, use NUM_SHARDS and SHARD_ID to split the workload. Each shard processes a contiguous chunk and automatically skips already-completed pairs.

    Example for running the 3rd shard (index 2) out of 8 on a specific GPU:

    NUM_SHARDS=8 SHARD_ID=2 RESOLUTION=720p bash scripts/inference/example_inference_eval.sh
    RESOLUTION=720p bash scripts/inference/example_inference_eval.sh
  9. Render point clouds with DSE

    main

    To unproject the source clip and DSE frames into a single 4D point cloud and render them in target cameras, use the example_render_dse.sh script.

    Outputs are saved to ./results/dse/$EXAMPLE/render_$RESOLUTION/.

    Configuration Options:

    • RESOLUTION: Set the target resolution (e.g., 720p).
    • DSE_FRAME_INTERVAL: Controls subsampling of DSE frames during unprojection. The default is 4. A higher value means fewer DSE frames are used.
    • RENDER_ONLY_NECESSARY: Can be configured similarly to single-video rendering.
    EXAMPLE=lounge-cup RESOLUTION=720p bash scripts/preprocess/example_render_dse.sh
  10. Render point clouds from 4D reconstructions

    main

    To unproject the 4D reconstruction into a point cloud and render it using target cameras, use the example_render_single.sh script.

    Options:

    • EXAMPLE: The source video name (e.g., couple-newspaper).
    • RESOLUTION: Supports 384p or 720p (matches model checkpoints).
    • RENDER_ONLY_NECESSARY: Defaults to true. Set to false to output additional renders (without temporal persistence or double-reprojected versions) for baselines/ablations.

    Results are stored in ./results/single/$EXAMPLE/render_$RESOLUTION/.

    # Standard render
    EXAMPLE=couple-newspaper RESOLUTION=720p bash scripts/preprocess/example_render_single.sh
    
    # Render with all outputs (for ablations/baselines)
    EXAMPLE=couple-newspaper RESOLUTION=720p RENDER_ONLY_NECESSARY=false bash scripts/preprocess/example_render_single.sh
  11. Perform 4D reconstruction with Dynamic Scene Expansion (DSE)

    main

    Dynamic Scene Expansion (DSE) allows Vista4D to incorporate extra visual information (like casual scene captures or alternate angles) into a single temporally-persistent 4D point cloud. This reduces hallucinations by providing more context to the video diffusion model.

    To jointly reconstruct and segment a source clip and its paired scene capture, use the example_recon_and_seg_dse.sh script. Results, including a clips.json file that records source and DSE frame ranges, are saved to ./results/dse/$EXAMPLE/recon_and_seg/.

    EXAMPLE=lounge-cup RECON_METHOD=pi3 bash scripts/preprocess/example_recon_and_seg_dse.sh
  12. Perform 4D scene recomposition (Point cloud editing)

    main

    Vista4D allows direct editing of the 4D point cloud (manipulating, duplicating, deleting, or inserting subjects).

    Workflow:

    1. Reconstruct: Reconstruct the main scene and any insert scenes using scripts/preprocess/example_recon_and_seg_edit.sh.
    2. Render with Edits: Apply an edits JSON to the unprojected point cloud and render target cameras using scripts/preprocess/example_render_edit.sh.
    3. Inference: Run the final video synthesis using scripts/inference/example_inference_edit.sh.

    Supported Edit Modes:

    • existing: Edit points in the current scene matching a SAM3 prompt.
    • duplicate: Clone points, transform them, and add them to the scene.
    • insert: Unproject and insert points from a different recon_and_seg folder.
    # 1. Reconstruct
    EXAMPLE=hike RECON_METHOD=pi3 bash scripts/preprocess/example_recon_and_seg_edit.sh
    
    # 2. Render with edits
    EXAMPLE=hike_cow RESOLUTION=720p bash scripts/preprocess/example_render_edit.sh
    
    # 3. Inference
    EXAMPLE=hike_cow RESOLUTION=720p bash scripts/inference/example_inference_edit.sh