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

refactor(lidar_centerpoint)!: fix namespace and directory structure #8049

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
02ee90f
add prefix in lidar_centerpoint
MasatoSaeki Jul 16, 2024
abadf36
add .gitignore
MasatoSaeki Jul 16, 2024
c216bfe
change include package name in image_projection_based fusion
MasatoSaeki Jul 16, 2024
ba57d9f
fix
MasatoSaeki Jul 16, 2024
eef1d39
change in codeowner
MasatoSaeki Jul 16, 2024
d19f998
delete package
MasatoSaeki Jul 16, 2024
671ad78
style(pre-commit): autofix
pre-commit-ci[bot] Jul 16, 2024
8091b42
solve conflict
MasatoSaeki Jul 18, 2024
e789816
style(pre-commit): autofix
pre-commit-ci[bot] Jul 18, 2024
81dccc8
solve conflict too
MasatoSaeki Jul 18, 2024
96cb2e0
fix include file
MasatoSaeki Jul 18, 2024
d1b701d
fix typo in launch file
MasatoSaeki Jul 18, 2024
c6668d6
add prefix in README
MasatoSaeki Jul 18, 2024
345f9c0
fix bugs by conflict
MasatoSaeki Jul 18, 2024
1c4e1a4
Merge branch 'main' into refactor/lidar_centerpoint/autoware_prefix
MasatoSaeki Jul 22, 2024
3458a89
style(pre-commit): autofix
pre-commit-ci[bot] Jul 22, 2024
8de1ce3
Merge branch 'main' into refactor/lidar_centerpoint/autoware_prefix
MasatoSaeki Jul 22, 2024
d7527e0
Merge branch 'main' into refactor/lidar_centerpoint/autoware_prefix
MasatoSaeki Jul 22, 2024
5b820c6
change namespace from to
MasatoSaeki Jul 22, 2024
a7b8d63
Merge branch 'main' into refactor/lidar_centerpoint/autoware_prefix
knzo25 Jul 22, 2024
86ef16d
style(pre-commit): autofix
pre-commit-ci[bot] Jul 22, 2024
b207632
Merge branch 'main' into refactor/lidar_centerpoint/autoware_prefix
knzo25 Jul 22, 2024
d54004d
Merge branch 'main' into refactor/lidar_centerpoint/autoware_prefix
MasatoSaeki Jul 23, 2024
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
control/autoware_pid_longitudinal_controller/** mamoru.sobue@tier4.jp takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp
control/autoware_pure_pursuit/** takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp
control/autoware_shift_decider/** takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp
control/autoware_smart_mpc_trajectory_follower/** kosuke.takeuchi@tier4.jp masayuki.aino@proxima-ai-tech.com takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp

Check warning on line 58 in .github/CODEOWNERS

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (masayuki)

Check warning on line 58 in .github/CODEOWNERS

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (aino)
control/autoware_trajectory_follower_base/** takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp
control/autoware_trajectory_follower_node/** takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp
control/autoware_vehicle_cmd_gate/** takamasa.horibe@tier4.jp tomoya.kimura@tier4.jp
Expand Down Expand Up @@ -129,7 +129,7 @@
perception/lidar_apollo_instance_segmentation/** yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
perception/lidar_apollo_segmentation_tvm/** ambroise.vincent@arm.com yoshi.ri@tier4.jp
perception/lidar_apollo_segmentation_tvm_nodes/** ambroise.vincent@arm.com yoshi.ri@tier4.jp
perception/lidar_centerpoint/** kenzo.lobos@tier4.jp koji.minoda@tier4.jp
perception/autoware_lidar_centerpoint/** kenzo.lobos@tier4.jp koji.minoda@tier4.jp
perception/occupancy_grid_map_outlier_filter/** abrahammonrroy@yahoo.com yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
perception/probabilistic_occupancy_grid_map/** mamoru.sobue@tier4.jp yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
perception/radar_tracks_msgs_converter/** satoshi.tanaka@tier4.jp shunsuke.miura@tier4.jp taekjin.lee@tier4.jp yoshi.ri@tier4.jp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
<!-- CenterPoint -->
<group if="$(eval &quot;'$(var lidar_detection_model)'=='centerpoint'&quot;)">
<push-ros-namespace namespace="centerpoint"/>
<arg name="lidar_model_param_path" default="$(find-pkg-share lidar_centerpoint)/config"/>
<arg name="lidar_model_param_path" default="$(find-pkg-share autoware_lidar_centerpoint)/config"/>

<group>
<include file="$(find-pkg-share lidar_centerpoint)/launch/lidar_centerpoint.launch.xml">
<include file="$(find-pkg-share autoware_lidar_centerpoint)/launch/lidar_centerpoint.launch.xml">
<arg name="input/pointcloud" value="$(var input/pointcloud)"/>
<arg name="output/objects" value="$(var output/objects)"/>
<arg name="model_name" value="$(var centerpoint_model_name)"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.14)
project(lidar_centerpoint)
project(autoware_lidar_centerpoint)

find_package(autoware_cmake REQUIRED)
autoware_package()

# TODO(lidar_centerpoint): Remove once upgrading to TensorRT 8.5 is complete
# TODO(autoware_lidar_centerpoint): Remove once upgrading to TensorRT 8.5 is complete
add_compile_options(-Wno-deprecated-declarations)

option(CUDA_VERBOSE "Verbose output of CUDA modules" OFF)
Expand Down Expand Up @@ -79,7 +79,7 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
)

### centerpoint ###
ament_auto_add_library(centerpoint_lib SHARED
ament_auto_add_library(${PROJECT_NAME}_lib SHARED
lib/centerpoint_trt.cpp
lib/detection_class_remapper.cpp
lib/utils.cpp
Expand All @@ -91,48 +91,48 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
lib/preprocess/voxel_generator.cpp
)

cuda_add_library(centerpoint_cuda_lib SHARED
cuda_add_library(${PROJECT_NAME}_cuda_lib SHARED
lib/postprocess/circle_nms_kernel.cu
lib/postprocess/postprocess_kernel.cu
lib/network/scatter_kernel.cu
lib/preprocess/preprocess_kernel.cu
)

target_link_libraries(centerpoint_lib
target_link_libraries(${PROJECT_NAME}_lib
${NVINFER}
${NVONNXPARSER}
${CUDA_LIBRARIES}
${CUBLAS_LIBRARIES}
${CUDA_curand_LIBRARY}
${CUDNN_LIBRARY}
centerpoint_cuda_lib
${PROJECT_NAME}_cuda_lib
)

target_include_directories(centerpoint_lib
target_include_directories(${PROJECT_NAME}_lib
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

# To suppress unknown-pragmas error. The root-cause is CUB library in CUDA 11.6.
# This issue was fixed by https://github.com/NVIDIA/cub/commit/7d608bf1dc14553e2fb219eabeed80b76621b6fe
target_include_directories(centerpoint_lib
target_include_directories(${PROJECT_NAME}_lib
SYSTEM PUBLIC
${CUDA_INCLUDE_DIRS}
)

## node ##
ament_auto_add_library(lidar_centerpoint_component SHARED
ament_auto_add_library(${PROJECT_NAME}_component SHARED
src/node.cpp
)

target_link_libraries(lidar_centerpoint_component
centerpoint_lib
target_link_libraries(${PROJECT_NAME}_component
${PROJECT_NAME}_lib
)

rclcpp_components_register_node(lidar_centerpoint_component
PLUGIN "centerpoint::LidarCenterPointNode"
EXECUTABLE lidar_centerpoint_node
rclcpp_components_register_node(${PROJECT_NAME}_component
PLUGIN "autoware::lidar_centerpoint::LidarCenterPointNode"
EXECUTABLE ${PROJECT_NAME}_node
)

ament_export_dependencies(ament_cmake_python)
Expand All @@ -144,7 +144,7 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
)

install(
TARGETS centerpoint_cuda_lib
TARGETS ${PROJECT_NAME}_cuda_lib
DESTINATION lib
)

Expand Down Expand Up @@ -176,7 +176,7 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
# )
#
# target_link_libraries(test_preprocess_kernel
# centerpoint_cuda_lib
# ${PROJECT_NAME}_cuda_lib
# gtest
# gtest_main
# )
Expand All @@ -196,7 +196,7 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
# )
#
# target_link_libraries(test_postprocess_kernel
# centerpoint_cuda_lib
# ${PROJECT_NAME}_cuda_lib
# gtest
# gtest_main
# )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# lidar_centerpoint
# autoware_lidar_centerpoint

## Purpose

lidar_centerpoint is a package for detecting dynamic 3D objects.
autoware_lidar_centerpoint is a package for detecting dynamic 3D objects.

## Inner-workings / Algorithms

Expand Down Expand Up @@ -49,11 +49,11 @@ We trained the models using <https://github.com/open-mmlab/mmdetection3d>.

### The `build_only` option

The `lidar_centerpoint` node has `build_only` option to build the TensorRT engine file from the ONNX file.
The `autoware_lidar_centerpoint` node has `build_only` option to build the TensorRT engine file from the ONNX file.
Although it is preferred to move all the ROS parameters in `.param.yaml` file in Autoware Universe, the `build_only` option is not moved to the `.param.yaml` file for now, because it may be used as a flag to execute the build as a pre-task. You can execute with the following command:

```bash
ros2 launch lidar_centerpoint lidar_centerpoint.launch.xml model_name:=centerpoint_tiny model_path:=/home/autoware/autoware_data/lidar_centerpoint model_param_path:=$(ros2 pkg prefix lidar_centerpoint --share)/config/centerpoint_tiny.param.yaml build_only:=true
ros2 launch autoware_lidar_centerpoint lidar_centerpoint.launch.xml model_name:=centerpoint_tiny model_path:=/home/autoware/autoware_data/lidar_centerpoint model_param_path:=$(ros2 pkg prefix autoware_lidar_centerpoint --share)/config/centerpoint_tiny.param.yaml build_only:=true
```

## Assumptions / Known limits
Expand Down Expand Up @@ -225,7 +225,7 @@ the base link location of the vehicle.

#### Convert CenterPoint PyTorch model to ONNX Format

The lidar_centerpoint implementation requires two ONNX models as input the voxel encoder and the backbone-neck-head of the CenterPoint model, other aspects of the network,
The autoware_lidar_centerpoint implementation requires two ONNX models as input the voxel encoder and the backbone-neck-head of the CenterPoint model, other aspects of the network,
such as preprocessing operations, are implemented externally. Under the fork of the mmdetection3d repository,
we have included a script that converts the CenterPoint model to Autoware compatible ONNX format.
You can find it in `mmdetection3d/projects/AutowareCenterPoint` file.
Expand All @@ -236,7 +236,7 @@ python projects/AutowareCenterPoint/centerpoint_onnx_converter.py --cfg projects

#### Create the config file for the custom model

Create a new config file named **centerpoint_custom.param.yaml** under the config file directory of the lidar_centerpoint node. Sets the parameters of the config file like
Create a new config file named **centerpoint_custom.param.yaml** under the config file directory of the autoware_lidar_centerpoint node. Sets the parameters of the config file like
point_cloud_range, point_feature_size, voxel_size, etc. according to the training config file.

```yaml
Expand All @@ -262,7 +262,7 @@ point_cloud_range, point_feature_size, voxel_size, etc. according to the trainin
```bash
cd /YOUR/AUTOWARE/PATH/Autoware
source install/setup.bash
ros2 launch lidar_centerpoint lidar_centerpoint.launch.xml model_name:=centerpoint_custom model_path:=/PATH/TO/ONNX/FILE/
ros2 launch autoware_lidar_centerpoint lidar_centerpoint.launch.xml model_name:=centerpoint_custom model_path:=/PATH/TO/ONNX/FILE/
```

### Changelog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef LIDAR_CENTERPOINT__CENTERPOINT_CONFIG_HPP_
#define LIDAR_CENTERPOINT__CENTERPOINT_CONFIG_HPP_
#ifndef AUTOWARE__LIDAR_CENTERPOINT__CENTERPOINT_CONFIG_HPP_
#define AUTOWARE__LIDAR_CENTERPOINT__CENTERPOINT_CONFIG_HPP_

#include <cstddef>
#include <vector>

namespace centerpoint
namespace autoware::lidar_centerpoint
{
class CenterPointConfig
{
Expand Down Expand Up @@ -132,6 +132,6 @@ class CenterPointConfig
std::size_t down_grid_size_y_ = grid_size_y_ / downsample_factor_;
};

} // namespace centerpoint
} // namespace autoware::lidar_centerpoint

#endif // LIDAR_CENTERPOINT__CENTERPOINT_CONFIG_HPP_
#endif // AUTOWARE__LIDAR_CENTERPOINT__CENTERPOINT_CONFIG_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef LIDAR_CENTERPOINT__CENTERPOINT_TRT_HPP_
#define LIDAR_CENTERPOINT__CENTERPOINT_TRT_HPP_
#ifndef AUTOWARE__LIDAR_CENTERPOINT__CENTERPOINT_TRT_HPP_
#define AUTOWARE__LIDAR_CENTERPOINT__CENTERPOINT_TRT_HPP_

#include "lidar_centerpoint/cuda_utils.hpp"
#include "lidar_centerpoint/network/network_trt.hpp"
#include "lidar_centerpoint/postprocess/postprocess_kernel.hpp"
#include "lidar_centerpoint/preprocess/voxel_generator.hpp"
#include "autoware/lidar_centerpoint/cuda_utils.hpp"
#include "autoware/lidar_centerpoint/network/network_trt.hpp"
#include "autoware/lidar_centerpoint/postprocess/postprocess_kernel.hpp"
#include "autoware/lidar_centerpoint/preprocess/voxel_generator.hpp"
#include "pcl/point_cloud.h"
#include "pcl/point_types.h"

Expand All @@ -29,7 +29,7 @@
#include <utility>
#include <vector>

namespace centerpoint
namespace autoware::lidar_centerpoint
{
class NetworkParam
{
Expand Down Expand Up @@ -107,6 +107,6 @@ class CenterPointTRT
cuda::unique_ptr<unsigned int[]> num_voxels_d_{nullptr};
};

} // namespace centerpoint
} // namespace autoware::lidar_centerpoint

#endif // LIDAR_CENTERPOINT__CENTERPOINT_TRT_HPP_
#endif // AUTOWARE__LIDAR_CENTERPOINT__CENTERPOINT_TRT_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
* https://creativecommons.org/publicdomain/zero/1.0/deed.en
*/

