Skip to content

Commit

Permalink
bevfusion-ros-tensorrt
Browse files Browse the repository at this point in the history
  • Loading branch information
linClubs committed Oct 11, 2023
0 parents commit 079d81e
Show file tree
Hide file tree
Showing 320 changed files with 45,006 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/cuda/include/**",
"~/software/TensorRT-8.5.3.1/include/**",
"/home/lin/software/miniconda3/envs/bevfusion/include/python3.8/",
// "/opt/conda/include/python3.8/**",
"${workspaceFolder}/src/**",
"/home/lin/code/CUDA-BEVFusion/third_party/stb",
"/home/lin/code/CUDA-BEVFusion/third_party/pybind11/include/**",
"/usr/include/opencv4",
"/usr/include/pcl-1.10",
"/usr/include/eigen3",
"/home/lin/code/CUDA-BEVFusion/third_party"
// "${workspaceFolder}/../cuOSD/src/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
33 changes: 33 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bevfusion",
"args": ["example-data", "resnet50int8", "int8"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}

]
}
89 changes: 89 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"files.associations": {
"array": "cpp",
"deque": "cpp",
"list": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"string_view": "cpp",
"initializer_list": "cpp",
"valarray": "cpp",
"__bit_reference": "cpp",
"__hash_table": "cpp",
"__split_buffer": "cpp",
"__tree": "cpp",
"filesystem": "cpp",
"iterator": "cpp",
"map": "cpp",
"set": "cpp",
"__config": "cpp",
"__nullptr": "cpp",
"stdexcept": "cpp",
"cmath": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"forward_list": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"variant": "cpp",
"climits": "cpp",
"compare": "cpp",
"concepts": "cpp",
"numbers": "cpp",
"semaphore": "cpp",
"stop_token": "cpp",
"queue": "cpp",
"stack": "cpp",
"__locale": "cpp",
"shared_mutex": "cpp"
}
}
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
170 changes: 170 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
cmake_minimum_required(VERSION 2.8.12)
project(bevfusion)

add_definitions(-w)
# set(CMAKE_BUILD_TYPE "Release") # pcl会报错 使用debug模式
# set(CMAKE_BUILD_TYPE "Debug")

add_compile_options(-W)
add_compile_options(-std=c++14)

set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})

set(CMAKE_CXX_FLAGS "-std=c++14 -O3 -g -DENABLE_TEXT_BACKEND_STB")

# set(CMAKE_CXX_FLAGS_RELEASE "-std=c++14 -Wextra -Wall -Wno-missing-field-initializers -Wno-deprecated-declarations -O3 -DENABLE_TEXT_BACKEND_STB")
# set(CMAKE_CXX_FLAGS_DEBUG "-std=c++14 -O0 -g -DENABLE_TEXT_BACKEND_STB")

set(CUDA_NVCC_FLAGS_RELEASE "-Werror=all-warnings -Xcompiler -std=c++14,-Wextra,-Wall,-Wno-deprecated-declarations,-O3 -DENABLE_TEXT_BACKEND_STB")
set(CUDA_NVCC_FLAGS_DEBUG "-std=c++14 -O0 -g -DENABLE_TEXT_BACKEND_STB")

set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
# -gencode arch=compute_$ENV{CUDASM},code=compute_$ENV{CUDASM}
-gencode arch=compute_80,code=compute_80
)

# cuda
set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-11.3)
set(CUDA_INSTALL_TARGET_DIR targets/x86_64-linux)
set(CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_ROOT_DIR}/${CUDA_INSTALL_TARGET_DIR}/include)
set(CUDA_LIBS ${CUDA_TOOLKIT_ROOT_DIR}/${CUDA_INSTALL_TARGET_DIR}/lib)

# TENSORRT
# set(TensorRT_ROOT /home/lin/software/TensorRT-8.5.3.1)
set(TensorRT_ROOT ~/share/TensorRT-8.5.3.1)
set(TensorRT_INCLUDE_DIRS ${TensorRT_ROOT}/include)
set(TensorRT_LIBS ${TensorRT_ROOT}/lib/)


find_package(CUDA REQUIRED)
find_package(Protobuf REQUIRED)

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

find_package(PCL REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})

find_package(catkin REQUIRED COMPONENTS
roscpp
rospy

message_filters

sensor_msgs
pcl_conversions
pcl_ros
cv_bridge

tf2
geometry_msgs
jsk_recognition_msgs
vision_msgs
roslib
)

include_directories(
third_party/stb
third_party/pybind11/include
third_party/cuOSD/src
third_party/3DSparseConvolution/libspconv/include
src/common
src/
${TensorRT_INCLUDE_DIRS}
${Protobuf_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
src_ros/
)

catkin_package()

link_directories(
third_party/3DSparseConvolution/libspconv/lib/${arch}
build
/usr/lib/aarch64-linux-gnu
/usr/aarch64-linux-gnu/lib
${TensorRT_LIBS}
${CUDA_LIBS}
)

file(GLOB_RECURSE CORE_FILES
src/bevfusion/*.cu
src/bevfusion/*.cpp
src/common/tensor.cu
src/common/tensorrt.cpp
)

file(GLOB_RECURSE VISUALIZE_FILES
third_party/cuOSD/src/*.cpp
third_party/cuOSD/src/*.cu
src/common/visualize.cu
)

####################### libbevfusion_core.so ##########################
cuda_add_library(bevfusion_core SHARED
${CORE_FILES}
)

target_link_libraries(bevfusion_core
libcudart.so
libcublasLt.so
libnvinfer.so
libspconv.so
${Protobuf_LIBRARIES}
libnvinfer_plugin.so
)

####################### bevfusion program #############################

# cuda_add_executable(bevfusion_ros
# src_ros/bevfusion_ros.cpp src_ros/bevfusion_plugin.cpp
# ${VISUALIZE_FILES}
# )

# target_link_libraries(bevfusion_node
# bevfusion_core
# libnvinfer.so
# libspconv.so
# ${Protobuf_LIBRARIES}
# libnvinfer_plugin.so

# ${OpenCV_LIBS}
# ${PCL_LIBRARIES}
# ${catkin_LIBRARIES}
# )

cuda_add_executable(bevfusion_node
src_ros/bevfusion_node.cpp src_ros/bevfusion_plugin.cpp
${VISUALIZE_FILES}
)

target_link_libraries(bevfusion_node
bevfusion_core
libnvinfer.so
libspconv.so
${Protobuf_LIBRARIES}
libnvinfer_plugin.so

${OpenCV_LIBS}
${PCL_LIBRARIES}
${catkin_LIBRARIES}
)


cuda_add_executable(demo
src_ros/demo.cpp src_ros/bevfusion_plugin.cpp
${VISUALIZE_FILES}
)

target_link_libraries(demo
bevfusion_core
libnvinfer.so
libspconv.so
${Protobuf_LIBRARIES}
libnvinfer_plugin.so

${OpenCV_LIBS}
${PCL_LIBRARIES}
${catkin_LIBRARIES}
)
Loading

0 comments on commit 079d81e

Please sign in to comment.