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

Improve RadiusOutlierRemoval's performance #709

Merged
merged 1 commit into from
Oct 21, 2014

Conversation

Falcon4
Copy link
Contributor

@Falcon4 Falcon4 commented May 28, 2014

Change search & check method.
radius-serach & check k --> k-search & check radius

@Falcon4
Copy link
Contributor Author

Falcon4 commented May 28, 2014

Performance became at least twice faster than present

@Falcon4 Falcon4 closed this May 28, 2014
@VictorLamoine
Copy link
Contributor

Hey, thanks for your contribution ! I've seen your post on the PCL user list;
Why did you close the pull request ? If you can; open it again, otherwise make a new one 😉

@Falcon4 Falcon4 reopened this May 28, 2014
@Falcon4
Copy link
Contributor Author

Falcon4 commented May 28, 2014

Sory.
I don't understand how to use a pull request well.
Now I reopen it.

@VictorLamoine
Copy link
Contributor

There is something wrong with your code. The results are not the same and its much slower!
https://gist.github.com/VictorLamoine/f7470a7f1faf2559d7b0#file-radiusoutlierremoval

Original code

Point cloud size: 307200
Computation time: 1265 ms
Cloud filtered size: 212758

Your code (it takes an eternity!)

Point cloud size: 307200
Computation time: 559581 ms
Cloud filtered size: 280883

@Falcon4
Copy link
Contributor Author

Falcon4 commented May 29, 2014

Dear Victor Lamoine.

I test RadiusOutlierRemoval performance again, but I can’t replicate below situation.
https://gist.github.com/Falcon4/9c23f6dd9754a081589a

I send my data file.
https://github.com/Falcon4/CloudDataForTest
If you send your data to me, I will try it.

Best regard.

@VictorLamoine
Copy link
Contributor

Give it a try, compile and install your PCL version with the modifications then test with your PCD file;

Original code:

$ ./radiusOutlierRemoval CloudRaw01.pcd 
Point cloud size: 307200
Computation time: 3153 ms
Cloud filtered size: 242000

Your code:

[100%] Built target radiusOutlierRemoval
Point cloud size: 307200
Computation time: 586252 ms
Cloud filtered size: 307186

It's not normal that I don't get the same results, and it took nearly 10 minutes!

@Falcon4
Copy link
Contributor Author

Falcon4 commented Jun 2, 2014

Hi

I tried your test code, but runtime error is occured in organized.hpp line 57.
So, I remove a NaN value from a point cloud data before filter processing, and get a different result.
https://github.com/Falcon4/CloudDataForTest

[Original code]
Point cloud size: 242014
Computation time: 60892 ms
Cloud filterd size: 242000

[My code]
Point cloud size: 242014
Computation time: 11041 ms
Cloud filterd size: 242000

I changed a computer ,OS, and IDE.
Computer: Dell Precision T7500 (Intel Xeon Quad) --> Dell Precision T3400 (Intel Core2 Dual)
OS :Window 7 64bit --> Windows XP 32bit
IDE :Qt creator --> Visual Studio 2010

I think that NaN test in pcl::search::OrganizedNeighbor::radiusSearch() is ignored in Linux.
If you remove a NaN value before filtering process, you will get a non eternity result.
Please tyr it.

If NaN value removal code is needed like a statistical_outlier_removal.hpp line 97,
Please tell me how to treat a NaN value.

Cheers

@VictorLamoine
Copy link
Contributor

Hello,

Ok I can reproduce your results now:

Original code

$ ./radius_outlier_removal ../CloudRaw01.pcd
Point cloud size: 307200
Computation time: 3196 ms
Cloud filtered size: 242000

$ ./radius_outlier_removal ../CloudRaw01.pcd
Point cloud size: 307200
Computation time: 3204 ms
Cloud filtered size: 242000

$ ./radius_outlier_removal ../CloudRaw01_noNaN.pcd
Point cloud size: 242014
Computation time: 5086 ms
Cloud filtered size: 242000

$ ./radius_outlier_removal ../CloudRaw01_noNaN.pcd
Point cloud size: 242014
Computation time: 5068 ms
Cloud filtered size: 242000

Falcon4 code:

$ ./radius_outlier_removal ../CloudRaw01.pcd
Point cloud size: 307200
Computation time: 175009 ms
Cloud filtered size: 307186

$ ./radius_outlier_removal ../CloudRaw01_noNaN.pcd
Point cloud size: 242014
Computation time: 1054 ms
Cloud filtered size: 242000

When using a point cloud with NaN the results are not the same between the original/Falcon4 code
Your code is slower when using a point cloud with NaN (only on Linux ?)
Your code is faster when using a point cloud with no NaN values.

