Skip to main content

packaged InstantSplat

PyPI version Downloads Total downloads CI CI

This repo is the refactored python training and inference code for InstantSplat. Forked from commit 2c5006d41894d06464da53d5495300860f432872. We refactored the original code following the standard Python package structure, while keeping the algorithms used in the code identical to the original version.

Initialization methods:

  • DUST3R (same method used in InstantSplat)
  • MAST3R (same method used in Splatt3R)
  • COLMAP Sparse reconstruct (same method used in gaussian-splatting)
  • COLMAP Dense reconstruct (use patch_match_stereo, stereo_fusion, poisson_mesher and delaunay_mesher in COLMAP to reconstruct dense point cloud for initialization)
  • Masking of keypoints during COLMAP feature extraction (just put your mask into mask folder, e.g. for an image data/xxx/input/012.jpg, the mask would be data/xxx/input_mask/012.jpg.png)
  • VGGT and VGGT + Colmap Bundle Adjustment according to facebookresearch/vggt/demo_colmap.py
  • VGG-T³, VGG-T³ + COLMAP Bundle Adjustment, and VGG-T³ + COLMAP dense reconstruction
  • Map-Anything and Map-Anything with external pose/depth priors

Prerequisites

  • Pytorch (v2.4 or higher recommended)
  • CUDA Toolkit (12.4 recommended, should match with PyTorch version)

Install a colmap executable, e.g. using conda:

conda install conda-forge::colmap

Install mapanything and vggt:

pip install --upgrade "mapanything[all] @ git+https://github.com/facebookresearch/map-anything.git@main"
pip install --upgrade git+https://github.com/facebookresearch/vggt.git@main
pip install --upgrade Pillow hydra-core omegaconf # deps for vggt
pip install --upgrade git+https://github.com/jytime/LightGlue.git#egg=lightglue # deps for vggt

(Optional) Install xformers for faster Depth-Anything V2 inference:

pip install xformers

(Optional) If you have trouble with gaussian-splatting, try to install it from source:

pip install wheel setuptools
pip install --upgrade git+https://github.com/yindaheng98/gaussian-splatting.git@master --no-build-isolation

PyPI Install

pip install --upgrade instantsplat

or build latest from source:

pip install wheel setuptools
pip install --upgrade git+https://github.com/yindaheng98/InstantSplat.git@main --no-build-isolation

Development Install

git clone --recursive https://github.com/yindaheng98/InstantSplat
cd InstantSplat
pip install --target . --upgrade --no-deps .

Download model

wget -P checkpoints/ https://download.europe.naverlabs.com/ComputerVision/DUSt3R/DUSt3R_ViTLarge_BaseDecoder_224_linear.pth
wget -P checkpoints/ https://download.europe.naverlabs.com/ComputerVision/DUSt3R/DUSt3R_ViTLarge_BaseDecoder_512_linear.pth
wget -P checkpoints/ https://download.europe.naverlabs.com/ComputerVision/DUSt3R/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth
wget -P checkpoints/ https://download.europe.naverlabs.com/ComputerVision/MASt3R/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric.pth
wget -P checkpoints/ https://huggingface.co/depth-anything/Depth-Anything-V2-Small/resolve/main/depth_anything_v2_vits.pth
wget -P checkpoints/ https://huggingface.co/depth-anything/Depth-Anything-V2-Base/resolve/main/depth_anything_v2_vitb.pth
wget -P checkpoints/ https://huggingface.co/depth-anything/Depth-Anything-V2-Large/resolve/main/depth_anything_v2_vitl.pth
wget -P checkpoints/ https://huggingface.co/facebook/VGGT-1B-Commercial/resolve/main/vggt_1B_commercial.pt --header="Authorization: Bearer $HF_TOKEN"
wget -P checkpoints/ https://download.europe.naverlabs.com/ComputerVision/MUSt3R/MUSt3R_512.pth
wget -P checkpoints/ https://download.europe.naverlabs.com/ComputerVision/Pow3R/Pow3R_ViTLarge_BaseDecoder_512_linear.pth

Configs for map-anything:

git clone --depth 1 --filter=blob:none --sparse https://github.com/facebookresearch/map-anything.git /tmp/map-anything-configs
git -C /tmp/map-anything-configs sparse-checkout set configs
cp -r /tmp/map-anything-configs/configs ./
rm -rf /tmp/map-anything-configs

Running

  1. Initialize coarse point cloud and jointly train 3DGS & cameras
# Option 1: init and train in one command
python -m instantsplat.train -s data/sora/santorini/3_views -d output/sora/santorini/3_views -i 1000 --init dust3r
# Option 2: init and train in two separate commands
python -m instantsplat.initialize -d data/sora/santorini/3_views -i dust3r # init coarse point and save as a Colmap workspace at data/sora/santorini/3_views
python -m instantsplat.train -s data/sora/santorini/3_views -d output/sora/santorini/3_views -i 1000 # train

