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(pointpainting multiframe): add multi-sweep pointpainting #1462

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2696be3
pointpainting_fusion-paint points
tzhong518 Apr 11, 2022
41681d0
pointpainting_fusion:run the model
tzhong518 Apr 13, 2022
9738802
fix incorrect projection
tzhong518 Apr 20, 2022
bc80fca
update pointpainting_fusion using centerpoint as shared library
tzhong518 Apr 26, 2022
4b55948
pointpainting_fusion: fix uncommited node.cpp and node.hpp
tzhong518 Apr 26, 2022
2745511
fix: update the class
tzhong518 May 24, 2022
b213e54
fix: update the class
tzhong518 May 24, 2022
d4d6363
fix: small corrections
tzhong518 May 27, 2022
f5e7652
fix: correctionts to use centerpoint_trt.hpp
tzhong518 May 30, 2022
004406d
ci(pre-commit): autofix
pre-commit-ci[bot] May 30, 2022
17522e0
Merge branch 'autowarefoundation:main' into feature/pointpainting_fusion
tzhong518 May 31, 2022
6e65439
fix: resolve conversations
tzhong518 Jun 14, 2022
f5480d1
ci(pre-commit): autofix
pre-commit-ci[bot] Jun 14, 2022
47c6d84
fix: resolve conversations
tzhong518 Jun 15, 2022
5915e61
Merge branch 'feature/pointpainting_fusion' of github.com:tzhong518/a…
tzhong518 Jun 15, 2022
1d08963
ci(pre-commit): autofix
pre-commit-ci[bot] Jun 15, 2022
0b2c52a
fix: remove magic number
tzhong518 Jun 15, 2022
6d9fd01
Merge branch 'feature/pointpainting_fusion' of github.com:tzhong518/a…
tzhong518 Jun 15, 2022
c6bc2a4
fix: remove magic number7
tzhong518 Jun 15, 2022
190f7e8
fix: fix Cmakelist, doc, variable name and default value
tzhong518 Jun 21, 2022
3ecfaff
fix: CI build&precommit
tzhong518 Jun 24, 2022
5f25bc2
Merge branch 'autowarefoundation:main' into feature/pointpainting_fusion
tzhong518 Jun 24, 2022
79edef9
fix: pre-commit-optional&build(humble)
tzhong518 Jun 24, 2022
a670258
fix: move guard to publish()
tzhong518 Jun 28, 2022
5b97edc
ci(pre-commit): autofix
pre-commit-ci[bot] Jun 28, 2022
08b82b5
Merge branch 'autowarefoundation:main' into feature/pointpainting_fusion
tzhong518 Jun 29, 2022
f20cab5
Merge branch 'autowarefoundation:main' into feature/pointpainting_fusion
tzhong518 Jun 29, 2022
4d316ca
fix: update pointpainting model
tzhong518 Jul 1, 2022
28165ff
feat: latest update
Oct 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: update the class
Signed-off-by: tzhong518 <sworgun@gmail.com>
  • Loading branch information
tzhong518 committed May 30, 2022
commit 2745511586714a63edd872a5cc4aca58e3529b0c
127 changes: 49 additions & 78 deletions perception/image_projection_based_fusion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,88 +66,59 @@ else()
set(CUDNN_AVAIL OFF)
endif()

if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)