There are still things that need to be fixed!
Bye

@Falcon4
Copy link
Contributor Author

Falcon4 commented Jun 5, 2014

Hi

I add a NaN skip code to applyFilterIndices function, and reproduce your result too.
A point cloud with NaN is slower than a point cloud without NaN.
https://github.com/Falcon4/CloudDataForTest

[Point cloud without NaN]
Point cloud size: 242014
Computation time:11203 ms
Cloud filterd size:24200

[Point cloud with NaN]
Point cloud size: 307200
Computation time: 87659 ms
Cloud filterrs size:24200

I coud't test Original, Because runtime error occured.
See RuntimeErrorOriginal.JPG and error_in_organized_hpp.JPG

I tested StaticalOutlierRemoval, and get similar result too.
I think that Flann's k-search can't treat NaN data well

Bye

@taketwo
Copy link
Member

taketwo commented Jun 7, 2014

So what is the conclusion after all? Will we actually downgrade performance for at least some users?

@Falcon4
Copy link
Contributor Author

Falcon4 commented Jun 9, 2014

Hi

If PCL request that "user must remove NaN value before filtering", my code is faster than original.
And StaticalOutlierRemoval will be faster too.
I think that organized.hpp line 57 request it.

I don't know which is better.(To be or not to be.)
I think that it is a PCL's policy.

Bye

@Falcon4
Copy link
Contributor Author

Falcon4 commented Jun 9, 2014

Hi

Is it possible to remove NaN data in setInputCloud() function? (override)
I think that performance is better than original and get same result in Linux.
And Inprove StaticalOutlierRemoval performance too.

If it 's OK, I will try it.

Bye

@VictorLamoine
Copy link
Contributor

@Falcon4 The problem is that RadiusOutlierRemoval should remove only outliers, not NaN values!

@Falcon4
Copy link
Contributor Author

Falcon4 commented Jun 24, 2014

Hi

I changed applyIndices() function like voxel_grid.hpp L61.
if cloud's is_dense flag is true process my code, other process original code.
I think that if cloud's is_dense flag correct, it work well.

But after I merged source code, Failed message indicate below.
Anything wrong?

Bye

@jspricke
Copy link
Member

Hi,

the failed Travis build is an internal Travis error, nothing to worry about.

For your code, I think just testing is_dense is not the right parameter to test, as other point clouds could contain NaN values as well. I don't think there is an easy solution to check for NaN points, apart from checking all points. In that case I would propose to move this into an extra algorithm, so we can call it if we are sure to have no NaNs.

@Falcon4
Copy link
Contributor Author

Falcon4 commented Jul 31, 2014

Hi,

I understand your test result.
Is there anything should I do about this pull request?
If there is, please request me.

Bye

@jspricke
Copy link
Member

jspricke commented Oct 1, 2014

Sorry for taking so long an please forget my comment about ``is_dense` from July. I'm fine with merging this if you can squash your commits into one. Thanks!

@Falcon4
Copy link
Contributor Author

Falcon4 commented Oct 17, 2014

Sorry. I missed operation (Push Revert in GitHub), so I repush a previous source code again.
And I have a problem that, I don't know how to squash my commits well.
Today, I tryid squash in local repository, but I missed it.
I think that, I squashed other's commit.
I want to roll back to "Change flow int applayFilterIndices".
Is it possible?
If you know how to do that, please teach me.
Bye

@jspricke
Copy link
Member

Have a look here: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html. Basically you need git rebase -i HEAD~6, mark the second and third as fixup and remove the lines for the last two commits. If all is fine, you can push it using the --force option. Thanks!

@Falcon4
Copy link
Contributor Author

Falcon4 commented Oct 20, 2014

I did a squash operation, and made three commit.
It doesn't seems to into one.
Is it ok?
If I missed, please advice me again.
Bye

@jspricke
Copy link
Member

Almost ;), you have now 8 commits in your branch: https://github.com/PointCloudLibrary/pcl/pull/709/commits. I don't think you need three commits, but if, you should add reasonable commit messages. Also, do a git push -f, instead of the merge to get rid of the old commits.

radius-serach & check k --> k-search & check radius
@Falcon4
Copy link
Contributor Author

Falcon4 commented Oct 21, 2014

I think that I can squash my commit into one.
Please check it.
Bye

jspricke added a commit that referenced this pull request Oct 21, 2014
Improve RadiusOutlierRemoval's performance
@jspricke jspricke merged commit 22c9449 into PointCloudLibrary:master Oct 21, 2014
@jspricke
Copy link
Member

Thanks alot! And sorry for the long delay.

@Falcon4
Copy link
Contributor Author

Falcon4 commented Oct 21, 2014

Thank you for your advice about git too.

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.

4 participants