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: add yolov10 node #9198

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f93a2f3
feat: add yolov10 node
Oct 30, 2024
be204c7
style(pre-commit): autofix
pre-commit-ci[bot] Oct 30, 2024
763063e
feat: add yolov10 node
Oct 30, 2024
f5ef6ba
Merge branch 'yolov10' of github.com:storrrrrrrrm/autoware.universe i…
Oct 30, 2024
032ac7f
style(pre-commit): autofix
pre-commit-ci[bot] Oct 30, 2024
b5bbede
fix ci error
Oct 31, 2024
f997928
Merge branch 'yolov10' of github.com:storrrrrrrrm/autoware.universe i…
Oct 31, 2024
7261a5b
style(pre-commit): autofix
pre-commit-ci[bot] Oct 31, 2024
a20535e
fix ci error
Oct 31, 2024
0f623b5
Merge branch 'yolov10' of github.com:storrrrrrrrm/autoware.universe i…
Oct 31, 2024
4a44dc4
style(pre-commit): autofix
pre-commit-ci[bot] Oct 31, 2024
b27a55b
fix ci error
Oct 31, 2024
46662df
Merge branch 'yolov10' of github.com:storrrrrrrrm/autoware.universe i…
Oct 31, 2024
bba9239
style(pre-commit): autofix
pre-commit-ci[bot] Oct 31, 2024
80b6ac8
add cls in result
Nov 1, 2024
eeb76f3
add cls in result
Nov 1, 2024
10a5a85
Merge branch 'yolov10' of github.com:storrrrrrrrm/autoware.universe i…
Nov 1, 2024
5bb1c57
style(pre-commit): autofix
pre-commit-ci[bot] Nov 1, 2024
fad0f0b
fix ci error
Nov 1, 2024
6757148
Merge branch 'yolov10' of github.com:storrrrrrrrm/autoware.universe i…
Nov 1, 2024
63c5898
fix ci error
Nov 1, 2024
cd2470c
style(pre-commit): autofix
pre-commit-ci[bot] Nov 1, 2024
df9a7cc
fix ci error
Nov 1, 2024
3fffd23
Merge branch 'yolov10' of github.com:storrrrrrrrm/autoware.universe i…
Nov 1, 2024
515f864
style(pre-commit): autofix
pre-commit-ci[bot] Nov 1, 2024
743caa5
Merge branch 'main' into yolov10
storrrrrrrrm Nov 4, 2024
76ce9f0
update readme
Nov 18, 2024
08f21d6
Merge branch 'yolov10' of github.com:storrrrrrrrm/autoware.universe i…
Nov 18, 2024
726c120
style(pre-commit): autofix
pre-commit-ci[bot] Nov 18, 2024
46c14a3
update readme
Nov 26, 2024
b6da7ac
Merge branch 'yolov10' of github.com:storrrrrrrrm/autoware.universe i…
Nov 26, 2024
1e8a265
style(pre-commit): autofix
pre-commit-ci[bot] Nov 26, 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
175 changes: 175 additions & 0 deletions perception/autoware_tensorrt_yolov10/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
cmake_minimum_required(VERSION 3.17)
project(autoware_tensorrt_yolov10)

find_package(tensorrt_common)
if(NOT ${tensorrt_common_FOUND})
message(WARNING "The tensorrt_common package is not found. Please check its dependencies.")
return()
endif()

find_package(autoware_cmake REQUIRED)
autoware_package()

find_package(OpenCV REQUIRED)

option(CUDA_VERBOSE "Verbose output of CUDA modules" OFF)

# set flags for CUDA availability
option(CUDA_AVAIL "CUDA available" OFF)
find_package(CUDA)
if(CUDA_FOUND)
find_library(CUBLAS_LIBRARIES cublas HINTS
${CUDA_TOOLKIT_ROOT_DIR}/lib64
${CUDA_TOOLKIT_ROOT_DIR}/lib
)
if(CUDA_VERBOSE)
message("CUDA is available!")
message("CUDA Libs: ${CUDA_LIBRARIES}")
message("CUDA Headers: ${CUDA_INCLUDE_DIRS}")
endif()
# Note: cublas_device was depreciated in CUDA version 9.2
# https://forums.developer.nvidia.com/t/where-can-i-find-libcublas-device-so-or-libcublas-device-a/67251/4
# In LibTorch, CUDA_cublas_device_LIBRARY is used.
unset(CUDA_cublas_device_LIBRARY CACHE)
set(CUDA_AVAIL ON)
else()
message("CUDA NOT FOUND")
set(CUDA_AVAIL OFF)
endif()

