当前位置: 首页 > news >正文

复现YOLO_ORB_SLAM3_with_pointcloud_map项目记录

文章目录

  • 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

然后我们就成功复现这个项目了!!!!
在这里插入图片描述

http://www.lryc.cn/news/393077.html

相关文章:

  • Docker:Docker网络
  • Ubuntu 24.04-自动安装-Nvidia驱动
  • 【CSAPP】-attacklab实验
  • docker部署onlyoffice,开启JWT权限校验Token
  • Hive排序字段解析
  • 3101.力扣每日一题7/6 Java(接近100%解法)
  • virtualbox窗口和win10窗口的切换
  • 卫星轨道平面简单认识
  • IP-Guard定制函数配置说明
  • C++常用类
  • React Hooks --- 分享自己开发中常用的自定义的Hooks (1)
  • uniapp H5页面设置跨域请求
  • 使用myCobot280和OAK-D OpenCV DepthAI摄像头制作一个实时脸部跟踪的手机支架!
  • Xilinx FPGA:vivado关于单端ROM的一个只读小实验
  • 集成学习(一)Bagging
  • Docker 中查看及修改 Redis 容器密码的实用指南
  • CH09_JS的循环控制语句
  • Python实现Mybatis Plus
  • 卷积神经网络和Vision Transformer的对比之归纳偏置
  • Java之网络面试经典题(一)
  • Failed to download metadata for repo ‘docker-ce-stable‘
  • vant拍摄视频上传以及多张图片上传
  • 如何用手机拍出高级感黑白色调照片?华为Pura70系列XMAGE演绎黑白艺术
  • Cartographer前后端梳理
  • Java面试题系列 - 第3天
  • 【Spring Boot】Spring Boot简介
  • Akamai+Noname强强联合 | API安全再加强
  • 第四届BPAA算法大赛成功举办!共研算法未来
  • 2024第三届中国医疗机器人大会第一轮通知
  • 常见算法和Lambda