Multicore bundle adjustment

Changchang Wu, Sameer Agarwal, Brian Curless, Steven M. Seitz

TL;DR

This paper introduces highly optimized "matrix-free" Bundle Adjustment algorithms that leverage multicore CPUs and GPUs to achieve massive speedups in 3D scene reconstruction. By computing Jacobian entries on the fly and using single-precision arithmetic with clever normalization, the authors achieve up to 30x faster performance than previous state-of-the-art methods while significantly reducing memory overhead.

What Problem Does This Paper Address?

Bundle Adjustment (BA) is the computational "heavy lifter" in Structure from Motion (SfM) pipelines. It involves the joint non-linear refinement of camera parameters and 3D point positions to minimize reprojection error. As we move toward "community photo collections" (like reconstructing an entire city from thousands of internet photos), the scale of BA becomes a massive bottleneck.

Traditional solvers rely on the "Schur complement trick," which involves constructing and factoring large, sparse matrices. On modern hardware, especially GPUs, these matrices often exceed available RAM. Furthermore, the time spent moving these massive matrices between memory and the processor (the "memory wall") often dwarfs the actual computation time.

Methods

The authors propose two main iterative approaches based on the Inexact Step Levenberg-Marquardt (LM) algorithm combined with Preconditioned Conjugate Gradients (PCG):

  1. Implicit-Hessian: Runs PCG on the augmented Hessian matrix without ever explicitly forming it in memory.
  2. Implicit-Schur: Runs PCG on the Schur complement. While the Schur complement is usually the standard for BA, the authors show how to compute its product with a vector implicitly using only Jacobian-vector products.

Key Technical Innovations: * Matrix-Free Implementation: Instead of storing the Jacobian ($J$), the system can compute its entries on the fly. This trades redundant computation for reduced memory traffic—a winning trade-off on modern GPUs. * Single Precision Arithmetic: Standard BA solvers use double precision for numerical stability. The authors demonstrate that single precision is sufficient if combined with a pre-processing data normalization step that scales focal lengths and depths to a well-conditioned range. * Hardware-Specific Optimization: They use SSE instructions for CPU parallelization and custom CUDA kernels for the GPU. They specifically optimize memory access patterns (using Block Compressed Sparse Row format) to ensure coalesced memory fetching on the GPU.

Datasets

The algorithms were evaluated using the Bundle Adjustment in the Large (BAL) datasets, which include:

  • Ladybug: A video sequence (relatively sparse).
  • Skeletal and Final models: Reconstructions from internet photo collections of cities like Rome, Venice, Dubrovnik, and Trafalgar. These represent some of the largest and most challenging BA problems available at the time.

Key Insights and Ideas

  • Recomputation > Memory Access: On GPUs, the bottleneck isn't math; it's memory bandwidth. The "aha moment" here is that recomputing Jacobian values every time they are needed is actually faster than storing them and reading them back from RAM because it reduces memory contention.
  • The Power of Normalization: Numerical instability in single precision is often driven by the vast difference in scale between focal lengths (thousands) and reprojection errors (fractions). Simple median-based scaling makes single precision viable for high-accuracy 3D reconstruction.
  • Exploiting Problem Structure: Rather than using general-purpose sparse matrix libraries, the authors wrote custom kernels that exploit the specific block-diagonal structure of BA (camera vs. point parameters), leading to significant performance gains.

Key Results

The system shows dramatic improvements over the then-current state-of-the-art (the BAL solvers):

  • Speedup: The CPU-based system is up to 10x faster, and the GPU-based system is up to 30x faster than previous methods.
  • Scaling: The matrix-free GPU implementation allowed the authors to solve the "Rome-in-a-day" problem (one of the largest at the time) on a single consumer-grade GPU.
  • Efficiency: As seen in the convergence plots, the proposed solvers reach lower error levels much faster than traditional explicit solvers.
Figure 1. Runtimes for large scale problems. Our GPU solvers exhibit competitive convergence and a speedup of about 10x-30x against all the BAL solvers. Our method perform equally well for sparse reconstruction problems (e.g. Ladybug is a video sequence). Our multi-threaded CPU solvers achieves about 1

The table below highlights how much of the computation time is dominated by matrix-vector products ($Jx$ and $J^Ty$), justifying the focus on optimizing these specific operations.

Percentage of time spent on major functions in a single-threaded CPU implementation.

Limitations and Future Work

  • Numerical Stability: While normalization helps, single precision can still occasionally fail to reach the exact same minima as double-precision solvers on extremely sensitive problems.
  • Hardware Lock-in: The current high-performance implementation is written in CUDA, limiting it to NVIDIA hardware. The authors suggest porting to more general frameworks in the future.
  • Auto-Tuning: The authors noted that the best thread-block sizes and storage configurations vary by GPU model. They propose a future framework (similar to FFTW) that could automatically tune these parameters for the specific hardware at runtime.

Summary updated

BibTeX
@inproceedings{wu2011multicore,
  author = {Changchang Wu and Sameer Agarwal and Brian Curless and Steven M. Seitz},
  title = {{Multicore bundle adjustment}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2011},
  doi = {10.1109/cvpr.2011.5995552},
}
Figure