TensorRT转化代码
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

10 miesięcy temu
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. cmake_minimum_required(VERSION 3.10)
  2. project(yolov5)
  3. add_definitions(-std=c++11)
  4. add_definitions(-DAPI_EXPORTS)
  5. option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
  6. set(CMAKE_CXX_STANDARD 11)
  7. set(CMAKE_BUILD_TYPE Debug)
  8. # TODO(Call for PR): make cmake compatible with Windows
  9. set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc)
  10. enable_language(CUDA)
  11. # include and link dirs of cuda and tensorrt, you need adapt them if yours are different
  12. # cuda
  13. include_directories(/usr/local/cuda/include)
  14. link_directories(/usr/local/cuda/lib64)
  15. # tensorrt
  16. # TODO(Call for PR): make TRT path configurable from command line
  17. include_directories(/home/nvidia/TensorRT-8.2.5.1/include/)
  18. link_directories(/home/nvidia/TensorRT-8.2.5.1/lib/)
  19. include_directories(${PROJECT_SOURCE_DIR}/src/)
  20. include_directories(${PROJECT_SOURCE_DIR}/plugin/)
  21. file(GLOB_RECURSE SRCS ${PROJECT_SOURCE_DIR}/src/*.cpp ${PROJECT_SOURCE_DIR}/src/*.cu)
  22. file(GLOB_RECURSE PLUGIN_SRCS ${PROJECT_SOURCE_DIR}/plugin/*.cu)
  23. add_library(myplugins SHARED ${PLUGIN_SRCS})
  24. target_link_libraries(myplugins nvinfer cudart)
  25. find_package(OpenCV)
  26. include_directories(${OpenCV_INCLUDE_DIRS})
  27. add_executable(yolov5_det yolov5_det.cpp ${SRCS})
  28. target_link_libraries(yolov5_det nvinfer)
  29. target_link_libraries(yolov5_det cudart)
  30. target_link_libraries(yolov5_det myplugins)
  31. target_link_libraries(yolov5_det ${OpenCV_LIBS})
  32. add_executable(yolov5_cls yolov5_cls.cpp ${SRCS})
  33. target_link_libraries(yolov5_cls nvinfer)
  34. target_link_libraries(yolov5_cls cudart)
  35. target_link_libraries(yolov5_cls myplugins)
  36. target_link_libraries(yolov5_cls ${OpenCV_LIBS})
  37. add_executable(yolov5_seg yolov5_seg.cpp ${SRCS})
  38. target_link_libraries(yolov5_seg nvinfer)
  39. target_link_libraries(yolov5_seg cudart)
  40. target_link_libraries(yolov5_seg myplugins)
  41. target_link_libraries(yolov5_seg ${OpenCV_LIBS})