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

add Sim(3)-based alignment to the wrapper #702

Merged
merged 33 commits into from
Mar 11, 2021
Merged

Conversation

johnwlambert
Copy link
Contributor

@johnwlambert johnwlambert commented Feb 24, 2021

  • Fix pose notation in Sim(3) Align() code and unit tests
  • Add more docstrings
  • Move Sim(3) out of unstable to stable GTSAM
  • Add Sim(3) to python wrapper
  • Add python unit tests

3rd python unit test checks alignment here between 4 pose-pairs:

@ayushbaid
Copy link
Contributor

Hi John. Is this algorithm the same as what we are trying to implement in GTSFM?

@johnwlambert
Copy link
Contributor Author

Hi John. Is this algorithm the same as what we are trying to implement in GTSFM?

Yes, although PosePairs (wTi, wTi_) from wTi_list, wTi_list_ is the one that was suggested: https://github.com/borglab/gtsam/blob/develop/gtsam_unstable/geometry/Similarity3.cpp#L170

Copy link
Contributor

@akshay-krishnan akshay-krishnan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also add some unit tests for Similarity3 if there are not any already, especially since its being taken out of unstable.

gtsam/geometry/Similarity3.cpp Outdated Show resolved Hide resolved
@johnwlambert
Copy link
Contributor Author

I think we should also add some unit tests for Similarity3 if there are not any already, especially since its being taken out of unstable.

Agreed, yeah we should do that

@akshay-krishnan
Copy link
Contributor

akshay-krishnan commented Feb 25, 2021

It looks like there is a testSimilarity3 in unstable which broke because we moved the file. Maybe we can try moving that as well, and that might fix the CI?

@johnwlambert
Copy link
Contributor Author

It looks like there is a testSimilarity3 in unstable which broke because we moved the file. Maybe we can try moving that as well, and that might fix the CI?

Good point. But also seems like PointPairs isn't making its way into the gtsam namespace, also:

/home/runner/work/gtsam/gtsam/build/python/gtsam.cpp: In functionvoid pybind11_init_gtsam(pybind11::module&)’:
/home/runner/work/gtsam/gtsam/build/python/gtsam.cpp:1163:45: error: ‘PointPairsin namespacegtsamdoes not name a type
         .def_static("Align",[](const gtsam::PointPairs& abPointPairs){return gtsam::Similarity3::Align(abPointPairs);}, py::arg("abPointPairs"));
                                             ^
/home/runner/work/gtsam/gtsam/build/python/gtsam.cpp:1163:129: error: expected ‘)’ before string constant
         .def_static("Align",[](const gtsam::PointPairs& abPointPairs){return gtsam::Similarity3::Align(abPointPairs);}, py::arg("abPointPairs"));

Copy link
Collaborator

@varunagrawal varunagrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but please rename PointPairs to Point3Pairs and use the preferred using idiom for typedefs. Also @johnwlambert be sure to link your commits to your account.

gtsam/geometry/Similarity3.h Outdated Show resolved Hide resolved
@asa
Copy link
Contributor

asa commented Feb 26, 2021 via email

Copy link
Collaborator

@varunagrawal varunagrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some minor changes. 🙂

gtsam/geometry/Similarity3.cpp Show resolved Hide resolved
gtsam/geometry/tests/testSimilarity3.cpp Show resolved Hide resolved
gtsam/gtsam.i Outdated Show resolved Hide resolved
gtsam/gtsam.i Outdated Show resolved Hide resolved
@dellaert
Copy link
Member

Hmmmm, CI fails, but it seems with a compiler error, and only on Linux :-(

@dellaert
Copy link
Member

(Other than that LGTM, but that needs to be investigated before we can merge)

@johnwlambert
Copy link
Contributor Author

(Other than that LGTM, but that needs to be investigated before we can merge)

Yeah, @ProfFan thought it was likely OOM issue from the large gtsam.i file?

@dellaert
Copy link
Member

Definitely possible. @jingwuOUO reported similar issues on her Linux box. @ProfFan and @varunagrawal what can we do to split up gtsam.i? One file per subdir?

@varunagrawal
Copy link
Collaborator

I don't think we even need that. We need to figure out a way to break down the gtsam.cpp (which is fed to Pybind) into smaller files that can be parallelly built. At the end of the day, it generates one shared object file so that would be the easiest way to do it.

@jingwuOUO
Copy link
Contributor

When make -j1 python-install, it often causes my computer freezing and raise error g++-7: internal compiler error: Killed (program cc1plus), my processor is i7-8550U @ 1.80GHz x 8.

@varunagrawal
Copy link
Collaborator

What happens when you run make -j8?

I agree that the Pybind11 wrapper is a major memory hog. I had to update my swap from 8 GB to 24 GB to prevent my laptop from freezing as well.

@jingwuOUO
Copy link
Contributor

Tried, it will crash sooner. The same error message.

@jingwuOUO
Copy link
Contributor

Oh my swap is 8GB. I might need to update.

@ProfFan
Copy link
Collaborator

ProfFan commented Mar 11, 2021

Swapping makes compilation extremely slow (the compiler really does not like the disk). Splitting the header is the fastest way of cutting down compilation time and memory, since splitting gtsam.cpp is not an easy job (dependency analysis, etc. etc.).

@johnwlambert
Copy link
Contributor Author

CI passes now that TBB + Python is disabled in the CI

@johnwlambert johnwlambert dismissed stale reviews from dellaert and akshay-krishnan March 11, 2021 23:52

discussed changes have been made

@johnwlambert johnwlambert merged commit 0eb20b6 into develop Mar 11, 2021
@johnwlambert johnwlambert deleted the sim3-alignment branch March 11, 2021 23:53
@varunagrawal
Copy link
Collaborator

Interesting. I wonder if TBB is doing something to cause the OOM (instead of the wrapper). We need to update the TBB dependent code to use the new API.

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

Successfully merging this pull request may close these issues.

None yet

8 participants