-
Notifications
You must be signed in to change notification settings - Fork 640
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
fix(euclidean_cluster): fix euclidean cluster params #7662
fix(euclidean_cluster): fix euclidean cluster params #7662
Conversation
Signed-off-by: beginningfan <[email protected]>
Signed-off-by: beginningfan <[email protected]>
Signed-off-by: beginningfan <[email protected]>
@badai-nguyen Can I ask you to review this? |
@beginningfan Thank you for your PR and raising issue.
Could you check the issue that you raised again, and let me known if you have further comment. |
@badai-nguyen thanks for your reply. |
@@ -124,6 +124,10 @@ bool VoxelGridBasedEuclideanCluster::cluster( | |||
&temporary_clusters.at(map[index]).data[cluster_data_size], | |||
&pointcloud_msg->data[i * point_step], point_step); | |||
cluster_data_size += point_step; | |||
if (cluster_data_size == temporary_clusters.at(map[index]).data.size()) { | |||
temporary_clusters.at(map[index]) | |||
.data.resize(temporary_clusters.at(map[index]).data.size() * 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using the maximum value to allocate space will cause excessive CPU and memory usage.
@beginningfan I agree with you.
However, I think decide that the max size of output cluster (cluster_data_size
) to be doubled of temporary_cluster is not reasonable. (runtime_error might be occurred here for some high dense pointcloud)
.data.resize(temporary_clusters.at(map[index]).data.size() * 2); | |
.data.resize(max_cluster_size_ * point_step); |
Or we can increment cluster_data_size
and check it repeatedly.
if (cluster_data_size >= temporary_clusters.at(map[index]).data.size()) {
temporary_clusters.at(map[index]).data.resize(cluster_data_size + point_step * 10);
}
std::memcpy(
&temporary_clusters.at(map[index]).data[cluster_data_size],
&pointcloud_msg->data[i * point_step], point_step);
cluster_data_size += point_step;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a for loop
that reallocates twice the space every time the space is full. When the space is full, it will twice the space again.I have tested using a ouster64, and the dense pointcloud is sometimes 50 times larger than the downsampled one. Even so, enough space can be allocated quickly.
If you use max_cluster_size_
, it might as well just use the original code. If we add 10 points each time, this will result in multiple copies of the vector data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@beginningfan I understood. I have checked and it worked well. Thank you for your improvement.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7662 +/- ##
==========================================
- Coverage 15.09% 2.56% -12.54%
==========================================
Files 1967 201 -1766
Lines 135941 10420 -125521
Branches 42122 1744 -40378
==========================================
- Hits 20520 267 -20253
+ Misses 92700 10097 -82603
+ Partials 22721 56 -22665
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
@mitsudome-r The reviewer of this PR has approved it. Can it be merged now? |
…ion#7662) * fix(euclidean_cluster): fix max and min cluster size Signed-off-by: beginningfan <[email protected]> * fix(gnss_poser): fix a typo Signed-off-by: beginningfan <[email protected]> * fix(euclidean_cluster): fix min cluster size Signed-off-by: beginningfan <[email protected]> * style(pre-commit): autofix --------- Signed-off-by: beginningfan <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…ion#7662) * fix(euclidean_cluster): fix max and min cluster size Signed-off-by: beginningfan <[email protected]> * fix(gnss_poser): fix a typo Signed-off-by: beginningfan <[email protected]> * fix(euclidean_cluster): fix min cluster size Signed-off-by: beginningfan <[email protected]> * style(pre-commit): autofix --------- Signed-off-by: beginningfan <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…1378) * fix(euclidean_cluster): fix euclidean cluster params (autowarefoundation#7662) * fix(euclidean_cluster): fix max and min cluster size Signed-off-by: beginningfan <[email protected]> * fix(gnss_poser): fix a typo Signed-off-by: beginningfan <[email protected]> * fix(euclidean_cluster): fix min cluster size Signed-off-by: beginningfan <[email protected]> * style(pre-commit): autofix --------- Signed-off-by: beginningfan <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(euclidean_cluster): fix max_cluster_size bug (autowarefoundation#7734) Signed-off-by: badai-nguyen <[email protected]> * fix(ground_segmentation): fix bug (autowarefoundation#7771) --------- Signed-off-by: beginningfan <[email protected]> Signed-off-by: badai-nguyen <[email protected]> Co-authored-by: beginningfan <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Shunsuke Miura <[email protected]>
…ion#7662) * fix(euclidean_cluster): fix max and min cluster size Signed-off-by: beginningfan <[email protected]> * fix(gnss_poser): fix a typo Signed-off-by: beginningfan <[email protected]> * fix(euclidean_cluster): fix min cluster size Signed-off-by: beginningfan <[email protected]> * style(pre-commit): autofix --------- Signed-off-by: beginningfan <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: palas21 <[email protected]>
…ion#7662) * fix(euclidean_cluster): fix max and min cluster size Signed-off-by: beginningfan <[email protected]> * fix(gnss_poser): fix a typo Signed-off-by: beginningfan <[email protected]> * fix(euclidean_cluster): fix min cluster size Signed-off-by: beginningfan <[email protected]> * style(pre-commit): autofix --------- Signed-off-by: beginningfan <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* fix(euclidean_cluster): fix max and min cluster size Signed-off-by: beginningfan <[email protected]> * fix(gnss_poser): fix a typo Signed-off-by: beginningfan <[email protected]> * fix(euclidean_cluster): fix min cluster size Signed-off-by: beginningfan <[email protected]> * style(pre-commit): autofix --------- Signed-off-by: beginningfan <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Description
Fix bug 2 about
max_cluster_size_
related in hereThe bug about
min_cluster_size
is a mistake and it should not to be changedTests performed
use a large
max_cluster_size_
will not take too much CPU and memoryEffects on system behavior
Not applicable.
Interface changes
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.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.