# set flags for TensorRT availability
option(TRT_AVAIL "TensorRT available" OFF)
# try to find the tensorRT modules
find_library(NVINFER nvinfer)
find_library(NVONNXPARSER nvonnxparser)
if(NVINFER AND NVONNXPARSER)
if(CUDA_VERBOSE)
message("TensorRT is available!")
message("NVINFER: ${NVINFER}")
message("NVONNXPARSER: ${NVONNXPARSER}")
endif()
set(TRT_AVAIL ON)
else()
message("TensorRT is NOT Available")
set(TRT_AVAIL OFF)
endif()

# set flags for CUDNN availability
option(CUDNN_AVAIL "CUDNN available" OFF)
# try to find the CUDNN module
find_library(CUDNN_LIBRARY
NAMES libcudnn.so${__cudnn_ver_suffix} libcudnn${__cudnn_ver_suffix}.dylib ${__cudnn_lib_win_name}
PATHS $ENV{LD_LIBRARY_PATH} ${__libpath_cudart} ${CUDNN_ROOT_DIR} ${PC_CUDNN_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}
PATH_SUFFIXES lib lib64 bin
DOC "CUDNN library."
)
if(CUDNN_LIBRARY)
if(CUDA_VERBOSE)
message(STATUS "CUDNN is available!")
message(STATUS "CUDNN_LIBRARY: ${CUDNN_LIBRARY}")
endif()
set(CUDNN_AVAIL ON)
else()
message("CUDNN is NOT Available")
set(CUDNN_AVAIL OFF)
endif()

find_package(OpenMP)
if(OpenMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()

##########
# tensorrt_yolov10
ament_auto_add_library(${PROJECT_NAME} SHARED
src/tensorrt_yolov10.cpp
src/tensorrt_yolov10_node.cpp
)

ament_target_dependencies(${PROJECT_NAME}
OpenCV
)

if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
# Officially, add_library supports .cu file compilation.
# However, as of cmake 3.22.1, it seems to fail compilation because compiler flags for
# C++ are directly passed to nvcc (they are originally space separated
# but nvcc assume comma separated as argument of `-Xcompiler` option).
# That is why `cuda_add_library` is used here.
# cuda_add_library(${PROJECT_NAME}_gpu_preprocess
# SHARED
# src/preprocess.cu
# )

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

# target_link_libraries(${PROJECT_NAME}
# ${tensorrt_common_LIBRARIES}
# ${PROJECT_NAME}_gpu_preprocess
# )
else()
target_link_libraries(${PROJECT_NAME}
${tensorrt_common_LIBRARIES}
)
endif()

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

ament_auto_add_library(yolov10_single_image_inference_node SHARED
src/yolov10_single_image_inference_node.cpp
)

ament_target_dependencies(yolov10_single_image_inference_node
OpenCV
)

target_link_libraries(yolov10_single_image_inference_node
${PROJECT_NAME}
stdc++fs
)

target_compile_definitions(yolov10_single_image_inference_node PRIVATE
TENSORRT_VERSION_MAJOR=${TENSORRT_VERSION_MAJOR}
)

rclcpp_components_register_node(yolov10_single_image_inference_node
PLUGIN "autoware::tensorrt_yolov10::Yolov10SingleImageInferenceNode"
EXECUTABLE yolov10_single_image_inference
)

ament_auto_add_library(${PROJECT_NAME}_node SHARED
src/tensorrt_yolov10_node.cpp
)

ament_target_dependencies(${PROJECT_NAME}_node
OpenCV
)

target_link_libraries(${PROJECT_NAME}_node
${PROJECT_NAME}
)

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

rclcpp_components_register_node(${PROJECT_NAME}_node
PLUGIN "autoware::tensorrt_yolov10::TrtYolov10Node"
EXECUTABLE ${PROJECT_NAME}_node_exe
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

ament_auto_package(INSTALL_TO_SHARE
launch
config
)
1 change: 1 addition & 0 deletions perception/autoware_tensorrt_yolov10/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# autoware_tensorrt_yolov10
storrrrrrrrm marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading