Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About training code and differentiable ba implementation #20

Closed
mkocabas opened this issue Jun 30, 2024 · 4 comments
Closed

About training code and differentiable ba implementation #20

mkocabas opened this issue Jun 30, 2024 · 4 comments

Comments

@mkocabas
Copy link

Hi @jytime,

Awesome work! Do you have any plans to release the training code?

I am specifically interested in how you used the theseus library to implement differentiable BA.

@jytime
Copy link
Contributor

jytime commented Jun 30, 2024

Hi @mkocabas,

We do plan to release the training code, but it is not our top priority at the moment. Our recent focus is to resolve the memory issue and provide a version that supports video input (as mentioned in #9). We hope they will facilitate easier off-the-shelf usage.

Regarding Theseus, their team provides an official example for differentiable Bundle Adjustment, available here:
https://github.com/facebookresearch/theseus/blob/e07569138cafa2d5da3e16ff2586d2495e77817c/examples/bundle_adjustment.py#L4

While this implementation isn’t fast, it functions correctly.

Please let me know if there is anything else I can help.

@mkocabas
Copy link
Author

Thanks a lot for your prompt response!

I am looking forward to your training code.

I am aware of the example implementation. But as you mentioned it is quite slow. I wonder which tricks you used to make it work faster. It would be immensely helpful if you can share your code snippet implementing those changes.

@jytime
Copy link
Contributor

jytime commented Jun 30, 2024

Hi, as far as I can remember now (they were conducted months ago sry), these points helped:

(a) Use the linear solver BaSpaCho. BaSpaCho was specially designed by the Theseus team for BA. You need to compile it from the source code.
(b) A very time-consuming step is using the for loop to convert pytorch tensors to Theseus variables. it will be much faster if you can make it a batch operation. A trial I used before was facebookresearch/theseus#565, please check the github issue discussion for details. (But plz notice that we did not use this implementation finally. Instead we modified the source codes of Theseus to achieve something similar)
(c) During training, use a small number of 3D points and camera parameters. Subsampling 25% of the parameters for BA does not significantly impact performance but greatly improves speed.

@jytime jytime closed this as completed Jul 22, 2024
@jytime
Copy link
Contributor

jytime commented Jul 22, 2024

Closed now. Feel free to reopen this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants