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(lidar_apollo_instance_segmentation, tensorrt_common): use onnx instead of caffe for apollo cnnseg #3320

Merged
merged 10 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
70 changes: 47 additions & 23 deletions common/tensorrt_common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,57 +1,81 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.17)
wep21 marked this conversation as resolved.
Show resolved Hide resolved
project(tensorrt_common)

find_package(autoware_cmake REQUIRED)
autoware_package()

# TODO(tensorrt_common): Remove once upgrading to TensorRT 8.5 is complete
add_compile_options(-Wno-deprecated-declarations)
find_package(ament_cmake REQUIRED)
find_package(cudnn_cmake_module REQUIRED)
find_package(rclcpp REQUIRED)
find_package(tensorrt_cmake_module REQUIRED)

find_package(CUDA)
find_package(CUDAToolkit)
find_package(CUDNN)
find_package(TENSORRT)

if(NOT (${CUDA_FOUND} AND ${CUDNN_FOUND} AND ${TENSORRT_FOUND}))
if(NOT (CUDAToolkit_FOUND AND CUDNN_FOUND AND TENSORRT_FOUND))
message(WARNING "cuda, cudnn, tensorrt libraries are not found")
return()
endif()

cuda_add_library(${PROJECT_NAME} SHARED
add_library(${PROJECT_NAME} SHARED
src/tensorrt_common.cpp
)

ament_target_dependencies(${PROJECT_NAME}
rclcpp
target_link_libraries(${PROJECT_NAME}
CUDA::cudart
rclcpp::rclcpp
stdc++fs
${TENSORRT_LIBRARIES}
)

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

target_link_libraries(${PROJECT_NAME}
${TENSORRT_LIBRARIES}
stdc++fs
set_target_properties(${PROJECT_NAME}
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)

# TODO(tensorrt_common): Remove -Wno-deprecated-declarations once upgrading to TensorRT 8.5 is complete
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall -Wextra -Wpedantic -Werror -Wno-deprecated-declarations
)

target_compile_definitions(${PROJECT_NAME} PRIVATE
TENSORRT_VERSION_MAJOR=${TENSORRT_VERSION_MAJOR}
)

list(APPEND ${PROJECT_NAME}_LIBRARIES "${PROJECT_NAME}")

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)

# These don't pass yet, disable them for now
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_flake8_FOUND TRUE)
set(ament_cmake_pep257_FOUND TRUE)
set(ament_cmake_uncrustify_FOUND TRUE)

ament_lint_auto_find_test_dependencies()
endif()

ament_export_include_directories(include)
ament_export_dependencies(CUDA)
ament_export_dependencies(cudnn_cmake_module)
ament_export_dependencies(CUDNN)
ament_export_dependencies(tensorrt_cmake_module)
ament_export_dependencies(TENSORRT)
install(TARGETS ${PROJECT_NAME} EXPORT export_${PROJECT_NAME})
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})

ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_targets(export_${PROJECT_NAME})

ament_export_dependencies(
"CUDA"
"CUDAToolkit"
"cudnn_cmake_module"
"CUDNN"
"rclcpp"
"tensorrt_cmake_module"
"TENSORRT"
)

ament_auto_package()
ament_package()
manato marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 2 additions & 4 deletions common/tensorrt_common/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@

<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>ament_cmake</buildtool_depend>
miursh marked this conversation as resolved.
Show resolved Hide resolved
<buildtool_depend>cudnn_cmake_module</buildtool_depend>
<buildtool_depend>tensorrt_cmake_module</buildtool_depend>

<build_depend>autoware_cmake</build_depend>

<depend>rclcpp</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>
<test_depend>ament_lint_common</test_depend>
miursh marked this conversation as resolved.
Show resolved Hide resolved

<export>
<build_type>ament_cmake</build_type>
Expand Down
2 changes: 1 addition & 1 deletion perception/lidar_apollo_instance_segmentation/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
data/*.caffemodel
data/*.onnx
data/*.engine
Loading