To enable the optional auto-scaled Depth-Anything V2 wrapper for any initializer, add --with_depth_anything:

python -m instantsplat.initialize -d data/sora/santorini/3_views -i vggt --with_depth_anything
python -m instantsplat.train -s data/sora/santorini/3_views -d output/sora/santorini/3_views -i 1000 --init mapanything --with_depth_anything

Depth format note:

  • Depth-Anything V2 saves inverse depth (1 / depth), which matches the default depth supervision used by 3DGS.
  • The native depth saved by mapanything, mapanything-external, vggt, and vggttt is regular depth, not inverse depth.
  • When training from those native depth maps without --with_depth_anything, add -o depth_ground_truth_is_inversed=False.

Example:

python -m instantsplat.train -s data/sora/santorini/3_views -d output/sora/santorini/3_views -i 1000 --init vggt -o depth_ground_truth_is_inversed=False
python -m instantsplat.train -s data/sora/santorini/3_views -d output/sora/santorini/3_views -i 1000 --init mapanything-external -o depth_ground_truth_is_inversed=False

VGG-T³ initialization

VGG-T³ is available through three initializer names:

  • vggttt: directly initializes cameras, a point cloud, and native depth maps. Put images in <scene>/images.
  • vggttt-colmap-sparse: runs VGG-T³, VGGSfM tracking, and COLMAP bundle adjustment. Put images in <scene>/input.
  • vggttt-colmap-dense: additionally runs COLMAP dense reconstruction. Put images in <scene>/input.

The model weights are downloaded automatically from nvidia/vgg-ttt on first use. For a source checkout, clone with --recursive as shown in Development Install so that the submodules/vgg-ttt submodule is available.

Direct initialization:

python -m instantsplat.initialize -d data/my_scene -i vggttt

The VGG-T³ inference options can be passed with -o:

python -m instantsplat.initialize -d data/my_scene -i vggttt \
  -o num_ttt_steps=2 \
  -o memory_efficient_inference=True \
  -o use_global_pred=True \
  -o offload_to_cpu=True

COLMAP bundle adjustment and dense reconstruction:

python -m instantsplat.initialize -d data/my_scene -i vggttt-colmap-sparse \
  -o colmap_executable="'colmap'"

python -m instantsplat.initialize -d data/my_scene -i vggttt-colmap-dense \
  -o colmap_executable="'colmap'"

VGG-T³ saves regular depth rather than inverse depth. When training without --with_depth_anything, use:

python -m instantsplat.train -s data/my_scene -d output/my_scene -i 1000 \
  --init vggttt -o depth_ground_truth_is_inversed=False

VGG-T³ code and weights are subject to the NVIDIA OneWay Noncommercial License.

  1. Render it
python -m gaussian_splatting.render -s data/sora/santorini/3_views -d output/sora/santorini/3_views -i 1000 --load_camera output/sora/santorini/3_views/cameras.json

See .vscode\launch.json for more command examples.

Usage

See instantsplat.initialize, instantsplat.train and gaussian_splatting.render for full example.

Also check yindaheng98/gaussian-splatting for more detail of training process.

Gaussian models

Use CameraTrainableGaussianModel in yindaheng98/gaussian-splatting

Dataset

Use TrainableCameraDataset in yindaheng98/gaussian-splatting

Initialize coarse point cloud and cameras

from instantsplat.initializer import Dust3rInitializer
image_path_list = [os.path.join(image_folder, file) for file in sorted(os.listdir(image_folder))]
initializer = Dust3rInitializer(...).to(args.device) # see instantsplat/initializer/dust3r/dust3r.py for full options
initialized_point_cloud, initialized_cameras = initializer(image_path_list=image_path_list)

Create camera dataset from initialized cameras:

from instantsplat.initializer import TrainableInitializedCameraDataset
dataset = TrainableInitializedCameraDataset(initialized_cameras).to(device)

Initialize 3DGS from initialized coarse point cloud:

gaussians.create_from_pcd(initialized_point_cloud.points, initialized_point_cloud.colors)

Training

Trainer jointly optimize the 3DGS parameters and cameras, without densification

from instantsplat.trainer import Trainer
trainer = Trainer(
    gaussians,
    dataset=dataset,
    ... # see instantsplat/trainer/trainer.py for full options
)

InstantSplat: Sparse-view SfM-free Gaussian Splatting in Seconds

arXiv Gradio Home PageX youtube youtube

This repository is the official implementation of InstantSplat, an sparse-view, SfM-free framework for large-scale scene reconstruction method using Gaussian Splatting. InstantSplat supports 3D-GS, 2D-GS, and Mip-Splatting.

Free-view Rendering

https://github.com/zhiwenfan/zhiwenfan.github.io/assets/34684115/748ae0de-8186-477a-bab3-3bed80362ad7

