LiuLimingCode / HFNet_SLAM

HFNet-SLAM: An accurate and real-time monocular SLAM system with deep features
79 stars 15 forks source link

编译成功,但是运行有bug #6

Open Battlefieldgoblin opened 12 months ago

Battlefieldgoblin commented 12 months ago

目前我已经可以编译了,他的编译结果如下: ./build.sh Configuring and building Thirdparty/g2o ... mkdir: 无法创建目录 “build”: 文件已存在 CMake Error: The current CMakeCache.txt directory /home/yu/ubuntu20/tf_docker/HFNet_SLAM-_docker/HFNet_SLAM-main/Thirdparty/g2o/build/CMakeCache.txt is different than the directory /shared_volume/HFNet_SLAM-main/Thirdparty/g2o/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt CMake Error: The source "/home/yu/ubuntu20/tf_docker/HFNet_SLAM-_docker/HFNet_SLAM-main/Thirdparty/g2o/CMakeLists.txt" does not match the source "/shared_volume/HFNet_SLAM-main/Thirdparty/g2o/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory. CMake Error: The source directory "/shared_volume/HFNet_SLAM-main/Thirdparty/g2o" does not exist. Specify --help for usage, or press the help button on the CMake GUI. make: *** [Makefile:1046:cmake_check_build_system] 错误 1 Configuring and building Thirdparty/Sophus ... mkdir: 无法创建目录 “build”: 文件已存在 -- Configuring done -- Generating done -- Build files have been written to: /home/yu/ubuntu20/tf_docker/HFNet_SLAM-_docker/HFNet_SLAM-main/Thirdparty/Sophus/build [ 8%] Built target test_common [ 29%] Built target test_rxso2 [ 33%] Built target test_geometry [ 33%] Built target test_so2 [ 45%] Built target test_velocities [ 50%] Built target test_sim2 [ 58%] Built target test_se2 [ 66%] Built target test_sim3 [ 91%] Built target HelloSO3 [ 91%] Built target test_so3 [ 91%] Built target test_se3 [100%] Built target test_rxso3 Configuring and building ORB_SLAM3 ... mkdir: 无法创建目录 “build”: 文件已存在 build type: Release -- Configuring done -- Generating done -- Build files have been written to: /home/yu/ubuntu20/tf_docker/HFNet_SLAM-_docker/HFNet_SLAM-main/build [ 62%] Built target HFNet_SLAM [ 70%] Built target rgbd_tum [ 70%] Built target test_match_local_feats [ 74%] Built target mono_tum_vi [ 77%] Built target test_extractors [ 81%] Built target mono_inertial_euroc [ 85%] Built target mono_inertial_tum_vi [ 88%] Built target test_match_global_feats [ 92%] Built target mono_euroc [ 96%] Built target test_hfnet_tf_v1 [100%] Built target test_hfnet_tf_v2

但是编译成功运行代码的时候却保错 ./Examples/Monocular/mono_euroc ./Examples/Monocular/EuRoC.yaml ./evaluation/EUROC/ /home/yu/EUROC/MH_01_easy/ ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt 2023-07-12 08:42:11.289169: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0. num_seq = 1 settings path: ./Examples/Monocular/EuRoC.yaml result save path: ./evaluation/EUROC/ Loading images for sequence 0...LOADED! ORB-SLAM3 Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza. ORB-SLAM2 Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza. This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions. See LICENSE.txt.

Input sensor was set to: Monocular Loading settings from ./Examples/Monocular/EuRoC.yaml Camera1.k3 optional parameter does not exist... -Loaded camera 1 Camera.newHeight optional parameter does not exist... Camera.newWidth optional parameter does not exist... -Loaded image info -Loaded ORB settings Viewer.imageViewScale optional parameter does not exist... -Loaded viewer settings System.LoadAtlasFromFile optional parameter does not exist... System.SaveAtlasToFile optional parameter does not exist... -Loaded Atlas settings System.thFarPoints optional parameter does not exist... -Loaded misc parameters

SLAM settings: -Camera 1 parameters (Pinhole): [ 458.65399169921875 457.29598999023438 367.21499633789062 248.375 ] -Camera 1 distortion parameters: [ -0.28340810537338257 0.073959067463874817 0.00019359000725671649 1.7618711353861727e-05 ] -Original image size: [ 752 , 480 ] -Current image size: [ 752 , 480 ] -Sequence FPS: 20 -Scale factor of image pyramid: 1.2000000476837158 -Levels of image pyramid: 4 -Features per image: 675 -Detector threshold: 0.0099999997764825821 -Load model path: /home/yu/ubuntu20/tf_docker/hfnet_tf/

2023-07-12 08:42:11.292391: I tensorflow/cc/saved_model/reader.cc:43] Reading SavedModel from: /home/yu/ubuntu20/tf_docker/hfnet_tf/ 2023-07-12 08:42:11.296498: I tensorflow/cc/saved_model/reader.cc:81] Reading meta graph with tags { serve } 2023-07-12 08:42:11.296517: I tensorflow/cc/saved_model/reader.cc:122] Reading SavedModel debug info (if present) from: /home/yu/ubuntu20/tf_docker/hfnet_tf/ 2023-07-12 08:42:11.296584: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX_VNNI To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-07-12 08:42:11.651211: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3142 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6 2023-07-12 08:42:11.671593: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:354] MLIR V1 optimization pass is not enabled 2023-07-12 08:42:11.680870: I tensorflow/cc/saved_model/loader.cc:228] Restoring SavedModel bundle. 2023-07-12 08:42:11.857430: I tensorflow/cc/saved_model/loader.cc:301] SavedModel load for tags { serve }; Status: success: OK. Took 565036 microseconds. 2023-07-12 08:42:12.509429: I tensorflow/stream_executor/cuda/cuda_dnn.cc:384] Loaded cuDNN version 8401 段错误 (核心已转储)

这个问题主要是什么原因呢? 还有:tensorRT这种编译方式如何安装环境?我始终没有找到可靠的安装tensorRT C++API的方式。非常感谢您的回答

LiuLimingCode commented 12 months ago

你好: 首先,这部分代码是在提示你应该删除cmake build路径有冲突,你应该删除主目录下的build、Thirdparty/g2o/build、Thirdparty/Sophus/build然后重新运行build.sh

