cvg / Hierarchical-Localization

Visual localization made easy with hloc
Apache License 2.0
3.1k stars 578 forks source link

Alternative SfM reconstruction options to colmap? #317

Open expenses opened 11 months ago

expenses commented 11 months ago

Hi, thanks for providing this great framework! I'm finding that for localizing hundreds of images, the colmap reconstructions step is by far the longest, mostly due to it's CPU-bound global bundle adjustment algorithm. Are you aware of any other libraries that could be used that have a faster bundle adjuster such as https://github.com/hjwdzh/DeepLM or https://github.com/MegviiRobot/MegBA?

sarlinpe commented 11 months ago

We are aware of these approaches but they are usually much less flexible (e.g. in terms of shared intrinsic parameters and camera models) than Ceres, which is the solver COLMAP is based on. Ceres will support GPU-based solving in the near future, which is the path of least effort. As for the distributed setting, COLMAP has a hierarchical mapper mode, which is faster but not yet supported by hloc.

SamuelJamesFisher commented 11 months ago

dagsfm Could be something to look into if you have large scenes

greenbrettmichael commented 3 months ago

We are aware of these approaches but they are usually much less flexible (e.g. in terms of shared intrinsic parameters and camera models) than Ceres, which is the solver COLMAP is based on. Ceres will support GPU-based solving in the near future, which is the path of least effort. As for the distributed setting, COLMAP has a hierarchical mapper mode, which is faster but not yet supported by hloc.

Are you referring for support for sparse solving on GPU with ceres? I have seen a few issue threads of developers attempting to use ceres::DENSE_SCHUR and having issues with RAM consumption and stability on large numbers of images.

https://github.com/colmap/colmap/issues/2305 https://github.com/ceres-solver/ceres-solver/issues/1045

greenbrettmichael commented 3 months ago

After reading more into the colmap bundle adjustment code, the following algorithms are used in different scenarios ceres::DENSE_SCHUR ceres::SPARSE_SCHUR ceres::ITERATIVE_SCHUR WITH ceres::SCHUR_JACOBI preconditioner

ceres::DENSE_SCHUR has GPU support, but takes too much RAM and is numerically unstable after a certain number of images. the biggest bang for development buck would be adding GPU implementation for ceres::ITERATIVE_SCHUR, there is an open ceres issue on the topic here https://github.com/ceres-solver/ceres-solver/issues/871