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

feat(hesai): implement mask-based pruning filter for Hesai #251

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

mojomex
Copy link
Collaborator

@mojomex mojomex commented Jan 16, 2025

PR Type

  • New Feature

Related Links

Description

⚠️ #250 has to be merged first ⚠️

This PR implements the mask-based pruning filter introduced in #250 for all Hesai sensors. For more specifics on sensor configuration changes and filter behavior, see #250.

Review Procedure

  • Test whether pointcloud output is as expected when not specifying a filter
  • Try and create a downsample mask, e.g. in GIMP, and see if it works expected

Pre-Review Checklist for the PR Author

PR Author should check the checkboxes below when creating the PR.

  • Assign PR to reviewer

Checklist for the PR Reviewer

Reviewers should check the checkboxes below before approval.

  • Commits are properly organized and messages are according to the guideline
  • (Optional) Unit tests have been written for new behavior
  • PR title describes the changes

Post-Review Checklist for the PR Author

PR Author should check the checkboxes below before merging.

  • All open points are addressed and tracked via issues or tickets

CI Checks

  • Build and test for PR: Required to pass before the merge.

The filter takes a path to a PNG image (will be converted to grayscale) and expected resolution/channel count of the mask.

The grayscale mask is then dithered into a black/white mask of the same dimensions, and an `excluded(NebulaPoint const&)` function is provided to test whether a point shall be excluded according to the mask.

For debug purposes, the dithered mask is written to the same directory as the input mask, with the file ending changed to `_dithered.png`. If this fails, the filter will not throw but log a warning.

Signed-off-by: Max SCHMELLER <[email protected]>
@mojomex
Copy link
Collaborator Author

mojomex commented Jan 16, 2025

🟢 Self-Evaluation

🟢 Performance

Take-aways:

  • Performance impact is near 0 or negative (as in, performance improves when using the filter)
    • A disabled filter, and a filter that keeps all points, perform as well as the baseline before this PR
    • A filter discarding 50 % of points improves mean decode time by 7.4 %
    • A filter discarding all points improves mean decode time by 30.3 %

The below performance measurements have been performed with a modified decoder that measures timings of the convert_returns function and accumulates them for one scan. The filter for invalid points (distance == 0) has been disabled, as have other distance checks, to keep the number of input points artificially high ("worst-case"). The decoded number of points per cloud was around 460.000 which is around 2/3 of the maximum possible output in high-res+dual-return mode for OT128.

Decode times for different filter settings

label ('total_time', 'count') ('total_time', 'mean') ('total_time', 'std') ('total_time', 'min') ('total_time', '50%') ('total_time', 'max')
baseline 942 10.3296 0.390481 9.06057 10.3843 12.149
disabled 941 10.1409 0.296578 9.07079 10.0777 10.852
discard_all 941 7.19801 0.175469 6.94406 7.22401 7.68576
discard_half 940 9.56162 0.22284 9.16713 9.4687 10.6639
keep_all 940 10.2512 0.278572 9.13494 10.172 10.8176

@mojomex mojomex self-assigned this Jan 16, 2025
@mojomex mojomex changed the title Feat/hesai/universal downsample feat(hesai): implement mask-based pruning filter for Hesai Jan 16, 2025
@mojomex mojomex marked this pull request as draft January 16, 2025 05:59
@mojomex mojomex force-pushed the feat/hesai/universal-downsample branch from 9cde2d2 to cb20367 Compare January 16, 2025 08:26
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 58.69565% with 57 lines in your changes missing coverage. Please review.

Project coverage is 27.62%. Comparing base (97959dd) to head (cb20367).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
..._decoders_common/point_filters/downsample_mask.hpp 66.66% 15 Missing and 2 partials ⚠️
nebula_ros/src/hesai/hesai_ros_wrapper.cpp 0.00% 17 Missing ⚠️
...oders/tests/point_filters/test_downsample_mask.cpp 79.59% 0 Missing and 10 partials ⚠️
...s/nebula_decoders_hesai/decoders/hesai_decoder.hpp 40.00% 4 Missing and 2 partials ⚠️
nebula_ros/src/hesai/decoder_wrapper.cpp 0.00% 5 Missing ⚠️
.../nebula_decoders/nebula_decoders_common/angles.hpp 0.00% 0 Missing and 1 partial ⚠️
...ecoders/src/nebula_decoders_hesai/hesai_driver.cpp 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #251      +/-   ##
==========================================
+ Coverage   26.07%   27.62%   +1.54%     
==========================================
  Files         101      107       +6     
  Lines        9232     9580     +348     
  Branches     2213     2387     +174     
==========================================
+ Hits         2407     2646     +239     
- Misses       6436     6484      +48     
- Partials      389      450      +61     
Flag Coverage Δ
differential 27.62% <58.69%> (?)
total ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mojomex mojomex requested review from knzo25 and drwnz January 17, 2025 06:06
@mojomex mojomex marked this pull request as ready for review January 17, 2025 06:06
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.

1 participant