TUM: how to use TUM dataset - TUM数据集的使用
# 目标
- 如何使用TUM数据集?
- 如何用SLAM跑TUM数据集?
- 如何评价SLAM定位的好坏?
# 获取数据集
- [TUM RGBD dataset](https://vision.in.tum.de/data/datasets/rgbd-dataset/download)
- [rgbd_benchmark](https://vision.in.tum.de/data/datasets/rgbd-dataset/tools#evaluation)
For example:
```sh
wget -c https://vision.in.tum.de/rgbd/dataset/freiburg3/rgbd_dataset_freiburg3_walking_halfsphere.tgz
wget -c https://vision.in.tum.de/rgbd/dataset/freiburg3/rgbd_dataset_freiburg3_walking_rpy.tgz
```
Unzip:
```sh
tar zxvf rgbd_dataset_freiburg3_walking_halfsphere.tgz
```
数据集目录结构:
```sh
➜ rgbd_dataset_freiburg3_walking_rpy tree -L 1
.
├── accelerometer.txt
├── associations.txt
├── depth
├── depth.txt
├── groundtruth.txt
├── rgb
└── rgb.txt
```
# 关联彩色图像与深度图像
先要下载RGBD benchmark
```sh
associate.py rgb.txt depth.txt > associations.txt
```
associations.txt 内容格式:
- RGB timestamp, float
- RGB image, string
- Depth timestamp, float
- Depth image, string
For example:
```sh
1341846647.802247 rgb/1341846647.802247.png 1341846647.802269 depth/1341846647.802269.png
1341846647.834093 rgb/1341846647.834093.png 1341846647.834105 depth/1341846647.834105.png
...
```
# 仿真
## ORB SLAM2
运行参数:
- Vocabulary
- TUM.yaml
- dataset directory
- associations.txt
For example:
```sh
./Examples/RGB-D/rgbd_tum ./Vocabulary/ORBvoc.txt ./Examples/RGB-D/TUM3.yaml /root/Dataset/TUM/freiburg3/rgbd_dataset_freiburg3_walking_rpy /root/Dataset/TUM/freiburg3/rgbd_dataset_freiburg3_walking_rpy/associations.txt
```
# 用数据集进行验证
- 先要下载 rgbd_benchmark_tools
```sh
svn checkout https://svncvpr.in.tum.de/cvpr-ros-pkg/trunk/rgbd_benchmark/rgbd_benchmark_tools
```
- 下载 Ground truth
```sh
wget -c https://vision.in.tum.de/rgbd/dataset/freiburg3/rgbd_dataset_freiburg3_walking_rpy-groundtruth.txt
```
- ATE Error of rgbd_dataset_freiburg3_walking_rpy
```sh
evaluate_ate.py --plot ate.png --verbose --save_associations ate_associate.txt ../rgbd_dataset_freiburg3_walking_rpy-groundtruth.txt ../KeyFrameTrajectory.txt
compared_pose_pairs 388 pairs
absolute_translational_error.rmse 1.085461 m
absolute_translational_error.mean 0.970126 m
absolute_translational_error.median 1.135803 m
absolute_translational_error.std 0.486909 m
absolute_translational_error.min 0.047486 m
absolute_translational_error.max 1.905858 m
```
![ate.png](https://cdn.jsdelivr.net/gh/yubaoliu/assets@image/ate.png)
- RPE Error of rgbd_dataset_freiburg3_walking_rpy
```sh
evaluate_rpe.py --fixed_delta --plot rpe.png --save rpe.txt --verbose ../rgbd_dataset_freiburg3_walking_rpy-groundtruth.txt ../KeyFrameTrajectory.txt
compared_pose_pairs 364 pairs
translational_error.rmse 0.385744 m
translational_error.mean 0.290880 m
translational_error.median 0.203410 m
translational_error.std 0.253352 m
translational_error.min 0.000000 m
translational_error.max 1.024328 m
rotational_error.rmse 7.523788 deg
rotational_error.mean 5.614611 deg
rotational_error.median 0.064197 deg
rotational_error.std 5.008347 deg
rotational_error.min 0.000000 deg
rotational_error.max 19.987115 deg
```
![rpe.png](https://cdn.jsdelivr.net/gh/yubaoliu/assets@image/rpe.png)
# groundtruth_file 数据格式
```sh
groundtruth_file ground-truth trajectory file (format: "timestamp tx ty tz qx qy qz qw")
estimated_file estimated trajectory file (format: "timestamp tx ty tz qx qy qz qw")
```
For example:
```sh
1341846647.802247 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000
1341846647.866652 0.0070123 0.0018382 -0.0068172 0.0032666 0.0019550 0.0018201 0.9999911
...
```
# 2D到3D点的转换
```cpp
fx = 525.0 # focal length x
fy = 525.0 # focal length y
cx = 319.5 # optical center x
cy = 239.5 # optical center y
factor = 5000 # for the 16-bit PNG files
# OR: factor = 1 # for the 32-bit float images in the ROS bag files
for v in range(depth_image.height):
for u in range(depth_image.width):
Z = depth_image[v,u] / factor;
X = (u - cx) * Z / fx;
Y = (v - cy) * Z / fy;
```
# 相机内参
```cpp
Camera fx fy cx cy d0 d1 d2 d3 d4
(ROS default) 525.0 525.0 319.5 239.5 0.0 0.0 0.0 0.0 0.0
Freiburg 1 RGB 517.3 516.5 318.6 255.3 0.2624 -0.9531 -0.0054 0.0026 1.1633
Freiburg 2 RGB 520.9 521.0 325.1 249.7 0.2312 -0.7849 -0.0033 -0.0001 0.9172
Freiburg 3 RGB 535.4 539.2 320.1 247.6 0 0 0 0 0
```
No comments