ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

评估dso直接稀疏里程计

2026/9/3 11:08:11 拓冰建站 浏览量
评估dso直接稀疏里程计 部署好dso直接稀疏里程计后运行数据集生成result.txt使用evo进行评估出现问题1.1问题生成的result.txt第一列“时间戳”均为02解决在运行数据集下新建一个times.txt文件文件内容为图片名称无文件扩展名即去除.jpg 时间戳例如00000 1341840083.7899743实际操作步骤演示我是使用的Computer Vision Group - Dataset Download网站下的rgbd_dataset_freiburg3_nostructure_texture_near_withloop下载的zip压缩包并将该文件夹内的rgb文件夹内的.png图片转化为.jpg格式重命名为00000.jpg设置图片像素大小宽度为1280像素和高度为1024像素同时生成“文件名 时间戳”的times.txt文件pythoi代码png_to_jpg_size_times.py如下import osfrom PIL import Imagedef copy_and_rename_images(src_dir, dest_dir, times_file):# 确保目标文件夹存在if not os.path.exists(dest_dir):os.makedirs(dest_dir)images sorted([f for f in os.listdir(src_dir) if f.endswith(.png)])# 打开times.txt文件准备写入文件名一一对应with open(times_file, w) as f:for idx, image in enumerate(images):src_path os.path.join(src_dir, image)dest_path os.path.join(dest_dir, f{idx:05d}.jpg)# 打开图像调整大小并转换格式img Image.open(src_path)img img.resize((1280, 1024)) # 设置宽度为1280高度为1024img.convert(RGB).save(dest_path, JPEG)# 写入去除扩展名后的文件名一一对应src_name os.path.splitext(image)[0] # 去除扩展名dest_name f{idx:05d} # 目标文件名去除扩展名f.write(f{dest_name} {src_name}\n)print(fSuccessfully copied and renamed {len(images)} images, and saved the filenames to {times_file}.)src_folder /home/dataset/rgbd_dataset_freiburg3_nostructure_texture_near_withloop/rgbdest_folder /home/dataset/rgbd_dataset_freiburg3_nostructure_texture_near_withloop/imagestimes_file /home/dataset/rgbd_dataset_freiburg3_nostructure_texture_near_withloop/times.txt# 确保目标目录存在if not os.path.exists(dest_folder):os.makedirs(dest_folder)# 确保times.txt文件存在不存在则创建if not os.path.exists(times_file):with open(times_file, w) as f:pass # 创建空文件# 调用函数copy_and_rename_images(src_folder, dest_folder, times_file)4在终端运行命令python png_to_jpg_size_times.py在文件夹rgbd_dataset_freiburg3_nostructure_texture_near_withloop下生成转换图片格式的images/00000.jpg等图片和times.txt文件注意修改png_to_jpg_size_times.py代码中的路径src_folder /home/dataset/rgbd_dataset_freiburg3_nostructure_texture_near_withloop/rgbdest_folder /home/dataset/rgbd_dataset_freiburg3_nostructure_texture_near_withloop/imagestimes_file /home/dataset/rgbd_dataset_freiburg3_nostructure_texture_near_withloop/times.txt5在文件夹rgbd_dataset_freiburg3_nostructure_texture_near_withloop下新建camera.txt文件内容为# camera.txt格式如下# 第一行: fx fy cx cy d0 d1 d2 d3# 第二行: 原始图像尺寸# 第三行: 相机类型 crop / full / none / fx fy cx cy 0# 第四行: resize后的图像尺寸0.349153000000000 0.436593000000000 0.493140000000000 0.499021000000000 0.9332710000000001280 10240.4 0.53 0.5 0.5 0640 4806重新运行dso在新数据集/home/dataset/rgbd_dataset_freiburg3_nostructure_texture_near_withloop/images下重新运行dso生成的result.txt第一列即为时间戳终端下输入build/bin/dso_dataset files你的路径/rgbd_dataset_freiburg3_nostructure_texture_near_withloop/images calib你的路径/rgbd_dataset_freiburg3_nostructure_texture_near_withloop/camera.txt mode12.1问题在使用evo进行tum格式进行评估运行命令evo_ape tum groundtruth.txt result.txt -vas报错[ERROR] TUM trajectory files must have 8 entries per row and no trailing delimiter at the end of the rows (space)分析原因生成的result.txt多了空格2解决先在终端下执行cat result.txt | tr -s [:space:] dso_result.txt再使用evo工具评估evo_ape tum groundtruth.txt dso_result.txt -vas