TODO List

  • Confidence-aware Point Cloud Downsampling
  • Support 2D-GS
  • Support Mip-Splatting

Acknowledgement

This work is built on many amazing research works and open-source projects, thanks a lot to all the authors for sharing!

Citation

If you find our work useful in your research, please consider giving a star :star: and citing the following paper :pencil:.

@misc{fan2024instantsplat,
        title={InstantSplat: Unbounded Sparse-view Pose-free Gaussian Splatting in 40 Seconds},
        author={Zhiwen Fan and Wenyan Cong and Kairun Wen and Kevin Wang and Jian Zhang and Xinghao Ding and Danfei Xu and Boris Ivanovic and Marco Pavone and Georgios Pavlakos and Zhangyang Wang and Yue Wang},
        year={2024},
        eprint={2403.20309},
        archivePrefix={arXiv},
        primaryClass={cs.CV}
      }

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

instantsplat-1.16.2.tar.gz (385.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

instantsplat-1.16.2-cp312-cp312-win_amd64.whl (604.8 kB view details)

Uploaded CPython 3.12Windows x86-64

instantsplat-1.16.2-cp311-cp311-win_amd64.whl (604.6 kB view details)

Uploaded CPython 3.11Windows x86-64

instantsplat-1.16.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

instantsplat-1.16.2-cp310-cp310-win_amd64.whl (603.8 kB view details)

Uploaded CPython 3.10Windows x86-64

instantsplat-1.16.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file instantsplat-1.16.2.tar.gz.

File metadata

  • Download URL: instantsplat-1.16.2.tar.gz
  • Upload date:
  • Size: 385.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for instantsplat-1.16.2.tar.gz
Algorithm Hash digest
SHA256 f87ead0613bc66ba8262ceed3e95c35b3049e74ca248a089e617ad9930d43f8e
MD5 7425083430b6f9ac31c181ad97cd0d0b
BLAKE2b-256 0d4f5ef73be0407b3d3e7de65cb7753db28c1d4b303ec2ca73b6f347b73fc80c

See more details on using hashes here.

Provenance

The following attestation bundles were made for instantsplat-1.16.2.tar.gz:

Publisher: build-release.yml on yindaheng98/InstantSplat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file instantsplat-1.16.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for instantsplat-1.16.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 487bb36a12d93a1b281c1cb589840a3839ba06edcdfb2439d55f4d496dde87a1
MD5 21983ab2ddb34ff8ff0b0bcccbe1908f
BLAKE2b-256 53c5b5b82212d1d623466e072d6e3c04453b65a76648fe90b0e2119b738f47b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for instantsplat-1.16.2-cp312-cp312-win_amd64.whl:

Publisher: build-release.yml on yindaheng98/InstantSplat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file instantsplat-1.16.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for instantsplat-1.16.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b636b831e5b17835bafcbbe858e4e487403a4734e6ea727392668227d5d84a57
MD5 3ca8924d12ac1a3808bd884bcc7d911a
BLAKE2b-256 70abea30094cb6871727170053b2fd43734f93bd6880867357aae66293f6f17b

See more details on using hashes here.

Provenance

The following attestation bundles were made for instantsplat-1.16.2-cp311-cp311-win_amd64.whl:

Publisher: build-release.yml on yindaheng98/InstantSplat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file instantsplat-1.16.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for instantsplat-1.16.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 15b3e59076122b69082090957e51fbfdc6671f6ced72d1d1ad5b3c9495862b1b
MD5 7fc6663c9754ec7ad147e7f930d95d7b
BLAKE2b-256 dd98814dfb570a653e2b6f64f56085c1cb33804eec649c2eb09d8adc3636a565

See more details on using hashes here.

Provenance

The following attestation bundles were made for instantsplat-1.16.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-release.yml on yindaheng98/InstantSplat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file instantsplat-1.16.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for instantsplat-1.16.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5aefa1fd5559ada8d80f4ee98a79ac7e285e5277b0d645d2cca2eeab43568272
MD5 74eef3ae4a10fbffeb15c98e3498f6d9
BLAKE2b-256 8db002fcf33c688ed6a10e7475a761e145a167480f03febef0dba0d652000884

See more details on using hashes here.

Provenance

The following attestation bundles were made for instantsplat-1.16.2-cp310-cp310-win_amd64.whl:

Publisher: build-release.yml on yindaheng98/InstantSplat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file instantsplat-1.16.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for instantsplat-1.16.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 83f6abb87c75db94c961efc71cbeb9b2678bc9bbcb6cc68614eff77d556ddd19
MD5 a463aa354999faecdfb8391f1af4d3ae
BLAKE2b-256 84b4ef78309e17516390ab2b2912a898843d05fce90ee69f41cbac1eb36614f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for instantsplat-1.16.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-release.yml on yindaheng98/InstantSplat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page