文章目錄
- 1.環境問題
- 2.遇到的問題
- 2.1編譯問題1 monotonic_clock
- 2.2 associate.py
- 2.3 associate.py問題
- 3.運行問題
1.環境問題
首先環境大家就按照github上的指定環境安裝即可
環境怎么安裝網上大把的資源,自己去找。
2.遇到的問題
2.1編譯問題1 monotonic_clock
這是因為C++版本不同導致的系統計時函數編譯報錯
解決方案是 搜索COMPILEDWITHC11
然后把monotonic_clock 換成 steady_clock
例如:
/*
#ifdef COMPILEDWITHC11std::chrono::steady_clock::time_point t1 = std::chrono::steady_clock::now();
#elsestd::chrono::monotonic_clock::time_point t1 = std::chrono::monotonic_clock::now();
#endif
*/
// 替換成下面的:std::chrono::steady_clock::time_point t1 = std::chrono::steady_clock::now();//修改替換的代碼部分
這個問題會報很多次,至少十幾次吧,因為很多文件都有這個東西,他報錯了我們根據報錯位置去改就可以了,就是比較麻煩。
當然我看到有人說只需要把COMPILEDWITHC11改為COMPILEDWITHC14就可以了,這個我沒有嘗試,我只用了上面的方法,大家可以自己嘗試。
2.2 associate.py
數據集的下載地址:https://cvg.cit.tum.de/data/datasets/rgbd-dataset/download
associate.py是個啥,這個東西怎么用
這個就是把數據集轉化成一個文件的東西
鏈接: 怎么用看這個
1.按照要求下載數據集,我下載的是rgbd_dataset_freiburg3_walking_xyz,將其解壓到你喜歡的目錄.我個人放在了evalution下
2.下載 associate.py.放在evalution目錄下面.
3.打開終端,進入到associate.py所在目錄
python associate.py rgb.txt depth.txt > associations.txt
4.命令解說
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUMX.yaml PATH_TO_SEQUENCE_FOLDER ASSOCIATIONS_FILE
PATH_TO_SEQUENCE_FOLDER文件夾即為數據庫所在文件夾,我的是在orbslam2工程下面,
ASSOCIATIONS_FILE即為第3步中生成的associations.txt,給出他的制定目錄位置
例子:大家可以參考我的目錄自行更改!
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUMX.yaml /home/lvslam/YOLO_ORB_SLAM3_with_pointcloud_map/evaluation/rgbd_dataset_freiburg3_walking_xyz /home/lvslam/YOLO_ORB_SLAM3_with_pointcloud_map/evaluation/rgbd_dataset_freiburg3_walking_xyz/associations.txt
2.3 associate.py問題
問題1:報錯AttributeError: ‘dict_keys’ object has no attribute ‘remove’
由于Python2和python3語法的差別,需要將associate.py中第86行87行的
first_keys = first_list.keys()second_keys = second_list.keys()
改為
first_keys = list(first_list.keys())second_keys = list(second_list.keys())
問題2:TypeError: read_file_list() takes exactly 2 arguments (1 given)
所遇到的問題是因為read_file_list()函數需要兩個參數,而你在調用時只傳遞了一個參數。我們需要向read_file_list()傳遞兩個參數,即args.first_file和remove_bounds。從代碼來看,remove_bounds應該是一個布爾值,具體是True還是False,可以根據需求來設定。
我們需要修改associate.py
改為:
import argparse
import sys
import os
import numpydef read_file_list(filename, remove_bounds):"""Reads a trajectory from a text file. File format:The file format is "stamp d1 d2 d3 ...", where stamp denotes the time stamp (to be matched)and "d1 d2 d3.." is arbitary data (e.g., a 3D position and 3D orientation) associated to this timestamp. Input:filename -- File nameOutput:dict -- dictionary of (stamp,data) tuples"""file = open(filename)data = file.read()lines = data.replace(",", " ").replace("\t", " ").split("\n")if remove_bounds:lines = lines[100:-100]list = [[v.strip() for v in line.split(" ") if v.strip() != ""] for line in lines if len(line) > 0 and line[0] != "#"]list = [(float(l[0]), l[1:]) for l in list if len(l) > 1]return dict(list)def associate(first_list, second_list, offset, max_difference):"""Associate two dictionaries of (stamp,data). As the time stamps never match exactly, we aim to find the closest match for every input tuple.Input:first_list -- first dictionary of (stamp,data) tuplessecond_list -- second dictionary of (stamp,data) tuplesoffset -- time offset between both dictionaries (e.g., to model the delay between the sensors)max_difference -- search radius for candidate generationOutput:matches -- list of matched tuples ((stamp1,data1),(stamp2,data2))"""first_keys = list(first_list.keys())second_keys = list(second_list.keys())potential_matches = [(abs(a - (b + offset)), a, b)for a in first_keysfor b in second_keysif abs(a - (b + offset)) < max_difference]potential_matches.sort()matches = []for diff, a, b in potential_matches:if a in first_keys and b in second_keys:first_keys.remove(a)second_keys.remove(b)matches.append((a, b))matches.sort()return matchesif __name__ == '__main__':# parse command lineparser = argparse.ArgumentParser(description='''This script takes two data files with timestamps and associates them ''')parser.add_argument('first_file', help='first text file (format: timestamp data)')parser.add_argument('second_file', help='second text file (format: timestamp data)')parser.add_argument('--first_only', help='only output associated lines from first file', action='store_true')parser.add_argument('--offset', help='time offset added to the timestamps of the second file (default: 0.0)', default=0.0)parser.add_argument('--max_difference', help='maximally allowed time difference for matching entries (default: 0.02)', default=0.02)parser.add_argument('--remove_bounds', help='remove first and last 100 entries', action='store_true')args = parser.parse_args()first_list = read_file_list(args.first_file, args.remove_bounds)second_list = read_file_list(args.second_file, args.remove_bounds)matches = associate(first_list, second_list, float(args.offset), float(args.max_difference))if args.first_only:for a, b in matches:print("%f %s" % (a, " ".join(first_list[a])))else:for a, b in matches:print("%f %s %f %s" % (a, " ".join(first_list[a]), b - float(args.offset), " ".join(second_list[b])))
3.運行問題
rgbd_tum: /tmp/llvm/lib/Support/BranchProbability.cpp:41:llvm::BranchProbability::BranchProbability(uint32_t, uint32_t): 假設 ‘Numerator <= Denominator && “Probability cannot be bigger than 1!”’ 失敗。
已放棄 (核心已轉儲)
運行出來兩秒就閃退的問題!
切換剛開始的libtorch版本
https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.3.1%2Bcpu.zip
這個時2.3.1版本的,我們只需要將上面的數字換掉,然后直接瀏覽器粘貼就可以下對對應的版本!!
經過測試使用1.7.1版本的libtorch可以解決這個問題
也就是
https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.7.1%2Bcpu.zip
重新安裝號新的1.7.1版本的libtorch后重新編譯,./build.sh
又會遇到下面的問題:
version `GOMP_4.5’ not found (required by /lib/x86_64-linux-gnu/libpcl_common.so.1.10)
我們需要鏈接動態庫解決這個問題:
ln -sf /usr/lib/x86_64-linux-gnu/libgomp.so.1 /YOLO_ORB_SLAM3_with_pointcloud_map/Thirdparty/libtorch/lib/libgomp-75eea7e8.so.1
之后應該就是可以運行了,不過有可能有人會碰到別的問題
之后如果報錯:libORB_SLAM3.so: undefined symbol: _ZN5DBoW24FORB1LE,查看下面的博客就可以
https://blog.csdn.net/qq_41035283/article/details/128301376
然后我們就成功復現這個項目了!!!!