8000 Add BinaryTreePartition class for hierarchical image-pair partitioning by tiantianxiangshang629 · Pull Request #840 · borglab/gtsfm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add BinaryTreePartition class for hierarchical image-pair partitioning #840

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tiantianxiangshang629
Copy link
Collaborator
@tiantianxiangshang629 tiantianxiangshang629 commented Apr 20, 2025

This PR introduces a new BinaryTreePartition class to the GTSFM graph partitioning module. The partitioner supports hierarchical binary tree-based splitting of image-pair graphs, enabling configurable partition depths for scalable and efficient scene processing.

Key Features:

  • Implements BinaryTreePartition as a subclass of GraphPartitionerBase.
  • Partitions image pairs into 2^max_depth leaf partitions using METIS-based symbolic ordering.
  • Constructs a binary tree structure with configurable maximum depth.

@akshay-krishnan akshay-krishnan requested a review from Copilot April 22, 2025 21:49
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces improvements to the graph partitioning functionality in GTSFM by adding new partitioner implementations, visualization support, and corresponding tests. Key changes include:

  • Updated import ordering and added a commented-out alternative partitioner configuration in gtsfm_runner_base.py.
  • Addition of new partitioner implementations in eight_partitions.py and binary_tree_partition.py, along with visualization (binary_tree_partition_visualization.py) and tests (binary_tree_partition_test.py).
  • Updated environment file (environment_m3_ultra.yml) to include new dependencies such as metis and graphviz.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
gtsfm/runner/gtsfm_runner_base.py Revised import ordering and added an alternative partitioner option.
gtsfm/graph_partitioner/eight_partitions.py Introduced a partitioner using a 3-level binary tree with METIS.
gtsfm/graph_partitioner/binary_tree_partition_visualization.py Added visualization support for binary tree partitions.
gtsfm/graph_partitioner/binary_tree_partition_test.py Added tests for the binary tree partitioner.
gtsfm/graph_partitioner/binary_tree_partition.py Implemented binary tree partitioning using METIS ordering.
environment_m3_ultra.yml Updated environment file with new dependencies.
Comments suppressed due to low confidence (1)

gtsfm/runner/gtsfm_runner_base.py:292

  • [nitpick] The commented alternative partitioner uses 'EightPartition()', but the implemented class is named 'EightPartitions'. Update the comment for consistency.
# graph_partitioner = EightPartition()

@akshay-krishnan
Copy link
Collaborator

@tiantianxiangshang629 status of this PR?

@tiantianxiangshang629 tiantianxiangshang629 force-pushed the feature/metis_partition_palace_fine_art branch from fe3e323 to 879f35a Compare June 4, 2025 03:09
@tiantianxiangshang629 tiantianxiangshang629 changed the title Metis partition palace fine art Generate binary tree partition results Jun 23, 2025
@tiantianxiangshang629 tiantianxiangshang629 changed the title Generate binary tree partition results Add BinaryTreePartition class for hierarchical image-pair partitioning Jun 23, 2025
@tiantianxiangshang629 tiantianxiangshang629 marked this pull request as ready for review June 23, 2025 15:57
Copy link
Collaborator
@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.

High level comment: we need docstrings.
At different levels: document level, class level and method/function level.
Please take a look at other gtsfm files.

@@ -90,7 +89,6 @@ def __init__(
self._pose_angular_error_thresh = pose_angular_error_thresh
self.output_root = Path( 8000 output_root)
self._output_worker = output_worker
self._create_output_directories()
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I implemented a new create_output_directories function to create the partition result directories.

else:
raise ValueError(f"Unsupported COLMAP camera type: {camera_model_name}")

intrinsics_gtsfm.append(Cal3Bundler(fx, k1, k2, cx, cy))
if camera_model_name == "OPENCV":
Copy link
Collaborator

Choose a reason for hiding this comment

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

were you able to run gtsfm with Cal3DS2? I think it was not as good as Cal3Bundler when we have used it before.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I was. The reason for using it is that Cal3Bundler does not accept those distortion arguments from OPENCV.

Copy link
Collaborator

Choose a reason for hiding this comment

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

How did you get it to run with Cal3DS2 without adding Cal3DS2 support to the bundle adjustment module? Only Cal3Bundler and Cal3Fisheye are supported I believe.

@tiantianxiangshang629 tiantianxiangshang629 force-pushed the feature/metis_partition_palace_fine_art branch from 6c4dfe3 to fd306e3 Compare July 5, 2025 05:37
Remove draft code.

Add binayr tree partition result.

Add OPENCV camera model.

Untrack binary_tree_partition_visualization.py and update .gitignore

Remove unused log.

Fix format issue.

Add docstring to binary tree partition.

Move unittest under test folder.

Remove incorrect unittest file.

Use more informative function name.

Add unittests for member functions.

Fix import format.

Remove tracked binary files and local image dataset

Remove temp scripts and image assets from version control

Remove points3D.txt from tracking
@tiantianxiangshang629 tiantianxiangshang629 force-pushed the feature/metis_partition_palace_fine_art branch from d509a4a to 57772a0 Compare July 5, 2025 05:50
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.

3 participants
0