# find dependencies
find_package(ament_lint_auto REQUIRED)
find_package(ament_cmake_auto REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(PCL REQUIRED)
ament_auto_find_build_dependencies()

include_directories(
include
${OpenCV_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${PCL_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
)

### node ###
ament_auto_add_library(${PROJECT_NAME} SHARED
src/fusion_node.cpp
src/debugger.cpp
src/utils/geometry.cpp
src/utils/utils.cpp
src/roi_cluster_fusion/node.cpp
src/roi_detected_object_fusion/node.cpp
src/pointpainting_fusion/node.cpp
src/pointpainting_fusion/pointpainting_trt.cpp
src/pointpainting_fusion/voxel_generator.cpp
)

cuda_add_library(pointpainting_cuda_lib SHARED
src/pointpainting_fusion/preprocess_kernel.cu
)

target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBRARIES}
${EIGEN3_LIBRARIES}
${PCL_LIBRARIES}
${NVINFER}
${CUDA_LIBRARIES}
${CUBLAS_LIBRARIES}
${CUDA_curand_LIBRARY}
${CUDNN_LIBRARY}
pointpainting_cuda_lib
)
find_package(OpenCV REQUIRED)
find_package(Eigen3 REQUIRED)

include_directories(
include
${OpenCV_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
)

rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "image_projection_based_fusion::RoiClusterFusionNode"
EXECUTABLE roi_cluster_fusion_node
)
ament_auto_add_library(${PROJECT_NAME} SHARED
src/fusion_node.cpp
src/debugger.cpp
src/utils/geometry.cpp
src/utils/utils.cpp
src/roi_cluster_fusion/node.cpp
src/roi_detected_object_fusion/node.cpp
src/pointpainting_fusion/node.cpp
src/pointpainting_fusion/pointpainting_trt.cpp
src/pointpainting_fusion/voxel_generator.cpp
)

rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "image_projection_based_fusion::RoiDetectedObjectFusionNode"
EXECUTABLE roi_detected_object_fusion_node
)
cuda_add_library(pointpainting_cuda_lib SHARED
src/pointpainting_fusion/preprocess_kernel.cu
)

rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "image_projection_based_fusion::PointpaintingFusionNode"
EXECUTABLE pointpainting_fusion_node
)
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBRARIES}
${EIGEN3_LIBRARIES}
${PCL_LIBRARIES}
${NVINFER}
${CUDA_LIBRARIES}
${CUBLAS_LIBRARIES}
${CUDA_curand_LIBRARY}
${CUDNN_LIBRARY}
pointpainting_cuda_lib
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
endif()
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "image_projection_based_fusion::RoiClusterFusionNode"
EXECUTABLE roi_cluster_fusion_node
)

ament_auto_package(INSTALL_TO_SHARE
launch
data
config
)
else()
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "image_projection_based_fusion::RoiDetectedObjectFusionNode"
EXECUTABLE roi_detected_object_fusion_node
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "image_projection_based_fusion::PointpaintingFusionNode"
EXECUTABLE pointpainting_fusion_node
)

