Improved performance of function geometry::PointCloud::RemoveRadiusOutliers, function geometry::ClusterDBSCAN and feature counting - #6676
Conversation
|
Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes. |
|
Hi @PiatrouskiIM thanks for this optimization! Can you provide some benchmark results of speed comparisons with the code in the |
|
@PiatrouskiIM SearchHybrid is implemented on top of radius search. Can you give an idea of which changes contribute the most to the performance improvement? |
|
I was mistaken about the presence of performance improvements when switching to SearchHybrid (my tests sets were regenerated when running benchmark of the another implementation). |
|
@benjaminum, SearchHybrid is implemented on top of SearchKNN, which is usually implemented differently (I won’t say for nanoflann, but I saw the implementation from scipy written in c). I was wrong about improving performance; it’s more likely a trade-off in favor of searching by radius. There are improvements only if there are many more points in the radius than the set threshold. I can prepare a more detailed comparison to find a visual tradeoff, but it seems that most often searching by radius is almost twice as fast. |
|
Sounds good. Looking forward to the comparison! |
There was a problem hiding this comment.
Pull request overview
This PR focuses on performance optimizations in legacy (Eigen-based) point cloud processing and registration feature computation by reducing expensive neighbor-search work and simplifying DBSCAN bookkeeping.
Changes:
- Use
KDTreeFlann::SearchHybridinPointCloud::RemoveRadiusOutliersto early-exit once enough neighbors are found. - Refactor
PointCloud::ClusterDBSCANcluster expansion to avoid per-clusterunordered_settracking, relying on labels and a vector worklist instead. - Simplify
ComputePairFeaturesby replacingacos(fabs(..))comparisons with an equivalentfabs(..)comparison.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cpp/open3d/pipelines/registration/Feature.cpp | Avoids acos() calls in pair-feature ordering logic. |
| cpp/open3d/geometry/PointCloudCluster.cpp | Refactors DBSCAN expansion loop to reduce hashing overhead. |
| cpp/open3d/geometry/PointCloud.cpp | Switches radius outlier counting to hybrid search with a max neighbor cap. |
…ed list + unvisited list
…tliers function" This reverts commit 796d8e6.
|
Reverted switch from radius -> hybrid search:
|
Type
Motivation and Context
Performance improvements.
Checklist:
python util/check_style.py --applyto apply Open3D code styleto my code.
updated accordingly.
results (e.g. screenshots or numbers) here.
Description
2.0 When clustering in PointCloud::ClusterDBSCAN, a set of visited points is created for each new cluster. Elements are added to this set based on the presence of a certain label. This set is subsequently used to add elements to the set of unvisited points. The same thing can be done much more efficiently based only on labels.
2.1 And there is also no need to represent the collection of unvisited points as an unordered set, given that the only difference is the additional protection against duplication when adding a new element.