#ifndef LIDAR_CENTERPOINT__CUDA_UTILS_HPP_
#define LIDAR_CENTERPOINT__CUDA_UTILS_HPP_
#ifndef AUTOWARE__LIDAR_CENTERPOINT__CUDA_UTILS_HPP_
#define AUTOWARE__LIDAR_CENTERPOINT__CUDA_UTILS_HPP_

#include "cuda_runtime_api.h"

Expand Down Expand Up @@ -117,4 +117,4 @@ inline T * get_next_ptr(size_t num_elem, void *& workspace, size_t & workspace_s

} // namespace cuda

#endif // LIDAR_CENTERPOINT__CUDA_UTILS_HPP_
#endif // AUTOWARE__LIDAR_CENTERPOINT__CUDA_UTILS_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef LIDAR_CENTERPOINT__DETECTION_CLASS_REMAPPER_HPP_
#define LIDAR_CENTERPOINT__DETECTION_CLASS_REMAPPER_HPP_
#ifndef AUTOWARE__LIDAR_CENTERPOINT__DETECTION_CLASS_REMAPPER_HPP_
#define AUTOWARE__LIDAR_CENTERPOINT__DETECTION_CLASS_REMAPPER_HPP_

#include <Eigen/Core>

Expand All @@ -24,7 +24,7 @@

#include <vector>

namespace centerpoint
namespace autoware::lidar_centerpoint
{

class DetectionClassRemapper
Expand All @@ -42,6 +42,6 @@ class DetectionClassRemapper
int num_labels_;
};

} // namespace centerpoint
} // namespace autoware::lidar_centerpoint

#endif // LIDAR_CENTERPOINT__DETECTION_CLASS_REMAPPER_HPP_
#endif // AUTOWARE__LIDAR_CENTERPOINT__DETECTION_CLASS_REMAPPER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef LIDAR_CENTERPOINT__NETWORK__NETWORK_TRT_HPP_
#define LIDAR_CENTERPOINT__NETWORK__NETWORK_TRT_HPP_
#ifndef AUTOWARE__LIDAR_CENTERPOINT__NETWORK__NETWORK_TRT_HPP_
#define AUTOWARE__LIDAR_CENTERPOINT__NETWORK__NETWORK_TRT_HPP_

#include "lidar_centerpoint/centerpoint_config.hpp"
#include "lidar_centerpoint/network/tensorrt_wrapper.hpp"
#include "autoware/lidar_centerpoint/centerpoint_config.hpp"
#include "autoware/lidar_centerpoint/network/tensorrt_wrapper.hpp"

#include <vector>

namespace centerpoint
namespace autoware::lidar_centerpoint
{
class VoxelEncoderTRT : public TensorRTWrapper
{
Expand Down Expand Up @@ -48,6 +48,6 @@ class HeadTRT : public TensorRTWrapper
std::vector<std::size_t> out_channel_sizes_;
};

} // namespace centerpoint
} // namespace autoware::lidar_centerpoint

#endif // LIDAR_CENTERPOINT__NETWORK__NETWORK_TRT_HPP_
#endif // AUTOWARE__LIDAR_CENTERPOINT__NETWORK__NETWORK_TRT_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef LIDAR_CENTERPOINT__NETWORK__SCATTER_KERNEL_HPP_
#define LIDAR_CENTERPOINT__NETWORK__SCATTER_KERNEL_HPP_
#ifndef AUTOWARE__LIDAR_CENTERPOINT__NETWORK__SCATTER_KERNEL_HPP_
#define AUTOWARE__LIDAR_CENTERPOINT__NETWORK__SCATTER_KERNEL_HPP_

#include "cuda.h"
#include "cuda_runtime_api.h"

namespace centerpoint
namespace autoware::lidar_centerpoint
{
cudaError_t scatterFeatures_launch(
const float * pillar_features, const int * coords, const unsigned int * num_pillars,
const std::size_t max_voxel_size, const std::size_t encoder_out_feature_size,
const std::size_t grid_size_x, const std::size_t grid_size_y, float * scattered_features,
cudaStream_t stream);

} // namespace centerpoint
} // namespace autoware::lidar_centerpoint

#endif // LIDAR_CENTERPOINT__NETWORK__SCATTER_KERNEL_HPP_
#endif // AUTOWARE__LIDAR_CENTERPOINT__NETWORK__SCATTER_KERNEL_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef LIDAR_CENTERPOINT__NETWORK__TENSORRT_WRAPPER_HPP_
#define LIDAR_CENTERPOINT__NETWORK__TENSORRT_WRAPPER_HPP_
#ifndef AUTOWARE__LIDAR_CENTERPOINT__NETWORK__TENSORRT_WRAPPER_HPP_
#define AUTOWARE__LIDAR_CENTERPOINT__NETWORK__TENSORRT_WRAPPER_HPP_

#include "NvInfer.h"
#include "lidar_centerpoint/centerpoint_config.hpp"
#include "autoware/lidar_centerpoint/centerpoint_config.hpp"
#include "tensorrt_common/tensorrt_common.hpp"

#include <iostream>
#include <memory>
#include <string>

namespace centerpoint
namespace autoware::lidar_centerpoint
{

class TensorRTWrapper
Expand Down Expand Up @@ -62,6 +62,6 @@ class TensorRTWrapper
tensorrt_common::TrtUniquePtr<nvinfer1::ICudaEngine> engine_{nullptr};
};

} // namespace centerpoint
} // namespace autoware::lidar_centerpoint

#endif // LIDAR_CENTERPOINT__NETWORK__TENSORRT_WRAPPER_HPP_
#endif // AUTOWARE__LIDAR_CENTERPOINT__NETWORK__TENSORRT_WRAPPER_HPP_
Loading
Loading