ament_auto_package(
INSTALL_TO_SHARE
launch
)
endif()
ament_auto_package(INSTALL_TO_SHARE
launch
)
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace image_projection_based_fusion
{
using Label = autoware_auto_perception_msgs::msg::ObjectClassification;

class PointpaintingFusionNode : public FusionNode<sensor_msgs::msg::PointCloud2>
class PointpaintingFusionNode : public FusionNode<sensor_msgs::msg::PointCloud2, DetectedObjects>
{
public:
explicit PointpaintingFusionNode(const rclcpp::NodeOptions & options);
Expand All @@ -39,21 +39,23 @@ class PointpaintingFusionNode : public FusionNode<sensor_msgs::msg::PointCloud2>
void preprocess(sensor_msgs::msg::PointCloud2 & painted_pointcloud_msg) override;

void fuseOnSingleImage(
const sensor_msgs::msg::PointCloud2 & input_pointcloud_msg, const int image_id,
const sensor_msgs::msg::PointCloud2 & input_pointcloud_msg, const std::size_t image_id,
const DetectedObjectsWithFeature & input_roi_msg,
const sensor_msgs::msg::CameraInfo & camera_info,
sensor_msgs::msg::PointCloud2 & painted_pointcloud_msg) override;

void postprocess(sensor_msgs::msg::PointCloud2 & painted_pointcloud_msg) override;

rclcpp::Publisher<autoware_auto_perception_msgs::msg::DetectedObjects>::SharedPtr obj_pub_ptr_;
rclcpp::Publisher<DetectedObjects>::SharedPtr obj_pub_ptr_;

float score_threshold_{0.0};
std::vector<std::string> class_names_;
bool rename_car_to_truck_and_bus_{false};
bool has_twist_{false};

std::unique_ptr<centerpoint::PointPaintingTRT> detector_ptr_{nullptr};

bool out_of_scope(const DetectedObjects & obj);
};

} // namespace image_projection_based_fusion
Expand Down
1 change: 1 addition & 0 deletions perception/image_projection_based_fusion/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<depend>tf2_sensor_msgs</depend>
<depend>tier4_perception_msgs</depend>
<depend>tier4_autoware_utils</depend>
<depend>lidar_centerpoint</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace image_projection_based_fusion
{

PointpaintingFusionNode::PointpaintingFusionNode(const rclcpp::NodeOptions & options)
: FusionNode<sensor_msgs::msg::PointCloud2>("pointpainting_fusion", options)
: FusionNode<sensor_msgs::msg::PointCloud2, DetectedObjects>("pointpainting_fusion", options)
{
const float score_threshold =
static_cast<float>(this->declare_parameter<double>("score_threshold", 0.4));
Expand Down Expand Up @@ -65,14 +65,14 @@ PointpaintingFusionNode::PointpaintingFusionNode(const rclcpp::NodeOptions & opt
centerpoint::CenterPointConfig config(
class_names_.size(), point_feature_size, max_voxel_size, point_cloud_range, voxel_size,
downsample_factor, encoder_in_feature_size, score_threshold, circle_nms_dist_threshold);

// create detector
detector_ptr_ = std::make_unique<centerpoint::PointPaintingTRT>(
encoder_param, head_param, densification_param, config);

// sub and pub
sub_.subscribe(this, "~/input/pointcloud", rmw_qos_profile_sensor_data);
obj_pub_ptr_ = this->create_publisher<autoware_auto_perception_msgs::msg::DetectedObjects>(
"~/output/objects", rclcpp::QoS{1});
obj_pub_ptr_ = this->create_publisher<DetectedObjects>("~/output/objects", rclcpp::QoS{1});
}

void PointpaintingFusionNode::preprocess(sensor_msgs::msg::PointCloud2 & painted_pointcloud_msg)
Expand Down Expand Up @@ -120,8 +120,8 @@ void PointpaintingFusionNode::preprocess(sensor_msgs::msg::PointCloud2 & painted
}

void PointpaintingFusionNode::fuseOnSingleImage(
const sensor_msgs::msg::PointCloud2 & input_pointcloud_msg, const int image_id,
const DetectedObjectsWithFeature & input_roi_msg,
__attribute__((unused)) const sensor_msgs::msg::PointCloud2 & input_pointcloud_msg,
const std::size_t image_id, const DetectedObjectsWithFeature & input_roi_msg,
const sensor_msgs::msg::CameraInfo & camera_info,
sensor_msgs::msg::PointCloud2 & painted_pointcloud_msg)
{
Expand All @@ -140,17 +140,6 @@ void PointpaintingFusionNode::fuseOnSingleImage(
transform_stamped = transform_stamped_optional.value();
}

// get transform from pointcloud frame id to camera optical frame id
// geometry_msgs::msg::TransformStamped transform_stamped;
// try {
// transform_stamped = tf_buffer_.lookupTransform(
// /*target*/ camera_info.header.frame_id,
// /*src*/ painted_pointcloud_msg.header.frame_id, tf2::TimePointZero);
// } catch (tf2::TransformException & ex) {
// RCLCPP_WARN(this->get_logger(), "%s", ex.what());
// return;
// }

// projection matrix
Eigen::Matrix4d camera_projection;
camera_projection << camera_info.p.at(0), camera_info.p.at(1), camera_info.p.at(2),
Expand Down Expand Up @@ -253,6 +242,11 @@ void PointpaintingFusionNode::postprocess(sensor_msgs::msg::PointCloud2 & painte
obj_pub_ptr_->publish(output_obj_msg);
}

bool PointpaintingFusionNode::out_of_scope(__attribute__((unused)) const DetectedObjects & obj)
{
return false;
}

} // namespace image_projection_based_fusion

#include <rclcpp_components/register_node_macro.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <vector>

namespace centerpoint
// image_projection_based_fusion
{
PointPaintingTRT::PointPaintingTRT(
const NetworkParam & encoder_param, const NetworkParam & head_param,
Expand Down