Skip to main content
Back

InstantSfM Rebuilds 3D Scene Reconstruction in PyTorch, Hitting 40x Speedup

A PyTorch-native Structure-from-Motion pipeline uses sparse GPU optimization and depth priors to run up to 40x faster than COLMAP on 5,000-image scenes.

Pro

  • InstantSfM is a PyTorch-native global SfM system running fully on GPU, released with code on GitHub.
  • Reports up to 40x speedup over COLMAP; Alamo scene drops from 12,855s to 597s.
  • Uses sparse Jacobian blocks and a custom Levenberg-Marquardt solver in PyTorch, cutting BA cost from O(n^2) to O(n).
  • Embeds monocular or sensor depth priors directly into the Jacobian to resolve SfM's scale ambiguity in metric units.
  • Filters under-constrained variables on the GPU to prevent rank-deficient solves that cause COLMAP/GLOMAP failures on ScanNet.
  • Scales to 5,000 images where feedforward methods VGGSfM and VGGT run out of memory; triangulation not yet GPU-accelerated.

Structure-from-Motion is the quiet workhorse behind almost every modern 3D reconstruction stack, from photogrammetry to 3D Gaussian Splatting. But the two systems everyone actually uses, COLMAP and GLOMAP, are C++ codebases pinned to the CPU. A new paper called InstantSfM rebuilds the entire global SfM pipeline in PyTorch on the GPU, and reports up to 40x speedup over COLMAP and significantly outperforms GLOMAP on large-scale datasets.

Why SfM has been stuck on the CPU

Despite the state-of-the-art performance of traditional SfM methods such as COLMAP and its follow-up work GLOMAP, naive CPU-specialized implementations of bundle adjustment and global positioning introduce significant computational overhead when handling large-scale scenarios, leading to a trade-off between accuracy and speed. Deep learning alternatives like VGGSfM and VGGT exist, but they are unable to scale to thousands of input views at once as GPU memory consumption increases sharply as the number of input views grows.

Prior attempts to move bundle adjustment onto the GPU stalled on two hard problems: recovering metric scale (SfM is scale-ambiguous by nature) and staying numerically stable when outliers leave some cameras or points with too few constraints to solve. InstantSfM's contribution is addressing both while keeping the whole pipeline sparse and parallel.

The sparse-Jacobian trick

The core insight is that bundle adjustment's Jacobian is almost entirely zeros. Each image observation only touches one camera and one 3D point, so most entries in the Jacobian are zero. By storing and operating only on the non-zero blocks, the system turns O(n^2) work into O(n), enabling fine-grained parallelism across GPU cores.

On top of that sparse representation, the optimizer is Levenberg-Marquardt implemented with sparse block operations in PyTorch, including custom kernels for matrix-vector/matrix-matrix multiplies and quaternion updates. Robust losses are integrated directly in the sparse pipeline, helping automatically downweight outliers without dense detours.

Depth priors, baked into the optimizer

The more novel piece is how InstantSfM handles metric scale. Rather than solving for a global scale factor as a separate variable, a depth-constrained Jacobian structure enables metric depth priors obtained from depth sensors or monocular depth estimators to be directly embedded into global positioning and BA. This formulation resolves the inherent scale ambiguity of SfM within the optimization process, allowing camera poses and 3D points to be recovered at a consistent metric scale.

For numerical robustness, the system watches which variables are actually observable. Aggressive outlier filtering or highly uneven outlier distributions can leave cameras or 3D points under-constrained, resulting in rank-deficient normal equations in the LM solver and potential optimization failure. InstantSfM proactively strips those under-constrained variables before each solve, running the check as a SIMD-style GPU pass.

InstantSfM point cloud reconstructions with camera frustums shown against source imagery

The numbers

The benchmarks span MipNeRF360, DTU, Tanks and Temples, ScanNet, and ScanNet++, plus large internet-photo collections. The Alamo scene is a good stress test: COLMAP requires 12,855.4 seconds, GLOMAP needs 1,599.5 seconds, while InstantSfM completes reconstruction in just 597.0 seconds. On indoor sequences, InstantSfM shows superior robustness where COLMAP and GLOMAP often fail.

A few things worth knowing about the setup:

  • Scaling was tested from 100 to 5,000 images, a range where feedforward learning-based SfM methods run out of GPU memory.
  • Hardware in the paper is an Intel Xeon Platinum 8480C paired with an NVIDIA H200.
  • Accuracy is reported as comparable to or better than COLMAP and GLOMAP across camera pose and 3D point metrics.

Trying it, and what it can't do yet

Code is public at github.com/cre185/InstantSfM. The project requires an NVIDIA GPU with CUDA support. The code is tested on Ubuntu 20.04 with CUDA 12.1 and PyTorch 2.3.1. The pipeline runs in three stages: feature extraction and matching, global SfM, and optional 3D Gaussian Splatting training, each exposed as a CLI command (ins-feat, ins-sfm).

The main caveats the authors list:

  • Triangulation of 3D points is not yet accelerated with CUDA/Triton operators, so it remains a bottleneck relative to BA and GP.
  • The current system is primarily designed for single-node execution, which may limit scalability to extremely large problems.
  • Depth priors are optional but recommended for anything where metric scale matters, such as robotics or simulation pipelines.

The practical implication is that any pipeline that currently shells out to COLMAP as a preprocessing step, whether for NeRF training, Gaussian Splatting, or SLAM-style mapping, can now stay inside PyTorch end-to-end. That opens the door to differentiable SfM front-ends, learned features plugged directly into the optimizer, and reconstructions on image counts that used to require overnight runs.