Code Monkey home page Code Monkey logo

daba's Introduction

DABA: Decentralized and Accelerated Large-Scale Bundle Adjustment

Official implementation of Decentralization and Acceleration Enables Large-Scale Bundle Adjustment. Taosha Fan, Joseph Ortiz, Ming Hsiao, Maurizio Monge, Jing Dong, Todd Murphey, Mustafa Mukadam. In Robotics Science and Systems (RSS), 2023.

drawing

In this work, we present Decentralized and Accelerated Bundle Adjustment (DABA), a method that addresses the compute and communication bottleneck for bundle adjustment problems of arbitrary scale. Despite limited peer-to-peer communication, DABA achieves provable convergence to first-order critical points under mild conditions. Through extensive benchmarking with public datasets, we have shown that DABA converges much faster than comparable decentralized baselines, with similar memory usage and communication load. Compared to centralized baselines using a single device, DABA, while being decentralized, yields more accurate solutions with significant speedups of up to 953.7x over Ceres and 174.6x over DeepLM.


Dependencies

  1. Eigen >= 3.4.0
  2. CUDA >= 11.4
  3. CMake >= 3.18
  4. OpenMPI
  5. NCCL
  6. CUB >= 11.4
  7. Thrust >= 2.0
  8. Glog
  9. Boost >= 1.60
  10. Ceres >= 2.0 (optional)

Quickstart

Download BAL Dataset

wget https://grail.cs.washington.edu/projects/bal/data/ladybug/problem-1723-156502-pre.txt.bz2
bzip2 -dk problem-1723-156502-pre.txt.bz2

Compile

git clone https://github.com/facebookresearch/DABA.git
cd DABA
mkdir release
cd release
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j16

Run

mpiexec -n NUM_DEVICES ./bin/mpi_daba_bal_dataset --dataset /path/to/your/dataset --iters 1000 --loss "trivial" --accelerated true --save true

Citation

If you find this work useful for your research, please cite our paper:

@article{fan2023daba,
    title={Decentralization and Acceleration Enables Large-Scale Bundle Adjustment}, 
    author={Fan, Taosha and Ortiz, Joseph and Hsiao, Ming and Monge, Maurizio and Dong, Jing and Murphey, Todd and  Mukadam, Mustafa},
    journal={arXiv:2305.07026},
    year={2023},
}

License

The majority of this project is licensed under MIT License. However, a portion of the code is available under the Apache 2.0 license.

daba's People

Contributors

eltociear avatar fantaosha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

daba's Issues

How to exploit the retrieved parameters from neighboring devices?

Pleasure to see the wonderful work! I read the paper and did not find any words to explain how to exploit the x^beta. In other words, how to fuse the results of common parameters from respective k-th iteration of neighboring devices? Any explanation will be appreciated!
image

It can solve pose graph error also?

If I add pose graph error and jacobians, it can solve also?

I don't have the knowledge about mpi / nccl. so I don't know about it works well.

I want to know DABA solve pose graph problems, when I use your api about Least square optimization.

Thank you.

some problems when visualizing the poses and points

Hi,

First, thanks for your great work.

Because I'm not sure what tool to use to visualize the results, so I transform the "results-mm-lm-acc-trivial-problem-1723-156502-pre-2-GPU-1000-iters.txt" to the colmap format(which save r_{iw}, t_{iw}, p_w).

In my understand, "results-mm-....txt" saves:
[R_{wi} | R_{wi}t_{iw} = -t_{wi}]
f k1 k2
-p_w1 -p_w2 -p_w3

After I have transformed the poses and points, I got a weird result.
image
(after optimization)
this is the code I try to transform

  extrinsic.resize(num_extrinsics);
  for (int i = 0; i < num_extrinsics; i++) {
    std::getline(file, line);
    Eigen::Matrix<double, 3, 3> r;
    Eigen::Vector3d t;
    for (int m = 0; m < 3; m++) {
      std::getline(file, line);
      std::istringstream iss(line);
      iss >> r.coeffRef(m, 0) >> r.coeffRef(m, 1) >> r.coeffRef(m, 2) >> t[m];
    }
    // if r is r_wi
    // t_iw = - r_wi^T * t_iw =r_wi^T  *( - t_wi) = r_wi^T * t
    Eigen::Vector3d r_aa;
    Log(r.transpose(), r_aa); // copy from DABA/sfm/math/
    t = r * t;
    Eigen::AngleAxisd r_aad(r_aa.norm(), r_aa.normalized());
    Eigen::Quaterniond qua(r_aad);
    qua.normalize();
    qua.inverse();

    extrinsic[i].resize(7);
    extrinsic[i][0] = qua.w();
    extrinsic[i][1] = qua.x();
    extrinsic[i][2] = qua.y();
    extrinsic[i][3] = qua.z();

    for (int m = 0; m < 3; m++) {
      extrinsic[i][m + 4] = t[m];
    }
  }

I transform the input "problem-1723-156502-pre.txt", and I got the correct result:
image

I did modified you code, and i just run commandmpiexec -n 2 ./bin/mpi_daba_bal_dataset --dataset /path/to/your/dataset --iters 1000 --loss "trivial" --accelerated true --save true.

I don't know where I got a misunderstanding. And I also want to know if there is a tool to visualiza the results easily.

Thank you!

Questions regarding distortion coefs and cost function

Hi,

First, I'd like to say great work and amazing results.

I've been trying to run DABA on custom-made BAL dataset examples, resulting in failed solutions. Unstable optimization (especially for ceres solver) and divergent final reconstruction. However, standard ceres optimization with Snavely reprojection cost function results in converged output. Additionally, both Snavely ceres implementation, DABA, and your ceres implementation result in the same converged solution when distortion parameters are removed (from both cost and jacobian evaluation) keeping them at zero (basically, keeping simple pinhole camera model).

With that in mind, I have trouble understanding a few parts of the code regarding distortion:

  1. In reprojection error cost implementation, the term for undistorted reprojection ray is
$$\begin{bmatrix}\pmb u_{ij}\\f + k_{i,1}||\pmb u_{ij}||^2 + k_{i,2}||\pmb u_{ij}||^4\end{bmatrix}$$

, while the derived formula (supported by your paper) is

$$\begin{bmatrix}\pmb u_{ij}\\f + fk_{i,1}||\pmb u_{ij}||^2 + fk_{i,2}||\pmb u_{ij}||^4\end{bmatrix}$$

I'm noticing a slight difference between them in second and fourth order terms.
Even if focal length and measurements were rescaled so that focal length equals 1.0 (in loading methods), second and fourth order terms should still contain the scaled focal length as it is optimized. I'm wondering if there is something I might be overlooking or if there's an explanation for this difference.

  1. As I understand, you are using Fitzgibbon's division model for distortion (in pixel space), while BAL/Bundler format uses the polynomial model in camera space. I'm curious to know how these models are interchangeable. I can see that k1 and k2 are scaled with focal length to accommodate between pixel <-> camera space. Can you please elaborate on how this interchangeability is achieved?

My guess on why custom BAL examples are failing, for now, is that the initial problems have large initial errors due to differences in distortion models and that results in divergent behavior. This is supported by the fact that DABA converges if distortion is optimized, but with 0 as the initial value.
If I have misunderstood something, I would appreciate any clarification and hope this helps in running DABA on any bundle adjustment problem.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.