-
Notifications
You must be signed in to change notification settings - Fork 673
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(image_projection_based_fusion): add cache for camera projection #9635
feat(image_projection_based_fusion): add cache for camera projection #9635
Conversation
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
3a0b75c
to
be70bd7
Compare
d518133
to
bf52055
Compare
bf52055
to
6e00c9c
Compare
Signed-off-by: a-maumau <[email protected]>
Signed-off-by: a-maumau <[email protected]>
3822a96
to
b445034
Compare
Signed-off-by: a-maumau <[email protected]>
Can you also update the schema file? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9635 +/- ##
==========================================
- Coverage 29.80% 29.78% -0.03%
==========================================
Files 1443 1446 +3
Lines 108590 108696 +106
Branches 42653 42691 +38
==========================================
+ Hits 32369 32370 +1
- Misses 73042 73145 +103
- Partials 3179 3181 +2
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: a-maumau <[email protected]>
@technolojin I changed the terms in bc1e8ed |
Signed-off-by: a-maumau <[email protected]>
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.
Just rename some variables.
- avoid to use too general name such as
index
: more specify likegrid_index
- name as its role:
grid_x
->grid_idx_x
- align naming style: since
cell_width_
is used,image_w_
->image_width_
perception/autoware_image_projection_based_fusion/src/camera_projection.cpp
Outdated
Show resolved
Hide resolved
perception/autoware_image_projection_based_fusion/src/camera_projection.cpp
Outdated
Show resolved
Hide resolved
perception/autoware_image_projection_based_fusion/src/camera_projection.cpp
Outdated
Show resolved
Hide resolved
perception/autoware_image_projection_based_fusion/src/camera_projection.cpp
Outdated
Show resolved
Hide resolved
...projection_based_fusion/include/autoware/image_projection_based_fusion/camera_projection.hpp
Outdated
Show resolved
Hide resolved
Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]>
Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]>
Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]>
Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]>
Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]>
Signed-off-by: a-maumau <[email protected]>
4bdbbcf
to
542ed48
Compare
@technolojin I applied the suggestions. thank you for pointing out! |
Test the PR in TIER IV INTERNAL CLOUD TESTER |
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
@badai-nguyen @YoshiRi @yukkysaito Can you review this PR? This PR has been tested. |
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.
@a-maumau Thank you for your great idea and PR. I have minor comments.
...image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp
Outdated
Show resolved
Hide resolved
118ca9b
to
899a267
Compare
Co-authored-by: badai nguyen <[email protected]> Signed-off-by: a-maumau <[email protected]>
Co-authored-by: badai nguyen <[email protected]> Signed-off-by: a-maumau <[email protected]>
899a267
to
c3317ac
Compare
@badai-nguyen Thank you for pointing out. I applied your suggestions. |
@@ -65,6 +65,21 @@ | |||
"type": "number", | |||
"description": "Maximum z position [m].", | |||
"default": 100.0 | |||
}, |
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.
point_project_to_unrectified_image
parameter was missing from previous PR, could also add it?
}, | |
}, | |
"point_project_to_unrectified_image": { | |
"type": "array", | |
"description": "An array of options indicating whether to project point to unrectified image or not.", | |
"default": [false, false, false, false, false, false] | |
}, |
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.
resolved 3b0bbd0
Signed-off-by: Taekjin LEE <[email protected]>
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
…utowarefoundation#9635) * add camera_projection class and projection cache Signed-off-by: a-maumau <[email protected]> * style(pre-commit): autofix * fix FOV filtering Signed-off-by: a-maumau <[email protected]> * style(pre-commit): autofix * remove unused includes Signed-off-by: a-maumau <[email protected]> * update schema Signed-off-by: a-maumau <[email protected]> * fix cpplint error Signed-off-by: a-maumau <[email protected]> * apply suggestion: more simple and effcient computation Signed-off-by: a-maumau <[email protected]> * correct terminology Signed-off-by: a-maumau <[email protected]> * style(pre-commit): autofix * fix comments Signed-off-by: a-maumau <[email protected]> * fix var name Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]> * fix variable names Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]> * fix variable names Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]> * fix variable names Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]> * fix variable names Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]> * fix variable names Signed-off-by: a-maumau <[email protected]> * fix initialization Co-authored-by: badai nguyen <[email protected]> Signed-off-by: a-maumau <[email protected]> * add verification to point_project_to_unrectified_image when loading Co-authored-by: badai nguyen <[email protected]> Signed-off-by: a-maumau <[email protected]> * chore: add option description to project points to unrectified image Signed-off-by: Taekjin LEE <[email protected]> --------- Signed-off-by: a-maumau <[email protected]> Signed-off-by: Taekjin LEE <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Taekjin LEE <[email protected]> Co-authored-by: badai nguyen <[email protected]> Co-authored-by: Taekjin LEE <[email protected]>
…utowarefoundation#9635) * add camera_projection class and projection cache Signed-off-by: a-maumau <[email protected]> * style(pre-commit): autofix * fix FOV filtering Signed-off-by: a-maumau <[email protected]> * style(pre-commit): autofix * remove unused includes Signed-off-by: a-maumau <[email protected]> * update schema Signed-off-by: a-maumau <[email protected]> * fix cpplint error Signed-off-by: a-maumau <[email protected]> * apply suggestion: more simple and effcient computation Signed-off-by: a-maumau <[email protected]> * correct terminology Signed-off-by: a-maumau <[email protected]> * style(pre-commit): autofix * fix comments Signed-off-by: a-maumau <[email protected]> * fix var name Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]> * fix variable names Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]> * fix variable names Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]> * fix variable names Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]> * fix variable names Signed-off-by: a-maumau <[email protected]> Co-authored-by: Taekjin LEE <[email protected]> * fix variable names Signed-off-by: a-maumau <[email protected]> * fix initialization Co-authored-by: badai nguyen <[email protected]> Signed-off-by: a-maumau <[email protected]> * add verification to point_project_to_unrectified_image when loading Co-authored-by: badai nguyen <[email protected]> Signed-off-by: a-maumau <[email protected]> * chore: add option description to project points to unrectified image Signed-off-by: Taekjin LEE <[email protected]> --------- Signed-off-by: a-maumau <[email protected]> Signed-off-by: Taekjin LEE <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Taekjin LEE <[email protected]> Co-authored-by: badai nguyen <[email protected]> Co-authored-by: Taekjin LEE <[email protected]>
Description
This PR introduces a caching feature for calculating raw image projections (unrectifyPoint).
This PR must merged with autowarefoundation/autoware_launch#1275
It introduces the CameraProjection class to handle the related processes. The cache is computed based on specific grid centers, and the projected points are represented using these grid centers. These grid centers are determined by
approximation_grid_cell_width
andapproximation_grid_cell_height
.Pre-cached result will be simply stored in an array and all grid cells on the image will be pre-computed.
For example, when approximation_grid_cell_* is set to 1.0 pixel, the grid centers will be created as shown in the following image:
Note that edge pixels ((w, *), (*, h)) will be rounded to fall outside the image bounds.
memory consumption
When using caching, memory consumption is calculated as:
ceil(image_width / grid_cell_width) * ceil(image_height / grid_cell_height) * (4 * 2) * roi_numbers [bytes]
Here, (4 * 2) represents the bytes for two float values.
For example, for an image with dimensions 1440 × 1080, a grid size of 1 pixel, and caching enabled for 6 cameras, the memory consumption is:
(1440 / 1.0) * (1080 / 1.0) * 4 * 2 * 6 / (1024 * 1024) ≈ 71.2 MiB (theoretical).
Also when using the cache feature, it requires an initialization step (pre-caching). This will make some delay to a node before starting the processing.
Other changes
pointpainting_fusion
.point_project_to_unrectified_image
paramPerformance: current impl. vs. this PR
map_based_prediction
node, so there is no guarantee it is aligned.baseline
indicates the current implementation,unrectified
is thepoint_project_to_unrectified_image
andcache
meansapproximate_camera_projection
option in the config.Processing Time
roi_cluster_fusion
all processing times
current
point_project_to_unrectified_image=false
vs. this PRpoint_project_to_unrectified_image=true, cache=true
This shows the processing time is close to the case of
point_project_to_unrectified_image=false
case when we use the cache feature.pointpainting_fusion
all processing times
current
point_project_to_unrectified_image=false
vs. this PRpoint_project_to_unrectified_image=true, cache=true
current
point_project_to_unrectified_image=true
vs. this PRpoint_project_to_unrectified_image=true, no cache
This performance difference should be coming from the fix of the bug in FOV filtering (
camera_info
was not properly initialized).CPU Usage
roi_cluster_fusion
Plot length differ because of the difference of play rate (0.1x is 3 times longer than 0.3x).
It does not contains the CPU usage of initialization step (which might use 100% of CPU).
Memory Usage
roi_cluster_fusion
Plot length differ because of the difference of play rate (0.1x is 3 times longer than 0.3x).
Visualization
Following images ware not captured at the same frame.
All images are in the case of
point_project_to_unrectified_image=true
.Related links
Parent Issue:
How was this PR tested?
Checked the rviz output and each fusion node's visualization.
For checking by yourself, you need some processing like
and set the
debug_mode: true
in param. Forpointpainting_fusion
, you need to set the#if 0
to#if 1
to contain the points in an image.Notes for reviewers
None.
Interface changes
None.
Effects on system behavior
None.