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

Correct testPoint for organized nearest neighbor search #2198

Conversation

wannesvanloock
Copy link
Contributor

I was seeing occasional spikes in the computation time for organized kNN search. This is due to the search box not being updated when adding the k-th neighbor and subsequent iterations of the do-while loop in kNN search never trigger the else case in testPoint. This way we iterate over way too many points during search.

The plot below shows a histogram of the log10 computation time before (top) and after (bottom) the fix for k=20 for every point on a particularly problematic point cloud. Note the grouping around -3 on the before plot. On this point cloud, this reduces the average computation time of nearest neighbor searches by a factor 20. On other clouds I see around a factor 2 improvement.

organized_neighbor

I was perceiving occasional spikes in the computation time for
kNN search. This is due to the search box not being updated when
adding the k-th neighbor and subsequent iterations of the do-while
loop in kNN search never trigger the else case in testPoint. This
way we iterate over way too many points during search.
@wannesvanloock wannesvanloock force-pushed the fix/organized_nearest_neighbor branch from 44adb56 to ae742e9 Compare January 29, 2018 14:03
@SergioRAgostinho SergioRAgostinho added the needs: code review Specify why not closed/merged yet label Jan 29, 2018
@wannesvanloock
Copy link
Contributor Author

Friendly ping to the developers. What is holding back review on this PR? Is there anything I can do to accelerate the process?

@taketwo
Copy link
Member

taketwo commented Feb 16, 2018

Could you please explain why it is not return true; in the line you added? In other words, if the we pushed a point to the queue, doesn't this mean that it is among k neighbors?

@wannesvanloock
Copy link
Contributor Author

This line should get called whenever the top element in the results queue changes (As long as the queue is not full it should return false). However, this did not happen when the k-th element was added. Causing the search box to never be updated, and therefore the search continues for too long.

Copy link
Member

@taketwo taketwo left a comment

Choose a reason for hiding this comment

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

Thanks for clarification

@SergioRAgostinho SergioRAgostinho removed the needs: code review Specify why not closed/merged yet label Feb 16, 2018
@SergioRAgostinho SergioRAgostinho merged commit 43006c3 into PointCloudLibrary:master Feb 16, 2018
@taketwo taketwo added this to the pcl-1.9.0 milestone Feb 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants