From aeab4eeb8a04e2652246b28167287bdfe2d31b9d Mon Sep 17 00:00:00 2001 From: HaronCHou <640611686@qq.com> Date: Mon, 14 Mar 2022 15:47:24 +0800 Subject: [PATCH 1/4] Rename README.md to README_org.md --- README.md => README_org.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.md => README_org.md (100%) diff --git a/README.md b/README_org.md similarity index 100% rename from README.md rename to README_org.md From 841ffb7dcf2939105b8dc07c183e5f53a9f35de0 Mon Sep 17 00:00:00 2001 From: HaronCHou <640611686@qq.com> Date: Mon, 14 Mar 2022 15:48:15 +0800 Subject: [PATCH 2/4] Create README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..913f6885a --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Multitarget-tracker +Multiple Object Tracker, Based on Hungarian algorithm + Kalman filter. + +master is orig fork from Smorodov/Multitarget-tracker + +modify branch is my own modified version From 5ceb94f22a170416580c8ad4bb21b8df5e1cc112 Mon Sep 17 00:00:00 2001 From: zhouhairong Date: Thu, 15 Aug 2024 10:47:07 +0800 Subject: [PATCH 3/4] =?UTF-8?q?tensorrt=E7=8E=AF=E5=A2=83=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tensorrt_yolo/cmake/FindTensorRT.cmake | 6 ++- ...50\257\221\347\273\223\346\236\234_zhr.md" | 53 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 "\347\274\226\350\257\221\347\273\223\346\236\234_zhr.md" diff --git a/src/Detector/tensorrt_yolo/cmake/FindTensorRT.cmake b/src/Detector/tensorrt_yolo/cmake/FindTensorRT.cmake index 7f07dd363..4ba60d63b 100644 --- a/src/Detector/tensorrt_yolo/cmake/FindTensorRT.cmake +++ b/src/Detector/tensorrt_yolo/cmake/FindTensorRT.cmake @@ -19,14 +19,18 @@ # set(_TensorRT_SEARCHES) +set(TensorRT_ROOT "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7" ) + if(TensorRT_ROOT) set(_TensorRT_SEARCH_ROOT PATHS ${TensorRT_ROOT} NO_DEFAULT_PATH) + # set(_TensorRT_SEARCH_ROOT PATHS ${TensorRT_ROOT} "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7") list(APPEND _TensorRT_SEARCHES _TensorRT_SEARCH_ROOT) endif() # appends some common paths set(_TensorRT_SEARCH_NORMAL - PATHS "/usr" + PATHS "/usr" # /home/dl-a4500/zhr/videopipe/TensorRT-8.0.3.4.cuda11.3.cudnn8.2 + # PATHS "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7" ) list(APPEND _TensorRT_SEARCHES _TensorRT_SEARCH_NORMAL) diff --git "a/\347\274\226\350\257\221\347\273\223\346\236\234_zhr.md" "b/\347\274\226\350\257\221\347\273\223\346\236\234_zhr.md" new file mode 100644 index 000000000..57162aaf1 --- /dev/null +++ "b/\347\274\226\350\257\221\347\273\223\346\236\234_zhr.md" @@ -0,0 +1,53 @@ + +编译命令如下: + +``` +cmake . .. -DUSE_OCV_BGFG=ON -DUSE_OCV_KCF=ON -DUSE_OCV_UKF=ON -DBUILD_YOLO_LIB=ON -DBUILD_YOLO_TENSORRT=ON -DBUILD_ASYNC_DETECTOR=ON -DBUILD_CARS_COUNTING=ON +``` + +* 找不到TensorRT库的解决办法,我没有安装,是离线包;因为版本太多了,要切换。 +* 解决方法:src/Detector/tensorrt_yolo/cmake/FindTensorRT.cmake + + * 修改Tensorrt库的查找路径: + * set(TensorRT_ROOT "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7" ) + + +-- The C compiler identification is GNU 9.4.0 +-- The CXX compiler identification is GNU 9.4.0 +-- Check for working C compiler: /bin/cc +-- Check for working C compiler: /bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /bin/c++ +-- Check for working CXX compiler: /bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Found OpenMP_C: -fopenmp (found version "4.5") +-- Found OpenMP_CXX: -fopenmp (found version "4.5") +-- Found OpenMP: TRUE (found version "4.5") +-- Looking for pthread.h +-- Looking for pthread.h - found +-- Performing Test CMAKE_HAVE_LIBC_PTHREAD +-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success +-- Found Threads: TRUE +-- Found CUDA: /usr/local/cuda-11.0 (found suitable exact version "11.0") +-- Found OpenCV: /usr/local (found version "4.6.0") +-- Looking for C++ include filesystem +-- Looking for C++ include filesystem - found +Founded filesystem header +-- Found CUDA: /usr/local/cuda-11.0 (found version "11.0") +-- Found PkgConfig: /bin/pkg-config (found version "0.29.1") +-- Found CUDNN: /usr/local/cuda-11.0/lib64/libcudnn.so +CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): + Could NOT find TensorRT (missing: TensorRT_LIBRARY TensorRT_INCLUDE_DIR) +Call Stack (most recent call first): + /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE) + src/Detector/tensorrt_yolo/cmake/FindTensorRT.cmake:61 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) + src/Detector/tensorrt_yolo/CMakeLists.txt:44 (find_package) + +-- Configuring incomplete, errors occurred! +See also "/home/dl-a4500/zhr/code/gitee-code-zhr/Multitarget-tracker/build/CMakeFiles/CMakeOutput.log". From 61bc4292a811d889417557160e9a8b47bce8f138 Mon Sep 17 00:00:00 2001 From: zhouhairong Date: Thu, 15 Aug 2024 20:39:29 +0800 Subject: [PATCH 4/4] commit --- .vscode/c_cpp_properties.json | 23 +++++ .vscode/launch.json | 36 +++++++ .vscode/settings.json | 95 +++++++++++++++++++ .vscode/tasks.json | 48 ++++++++++ CMakeLists.txt | 3 +- example/CMakeLists.txt | 1 + example/main.cpp | 4 +- src/Detector/tensorrt_yolo/CMakeLists.txt | 13 ++- .../tensorrt_yolo/cmake/FindTensorRT.cmake | 2 + src/Detector/tensorrt_yolo/ds_image.h | 2 +- ...50\257\221\347\273\223\346\236\234_zhr.md" | 3 +- 11 files changed, 225 insertions(+), 5 deletions(-) create mode 100755 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100755 .vscode/settings.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100755 index 000000000..d7913d676 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,23 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**", + "/usr/local/include/**", + "/usr/include/**" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "windowsSdkVersion": "8.1", + "compilerPath": "/usr/bin/g++", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "linux-gcc-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..88c39236e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,36 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": "debug samples", // debug for samples in videopipe + "type": "cppdbg", + "request": "launch", + // "program": "${workspaceFolder}/build/bin/${fileBasenameNoExtension}", + "program": "${workspaceFolder}/build/MultitargetTracker", + "args": [ + // "-g", // 启用调试 + "/home/dl-a4500/zhr/code/gitee-code-zhr/Multitarget-tracker/data/atrium.avi", + "--example","6" + + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/..", // change this value to the path of your vp_data + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100755 index 000000000..13de096a1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,95 @@ +{ + "files.associations": { + "memory": "cpp", + "cmath": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "cwchar": "cpp", + "exception": "cpp", + "initializer_list": "cpp", + "iosfwd": "cpp", + "limits": "cpp", + "new": "cpp", + "stdexcept": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "utility": "cpp", + "vector": "cpp", + "xmemory": "cpp", + "xmemory0": "cpp", + "xstddef": "cpp", + "xstring": "cpp", + "xtr1common": "cpp", + "xutility": "cpp", + "queue": "cpp", + "thread": "cpp", + "mutex": "cpp", + "algorithm": "cpp", + "chrono": "cpp", + "deque": "cpp", + "functional": "cpp", + "ios": "cpp", + "istream": "cpp", + "ostream": "cpp", + "ratio": "cpp", + "streambuf": "cpp", + "string": "cpp", + "system_error": "cpp", + "xthread": "cpp", + "tuple": "cpp", + "xfacet": "cpp", + "xfunctional": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocinfo": "cpp", + "xlocnum": "cpp", + "iostream": "cpp", + "any": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "compare": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "cstdarg": "cpp", + "ctime": "cpp", + "cwctype": "cpp", + "map": "cpp", + "unordered_map": "cpp", + "iterator": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "random": "cpp", + "string_view": "cpp", + "numbers": "cpp", + "semaphore": "cpp", + "stop_token": "cpp", + "complex": "cpp", + "sstream": "cpp", + "list": "cpp", + "set": "cpp", + "fstream": "cpp", + "iomanip": "cpp", + "optional": "cpp", + "hash_map": "cpp", + "hash_set": "cpp", + "bitset": "cpp", + "codecvt": "cpp", + "unordered_set": "cpp", + "filesystem": "cpp", + "future": "cpp", + "cfenv": "cpp", + "cinttypes": "cpp", + "__nullptr": "cpp", + "__locale": "cpp", + "regex": "cpp" + }, + "C_Cpp.errorSquiggles": "Disabled", + "workbench.editor.wrapTabs": true +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..75878a11b --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,48 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++ 生成活动文件", + "command": "/usr/bin/g++", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "调试器生成的任务。" + }, + { + "type": "cppbuild", + "label": "C/C++: g++ 生成活动文件", + "command": "/usr/bin/g++", + "args": [ + "-fdiagnostics-color=always", + "-g", + "main.cpp", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": "build", + "detail": "编译器: /usr/bin/g++" + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 79fa92d5d..90e2208a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,9 +18,10 @@ endif() set(CMAKE_CXX_STANDARD 17) if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_BUILD_TYPE "Debug") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" CACHE STRING COMPILE_FLAGS FORCE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic-errors -fPIC" CACHE STRING COMPILE_FLAGS FORCE) - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -march=native -mtune=native -funroll-loops -DNDEBUG -DBOOST_DISABLE_ASSERTS" CACHE STRING COMPILE_FLAGS FORCE) + set(CMAKE_CXX_FLAGS_RELEASE "-g -march=native -mtune=native -funroll-loops -DNDEBUG -DBOOST_DISABLE_ASSERTS" CACHE STRING COMPILE_FLAGS FORCE) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -march=native -mtune=native -DDEBUG" CACHE STRING COMPILE_FLAGS FORCE) elseif (MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /W4 -DGTL_STATIC" CACHE STRING COMPILE_FLAGS FORCE) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 6c4adb9c5..59207e3f1 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required (VERSION 3.5) project(MultitargetTracker) +set(CMAKE_BUILD_TYPE "Debug") set(SOURCES main.cpp VideoExample.cpp) diff --git a/example/main.cpp b/example/main.cpp index f79f188ca..355e24b3d 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -33,7 +33,7 @@ const char* keys = "{ sl show_logs |1 | Show Trackers logs | }" "{ g gpu |0 | Use OpenCL acceleration | }" "{ a async |1 | Use 2 theads for processing pipeline | }" - "{ r log_res | | Path to the csv file with tracking result | }" + "{ r log_res |1 | Path to the csv file with tracking result | }" "{ cvat_res | | Path to the xml file in cvat format with tracking result | }" "{ s settings | | Path to the ini file with tracking settings | }" "{ bs batch_size |1 | Batch size - frames count for processing | }" @@ -56,7 +56,9 @@ int main(int argc, char** argv) std::cout << (cv::ocl::useOpenCL() ? "OpenCL is enabled" : "OpenCL not used") << std::endl; int exampleNum = parser.get("example"); + exampleNum = 1; int asyncPipeline = parser.get("async"); + asyncPipeline = 0; std::unique_ptr detector; diff --git a/src/Detector/tensorrt_yolo/CMakeLists.txt b/src/Detector/tensorrt_yolo/CMakeLists.txt index 30509d0e6..f66c9431d 100644 --- a/src/Detector/tensorrt_yolo/CMakeLists.txt +++ b/src/Detector/tensorrt_yolo/CMakeLists.txt @@ -43,12 +43,15 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) find_package(CUDNN REQUIRED) find_package(TensorRT REQUIRED) +# set(TensorRT_INCLUDE_DIRS "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7/include") +# set(TensorRT_LIBRARIES "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7/lib") message("TensorRT major version: " ${TensorRT_VERSION_MAJOR}) include_directories(${OpenCV_INCLUDE_DIRS}) include_directories(${CUDA_INCLUDE_DIRS}) include_directories(${CUDNN_INCLUDE_DIR}) include_directories(${TensorRT_INCLUDE_DIRS}) +# include_directories("/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7/include") file(GLOB TENSORRT_SOURCE_FILES *.cpp common/*.cpp) file(GLOB TENSORRT_HEADER_FILES *.h* common/*.h*) @@ -75,13 +78,21 @@ set(TENSORRT_LIBS ${CUDNN_LIBRARY} # ${LIB_PTHREAD} ${TensorRT_LIBRARIES} + # "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7/lib" ) +message("TRT include:" ${TensorRT_INCLUDE_DIRS}) +message("TRT lib:" ${TensorRT_LIBRARY}) + if (CMAKE_COMPILER_IS_GNUCXX) set(TENSORRT_LIBS ${TENSORRT_LIBS} stdc++fs nvinfer_plugin nvonnxparser) endif(CMAKE_COMPILER_IS_GNUCXX) -target_link_libraries(${libname_rt} ${TENSORRT_LIBS}) +set(TRT1 "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7/lib/libnvinfer.so") +set(TRT2 "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7/lib/libnvinfer_plugin.so") +set(TRT3 "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7/lib/libnvonnxparser.so") +target_link_libraries(${libname_rt} ${TRT1} ${TRT2} ${TRT3}) +# target_link_libraries(${libname_rt} ${TENSORRT_LIBS}) install(TARGETS ${libname_rt} EXPORT MTTrackingExports diff --git a/src/Detector/tensorrt_yolo/cmake/FindTensorRT.cmake b/src/Detector/tensorrt_yolo/cmake/FindTensorRT.cmake index 4ba60d63b..b0818feab 100644 --- a/src/Detector/tensorrt_yolo/cmake/FindTensorRT.cmake +++ b/src/Detector/tensorrt_yolo/cmake/FindTensorRT.cmake @@ -75,5 +75,7 @@ if(TensorRT_FOUND) add_library(TensorRT::TensorRT UNKNOWN IMPORTED) set_target_properties(TensorRT::TensorRT PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${TensorRT_INCLUDE_DIRS}") set_property(TARGET TensorRT::TensorRT APPEND PROPERTY IMPORTED_LOCATION "${TensorRT_LIBRARY}") + message("TRT include:" ${TensorRT_INCLUDE_DIRS}) + message("TRT lib:" ${TensorRT_LIBRARY}) endif() endif() diff --git a/src/Detector/tensorrt_yolo/ds_image.h b/src/Detector/tensorrt_yolo/ds_image.h index 974dc6b9d..a0401e6a8 100644 --- a/src/Detector/tensorrt_yolo/ds_image.h +++ b/src/Detector/tensorrt_yolo/ds_image.h @@ -54,7 +54,7 @@ class DsImage int m_YOffset = 0; float m_ScalingFactor = 0.0f; std::string m_ImagePath; - cv::RNG m_RNG { cv::RNG(unsigned(std::time(0))) }; + cv::RNG m_RNG = cv::RNG(unsigned(std::time(0))); std::string m_ImageName; std::vector m_Bboxes; diff --git "a/\347\274\226\350\257\221\347\273\223\346\236\234_zhr.md" "b/\347\274\226\350\257\221\347\273\223\346\236\234_zhr.md" index 57162aaf1..aff19472d 100644 --- "a/\347\274\226\350\257\221\347\273\223\346\236\234_zhr.md" +++ "b/\347\274\226\350\257\221\347\273\223\346\236\234_zhr.md" @@ -3,6 +3,7 @@ ``` cmake . .. -DUSE_OCV_BGFG=ON -DUSE_OCV_KCF=ON -DUSE_OCV_UKF=ON -DBUILD_YOLO_LIB=ON -DBUILD_YOLO_TENSORRT=ON -DBUILD_ASYNC_DETECTOR=ON -DBUILD_CARS_COUNTING=ON +make -j ``` * 找不到TensorRT库的解决办法,我没有安装,是离线包;因为版本太多了,要切换。 @@ -10,7 +11,7 @@ cmake . .. -DUSE_OCV_BGFG=ON -DUSE_OCV_KCF=ON -DUSE_OCV_UKF=ON -DBUILD_YOLO_LIB= * 修改Tensorrt库的查找路径: * set(TensorRT_ROOT "/home/dl-a4500/zhr/videopipe/TensorRT-8.5.1.7" ) - +* 找不到lib库,不在环境变量里面,怎么弄? -- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.4.0