InstantSfM

Zhong 2025 · Paper

One-line summary — A fully GPU-based, PyTorch-compatible global SfM pipeline with sparsity-aware optimisation, reaching up to ~40x speedups over COLMAP on large scenes at comparable accuracy.

Problem

Mature SfM systems remain CPU-centric and built on traditional optimisation toolchains (Ceres-style solvers), creating “a growing mismatch with modern GPU-based, learning-driven pipelines” and limiting scalability — large collections can take hours to days. GPU-accelerated bundle adjustment had shown the potential of parallel sparse optimisation, but extending it into a complete global SfM system was blocked by two unresolved issues: recovering metric scale, and numerical robustness (outlier filtering can leave cameras/points under-constrained, producing rank-deficient normal equations that break the Levenberg–Marquardt solver). InstantSfM builds that complete system.

Method & architecture

InstantSfM follows the global paradigm (like GLOMAP): rotation averaging, then global positioning (GP), then bundle adjustment (BA) — all stages implemented in PyTorch on the GPU with sparse Jacobians. GP jointly estimates points Xj\mathbf{X}_j, camera centres ti\mathbf{t}_i, and per-observation scales sijs_{ij} from rotated ray directions vij\mathbf{v}_{ij}:

θ=argminX,t,si=1Cj=1Pρ(vijsij(Xjti)22)\boldsymbol{\theta}=\arg\min_{\mathbf{X},\mathbf{t},s}\sum_{i=1}^{C}\sum_{j=1}^{P}\rho\left(\|\mathbf{v}_{ij}-s_{ij}(\mathbf{X}_{j}-\mathbf{t}_{i})\|^{2}_{2}\right)

BA then refines poses ζi\boldsymbol{\zeta}_i, intrinsics Ki\mathbf{K}_i, and points by minimising reprojection error rij=Π(ζi,Xj,Ki)xij\mathbf{r}_{ij}=\Pi(\boldsymbol{\zeta}_{i},\mathbf{X}_{j},\mathbf{K}_{i})-\mathbf{x}_{ij}. Both are solved with LM steps (JJ+λdiag(JJ))Δθ=Jr(\mathbf{J}^{\top}\mathbf{J}+\lambda\operatorname{diag}(\mathbf{J}^{\top}\mathbf{J}))\Delta\boldsymbol{\theta}=-\mathbf{J}^{\top}\mathbf{r}, where the BA Jacobian JR2CP×(7C+3P)\mathbf{J}\in\mathbb{R}^{2CP\times(7C+3P)} is stored and manipulated in block-sparse form. Two contributions make it a complete system:

rijd=1Depth(ζi,Xj,Ki)1d^ij,θ=argmini,jρ(rij+λdrijd)\mathbf{r}^{d}_{ij}=\frac{1}{\text{Depth}(\boldsymbol{\zeta}_{i},\mathbf{X}_{j},\mathbf{K}_{i})}-\frac{1}{\hat{d}_{ij}},\qquad \boldsymbol{\theta}=\arg\min\sum_{i,j}\rho\left(\mathbf{r}_{ij}+\lambda_{d}\mathbf{r}^{d}_{ij}\right)

Invalid depth pixels (sky, speculars) are handled by a binary mask mijm_{ij} that sets the reference d~ij1=mijd^ij1\tilde{d}^{-1}_{ij}=m_{ij}\cdot\hat{d}_{ij}^{-1}, collapsing the term to reprojection-only in one uniform GPU operation — no thread-divergent per-observation branching.

Results

Why it matters for SLAM

Offline SfM is the workhorse behind SLAM research: it produces pseudo-ground-truth trajectories, calibration, and the posed images used to train NeRF/3DGS and learning-based SLAM systems — speeding it up by an order of magnitude shortens every iteration loop in that ecosystem. InstantSfM continues the shift away from the slow incremental CPU pipeline that COLMAP standardised (following GLOMAP’s global formulation), and its depth-prior-in-the-Jacobian trick is a clean example of fusing learned priors into classical estimation rather than replacing it. The dynamic parameter-extraction idea — restructure the problem each iteration to keep the normal equations full-rank — is broadly useful in any GPU-resident SLAM backend.