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

perf(voxel_grid_downsample_filter): performance tuning #3679

Conversation

atsushi421
Copy link
Contributor

@atsushi421 atsushi421 commented May 11, 2023

Description

This PR makes voxel_grid_downsample_filter faster without changing the logical output.
The tail latency of the voxel_grid_downsample_filter node gets about x2.3 faster with this PR merged.
image

Measurement Condition

Related links

Tests performed

I have comfirmed the following between point clouds with the same timestamp before and after this PR:

  • the number of point clouds is the same
  • the distance between the nearest point is less than 0.001
  • the 3D plot results are almost identical

To reproduce: https://drive.google.com/drive/folders/1mON3GN-2v8uUPjw1oejasflOP_O-V0kc?usp=share_link

Notes for reviewers

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.
  • The PR is ready for merge.

After all checkboxes are checked, anyone who has write access can merge the PR.

atsushi421 added 3 commits April 23, 2023 07:52
@github-actions github-actions bot added the component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) label May 11, 2023
@atsushi421 atsushi421 changed the title Performance tuning for voxel grid downsample filger perf(voxel_grid_downsample_filter): performance tuning May 11, 2023
@atsushi421 atsushi421 marked this pull request as ready for review May 12, 2023 09:30
@atsushi421 atsushi421 requested review from amc-nu, miursh, yukkysaito and a team as code owners May 12, 2023 09:30
@yukkysaito
Copy link
Contributor

@atsushi421 Thank you for your PR 👍 I just commented

Signed-off-by: atsushi421 <yff81986@nifty.com>
@atsushi421 atsushi421 marked this pull request as draft May 15, 2023 21:19
pre-commit-ci bot and others added 7 commits May 15, 2023 21:21
Signed-off-by: atsushi421 <yff81986@nifty.com>
Signed-off-by: atsushi421 <yff81986@nifty.com>
Signed-off-by: atsushi421 <yff81986@nifty.com>
Signed-off-by: atsushi421 <yff81986@nifty.com>
Signed-off-by: atsushi421 <yff81986@nifty.com>
@atsushi421 atsushi421 marked this pull request as ready for review May 16, 2023 23:56
@atsushi421
Copy link
Contributor Author

@yukkysaito
Thank you for your review!
I have carved out the filtering process into a separate class to improve readability.
It is also possible to switch to the PCL voxel grid filter by calling filter() instead of faster_filter().

@atsushi421 atsushi421 requested a review from yukkysaito May 16, 2023 23:57
@@ -0,0 +1,92 @@
// Copyright 2020 Tier IV, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Copyright 2020 Tier IV, Inc.
// Copyright 2023 TIER IV, Inc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 6451075.

Copy link
Contributor

Choose a reason for hiding this comment

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

@atsushi421 Looks like no change 🙏

@yukkysaito
Copy link
Contributor

@atsushi421 Thank you for your modification 👍 it is looks like almost good!

I compared the publish messages before and after this PR and confirmed that the data sizes for the same timestamps matched.

Are you able to confirm that the point clouds are the same, not just the data size? 🙏
image

@atsushi421 atsushi421 marked this pull request as draft May 27, 2023 21:38
atsushi421 and others added 7 commits May 28, 2023 06:46
Signed-off-by: atsushi421 <yff81986@nifty.com>
Signed-off-by: atsushi421 <yff81986@nifty.com>
Signed-off-by: atsushi421 <yff81986@nifty.com>
Signed-off-by: atsushi421 <yff81986@nifty.com>
@atsushi421
Copy link
Contributor Author

@atsushi421 Thank you for your modification +1 it is looks like almost good!

I compared the publish messages before and after this PR and confirmed that the data sizes for the same timestamps matched.

Are you able to confirm that the point clouds are the same, not just the data size? pray image

@yukkysaito
Thank you for your considerate comments.
Upon inspection, it was observed that the point clouds did not match exactly, most likely due to the floating point calculation process.
As an alternative approach, a threshold was defined for the point-to-point distance, and it was verified that the change in coordinates between the points before and after this pull request remained below the threshold.
Additionally, point clouds with the same timestamp were plotted on shared 3D coordinates to visually confirm minimal discrepancies.
For further details, please refer to the "Tests Performed" section of this pull request.

@atsushi421 atsushi421 marked this pull request as ready for review May 29, 2023 07:46
@atsushi421 atsushi421 requested a review from yukkysaito May 29, 2023 07:47
atsushi421 added 2 commits May 29, 2023 18:24
Signed-off-by: atsushi421 <yff81986@nifty.com>
Signed-off-by: atsushi421 <yff81986@nifty.com>
Copy link
Contributor

@yukkysaito yukkysaito left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a typo in filename: dowNsample

// See the License for the specific language governing permissions and
// limitations under the License.

#include "pointcloud_preprocessor/downsample_filter/faster_voxel_grid_dowmsample_filter.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Signed-off-by: atsushi421 <yff81986@nifty.com>
@atsushi421
Copy link
Contributor Author

@ralwing
Thank you for pointing this out.
I have corrected the typo (e5d40f0).

@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.02 ⚠️

Comparison is base (6c6973b) 14.38% compared to head (8742484) 14.37%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3679      +/-   ##
==========================================
- Coverage   14.38%   14.37%   -0.02%     
==========================================
  Files        1563     1566       +3     
  Lines      107631   107725      +94     
  Branches    31175    31175              
==========================================
  Hits        15481    15481              
- Misses      75325    75419      +94     
  Partials    16825    16825              
Flag Coverage Δ *Carryforward flag
differential 7.52% <0.00%> (?)
total 14.38% <ø> (+<0.01%) ⬆️ Carriedforward from 6c6973b

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
...cessor/crop_box_filter/crop_box_filter_nodelet.hpp 0.00% <ø> (ø)
...ple_filter/faster_voxel_grid_downsample_filter.hpp 0.00% <0.00%> (ø)
...ocessor/include/pointcloud_preprocessor/filter.hpp 0.00% <ø> (ø)
...sor/outlier_filter/ring_outlier_filter_nodelet.hpp 0.00% <ø> (ø)
...include/pointcloud_preprocessor/transform_info.hpp 0.00% <0.00%> (ø)
...ple_filter/faster_voxel_grid_downsample_filter.cpp 0.00% <0.00%> (ø)
...le_filter/voxel_grid_downsample_filter_nodelet.cpp 0.00% <0.00%> (ø)
sensing/pointcloud_preprocessor/src/filter.cpp 7.84% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@atsushi421 atsushi421 merged commit edcad42 into autowarefoundation:main Jun 23, 2023
Shin-kyoto added a commit to Shin-kyoto/autoware.universe that referenced this pull request Sep 10, 2023
Shin-kyoto added a commit to Shin-kyoto/autoware.universe that referenced this pull request Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants