Skip to content

Commit

Permalink
refactor(lidar_transfusion)!: fix namespace and directory structure (#…
Browse files Browse the repository at this point in the history
…8022)

* add prefix

Signed-off-by: MasatoSaeki <[email protected]>

* add prefix in code owner

Signed-off-by: MasatoSaeki <[email protected]>

* style(pre-commit): autofix

* fix launcher

Signed-off-by: MasatoSaeki <[email protected]>

---------

Signed-off-by: MasatoSaeki <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Amadeusz Szymko <[email protected]>
Co-authored-by: Kenzo Lobos Tsunekawa <[email protected]>
  • Loading branch information
4 people authored Jul 22, 2024
1 parent 64a1658 commit 56166bb
Show file tree
Hide file tree
Showing 45 changed files with 219 additions and 218 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ map/map_projection_loader/** [email protected] [email protected] mas
map/map_tf_generator/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
map/util/lanelet2_map_preprocessor/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
perception/autoware_crosswalk_traffic_light_estimator/** [email protected] [email protected] [email protected]
perception/autoware_lidar_transfusion/** [email protected] [email protected] [email protected]
perception/autoware_map_based_prediction/** [email protected] [email protected] [email protected] [email protected] [email protected]
perception/autoware_multi_object_tracker/** [email protected] [email protected] [email protected]
perception/autoware_object_merger/** [email protected] [email protected] [email protected]
perception/autoware_object_range_splitter/** [email protected] [email protected]
perception/autoware_object_velocity_splitter/** [email protected] [email protected] [email protected]
Expand All @@ -128,8 +130,6 @@ perception/lidar_apollo_instance_segmentation/** [email protected] yukihiro.sait
perception/lidar_apollo_segmentation_tvm/** [email protected] [email protected]
perception/lidar_apollo_segmentation_tvm_nodes/** [email protected] [email protected]
perception/lidar_centerpoint/** [email protected] [email protected]
perception/lidar_transfusion/** [email protected] [email protected] [email protected]
perception/autoware_multi_object_tracker/** [email protected] [email protected] [email protected]
perception/occupancy_grid_map_outlier_filter/** [email protected] [email protected] [email protected]
perception/probabilistic_occupancy_grid_map/** [email protected] [email protected] [email protected]
perception/radar_tracks_msgs_converter/** [email protected] [email protected] [email protected] [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<!-- TransFusion -->
<group if="$(eval &quot;'$(var lidar_detection_model)'=='transfusion'&quot;)">
<push-ros-namespace namespace="transfusion"/>
<arg name="lidar_model_param_path" default="$(find-pkg-share lidar_transfusion)/config"/>
<arg name="lidar_model_param_path" default="$(find-pkg-share autoware_lidar_transfusion)/config"/>

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

find_package(autoware_cmake REQUIRED)
autoware_package()
Expand Down Expand Up @@ -82,7 +82,7 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
set(CUDA_NVCC_FLAGS "-g -G")
endif()

ament_auto_add_library(transfusion_lib SHARED
ament_auto_add_library(${PROJECT_NAME}_lib SHARED
lib/detection_class_remapper.cpp
lib/network/network_trt.cpp
lib/postprocess/non_maximum_suppression.cpp
Expand All @@ -92,50 +92,50 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
lib/transfusion_trt.cpp
)

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

target_link_libraries(transfusion_lib
target_link_libraries(${PROJECT_NAME}_lib
${NVINFER}
${NVONNXPARSER}
${CUDA_LIBRARIES}
${CUBLAS_LIBRARIES}
${CUDA_curand_LIBRARY}
${CUDNN_LIBRARY}
transfusion_cuda_lib
${PROJECT_NAME}_cuda_lib
)

target_include_directories(transfusion_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(transfusion_lib
target_include_directories(${PROJECT_NAME}_lib
SYSTEM PUBLIC
${CUDA_INCLUDE_DIRS}
)

ament_auto_add_library(lidar_transfusion_component SHARED
ament_auto_add_library(${PROJECT_NAME}_component SHARED
src/lidar_transfusion_node.cpp
)

target_link_libraries(lidar_transfusion_component
transfusion_lib
target_link_libraries(${PROJECT_NAME}_component
${PROJECT_NAME}_lib
)

rclcpp_components_register_node(lidar_transfusion_component
PLUGIN "lidar_transfusion::LidarTransfusionNode"
EXECUTABLE lidar_transfusion_node
rclcpp_components_register_node(${PROJECT_NAME}_component
PLUGIN "autoware::lidar_transfusion::LidarTransfusionNode"
EXECUTABLE ${PROJECT_NAME}_node
)

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

Expand Down Expand Up @@ -168,7 +168,7 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
# ${test_preprocess_kernel_SOURCE_DIR}
# )
# target_link_libraries(test_preprocess_kernel
# transfusion_cuda_lib
# ${PROJECT_NAME}_cuda_lib
# gtest
# gtest_main
# )
Expand All @@ -185,7 +185,7 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
# ${test_postprocess_kernel_SOURCE_DIR}
# )
# target_link_libraries(test_postprocess_kernel
# transfusion_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_transfusion
# autoware_lidar_transfusion

## Purpose

The `lidar_transfusion` package is used for 3D object detection based on lidar data (x, y, z, intensity).
The `autoware_lidar_transfusion` package is used for 3D object detection based on lidar data (x, y, z, intensity).

## Inner-workings / Algorithms

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

### TransFusion

{{ json_to_markdown("perception/lidar_transfusion/schema/transfusion.schema.json") }}
{{ json_to_markdown("perception/autoware_lidar_transfusion/schema/transfusion.schema.json") }}

### Detection class remapper

{{ json_to_markdown("perception/lidar_transfusion/schema/detection_class_remapper.schema.json") }}
{{ json_to_markdown("perception/autoware_lidar_transfusion/schema/detection_class_remapper.schema.json") }}

### The `build_only` option

The `lidar_transfusion` node has `build_only` option to build the TensorRT engine file from the ONNX file.
The `autoware_lidar_transfusion` 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_transfusion lidar_transfusion.launch.xml build_only:=true
ros2 launch autoware_lidar_transfusion lidar_transfusion.launch.xml build_only:=true
```

### The `log_level` option

The default logging severity level for `lidar_transfusion` is `info`. For debugging purposes, the developer may decrease severity level using `log_level` parameter:
The default logging severity level for `autoware_lidar_transfusion` is `info`. For debugging purposes, the developer may decrease severity level using `log_level` parameter:

```bash
ros2 launch lidar_transfusion lidar_transfusion.launch.xml log_level:=debug
ros2 launch autoware_lidar_transfusion lidar_transfusion.launch.xml log_level:=debug
```

## Assumptions / Known limits
Expand Down
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_TRANSFUSION__CUDA_UTILS_HPP_
#define LIDAR_TRANSFUSION__CUDA_UTILS_HPP_
#ifndef AUTOWARE__LIDAR_TRANSFUSION__CUDA_UTILS_HPP_
#define AUTOWARE__LIDAR_TRANSFUSION__CUDA_UTILS_HPP_

#include <cuda_runtime_api.h>

Expand Down Expand Up @@ -123,4 +123,4 @@ void clear_async(T * ptr, size_t num_elem, cudaStream_t stream)

} // namespace cuda

#endif // LIDAR_TRANSFUSION__CUDA_UTILS_HPP_
#endif // AUTOWARE__LIDAR_TRANSFUSION__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_TRANSFUSION__DETECTION_CLASS_REMAPPER_HPP_
#define LIDAR_TRANSFUSION__DETECTION_CLASS_REMAPPER_HPP_
#ifndef AUTOWARE__LIDAR_TRANSFUSION__DETECTION_CLASS_REMAPPER_HPP_
#define AUTOWARE__LIDAR_TRANSFUSION__DETECTION_CLASS_REMAPPER_HPP_

#include <Eigen/Core>

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

#include <vector>

namespace lidar_transfusion
namespace autoware::lidar_transfusion
{

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

} // namespace lidar_transfusion
} // namespace autoware::lidar_transfusion

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

#ifndef LIDAR_TRANSFUSION__LIDAR_TRANSFUSION_NODE_HPP_
#define LIDAR_TRANSFUSION__LIDAR_TRANSFUSION_NODE_HPP_
#ifndef AUTOWARE__LIDAR_TRANSFUSION__LIDAR_TRANSFUSION_NODE_HPP_
#define AUTOWARE__LIDAR_TRANSFUSION__LIDAR_TRANSFUSION_NODE_HPP_

#include "lidar_transfusion/detection_class_remapper.hpp"
#include "lidar_transfusion/postprocess/non_maximum_suppression.hpp"
#include "lidar_transfusion/preprocess/pointcloud_densification.hpp"
#include "lidar_transfusion/transfusion_trt.hpp"
#include "lidar_transfusion/visibility_control.hpp"
#include "autoware/lidar_transfusion/detection_class_remapper.hpp"
#include "autoware/lidar_transfusion/postprocess/non_maximum_suppression.hpp"
#include "autoware/lidar_transfusion/preprocess/pointcloud_densification.hpp"
#include "autoware/lidar_transfusion/transfusion_trt.hpp"
#include "autoware/lidar_transfusion/visibility_control.hpp"

#include <autoware/universe_utils/ros/debug_publisher.hpp>
#include <autoware/universe_utils/ros/published_time_publisher.hpp>
Expand All @@ -36,7 +36,7 @@
#include <string>
#include <vector>

namespace lidar_transfusion
namespace autoware::lidar_transfusion
{

class LIDAR_TRANSFUSION_PUBLIC LidarTransfusionNode : public rclcpp::Node
Expand Down Expand Up @@ -68,6 +68,6 @@ class LIDAR_TRANSFUSION_PUBLIC LidarTransfusionNode : public rclcpp::Node
std::unique_ptr<autoware::universe_utils::DebugPublisher> debug_publisher_ptr_{nullptr};
std::unique_ptr<autoware::universe_utils::PublishedTimePublisher> published_time_pub_{nullptr};
};
} // namespace lidar_transfusion
} // namespace autoware::lidar_transfusion

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

#ifndef LIDAR_TRANSFUSION__NETWORK__NETWORK_TRT_HPP_
#define LIDAR_TRANSFUSION__NETWORK__NETWORK_TRT_HPP_
#ifndef AUTOWARE__LIDAR_TRANSFUSION__NETWORK__NETWORK_TRT_HPP_
#define AUTOWARE__LIDAR_TRANSFUSION__NETWORK__NETWORK_TRT_HPP_

#include "lidar_transfusion/transfusion_config.hpp"
#include "lidar_transfusion/utils.hpp"
#include "autoware/lidar_transfusion/transfusion_config.hpp"
#include "autoware/lidar_transfusion/utils.hpp"

#include <tensorrt_common/tensorrt_common.hpp>

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

namespace lidar_transfusion
namespace autoware::lidar_transfusion
{

struct ProfileDimension
Expand Down Expand Up @@ -82,6 +82,6 @@ class NetworkTRT
std::array<ProfileDimension, 3> in_profile_dims_;
};

} // namespace lidar_transfusion
} // namespace autoware::lidar_transfusion

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

#ifndef LIDAR_TRANSFUSION__POSTPROCESS__CIRCLE_NMS_KERNEL_HPP_
#define LIDAR_TRANSFUSION__POSTPROCESS__CIRCLE_NMS_KERNEL_HPP_
#ifndef AUTOWARE__LIDAR_TRANSFUSION__POSTPROCESS__CIRCLE_NMS_KERNEL_HPP_
#define AUTOWARE__LIDAR_TRANSFUSION__POSTPROCESS__CIRCLE_NMS_KERNEL_HPP_

#include "lidar_transfusion/utils.hpp"
#include "autoware/lidar_transfusion/utils.hpp"

#include <thrust/device_vector.h>

namespace lidar_transfusion
namespace autoware::lidar_transfusion
{
// Non-maximum suppression (NMS) uses the distance on the xy plane instead of
// intersection over union (IoU) to suppress overlapped objects.
std::size_t circleNMS(
thrust::device_vector<Box3D> & boxes3d, const float distance_threshold,
thrust::device_vector<bool> & keep_mask, cudaStream_t stream);

} // namespace lidar_transfusion
} // namespace autoware::lidar_transfusion

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

#ifndef LIDAR_TRANSFUSION__POSTPROCESS__NON_MAXIMUM_SUPPRESSION_HPP_
#define LIDAR_TRANSFUSION__POSTPROCESS__NON_MAXIMUM_SUPPRESSION_HPP_
#ifndef AUTOWARE__LIDAR_TRANSFUSION__POSTPROCESS__NON_MAXIMUM_SUPPRESSION_HPP_
#define AUTOWARE__LIDAR_TRANSFUSION__POSTPROCESS__NON_MAXIMUM_SUPPRESSION_HPP_

#include "lidar_transfusion/ros_utils.hpp"
#include "autoware/lidar_transfusion/ros_utils.hpp"

#include <Eigen/Eigen>

Expand All @@ -24,7 +24,7 @@
#include <string>
#include <vector>

namespace lidar_transfusion
namespace autoware::lidar_transfusion
{
using autoware_perception_msgs::msg::DetectedObject;

Expand Down Expand Up @@ -75,6 +75,6 @@ class NonMaximumSuppression
std::vector<bool> target_class_mask_{};
};

} // namespace lidar_transfusion
} // namespace autoware::lidar_transfusion

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

#ifndef LIDAR_TRANSFUSION__POSTPROCESS__POSTPROCESS_KERNEL_HPP_
#define LIDAR_TRANSFUSION__POSTPROCESS__POSTPROCESS_KERNEL_HPP_
#ifndef AUTOWARE__LIDAR_TRANSFUSION__POSTPROCESS__POSTPROCESS_KERNEL_HPP_
#define AUTOWARE__LIDAR_TRANSFUSION__POSTPROCESS__POSTPROCESS_KERNEL_HPP_

#include "lidar_transfusion/transfusion_config.hpp"
#include "lidar_transfusion/utils.hpp"
#include "autoware/lidar_transfusion/transfusion_config.hpp"
#include "autoware/lidar_transfusion/utils.hpp"

#include <cuda.h>
#include <cuda_runtime_api.h>
#include <thrust/device_vector.h>

#include <vector>

namespace lidar_transfusion
namespace autoware::lidar_transfusion
{

class PostprocessCuda
Expand All @@ -45,6 +45,6 @@ class PostprocessCuda
thrust::device_vector<float> yaw_norm_thresholds_d_;
};

} // namespace lidar_transfusion
} // namespace autoware::lidar_transfusion

#endif // LIDAR_TRANSFUSION__POSTPROCESS__POSTPROCESS_KERNEL_HPP_
#endif // AUTOWARE__LIDAR_TRANSFUSION__POSTPROCESS__POSTPROCESS_KERNEL_HPP_
Loading

0 comments on commit 56166bb

Please sign in to comment.