Introduction
Bundle Adjustment (BA) is a fundamental component in 3D computer vision, essential for tasks ranging from cinematic visual effects to the development of high-definition maps for autonomous driving. The process involves the simultaneous refinement of camera parameters and 3D point coordinates to minimize reprojection error. However, as the scope of computer vision projects expands to city-scale mapping, the size of BA problems has grown exponentially, often involving millions of points and tens of millions of observations.
Traditional libraries like Ceres and g2o, which are primarily CPU-based, frequently encounter a "memory wall." They struggle to store the massive Hessian matrices required for large-scale optimization within the RAM of a single machine. While some distributed BA approaches exist, they often rely on mathematical approximations that compromise numerical precision. MegBA addresses these challenges by providing a high-performance, open-source library that distributes "exact" BA computation across multiple GPUs.
System Architecture and Methods
MegBA’s architecture is designed to handle massive-scale problems without sacrificing accuracy. It achieves this through three primary innovations: edge-based partitioning, distributed solvers, and SIMD-optimized data structures.
Edge-Based Partitioning
BA problems can be modeled as graphs where nodes represent cameras and points, and edges represent observations. MegBA partitions the problem by edges, ensuring that each GPU processes an equal number of observations. This strategy balances the computational load and enables the system to aggregate the memory capacity of multiple GPUs, effectively overcoming the memory limitations of single-node systems.
Distributed Solvers (DPCG & DSE)
To maintain numerical precision, MegBA implements distributed versions of Schur Elimination and the Preconditioned Conjugate Gradient (PCG) method. By leveraging the NVIDIA Collective Communications Library (NCCL) for high-speed allreduce operations, MegBA ensures that its distributed solution is mathematically identical to one computed on a single node.
JetVector: SIMD Optimization
On individual GPUs, performance is often limited by memory access patterns. MegBA introduces JetVector, a "Structure-of-Arrays" (SoA) data format that replaces the standard "Array-of-Structures" (AoS) approach. This allows for coalesced memory access, enabling the GPU's thousands of cores to read data with maximum efficiency.
Experimental Evaluation
The performance of MegBA was evaluated using standard benchmarks like Bundle Adjustment in the Large (BAL) and 1DSfM, as well as a custom synthetic dataset containing 80 million observations—nearly three times larger than the largest standard benchmark.
Key Results
- Significant Speedups: MegBA achieved up to a 41.45x speedup compared to Ceres (using 16 CPU threads) and outperformed other GPU-based libraries like DeepLM by over 6.7x.
- Scalability: On the 80-million-observation dataset, MegBA completed optimization in 216 seconds using 8 GPUs. Competing libraries like DeepLM and RootBA failed this test due to memory exhaustion.
- Communication Efficiency: Profiling indicated that communication overhead (GPU-to-GPU synchronization) accounted for less than 8% of the total execution time, validating the efficiency of the distributed strategy.
Discussion and Future Work
MegBA represents a significant advancement in large-scale BA, though it does have specific hardware requirements, such as multi-GPU setups with high-speed interconnects like NVLink. For very small-scale problems, the overhead of GPU data transfer may make traditional CPU solvers more efficient.
Future development of MegBA could include tighter integration with front-end SLAM systems and support for more complex camera models. The library is open-source and provides API compatibility with Ceres and g2o, facilitating its adoption in existing computer vision pipelines.
Summary updated