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

CUDA RANSAC implementation #21

Merged
merged 72 commits into from
Mar 23, 2024
Merged

CUDA RANSAC implementation #21

merged 72 commits into from
Mar 23, 2024

Conversation

true-real-michael
Copy link
Collaborator

@true-real-michael true-real-michael commented Feb 5, 2024

This PR introduces CUDA RANSAC implementation.

  • The file octreelib/ransac/cuda_ransac.py contains new logic related to the RANSAC implementation.
  • A new method map_leaf_points_cuda is implemented for class Grid. It accepts an instance of class CudaRansac as a function.
  • The solution works as follows:
    1. For each pose point clouds from all voxels are concatenated forming a combined point cloud for one pose. The indices where they should be divided are recorded into an array.
    2. These combined point clouds are concatenated again forming a combined point cloud for the whole grid. The indices where poses should be divided are recorded into another array.
    3. The combined point cloud along with the divider indices and block sizes (block = slice of a point cloud where all points belong to one voxel) are passed to CudaRansac.evaluate() which calls the kernel function.
    4. The kernel function computes 1024 masks based on random hypotheses for each block) (picture)
    5. The masks are obtained and the best one is chosen for each block individually.
    6. The masks are applied to the octree leaves.

Untitled

The numba usage in this solution is based on PyPRANSAC.

TODO:

  • This solution cannot test over 1024 hypotheses, needs to be fixed.

octreelib/grid/grid.py Outdated Show resolved Hide resolved
octreelib/grid/grid.py Outdated Show resolved Hide resolved
octreelib/grid/grid.py Outdated Show resolved Hide resolved
octreelib/octree/octree_base.py Show resolved Hide resolved
octreelib/ransac/__init__.py Show resolved Hide resolved
test/grid/test_grid.py Outdated Show resolved Hide resolved
octreelib/ransac/cuda_ransac.py Outdated Show resolved Hide resolved
true-real-michael and others added 11 commits February 19, 2024 20:35
this commit contains temp edits and comments for ones who wish to continue on this implementation while i am unavailable
* process poses in batches to avoid running out of memory

* fix imports

* make n poses per batch a parameter

* fix number of processed blocks

* remove unnecessary imports and fix black

* remove unnecessary imports and fix black
@true-real-michael true-real-michael marked this pull request as ready for review March 21, 2024 07:58
# Conflicts:
#	.github/workflows/test.yml
octreelib/grid/grid.py Outdated Show resolved Hide resolved
octreelib/grid/grid.py Outdated Show resolved Hide resolved
octreelib/grid/grid.py Outdated Show resolved Hide resolved
octreelib/ransac/initial_points_config.py Outdated Show resolved Hide resolved
octreelib/ransac/cuda_ransac.py Outdated Show resolved Hide resolved
octreelib/ransac/cuda_ransac.py Outdated Show resolved Hide resolved
octreelib/ransac/cuda_ransac.py Outdated Show resolved Hide resolved
octreelib/ransac/util.py Show resolved Hide resolved
@true-real-michael true-real-michael merged commit cd403fb into main Mar 23, 2024
4 checks passed
@true-real-michael true-real-michael deleted the cuda-ransac branch April 5, 2024 17:43
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.

2 participants