-
Notifications
You must be signed in to change notification settings - Fork 668
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 image segmentation_pointcloud_fusion for pointcloud filter #5562
Merged
miursh
merged 17 commits into
autowarefoundation:main
from
badai-nguyen:feat/add_image_segmentation_fusion
Jan 9, 2024
Merged
feat(image_projection_based_fusion): add image segmentation_pointcloud_fusion for pointcloud filter #5562
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ef93592
fix: roiCallback for Image
badai-nguyen fcb8169
fix: pointcloud filter
badai-nguyen 94ba048
fix: pointcloud filter bugfix
badai-nguyen cfa1d63
fix: segmentation poincloud filter
badai-nguyen 73e4fd8
fix: add option in launch file
badai-nguyen 949ac3c
chore: refactor
badai-nguyen 0702bf6
docs: update docs
badai-nguyen 55da066
fix: roi_pointcloud_fusion with new template
badai-nguyen d4ebbb8
fix: add param of selectable semantic id
badai-nguyen 2ff0ff3
chore: typo
badai-nguyen 5dfa160
fix: launch file
badai-nguyen b999c78
Revert "fix: launch file"
badai-nguyen 6a9331a
fix: reverse perception launcher
badai-nguyen bf32121
Merge branch 'main' into feat/add_image_segmentation_fusion
badai-nguyen 4c0f353
style(pre-commit): autofix
pre-commit-ci[bot] 1499f30
Update perception/image_projection_based_fusion/src/segmentation_poin…
badai-nguyen ef36ead
style(pre-commit): autofix
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
perception/image_projection_based_fusion/config/segmentation_pointcloud_fusion.param.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/**: | ||
ros__parameters: | ||
# if the semantic label is applied for pointcloud filtering | ||
filter_semantic_label_target: | ||
[ | ||
true, # road | ||
true, # sidewalk | ||
true, # building | ||
true, # wall | ||
true, # fence | ||
true, # pole | ||
true, # traffic_light | ||
true, # traffic_sign | ||
true, # vegetation | ||
true, # terrain | ||
true, # sky | ||
false, # person | ||
false, # ride | ||
false, # car | ||
false, # truck | ||
false, # bus | ||
false, # train | ||
false, # motorcycle | ||
false, # bicycle | ||
false, # others | ||
] | ||
# the maximum distance of pointcloud to be applied filter, | ||
# this is selected based on semantic segmentation model accuracy, | ||
# calibration accuracy and unknown reaction distance | ||
filter_distance_threshold: 60.0 |
87 changes: 87 additions & 0 deletions
87
perception/image_projection_based_fusion/docs/segmentation-pointcloud-fusion.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# segmentation_pointcloud_fusion | ||
|
||
## Purpose | ||
|
||
The node `segmentation_pointcloud_fusion` is a package for filtering pointcloud that are belong to less interesting region which is defined by semantic or instance segmentation by 2D image segmentation model. | ||
|
||
## Inner-workings / Algorithms | ||
|
||
- The pointclouds are projected onto the semantic/instance segmentation mask image which is the output from 2D segmentation neural network. | ||
- The pointclouds are belong to segment such as road, sidewalk, building, vegetation, sky ... are considered as less important points for autonomous driving and could be removed. | ||
|
||
![segmentation_pointcloud_fusion_image](./images/segmentation_pointcloud_fusion.png) | ||
|
||
## Inputs / Outputs | ||
|
||
### Input | ||
|
||
| Name | Type | Description | | ||
| ------------------------ | ----------------------------------- | --------------------------------------------------------- | | ||
| `input` | `sensor_msgs::msg::PointCloud2` | input pointcloud | | ||
| `input/camera_info[0-7]` | `sensor_msgs::msg::CameraInfo` | camera information to project 3d points onto image planes | | ||
| `input/rois[0-7]` | `tier4_perception_msgs::msg::Image` | semantic segmentation mask image | | ||
| `input/image_raw[0-7]` | `sensor_msgs::msg::Image` | images for visualization | | ||
|
||
### Output | ||
|
||
| Name | Type | Description | | ||
| -------- | ------------------------------- | -------------------------- | | ||
| `output` | `sensor_msgs::msg::PointCloud2` | output filtered pointcloud | | ||
|
||
## Parameters | ||
|
||
### Core Parameters | ||
|
||
| Name | Type | Description | | ||
| ------------- | ---- | ------------------------ | | ||
| `rois_number` | int | the number of input rois | | ||
|
||
## Assumptions / Known limits | ||
|
||
<!-- Write assumptions and limitations of your implementation. | ||
|
||
Example: | ||
This algorithm assumes obstacles are not moving, so if they rapidly move after the vehicle started to avoid them, it might collide with them. | ||
Also, this algorithm doesn't care about blind spots. In general, since too close obstacles aren't visible due to the sensing performance limit, please take enough margin to obstacles. | ||
--> | ||
|
||
## (Optional) Error detection and handling | ||
|
||
<!-- Write how to detect errors and how to recover from them. | ||
|
||
Example: | ||
This package can handle up to 20 obstacles. If more obstacles found, this node will give up and raise diagnostic errors. | ||
--> | ||
|
||
## (Optional) Performance characterization | ||
|
||
<!-- Write performance information like complexity. If it wouldn't be the bottleneck, not necessary. | ||
|
||
Example: | ||
|
||
### Complexity | ||
|
||
This algorithm is O(N). | ||
|
||
### Processing time | ||
|
||
... | ||
--> | ||
|
||
## (Optional) References/External links | ||
|
||
<!-- Write links you referred to when you implemented. | ||
|
||
Example: | ||
[1] {link_to_a_thesis} | ||
[2] {link_to_an_issue} | ||
--> | ||
|
||
## (Optional) Future extensions / Unimplemented parts | ||
|
||
<!-- Write future extensions of this package. | ||
|
||
Example: | ||
Currently, this package can't handle the chattering obstacles well. We plan to add some probabilistic filters in the perception layer to improve it. | ||
Also, there are some parameters that should be global(e.g. vehicle size, max steering, etc.). These will be refactored and defined as global parameters so that we can share the same parameters between different nodes. | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...ased_fusion/include/image_projection_based_fusion/segmentation_pointcloud_fusion/node.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2023 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef IMAGE_PROJECTION_BASED_FUSION__SEGMENTATION_POINTCLOUD_FUSION__NODE_HPP_ | ||
#define IMAGE_PROJECTION_BASED_FUSION__SEGMENTATION_POINTCLOUD_FUSION__NODE_HPP_ | ||
|
||
#include "image_projection_based_fusion/fusion_node.hpp" | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
#if __has_include(<cv_bridge/cv_bridge.hpp>) | ||
#include <cv_bridge/cv_bridge.hpp> | ||
#else | ||
#include <cv_bridge/cv_bridge.h> | ||
#endif | ||
|
||
namespace image_projection_based_fusion | ||
{ | ||
class SegmentPointCloudFusionNode : public FusionNode<PointCloud2, PointCloud2, Image> | ||
{ | ||
private: | ||
rclcpp::Publisher<PointCloud2>::SharedPtr pub_pointcloud_ptr_; | ||
std::vector<bool> filter_semantic_label_target_; | ||
float filter_distance_threshold_; | ||
/* data */ | ||
public: | ||
explicit SegmentPointCloudFusionNode(const rclcpp::NodeOptions & options); | ||
|
||
protected: | ||
void preprocess(PointCloud2 & pointcloud_msg) override; | ||
|
||
void postprocess(PointCloud2 & pointcloud_msg) override; | ||
|
||
void fuseOnSingleImage( | ||
const PointCloud2 & input_pointcloud_msg, const std::size_t image_id, const Image & input_mask, | ||
const CameraInfo & camera_info, PointCloud2 & output_pointcloud_msg) override; | ||
|
||
bool out_of_scope(const PointCloud2 & filtered_cloud); | ||
}; | ||
|
||
} // namespace image_projection_based_fusion | ||
#endif // IMAGE_PROJECTION_BASED_FUSION__SEGMENTATION_POINTCLOUD_FUSION__NODE_HPP_ |
87 changes: 87 additions & 0 deletions
87
perception/image_projection_based_fusion/launch/segmentation_pointcloud_fusion.launch.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<launch> | ||
<arg name="input/camera_number" default="1"/> | ||
<arg name="input/mask0" default="/perception/object_recognition/detection/mask0"/> | ||
<arg name="input/camera_info0" default="/sensing/camera/camera0/camera_info"/> | ||
<arg name="input/mask1" default="/perception/object_recognition/detection/mask1"/> | ||
<arg name="input/camera_info1" default="/sensing/camera/camera0/camera_info"/> | ||
<arg name="input/mask2" default="/perception/object_recognition/detection/mask2"/> | ||
<arg name="input/camera_info2" default="/sensing/camera/camera0/camera_info"/> | ||
<arg name="input/mask3" default="/perception/object_recognition/detection/mask3"/> | ||
<arg name="input/camera_info3" default="/sensing/camera/camera0/camera_info"/> | ||
<arg name="input/mask4" default="/perception/object_recognition/detection/mask4"/> | ||
<arg name="input/camera_info4" default="/sensing/camera/camera0/camera_info"/> | ||
<arg name="input/mask5" default="/perception/object_recognition/detection/mask5"/> | ||
<arg name="input/camera_info5" default="/sensing/camera/camera0/camera_info"/> | ||
<arg name="input/mask6" default="/perception/object_recognition/detection/mask6"/> | ||
<arg name="input/camera_info6" default="/sensing/camera/camera0/camera_info"/> | ||
<arg name="input/mask7" default="/perception/object_recognition/detection/mask7"/> | ||
<arg name="input/camera_info7" default="/sensing/camera/camera0/camera_info"/> | ||
<arg name="input/pointcloud" default="/sensing/lidar/top/outlier_filtered/pointcloud"/> | ||
<arg name="output/pointcloud" default="output/pointcloud"/> | ||
<arg name="sync_param_path" default="$(find-pkg-share image_projection_based_fusion)/config/roi_sync.param.yaml"/> | ||
<arg name="semantic_segmentation_based_filter_param_path" default="$(find-pkg-share image_projection_based_fusion)/config/segmentation_pointcloud_fusion.param.yaml"/> | ||
<!-- debug --> | ||
<!-- cspell: ignore minx, maxx, miny, maxy, minz, maxz --> | ||
<arg name="debug_mode" default="false"/> | ||
|
||
<arg name="filter_scope_minx" default="-100"/> | ||
<arg name="filter_scope_maxx" default="100"/> | ||
<arg name="filter_scope_miny" default="-100"/> | ||
<arg name="filter_scope_maxy" default="100"/> | ||
<arg name="filter_scope_minz" default="-100"/> | ||
<arg name="filter_scope_maxz" default="100"/> | ||
<arg name="image_buffer_size" default="15"/> | ||
<arg name="input/image0" default="/image_raw0"/> | ||
<arg name="input/image1" default="/image_raw1"/> | ||
<arg name="input/image2" default="/image_raw2"/> | ||
<arg name="input/image3" default="/image_raw3"/> | ||
<arg name="input/image4" default="/image_raw4"/> | ||
<arg name="input/image5" default="/image_raw5"/> | ||
<arg name="input/image6" default="/image_raw6"/> | ||
<arg name="input/image7" default="/image_raw7"/> | ||
<group> | ||
<node pkg="image_projection_based_fusion" exec="segmentation_pointcloud_fusion_node" name="segmentation_pointcloud_fusion" output="screen"> | ||
<param name="rois_number" value="$(var input/camera_number)"/> | ||
<param from="$(var semantic_segmentation_based_filter_param_path)"/> | ||
<param from="$(var sync_param_path)"/> | ||
<remap from="input" to="$(var input/pointcloud)"/> | ||
<remap from="output" to="$(var output/pointcloud)"/> | ||
|
||
<!-- rois, camera and info --> | ||
<param name="input/rois0" value="$(var input/mask0)"/> | ||
<param name="input/camera_info0" value="$(var input/camera_info0)"/> | ||
<param name="input/image0" value="$(var input/image0)"/> | ||
<param name="input/rois1" value="$(var input/mask1)"/> | ||
<param name="input/camera_info1" value="$(var input/camera_info1)"/> | ||
<param name="input/image1" value="$(var input/image1)"/> | ||
<param name="input/rois2" value="$(var input/mask2)"/> | ||
<param name="input/camera_info2" value="$(var input/camera_info2)"/> | ||
<param name="input/image2" value="$(var input/image2)"/> | ||
<param name="input/rois3" value="$(var input/mask3)"/> | ||
<param name="input/camera_info3" value="$(var input/camera_info3)"/> | ||
<param name="input/image3" value="$(var input/image3)"/> | ||
<param name="input/rois4" value="$(var input/mask4)"/> | ||
<param name="input/camera_info4" value="$(var input/camera_info4)"/> | ||
<param name="input/image4" value="$(var input/image4)"/> | ||
<param name="input/rois5" value="$(var input/mask5)"/> | ||
<param name="input/camera_info5" value="$(var input/camera_info5)"/> | ||
<param name="input/image5" value="$(var input/image5)"/> | ||
<param name="input/rois6" value="$(var input/mask6)"/> | ||
<param name="input/camera_info6" value="$(var input/camera_info6)"/> | ||
<param name="input/image6" value="$(var input/image6)"/> | ||
<param name="input/rois7" value="$(var input/mask7)"/> | ||
<param name="input/camera_info7" value="$(var input/camera_info7)"/> | ||
<param name="input/image7" value="$(var input/image7)"/> | ||
|
||
<!-- debug --> | ||
<param name="debug_mode" value="$(var debug_mode)"/> | ||
<param name="filter_scope_minx" value="$(var filter_scope_minx)"/> | ||
<param name="filter_scope_maxx" value="$(var filter_scope_maxx)"/> | ||
<param name="filter_scope_miny" value="$(var filter_scope_miny)"/> | ||
<param name="filter_scope_maxy" value="$(var filter_scope_maxy)"/> | ||
<param name="filter_scope_minz" value="$(var filter_scope_minz)"/> | ||
<param name="filter_scope_maxz" value="$(var filter_scope_maxz)"/> | ||
<param name="image_buffer_size" value="$(var image_buffer_size)"/> | ||
</node> | ||
</group> | ||
</launch> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
[Q]
The image file has not been committed?