GaussianSTORM

repository·main·Indexed 18 days ago

https://github.com/nvlabs/gaussianstorm

STORM (Spatio-Temporal Reconstruction Model for Large-Scale Outdoor Scenes) is a fast, feed-forward, and self-supervised model for dynamic scene reconstruction from sparse multi-view sequences. It jointly learns 3D Gaussians and scene flow for real-time rendering and motion segmentation. The repository includes tools for training, evaluation, and preprocessing the Waymo Open Dataset, including sky mask extraction using DepthAnything-v2.

Tokens
2.9K
Snippets
8
Records
9
Agent score
13%

What's inside GaussianSTORM

  1. Train the STORM model

    main

    Training is performed using main_storm.py. The following example demonstrates a multi-GPU setup to reproduce the STORM-B/8 model.

    Key Configuration Details:

    • batch_size is per-GPU. The global batch size is calculated as batch_size × #GPUs × #nodes.
    • Checkpoints and logs are saved to work_dirs/<project>/<exp_name>.
    • For a full list of arguments, refer to main_storm.py.
    # Multi-GPU training example
    torchrun --nproc_per_node=8 main_storm.py \
        --project 0504_storm \
        --exp_name 0504_pixel_storm \
        --data_root ../storm2.3/data/STORM2 \ # replace this with your data root.
        --batch_size 4 --num_iterations 100000 --lr_sched constant \
        --model STORM-B/8 --num_motion_tokens 16 \
        --use_sky_token --use_affine_token \
        --load_depth --load_flow --load_ground \
        --enable_depth_loss --enable_flow_reg_loss --flow_reg_coeff 0.005 --enable_sky_opacity_loss \
        --enable_perceptual_loss --perceptual_loss_start_iter 5000 \
        --enable_wandb \
        --auto_resume
  2. Preprocess Waymo raw data with preprocess.py

    main

    After downloading the raw .tfrecord files, use preprocess.py to extract and organize components like images, LiDAR, and calibration data into a processed directory structure.

    Arguments:

    • --data_root: Path to the raw Waymo data.
    • --target_dir: Path where processed data should be saved.
    • --dataset: Set to waymo.
    • --split: Either training or validation.
    • --scene_list_file: Path to the split file containing scene names.
    • --scene_ids: (Optional) Specific scene IDs to process.
    • --num_workers: Number of worker threads.
    • --process_keys: A space-separated list of components to extract (e.g., images lidar calib pose dynamic_masks ground).
    • --json_folder_to_save: Path to save the resulting annotations.
    # Preprocess specific scenes
    python preprocess.py \
        --data_root data/waymo/raw/ \
        --target_dir data/waymo/processed \
        --dataset waymo \
        --split training \
        --scene_list_file data/dataset_scene_list/waymo_train_list.txt \
        --scene_ids 700 754 23 \
        --num_workers 8 \
        --process_keys images lidar calib pose dynamic_masks ground \
        --json_folder_to_save data/STORM_data/annotations/waymo 
  3. Set up the environment for Waymo data processing

    main

    Because TensorFlow dependencies often conflict with the main STORM environment, it is highly recommended to create a dedicated Conda environment for data preprocessing.

    1. Create and activate a new environment named storm_data with Python 3.10.
    2. Install the required preprocessing dependencies using requirements_data_preprocess.txt.
    conda create -n storm_data python=3.10
    conda activate storm_data
    pip install -r requirements_data_preprocess.txt
  4. Extract sky masks using DepthAnything-v2

    main

    Sky masks are extracted by identifying regions in the depth map that represent infinitely far distances (zero values in the relative depth map produced by DepthAnything-v2).

    Steps:

    1. Generate a file list of all processed images: find data/waymo/processed/training/*/images -name "*.jpg" > file_list.txt
    2. Download the DepthAnything-V2-Large checkpoint (e.g., depth_anything_v2_vitl.pth) and place it in a ckpts/ directory.
    3. Run the extraction script using the generated file list.
    # 1. Generate file list
    find data/waymo/processed/training/*/images -name "*.jpg" > file_list.txt
    
    # 2. Download checkpoint
    mkdir ckpts && wget https://huggingface.co/depth-anything/Depth-Anything-V2-Large/resolve/main/depth_anything_v2_vitl.pth -O ckpts/depth_anything_v2_vitl.pth
    
    # 3. Extract masks
    python extract_sky.py --file_list ./file_list.txt
  5. Download Waymo raw data using waymo_download.py

    main

    Use the preproc/waymo_download.py script to download specific scenes or entire splits from the Waymo Open Dataset. You must have a Waymo Open Dataset account and the gcloud SDK installed and authenticated.

    Arguments:

    • --target_dir: The directory where raw data will be stored (e.g., ./data/waymo/raw/training).
    • --split_file: Path to the text file containing the scene list (e.g., data/dataset_scene_list/waymo_train_list.txt).
    • --scene_ids: (Optional) A space-separated list of specific scene IDs to download. If omitted, all scenes in the --split_file are downloaded.
    # Download specific scenes
    python preproc/waymo_download.py \
        --target_dir ./data/waymo/raw/training \
        --split_file data/dataset_scene_list/waymo_train_list.txt \
        --scene_ids 700 754 23
    
    # Download all scenes in the training split
    python preproc/waymo_download.py \
        --target_dir ./data/waymo/raw/training \
        --split_file data/dataset_scene_list/waymo_train_list.txt
  6. Evaluate the STORM model

    main

    To run evaluation, use main_storm.py with the --evaluate flag. This uses the same configuration as the training command but triggers evaluation mode.

    torchrun --nproc_per_node=8 main_storm.py \
        --project 0504_storm \
        --exp_name 0504_pixel_storm \
        --data_root ../storm2.3/data/STORM2 \
        --batch_size 4 --num_iterations 100000 --lr_sched constant \
        --model STORM-B/8 --num_motion_tokens 16 \
        --use_sky_token --use_affine_token \
        --load_depth --load_flow --load_ground \
        --enable_depth_loss --enable_flow_reg_loss --flow_reg_coeff 0.005 --enable_sky_opacity_loss \
        --enable_perceptual_loss --perceptual_loss_start_iter 5000 \
        --auto_resume \
        --evaluate
  7. Install STORM

    main

    Follow these steps to set up the STORM environment. The project was tested with CUDA 12.1, PyTorch 2.3, and an NVIDIA A100. You may need to adjust CUDA/PyTorch versions to match your environment.

    1. Clone the repository.
    2. Create and activate a Conda environment with Python 3.10.
    3. Install Python dependencies via requirements.txt.
    4. Install gsplat for batch-wise rendering support. Note that gsplat installation can be machine-dependent. If the specific commit installation fails, try installing the latest version.
    # clone project
    git clone https://github.com/NVlabs/GaussianSTORM.git
    cd GaussianSTORM
    
    # create conda environment
    conda create -n storm python=3.10 -y
    conda activate storm
    
    # install python dependencies
    pip install -r requirements.txt
    
    # install gsplat (for batch-wise rendering support)
    pip install git+https://github.com/nerfstudio-project/gsplat.git@2b0de894232d21e8963179a7bbbd315f27c52c9c
    # If the above fails, try:
    # pip install git+https://github.com/nerfstudio-project/gsplat.git
  8. Run a Quick Start Inference Demo

    main

    To experiment quickly, you can download a small subset of the Waymo Open Dataset (~600 MB) and run a single-GPU inference demo.

    Note: You will need a checkpoint path ($CKPT_PTH). Official checkpoints are not currently shared, but you can find unofficial ones on the project's issue page.

    # download dataset subset (≈ 600 MB)
    gdown 14fapsAGoMCQ5Ky82cg2X6bk-mLQ7fdCF
    tar -xf STORM_subset.tar.gz
    
    # run single-GPU inference demo
    python inference.py \
        --project storm_playground --exp_name visualization \
        --data_root data/STORM_subset \
        --model STORM-B/8 --num_motion_tokens 16 \
        --use_sky_token --use_affine_token \
        --load_depth --load_flow --load_ground \
        --load_from $CKPT_PTH
  9. Waymo processed data directory structure

    main

    The following structure is expected after successful preprocessing and sky mask extraction:

    ProjectPath/data/
    └── waymo/
        ├── raw/                 # Original .tfrecord files
        │    └── ...
        └── processed/
             └── [training|validation]/
                  └── [scene_id]/  # e.g., 000, 001...
                     ├── cam_to_ego/         # {cam_id}.txt
                     ├── cam_to_world/       # {timestep:03d}_{cam_id}.txt
                     ├── depth_flows_4/      # {timestep:03d}_{cam_id}.npy
                     ├── dynamic_masks/      # {timestep:03d}_{cam_id}.png
                     ├── ego_to_world/       # {timestep:03d}.txt
                     ├── ground_label_4/     # {timestep:03d}.txt
                     ├── images/             # {timestep:03d}_{cam_id}.jpg
                     ├── images_4/           # {timestep:03d}_{cam_id}.jpg
                     ├── intrinsics/         # {cam_id}.txt
                     ├── lidar/               # {timestep:03d}.bin
                     └── sky_masks/          # {timestep:03d}_{cam_id}.png