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

Skipping pose estimation via --skip_relative_pose_estimation 1 can trigger segmentation fault #172

Open
gareth-odyssey opened this issue Mar 5, 2025 · 1 comment

Comments

@gareth-odyssey
Copy link

To reproduce:

  1. Initialize features with colmap feature_extractor.
  2. Match features with colmap exhaustive_matcher.
  3. Run glomap mapper and specify --skip_relative_pose_estimation 1.

Expected result

I don't fully know what the expected result is here, but if the configuration is unsupported an error message would be ideal.

Actual result

glomap encouters segmentation fault in the rotation averaging step:

Thread 1 "glomap" received signal SIGSEGV, Segmentation fault.
0x000055555573127e in glomap::BFS (graph=std::vector of length 0, capacity 0, root=0, parents=std::vector of length 0, capacity 0, banned_edges=std::vector of length 0, capacity 0) at /home/gareth/glomap/glomap/math/tree.cc:38
38        parents[root] = root;
(gdb) bt
#0  0x000055555573127e in glomap::BFS (graph=std::vector of length 0, capacity 0, root=0, parents=std::vector of length 0, capacity 0, banned_edges=std::vector of length 0, capacity 0)
    at /home/gareth/glomap/glomap/math/tree.cc:38
#1  0x0000555555731dc3 in glomap::MaximumSpanningTree (view_graph=..., images=std::unordered_map with 51 elements = {...}, parents=std::unordered_map with 0 elements, type=glomap::INLIER_NUM)
    at /home/gareth/glomap/glomap/math/tree.cc:134
#2  0x000055555564b7a7 in glomap::RotationEstimator::InitializeFromMaximumSpanningTree (this=0x7fffffffbad0, view_graph=..., images=std::unordered_map with 51 elements = {...})
    at /home/gareth/glomap/glomap/estimators/global_rotation_averaging.cc:69
#3  0x000055555564b432 in glomap::RotationEstimator::EstimateRotations (this=0x7fffffffbad0, view_graph=..., images=std::unordered_map with 51 elements = {...})
    at /home/gareth/glomap/glomap/estimators/global_rotation_averaging.cc:27
#4  0x0000555555583f0e in glomap::GlobalMapper::Solve (this=0x7fffffffd5e0, database=..., view_graph=..., cameras=std::unordered_map with 1 element = {...}, images=std::unordered_map with 51 elements = {...}, 
    tracks=std::unordered_map with 0 elements) at /home/gareth/glomap/glomap/controllers/global_mapper.cc:82

Specifically, the following sequences of events occurs:

  1. RotationEstimator::InitializeFromMaximumSpanningTree is invoked.
  2. MaximumSpanningTree is invoked.
  3. All images have image.is_registered == false, so the size of the graph is zero.
  4. The size of the min spanning tree is zero.
  5. BFS(...) does not handle this case, and instead segfaults.

I am happy to open a PR with a fix for this, but I would like to first validate that the expected result is failure. If so, I can add an error check for this situation and print something useful.

Cheers.

@lpanaf
Copy link
Collaborator

lpanaf commented Mar 6, 2025

Hi @gareth-odyssey, for the current pipeline, directly choosing --skip_relative_pose_estimation will have an undefined behavior. If you want to use this feature, you would need to feed the relative pose directly to the view graph (maybe you need to modify the source code).

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