Configuring and building Thirdparty/g2o ...
mkdir: 无法创建目录 “build”: 文件已存在
CMake Error: The current CMakeCache.txt directory /home/yu/ubuntu20/tf_docker/HFNet_SLAM-_docker/HFNet_SLAM-main/Thirdparty/g2o/build/CMakeCache.txt is different than the directory /shared_volume/HFNet_SLAM-main/Thirdparty/g2o/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
CMake Error: The source "/home/yu/ubuntu20/tf_docker/HFNet_SLAM-_docker/HFNet_SLAM-main/Thirdparty/g2o/CMakeLists.txt" does not match the source "/shared_volume/HFNet_SLAM-main/Thirdparty/g2o/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.
CMake Error: The source directory "/shared_volume/HFNet_SLAM-main/Thirdparty/g2o" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
make: *** [Makefile:1046:cmake_check_build_system] 错误 1
Configuring and building Thirdparty/Sophus ...

其次:你说你想测试TensorRT相关的代码,但是这段错误却说明你在使用TensorFlow,建议你打开 HFNet-SLAM/Examples/Monocular/EuRoC.yaml 确认一下 Extractor.type: "HFNetRT" # 指定使用的是TensorRT Extractor.modelPath: "/home/llm/ROS/HFNet_SLAM/model/HFNet-RT/" # 确定一下这个地址下的模型文件是TensorRT模型文件而不是TensorFlow模型文件

2023-07-12 08:42:11.292391: I tensorflow/cc/saved_model/reader.cc:43] Reading SavedModel from: /home/yu/ubuntu20/tf_docker/hfnet_tf/
2023-07-12 08:42:11.296498: I tensorflow/cc/saved_model/reader.cc:81] Reading meta graph with tags { serve }
2023-07-12 08:42:11.296517: I tensorflow/cc/saved_model/reader.cc:122] Reading SavedModel debug info (if present) from: /home/yu/ubuntu20/tf_docker/hfnet_tf/
2023-07-12 08:42:11.296584: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX_VNNI
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-07-12 08:42:11.651211: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3142 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6
2023-07-12 08:42:11.671593: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:354] MLIR V1 optimization pass is not enabled
2023-07-12 08:42:11.680870: I tensorflow/cc/saved_model/loader.cc:228] Restoring SavedModel bundle.
2023-07-12 08:42:11.857430: I tensorflow/cc/saved_model/loader.cc:301] SavedModel load for tags { serve }; Status: success: OK. Took 565036 microseconds.
2023-07-12 08:42:12.509429: I tensorflow/stream_executor/cuda/cuda_dnn.cc:384] Loaded cuDNN version 8401
段错误 (核心已转储)
Battlefieldgoblin commented 12 months ago

非常感谢您的回复,但是删除build目录然后重新编译似乎解决不了我遇到的困难,我仔细查看了模型文件的路径,同时也不是我路径的问题。

  1. tensorflow所遇到的问题:

./Examples/Monocular/mono_euroc ./Examples/Monocular/EuRoC.yaml ./evaluation/EUROC/ /home/yu/EUROC/MH_01_easy ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt 2023-07-13 10:11:16.511877: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0. num_seq = 1 settings path: ./Examples/Monocular/EuRoC.yaml result save path: ./evaluation/EUROC/ Loading images for sequence 0...LOADED!


ORB-SLAM3 Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza. ORB-SLAM2 Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza. This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions. See LICENSE.txt.

Input sensor was set to: Monocular Loading settings from ./Examples/Monocular/EuRoC.yaml Camera1.k3 optional parameter does not exist... -Loaded camera 1 Camera.newHeight optional parameter does not exist... Camera.newWidth optional parameter does not exist... -Loaded image info -Loaded ORB settings Viewer.imageViewScale optional parameter does not exist... -Loaded viewer settings System.LoadAtlasFromFile optional parameter does not exist... System.SaveAtlasToFile optional parameter does not exist... -Loaded Atlas settings System.thFarPoints optional parameter does not exist... -Loaded misc parameters

SLAM settings: -Camera 1 parameters (Pinhole): [ 458.65399169921875 457.29598999023438 367.21499633789062 248.375 ] -Camera 1 distortion parameters: [ -0.28340810537338257 0.073959067463874817 0.00019359000725671649 1.7618711353861727e-05 ] -Original image size: [ 752 , 480 ] -Current image size: [ 752 , 480 ] -Sequence FPS: 20 -Scale factor of image pyramid: 1.2000000476837158 -Levels of image pyramid: 4 -Features per image: 675 -Detector threshold: 0.0099999997764825821 -Load model path: /home/yu/ubuntu20/tf_docker/hfnet_tf

2023-07-13 10:11:16.525371: I tensorflow/cc/saved_model/reader.cc:43] Reading SavedModel from: /home/yu/ubuntu20/tf_docker/hfnet_tf 2023-07-13 10:11:16.530678: I tensorflow/cc/saved_model/reader.cc:81] Reading meta graph with tags { serve } 2023-07-13 10:11:16.530710: I tensorflow/cc/saved_model/reader.cc:122] Reading SavedModel debug info (if present) from: /home/yu/ubuntu20/tf_docker/hfnet_tf 2023-07-13 10:11:16.531400: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX_VNNI To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-07-13 10:11:16.801902: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:16.848169: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:16.848268: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:17.479643: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:17.480128: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:17.480194: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:17.480263: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3253 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6 2023-07-13 10:11:17.505948: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:354] MLIR V1 optimization pass is not enabled 2023-07-13 10:11:17.517111: I tensorflow/cc/saved_model/loader.cc:228] Restoring SavedModel bundle. 2023-07-13 10:11:17.765324: I tensorflow/cc/saved_model/loader.cc:301] SavedModel load for tags { serve }; Status: success: OK. Took 1239952 microseconds. 2023-07-13 10:11:18.811674: I tensorflow/stream_executor/cuda/cuda_dnn.cc:384] Loaded cuDNN version 8401 段错误 (核心已转储)

我尝试使用export TF_ENABLE_ONEDNN_OPTS=0用于解决
`oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`

以及新建终端输入sudo  su  && echo 0 | tee /sys/module/nvidia/drivers/pci:nvidia/*/numa_node  来解决

2023-07-13 10:11:16.801902: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:16.848169: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:16.848268: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:17.479643: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:17.480128: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-07-13 10:11:17.480194: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero

值得庆幸的是他似乎没有提出什么明显的bug了,但是最终仍然提示段错误

./Examples/Monocular/mono_euroc ./Examples/Monocular/EuRoC.yaml ./evaluation/EUROC/ /home/yu/EUROC/MH_01_easy ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt num_seq = 1 settings path: ./Examples/Monocular/EuRoC.yaml result save path: ./evaluation/EUROC/ Loading images for sequence 0...LOADED!


ORB-SLAM3 Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza. ORB-SLAM2 Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza. This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions. See LICENSE.txt.

Input sensor was set to: Monocular Loading settings from ./Examples/Monocular/EuRoC.yaml Camera1.k3 optional parameter does not exist... -Loaded camera 1 Camera.newHeight optional parameter does not exist... Camera.newWidth optional parameter does not exist... -Loaded image info -Loaded ORB settings Viewer.imageViewScale optional parameter does not exist... -Loaded viewer settings System.LoadAtlasFromFile optional parameter does not exist... System.SaveAtlasToFile optional parameter does not exist... -Loaded Atlas settings System.thFarPoints optional parameter does not exist... -Loaded misc parameters

SLAM settings: -Camera 1 parameters (Pinhole): [ 458.65399169921875 457.29598999023438 367.21499633789062 248.375 ] -Camera 1 distortion parameters: [ -0.28340810537338257 0.073959067463874817 0.00019359000725671649 1.7618711353861727e-05 ] -Original image size: [ 752 , 480 ] -Current image size: [ 752 , 480 ] -Sequence FPS: 20 -Scale factor of image pyramid: 1.2000000476837158 -Levels of image pyramid: 4 -Features per image: 675 -Detector threshold: 0.0099999997764825821 -Load model path: /home/yu/ubuntu20/tf_docker/hfnet_tf

2023-07-13 10:49:33.668781: I tensorflow/cc/saved_model/reader.cc:43] Reading SavedModel from: /home/yu/ubuntu20/tf_docker/hfnet_tf 2023-07-13 10:49:33.673164: I tensorflow/cc/saved_model/reader.cc:81] Reading meta graph with tags { serve } 2023-07-13 10:49:33.673186: I tensorflow/cc/saved_model/reader.cc:122] Reading SavedModel debug info (if present) from: /home/yu/ubuntu20/tf_docker/hfnet_tf 2023-07-13 10:49:33.673243: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX_VNNI To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-07-13 10:49:34.006846: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3360 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6 2023-07-13 10:49:34.027932: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:354] MLIR V1 optimization pass is not enabled 2023-07-13 10:49:34.037512: I tensorflow/cc/saved_model/loader.cc:228] Restoring SavedModel bundle. 2023-07-13 10:49:34.223059: I tensorflow/cc/saved_model/loader.cc:301] SavedModel load for tags { serve }; Status: success: OK. Took 554278 microseconds. 2023-07-13 10:49:34.841494: I tensorflow/stream_executor/cuda/cuda_dnn.cc:384] Loaded cuDNN version 8401 段错误 (核心已转储)

我尝试使用docker进行运行,在一次失败的、没有调用gpu的配置环境下(也就是cpu模式)可以运行,我观察到你们所提供的算法能够提取更多的特征点,但是由于是cpu模式,非常的卡。
我也有我一定的猜测:
是否和我3060分配的gpu内存有关系,但由于我是研究导航方向的,对于深度学习没有进一步的深入,所以还想向您请教这部分关于tensorflow问题。

2.tensorRT编译方式
了解您提供的tensorRT网站,似乎那个网站似乎仅仅支持python?值得庆幸的是 我似乎找到了类似tensorflow_ccI编译tensorflow的这种C++编译方式:
[我尝试按照这个网站进行编译](https://github.com/NVIDIA/TensorRT )
编译还有测试的结果没有什么问题,但是当我设置:

set(USE_TENSORRT ON) set(USE_TENSORFLOW OFF) ...... if(${USE_TENSORRT}) ADD_DEFINITIONS(-DUSE_TENSORRT) find_package(CUDA REQUIRED) set(TENSORRT_INCLUDE_DIR /home/yu/tf_cc/TensorRT-8.5.1.7.Linux.x86_64-gnu.cuda-11.8.cudnn8.6/TensorRT-8.5.1.7/include) include_directories(${TENSORRT_INCLUDE_DIR} ${CUDA_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} nvinfer nvonnxparser ${CUDA_LIBRARIES}) endif()

关于tensorRT8.5.1似乎支持的是cuda11.8但是代码提供的环境11.6也能运行
然后进行make编译的时候,一直在报错,很诡异的错误:

./build.sh Configuring and building Thirdparty/g2o ... mkdir: 无法创建目录 “build”: 文件已存在 -- BUILD TYPE:Release -- Compiling on Unix -- Configuring done -- Generating done -- Build files have been written to: /home/yu/ubuntu20/tf_docker/HFNet_SLAM-_docker/HFNet_SLAM-main/Thirdparty/g2o/build [100%] Built target g2o Configuring and building Thirdparty/Sophus ... mkdir: 无法创建目录 “build”: 文件已存在 -- Configuring done -- Generating done -- Build files have been written to: /home/yu/ubuntu20/tf_docker/HFNet_SLAM-_docker/HFNet_SLAM-main/Thirdparty/Sophus/build [ 8%] Built target test_common [ 16%] Built target test_rxso2 [ 25%] Built target test_so2 [ 33%] Built target test_geometry [ 58%] Built target test_sim2 [ 58%] Built target test_se2 [ 58%] Built target test_velocities [ 66%] Built target test_sim3 [ 75%] Built target test_se3 [ 83%] Built target test_so3 [ 91%] Built target test_rxso3 [100%] Built target HelloSO3 Configuring and building ORB_SLAM3 ... mkdir: 无法创建目录 “build”: 文件已存在 build type: Release -- Configuring done -- Generating done -- Build files have been written to: /home/yu/ubuntu20/tf_docker/HFNet_SLAM-_docker/HFNet_SLAM-main/build [ 2%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/System.cc.o [ 4%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Tracking.cc.o [ 6%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/LocalMapping.cc.o [ 8%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/LoopClosing.cc.o [ 10%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Extractors/BaseModel.cc.o [ 14%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Matcher.cc.o [ 14%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Extractors/HFNetRTModel.cc.o [ 16%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/FrameDrawer.cc.o [ 22%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Map.cc.o [ 22%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Converter.cc.o [ 22%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Atlas.cc.o [ 26%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/MapDrawer.cc.o [ 26%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/KeyFrame.cc.o [ 28%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/MapPoint.cc.o [ 30%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Frame.cc.o [ 32%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Optimizer.cc.o [ 34%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Viewer.cc.o [ 38%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/KeyFrameDatabase.cc.o [ 38%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/ImuTypes.cc.o [ 40%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/Sim3Solver.cc.o [ 42%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/G2oTypes.cc.o [ 44%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/CameraModels/Pinhole.cpp.o [ 46%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/CameraModels/KannalaBrandt8.cpp.o [ 48%] Building CXX object CMakeFiles/HFNet_SLAM.dir/src/OptimizableTypes.cpp.o

上面是正常的,但是后续报错:

/usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:85:32: error: ‘ios_base’ has not been declared 85 | open(const char __name, ios_base::openmode mode, int prot = 0664); | ^~~~ /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:85:51: error: expected ‘,’ or ‘...’ before ‘__mode’ 85 | open(const char name, ios_base::openmode mode, int prot = 0664); | ^~ /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:93:34: error: ‘ios_base’ has not been declared 93 | sys_open(__c_file* file, ios_base::openmode); | ^~~~ /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:96:26: error: ‘ios_base’ has not been declared 96 | sys_open(int fd, ios_base::openmode mode) throw (); | ^~~~ /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:96:45: error: expected ‘,’ or ‘...’ before ‘mode’ 96 | sys_open(int fd, ios_base::openmode __mode) throw (); | ^~ /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:112:7: error: ‘streamsize’ does not name a type 112 | streamsize | ^~~~~~ /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:115:7: error: ‘streamsize’ does not name a type 115 | streamsize | ^~~~~~ /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:119:7: error: ‘streamsize’ does not name a type 119 | streamsize | ^~~~~~ /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:122:7: error: ‘streamoff’ does not name a type 122 | streamoff | ^~~~~ /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:128:7: error: ‘streamsize’ does not name a type 128 | streamsize | ^~~~~~ /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h: In member function ‘void ORB_SLAM3::std::basic_file::swap(ORB_SLAM3::std::basic_file&)’: /usr/include/x86_64-linux-gnu/c++/9/bits/basic_file.h:79:7: error: ‘swap’ is not a member of ‘ORB_SLAM3::std’ 79 | std::swap(_M_cfile, __f._M_cfile);


由于篇幅,这里仅仅提供片段报错代码
这似乎问题很大,该错误显示似乎和g++9有关系。所以在问题中,我才向向您询问有没有可靠的编译tensorRT的方式
期待您的回信
Battlefieldgoblin commented 12 months ago

非常抱歉打扰您们,我还想问一个问题,这个算法您们有在其他型号的电脑上新搭建ubuntu20环境进行测试吗?(我怀疑我的笔记本3060可能不太适合您电脑2070的算法)?此外,有没有docker环境可以进行测试?

LiuLimingCode commented 12 months ago

我要是没记错的话,编译tensorflow_cc是需要修改默认的编译设置才能使用的。 我推荐你尝试使用TensorRT,因为使用TensorRT计算模型会比TensorFlow快很多。TensorRT应该不需要你额外编译,在https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html 网站的3.2.1章节正常安装后即可使用。建议你在CUDA,驱动,cudnn等等版本与我给出的保持一致。

我只在我的笔记本上测试过,抱歉,也没有docker环境。

Battlefieldgoblin commented 12 months ago

非常感谢您的回复,目前我已经重新装系统然后重新安装tensorRT8.5.1来进行测试,通过您分享的链接我已经成功安装了tensorRT 在测试中输入

dpkg-query -W tensorrt
tensorrt    8.5.1.7-1+cuda11.8

当然,我安装的cuda是

nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_Mar__8_18:18:20_PST_2022
Cuda compilation tools, release 11.6, V11.6.124
Build cuda_11.6.r11.6/compiler.31057947_0

不幸的是,该代码在编译的过程中依旧报错,很令人费解。 目前我尝试cmake -DCMAKE_BUILD_TYPE=Release .. 输出如下:

cmake -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
build type: Release
-- Found OpenCV: /usr/local (found version "4.2.0") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1") 
-- Found CUDA: /usr/local/cuda (found version "11.6") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yu/HFnet_slam/HFNet_SLAM-main/build

然后尝试make -j4 编译报错:

/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:99:54: error: ‘ORB_SLAM3::std::vector’ has not been declared
   99 | bool HFNetRTModel::Detect(const cv::Mat &image, std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |                                                      ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:99:60: error: expected ‘,’ or ‘...’ before ‘<’ token
   99 | bool HFNetRTModel::Detect(const cv::Mat &image, std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |                                                            ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:99:6: error: no declaration matches ‘bool ORB_SLAM3::HFNetRTModel::Detect(const cv::Mat&, int)’
   99 | bool HFNetRTModel::Detect(const cv::Mat &image, std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:50:10: note: candidates are: ‘virtual bool ORB_SLAM3::HFNetRTModel::Detect(const cv::Mat&, cv::Mat&)’
   50 |     bool Detect(const cv::Mat &intermediate, cv::Mat &globalDescriptors) override;
      |          ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:47:10: note:                 ‘virtual bool ORB_SLAM3::HFNetRTModel::Detect(const cv::Mat&, std::vector<cv::KeyPoint>&, cv::Mat&, int, float)’
   47 |     bool Detect(const cv::Mat &image, std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |          ^~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:44:10: note:                 ‘virtual bool ORB_SLAM3::HFNetRTModel::Detect(const cv::Mat&, std::vector<cv::KeyPoint>&, cv::Mat&, cv::Mat&, int, float)’
   44 |     bool Detect(const cv::Mat &image, std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors, cv::Mat &globalDescriptors,
      |          ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:139:52: error: ‘ORB_SLAM3::std::vector’ has not been declared
  139 |                                               std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |                                                    ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:139:58: error: expected ‘,’ or ‘...’ before ‘<’ token
  139 |                                               std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |                                                          ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:138:6: error: no declaration matches ‘void ORB_SLAM3::HFNetRTModel::GetLocalFeaturesFromTensor(const ORB_SLAM3::RTTensor&, const ORB_SLAM3::RTTensor&, int)’
  138 | void HFNetRTModel::GetLocalFeaturesFromTensor(const RTTensor &tScoreDense, const RTTensor &tDescriptorsMap,
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:76:10: note: candidate is: ‘void ORB_SLAM3::HFNetRTModel::GetLocalFeaturesFromTensor(const ORB_SLAM3::RTTensor&, const ORB_SLAM3::RTTensor&, std::vector<cv::KeyPoint>&, cv::Mat&, int, float)’
   76 |     void GetLocalFeaturesFromTensor(const RTTensor &tScoreDense, const RTTensor &tDescriptorsMap,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc: In member function ‘bool ORB_SLAM3::HFNetRTModel::LoadHFNetTRModel()’:
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:209:20: error: ‘unique_ptr’ was not declared in this scope; did you mean ‘std::unique_ptr’?
  209 |     auto builder = unique_ptr<IBuilder>(createInferBuilder(mLogger));
      |                    ^~~~~~~~~~
      |                    std::unique_ptr
In file included from /usr/include/c++/9/memory:80,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:5,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/usr/include/c++/9/bits/unique_ptr.h:172:11: note: ‘std::unique_ptr’ declared here
  172 |     class unique_ptr
      |           ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:209:39: error: expected primary-expression before ‘>’ token
  209 |     auto builder = unique_ptr<IBuilder>(createInferBuilder(mLogger));
      |                                       ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:213:49: error: expected primary-expression before ‘>’ token
  213 |     auto network = unique_ptr<INetworkDefinition>(builder->createNetworkV2(explicitBatch));
      |                                                 ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:216:51: error: expected primary-expression before ‘>’ token
  216 |     auto parser = unique_ptr<nvonnxparser::IParser>(nvonnxparser::createParser(*network, mLogger));
      |                                                   ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:228:44: error: expected primary-expression before ‘>’ token
  228 |     auto config = unique_ptr<IBuilderConfig>(builder->createBuilderConfig());
      |                                            ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:232:10: error: ‘unique_ptr’ is not a member of ‘ORB_SLAM3::std’; did you mean ‘std::unique_ptr’?
  232 |     std::unique_ptr<ITimingCache> timingCache{nullptr};
      |          ^~~~~~~~~~
In file included from /usr/include/c++/9/memory:80,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:5,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/usr/include/c++/9/bits/unique_ptr.h:172:11: note: ‘std::unique_ptr’ declared here
  172 |     class unique_ptr
      |           ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:232:33: error: expected primary-expression before ‘>’ token
  232 |     std::unique_ptr<ITimingCache> timingCache{nullptr};
      |                                 ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:232:35: error: ‘timingCache’ was not declared in this scope
  232 |     std::unique_ptr<ITimingCache> timingCache{nullptr};
      |                                   ^~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:234:51: error: expected primary-expression before ‘>’ token
  234 |     auto serializedEngine = unique_ptr<IHostMemory>(builder->buildSerializedNetwork(*network, *config));
      |                                                   ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:241:24: error: expected primary-expression before ‘>’ token
  241 |     unique_ptr<IRuntime> runtime{createInferRuntime(mLogger)};
      |                        ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:241:26: error: ‘runtime’ was not declared in this scope
  241 |     unique_ptr<IRuntime> runtime{createInferRuntime(mLogger)};
      |                          ^~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:244:15: error: ‘shared_ptr’ was not declared in this scope; did you mean ‘std::shared_ptr’?
  244 |     mEngine = shared_ptr<ICudaEngine>(runtime->deserializeCudaEngine(serializedEngine->data(), serializedEngine->size()));
      |               ^~~~~~~~~~
      |               std::shared_ptr
In file included from /usr/include/c++/9/bits/shared_ptr.h:52,
                 from /usr/include/c++/9/memory:81,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:5,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/usr/include/c++/9/bits/shared_ptr_base.h:348:11: note: ‘std::shared_ptr’ declared here
  348 |     class shared_ptr;
      |           ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:244:37: error: expected primary-expression before ‘>’ token
  244 |     mEngine = shared_ptr<ICudaEngine>(runtime->deserializeCudaEngine(serializedEngine->data(), serializedEngine->size()));
      |                                     ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:249:44: error: expected primary-expression before ‘>’ token
  249 |     mContext = shared_ptr<IExecutionContext>(mEngine->createExecutionContext());
      |                                            ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc: At global scope:
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:255:51: error: ‘string’ in namespace ‘ORB_SLAM3::std’ does not name a type
  255 | void HFNetRTModel::LoadTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                   ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:255:77: error: ‘ORB_SLAM3::std::unique_ptr’ has not been declared
  255 | void HFNetRTModel::LoadTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                                             ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:255:87: error: expected ‘,’ or ‘...’ before ‘<’ token
  255 | void HFNetRTModel::LoadTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                                                       ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:255:6: error: no declaration matches ‘void ORB_SLAM3::HFNetRTModel::LoadTimingCacheFile(const int&, int)’
  255 | void HFNetRTModel::LoadTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:62:10: note: candidate is: ‘void ORB_SLAM3::HFNetRTModel::LoadTimingCacheFile(const string&, std::unique_ptr<nvinfer1::IBuilderConfig>&, std::unique_ptr<nvinfer1::ITimingCache>&)’
   62 |     void LoadTimingCacheFile(const std::string& strFileName, std::unique_ptr<nvinfer1::IBuilderConfig>& config, std::unique_ptr<nvinfer1::ITimingCache>& timingCache);
      |          ^~~~~~~~~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:280:53: error: ‘string’ in namespace ‘ORB_SLAM3::std’ does not name a type
  280 | void HFNetRTModel::UpdateTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                     ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:280:79: error: ‘ORB_SLAM3::std::unique_ptr’ has not been declared
  280 | void HFNetRTModel::UpdateTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                                               ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:280:89: error: expected ‘,’ or ‘...’ before ‘<’ token
  280 | void HFNetRTModel::UpdateTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                                                         ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:280:6: error: no declaration matches ‘void ORB_SLAM3::HFNetRTModel::UpdateTimingCacheFile(const int&, int)’
  280 | void HFNetRTModel::UpdateTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:64:10: note: candidate is: ‘void ORB_SLAM3::HFNetRTModel::UpdateTimingCacheFile(const string&, std::unique_ptr<nvinfer1::IBuilderConfig>&, std::unique_ptr<nvinfer1::ITimingCache>&)’
   64 |     void UpdateTimingCacheFile(const std::string& strFileName, std::unique_ptr<nvinfer1::IBuilderConfig>& config, std::unique_ptr<nvinfer1::ITimingCache>& timingCache);
      |          ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:317:6: error: ‘string’ in namespace ‘ORB_SLAM3::std’ does not name a type
  317 | std::string HFNetRTModel::DecideEigenFileName(const std::string& strEngineSaveDir, ModelDetectionMode mode, const Dims4 inputShape)
      |      ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:328:48: error: ‘string’ in namespace ‘ORB_SLAM3::std’ does not name a type
  328 | bool HFNetRTModel::SaveEngineToFile(const std::string& strEngineSaveFile, const unique_ptr<IHostMemory>& serializedEngine)
      |                                                ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:328:81: error: ‘unique_ptr’ does not name a type
  328 | bool HFNetRTModel::SaveEngineToFile(const std::string& strEngineSaveFile, const unique_ptr<IHostMemory>& serializedEngine)
      |                                                                                 ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:328:91: error: expected ‘,’ or ‘...’ before ‘<’ token
  328 | bool HFNetRTModel::SaveEngineToFile(const std::string& strEngineSaveFile, const unique_ptr<IHostMemory>& serializedEngine)
      |                                                                                           ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:328:6: error: no declaration matches ‘bool ORB_SLAM3::HFNetRTModel::SaveEngineToFile(const int&, int)’
  328 | bool HFNetRTModel::SaveEngineToFile(const std::string& strEngineSaveFile, const unique_ptr<IHostMemory>& serializedEngine)
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:68:10: note: candidate is: ‘bool ORB_SLAM3::HFNetRTModel::SaveEngineToFile(const string&, const std::unique_ptr<nvinfer1::IHostMemory>&)’
   68 |     bool SaveEngineToFile(const std::string& strEngineSaveFile, const std::unique_ptr<nvinfer1::IHostMemory>& serializedEngine);
      |          ^~~~~~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:340:50: error: ‘string’ in namespace ‘ORB_SLAM3::std’ does not name a type
  340 | bool HFNetRTModel::LoadEngineFromFile(const std::string& strEngineSaveFile)
      |                                                  ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:340:6: error: no declaration matches ‘bool ORB_SLAM3::HFNetRTModel::LoadEngineFromFile(const int&)’
  340 | bool HFNetRTModel::LoadEngineFromFile(const std::string& strEngineSaveFile)
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:70:10: note: candidate is: ‘bool ORB_SLAM3::HFNetRTModel::LoadEngineFromFile(const string&)’
   70 |     bool LoadEngineFromFile(const std::string& strEngineSaveFile);
      |          ^~~~~~~~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:372:45: error: variable or field ‘PrintInputAndOutputsInfo’ declared void
  372 | void HFNetRTModel::PrintInputAndOutputsInfo(unique_ptr<INetworkDefinition>& network)
      |                                             ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:372:45: error: ‘unique_ptr’ was not declared in this scope; did you mean ‘std::unique_ptr’?
  372 | void HFNetRTModel::PrintInputAndOutputsInfo(unique_ptr<INetworkDefinition>& network)
      |                                             ^~~~~~~~~~
      |                                             std::unique_ptr
In file included from /usr/include/c++/9/memory:80,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:5,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/usr/include/c++/9/bits/unique_ptr.h:172:11: note: ‘std::unique_ptr’ declared here
  172 |     class unique_ptr
      |           ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:372:74: error: expected primary-expression before ‘>’ token
  372 | void HFNetRTModel::PrintInputAndOutputsInfo(unique_ptr<INetworkDefinition>& network)
      |                                                                          ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:372:77: error: ‘network’ was not declared in this scope
  372 | void HFNetRTModel::PrintInputAndOutputsInfo(unique_ptr<INetworkDefinition>& network)
      |                                                                             ^~~~~~~
make[2]: *** [CMakeFiles/HFNet_SLAM.dir/build.make:167:CMakeFiles/HFNet_SLAM.dir/src/Extractors/HFNetRTModel.cc.o] 错误 1
make[2]: *** 正在等待未完成的任务....
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Tracking.cc: In member function ‘void ORB_SLAM3::Tracking::Track()’:
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Tracking.cc:1429:13: warning: ‘bOK’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 1429 |             if(bOK)
      |             ^~
make[1]: *** [CMakeFiles/Makefile2:308:CMakeFiles/HFNet_SLAM.dir/all] 错误 2
make: *** [Makefile:84:all] 错误 2

距离上次解答已经过去了好几天,期间我尝试使用很多办法都没法解决,而且这个bug目前看不出来是什么原因造成的,一些C++指针还有库都出现了报错。

LiuLimingCode commented 12 months ago

确实太奇怪了,目前你的CUDA和TensorRT的版本确实和我一模一样了。 虽然很同情你,但是如果实在编译不出就算了吧。 这个项目主要是在ORB-SLAM3的基础上加了基于神经网络的Extraction和Matcher。 SLAM相关的内容可以从ORB-SLAM3项目上学习,基于神经网络部分的改进,把程序看懂就好了,在HFNet-SLAM/Examples/Utility文件下有很多轻量级的测试程序,他们基本包括了运行神经网络、提取特征、匹配特征的全部流程。如果你只是对神经网络感兴趣的话,可以不用编译整个SLAM框架,而是只编译和看懂这些小程序就可以了。

Dongdong-NEU commented 11 months ago

我也碰到 同样的问题了 之前不报错,后来把opencv3.3.1换到4.2报错了(),看着像编译器版本的问题呢

Dongdong-NEU commented 11 months ago

非常感谢您的回复,目前我已经重新装系统然后重新安装tensorRT8.5.1来进行测试,通过您分享的链接我已经成功安装了tensorRT 在测试中输入

dpkg-query -W tensorrt
tensorrt  8.5.1.7-1+cuda11.8

当然,我安装的cuda是

nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_Mar__8_18:18:20_PST_2022
Cuda compilation tools, release 11.6, V11.6.124
Build cuda_11.6.r11.6/compiler.31057947_0

不幸的是,该代码在编译的过程中依旧报错,很令人费解。 目前我尝试cmake -DCMAKE_BUILD_TYPE=Release .. 输出如下:

cmake -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
build type: Release
-- Found OpenCV: /usr/local (found version "4.2.0") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1") 
-- Found CUDA: /usr/local/cuda (found version "11.6") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yu/HFnet_slam/HFNet_SLAM-main/build

然后尝试make -j4 编译报错:

/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:99:54: error: ‘ORB_SLAM3::std::vector’ has not been declared
   99 | bool HFNetRTModel::Detect(const cv::Mat &image, std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |                                                      ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:99:60: error: expected ‘,’ or ‘...’ before ‘<’ token
   99 | bool HFNetRTModel::Detect(const cv::Mat &image, std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |                                                            ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:99:6: error: no declaration matches ‘bool ORB_SLAM3::HFNetRTModel::Detect(const cv::Mat&, int)’
   99 | bool HFNetRTModel::Detect(const cv::Mat &image, std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:50:10: note: candidates are: ‘virtual bool ORB_SLAM3::HFNetRTModel::Detect(const cv::Mat&, cv::Mat&)’
   50 |     bool Detect(const cv::Mat &intermediate, cv::Mat &globalDescriptors) override;
      |          ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:47:10: note:                 ‘virtual bool ORB_SLAM3::HFNetRTModel::Detect(const cv::Mat&, std::vector<cv::KeyPoint>&, cv::Mat&, int, float)’
   47 |     bool Detect(const cv::Mat &image, std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |          ^~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:44:10: note:                 ‘virtual bool ORB_SLAM3::HFNetRTModel::Detect(const cv::Mat&, std::vector<cv::KeyPoint>&, cv::Mat&, cv::Mat&, int, float)’
   44 |     bool Detect(const cv::Mat &image, std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors, cv::Mat &globalDescriptors,
      |          ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:139:52: error: ‘ORB_SLAM3::std::vector’ has not been declared
  139 |                                               std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |                                                    ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:139:58: error: expected ‘,’ or ‘...’ before ‘<’ token
  139 |                                               std::vector<cv::KeyPoint> &vKeyPoints, cv::Mat &localDescriptors,
      |                                                          ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:138:6: error: no declaration matches ‘void ORB_SLAM3::HFNetRTModel::GetLocalFeaturesFromTensor(const ORB_SLAM3::RTTensor&, const ORB_SLAM3::RTTensor&, int)’
  138 | void HFNetRTModel::GetLocalFeaturesFromTensor(const RTTensor &tScoreDense, const RTTensor &tDescriptorsMap,
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:76:10: note: candidate is: ‘void ORB_SLAM3::HFNetRTModel::GetLocalFeaturesFromTensor(const ORB_SLAM3::RTTensor&, const ORB_SLAM3::RTTensor&, std::vector<cv::KeyPoint>&, cv::Mat&, int, float)’
   76 |     void GetLocalFeaturesFromTensor(const RTTensor &tScoreDense, const RTTensor &tDescriptorsMap,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc: In member function ‘bool ORB_SLAM3::HFNetRTModel::LoadHFNetTRModel()’:
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:209:20: error: ‘unique_ptr’ was not declared in this scope; did you mean ‘std::unique_ptr’?
  209 |     auto builder = unique_ptr<IBuilder>(createInferBuilder(mLogger));
      |                    ^~~~~~~~~~
      |                    std::unique_ptr
In file included from /usr/include/c++/9/memory:80,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:5,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/usr/include/c++/9/bits/unique_ptr.h:172:11: note: ‘std::unique_ptr’ declared here
  172 |     class unique_ptr
      |           ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:209:39: error: expected primary-expression before ‘>’ token
  209 |     auto builder = unique_ptr<IBuilder>(createInferBuilder(mLogger));
      |                                       ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:213:49: error: expected primary-expression before ‘>’ token
  213 |     auto network = unique_ptr<INetworkDefinition>(builder->createNetworkV2(explicitBatch));
      |                                                 ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:216:51: error: expected primary-expression before ‘>’ token
  216 |     auto parser = unique_ptr<nvonnxparser::IParser>(nvonnxparser::createParser(*network, mLogger));
      |                                                   ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:228:44: error: expected primary-expression before ‘>’ token
  228 |     auto config = unique_ptr<IBuilderConfig>(builder->createBuilderConfig());
      |                                            ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:232:10: error: ‘unique_ptr’ is not a member of ‘ORB_SLAM3::std’; did you mean ‘std::unique_ptr’?
  232 |     std::unique_ptr<ITimingCache> timingCache{nullptr};
      |          ^~~~~~~~~~
In file included from /usr/include/c++/9/memory:80,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:5,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/usr/include/c++/9/bits/unique_ptr.h:172:11: note: ‘std::unique_ptr’ declared here
  172 |     class unique_ptr
      |           ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:232:33: error: expected primary-expression before ‘>’ token
  232 |     std::unique_ptr<ITimingCache> timingCache{nullptr};
      |                                 ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:232:35: error: ‘timingCache’ was not declared in this scope
  232 |     std::unique_ptr<ITimingCache> timingCache{nullptr};
      |                                   ^~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:234:51: error: expected primary-expression before ‘>’ token
  234 |     auto serializedEngine = unique_ptr<IHostMemory>(builder->buildSerializedNetwork(*network, *config));
      |                                                   ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:241:24: error: expected primary-expression before ‘>’ token
  241 |     unique_ptr<IRuntime> runtime{createInferRuntime(mLogger)};
      |                        ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:241:26: error: ‘runtime’ was not declared in this scope
  241 |     unique_ptr<IRuntime> runtime{createInferRuntime(mLogger)};
      |                          ^~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:244:15: error: ‘shared_ptr’ was not declared in this scope; did you mean ‘std::shared_ptr’?
  244 |     mEngine = shared_ptr<ICudaEngine>(runtime->deserializeCudaEngine(serializedEngine->data(), serializedEngine->size()));
      |               ^~~~~~~~~~
      |               std::shared_ptr
In file included from /usr/include/c++/9/bits/shared_ptr.h:52,
                 from /usr/include/c++/9/memory:81,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:5,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/usr/include/c++/9/bits/shared_ptr_base.h:348:11: note: ‘std::shared_ptr’ declared here
  348 |     class shared_ptr;
      |           ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:244:37: error: expected primary-expression before ‘>’ token
  244 |     mEngine = shared_ptr<ICudaEngine>(runtime->deserializeCudaEngine(serializedEngine->data(), serializedEngine->size()));
      |                                     ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:249:44: error: expected primary-expression before ‘>’ token
  249 |     mContext = shared_ptr<IExecutionContext>(mEngine->createExecutionContext());
      |                                            ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc: At global scope:
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:255:51: error: ‘string’ in namespace ‘ORB_SLAM3::std’ does not name a type
  255 | void HFNetRTModel::LoadTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                   ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:255:77: error: ‘ORB_SLAM3::std::unique_ptr’ has not been declared
  255 | void HFNetRTModel::LoadTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                                             ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:255:87: error: expected ‘,’ or ‘...’ before ‘<’ token
  255 | void HFNetRTModel::LoadTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                                                       ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:255:6: error: no declaration matches ‘void ORB_SLAM3::HFNetRTModel::LoadTimingCacheFile(const int&, int)’
  255 | void HFNetRTModel::LoadTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:62:10: note: candidate is: ‘void ORB_SLAM3::HFNetRTModel::LoadTimingCacheFile(const string&, std::unique_ptr<nvinfer1::IBuilderConfig>&, std::unique_ptr<nvinfer1::ITimingCache>&)’
   62 |     void LoadTimingCacheFile(const std::string& strFileName, std::unique_ptr<nvinfer1::IBuilderConfig>& config, std::unique_ptr<nvinfer1::ITimingCache>& timingCache);
      |          ^~~~~~~~~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:280:53: error: ‘string’ in namespace ‘ORB_SLAM3::std’ does not name a type
  280 | void HFNetRTModel::UpdateTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                     ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:280:79: error: ‘ORB_SLAM3::std::unique_ptr’ has not been declared
  280 | void HFNetRTModel::UpdateTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                                               ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:280:89: error: expected ‘,’ or ‘...’ before ‘<’ token
  280 | void HFNetRTModel::UpdateTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |                                                                                         ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:280:6: error: no declaration matches ‘void ORB_SLAM3::HFNetRTModel::UpdateTimingCacheFile(const int&, int)’
  280 | void HFNetRTModel::UpdateTimingCacheFile(const std::string& strFileName, std::unique_ptr<IBuilderConfig>& config, std::unique_ptr<ITimingCache>& timingCache)
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:64:10: note: candidate is: ‘void ORB_SLAM3::HFNetRTModel::UpdateTimingCacheFile(const string&, std::unique_ptr<nvinfer1::IBuilderConfig>&, std::unique_ptr<nvinfer1::ITimingCache>&)’
   64 |     void UpdateTimingCacheFile(const std::string& strFileName, std::unique_ptr<nvinfer1::IBuilderConfig>& config, std::unique_ptr<nvinfer1::ITimingCache>& timingCache);
      |          ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:317:6: error: ‘string’ in namespace ‘ORB_SLAM3::std’ does not name a type
  317 | std::string HFNetRTModel::DecideEigenFileName(const std::string& strEngineSaveDir, ModelDetectionMode mode, const Dims4 inputShape)
      |      ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:328:48: error: ‘string’ in namespace ‘ORB_SLAM3::std’ does not name a type
  328 | bool HFNetRTModel::SaveEngineToFile(const std::string& strEngineSaveFile, const unique_ptr<IHostMemory>& serializedEngine)
      |                                                ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:328:81: error: ‘unique_ptr’ does not name a type
  328 | bool HFNetRTModel::SaveEngineToFile(const std::string& strEngineSaveFile, const unique_ptr<IHostMemory>& serializedEngine)
      |                                                                                 ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:328:91: error: expected ‘,’ or ‘...’ before ‘<’ token
  328 | bool HFNetRTModel::SaveEngineToFile(const std::string& strEngineSaveFile, const unique_ptr<IHostMemory>& serializedEngine)
      |                                                                                           ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:328:6: error: no declaration matches ‘bool ORB_SLAM3::HFNetRTModel::SaveEngineToFile(const int&, int)’
  328 | bool HFNetRTModel::SaveEngineToFile(const std::string& strEngineSaveFile, const unique_ptr<IHostMemory>& serializedEngine)
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:68:10: note: candidate is: ‘bool ORB_SLAM3::HFNetRTModel::SaveEngineToFile(const string&, const std::unique_ptr<nvinfer1::IHostMemory>&)’
   68 |     bool SaveEngineToFile(const std::string& strEngineSaveFile, const std::unique_ptr<nvinfer1::IHostMemory>& serializedEngine);
      |          ^~~~~~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:340:50: error: ‘string’ in namespace ‘ORB_SLAM3::std’ does not name a type
  340 | bool HFNetRTModel::LoadEngineFromFile(const std::string& strEngineSaveFile)
      |                                                  ^~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:340:6: error: no declaration matches ‘bool ORB_SLAM3::HFNetRTModel::LoadEngineFromFile(const int&)’
  340 | bool HFNetRTModel::LoadEngineFromFile(const std::string& strEngineSaveFile)
      |      ^~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:70:10: note: candidate is: ‘bool ORB_SLAM3::HFNetRTModel::LoadEngineFromFile(const string&)’
   70 |     bool LoadEngineFromFile(const std::string& strEngineSaveFile);
      |          ^~~~~~~~~~~~~~~~~~
In file included from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:38:7: note: ‘class ORB_SLAM3::HFNetRTModel’ defined here
   38 | class HFNetRTModel : public BaseModel
      |       ^~~~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:372:45: error: variable or field ‘PrintInputAndOutputsInfo’ declared void
  372 | void HFNetRTModel::PrintInputAndOutputsInfo(unique_ptr<INetworkDefinition>& network)
      |                                             ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:372:45: error: ‘unique_ptr’ was not declared in this scope; did you mean ‘std::unique_ptr’?
  372 | void HFNetRTModel::PrintInputAndOutputsInfo(unique_ptr<INetworkDefinition>& network)
      |                                             ^~~~~~~~~~
      |                                             std::unique_ptr
In file included from /usr/include/c++/9/memory:80,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/include/Extractors/HFNetRTModel.h:5,
                 from /home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:1:
/usr/include/c++/9/bits/unique_ptr.h:172:11: note: ‘std::unique_ptr’ declared here
  172 |     class unique_ptr
      |           ^~~~~~~~~~
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:372:74: error: expected primary-expression before ‘>’ token
  372 | void HFNetRTModel::PrintInputAndOutputsInfo(unique_ptr<INetworkDefinition>& network)
      |                                                                          ^
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Extractors/HFNetRTModel.cc:372:77: error: ‘network’ was not declared in this scope
  372 | void HFNetRTModel::PrintInputAndOutputsInfo(unique_ptr<INetworkDefinition>& network)
      |                                                                             ^~~~~~~
make[2]: *** [CMakeFiles/HFNet_SLAM.dir/build.make:167:CMakeFiles/HFNet_SLAM.dir/src/Extractors/HFNetRTModel.cc.o] 错误 1
make[2]: *** 正在等待未完成的任务....
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Tracking.cc: In member function ‘void ORB_SLAM3::Tracking::Track()’:
/home/yu/HFnet_slam/HFNet_SLAM-main/src/Tracking.cc:1429:13: warning: ‘bOK’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 1429 |             if(bOK)
      |             ^~
make[1]: *** [CMakeFiles/Makefile2:308:CMakeFiles/HFNet_SLAM.dir/all] 错误 2
make: *** [Makefile:84:all] 错误 2

距离上次解答已经过去了好几天,期间我尝试使用很多办法都没法解决,而且这个bug目前看不出来是什么原因造成的,一些C++指针还有库都出现了报错。

Battlefieldgoblin commented 11 months ago

我也碰到同样的问题了 之前不报错,后来把openCV3.3.1换到4.2报错了(),看着像编译器版本的问题呢

您的意思是我需要换成opencv3.3.1?

Dongdong-NEU commented 11 months ago

我也碰到同样的问题了 之前不报错,后来把openCV3.3.1换到4.2报错了(),看着像编译器版本的问题呢

您的意思是我需要换成opencv3.3.1?

我换重新把opencv4.2换到3.3.1就好了,但需要修改两个错误,程序中有两个CV_OVERRIDE换成override就能编译过去了。但可能发生我刚提出的问题https://github.com/LiuLimingCode/HFNet_SLAM/issues/7#issue-1847704098%E3%80%82