MichaelGrupp / evo

Python package for the evaluation of odometry and SLAM
https://michaelgrupp.github.io/evo/
GNU General Public License v3.0
3.34k stars 745 forks source link

The best command to calcuate ATE for mono KITTI dataset #563

Closed kign17019999 closed 12 months ago

kign17019999 commented 1 year ago

I have reviewed several past issues in this repository; however, I have yet to find the most suitable command for calculating ATE for the KITTI dataset using a monocamera with ORB-SLAM3. Despite attempting some methods, I obtained peculiar results.

Therefore, I have the following questions:

  1. Could you provide the Python code to calculate ATE and RPE for mono KITTI?
  2. Where can I find the ground truth data for mono KITTI?

note:

A. Employing kitti_poses_and_timestamps_to_trajectory.py to map the timestamps. The command I am using to execute this code is as follows:

python3 kitti_poses_and_timestamps_to_trajectory.py gt/00.txt time/00.txt 00.txt

B. Utilizing the following Python code to calculate ATE and RPE for the mono KITTI dataset:

def evaluate_kit(ref_file, est_file):
    traj_ref = file_interface.read_tum_trajectory_file(ref_file)
    traj_est = file_interface.read_tum_trajectory_file(est_file)

    max_diff = 0.01
    traj_ref, traj_est = sync.associate_trajectories(traj_ref, traj_est, max_diff)

    # ===== ATE =======
    traj_est_aligned = copy.deepcopy(traj_est)
    traj_est_aligned.align(traj_ref, correct_scale=True, correct_only_scale=False)

    tum_ate_equivalent = metrics.APE(metrics.PoseRelation.translation_part)
    tum_ate_equivalent.process_data((traj_ref, traj_est_aligned))

    # ===== RPE =======
    delta = 1

    tum_rpe_equivalent = metrics.RPE(metrics.PoseRelation.translation_part, delta, metrics.Unit.frames, all_pairs=True)
    tum_rpe_equivalent.process_data((traj_ref, traj_est))

    # ===== extract result =======
    # ATE
    ate_rmse = tum_ate_equivalent.get_statistic(metrics.StatisticsType.rmse)
    ate_std = tum_ate_equivalent.get_statistic(metrics.StatisticsType.std)
    # print(f'ATE: rmse: {rmse}, std: {std}')

    # RPE
    rpe_rmse = tum_rpe_equivalent.get_statistic(metrics.StatisticsType.rmse)
    rpe_std = tum_rpe_equivalent.get_statistic(metrics.StatisticsType.std)
    # print(f'RPE: rmse: {rmse}, std: {std}')

    return ate_rmse, ate_std, rpe_rmse, rpe_std
def evaluate_tum(ref_file, est_file):
    traj_ref = file_interface.read_tum_trajectory_file(ref_file)
    traj_est = file_interface.read_tum_trajectory_file(est_file)

    max_diff = 0.01
    traj_ref, traj_est = sync.associate_trajectories(traj_ref, traj_est, max_diff)

    # ===== ATE =======
    traj_est_aligned = copy.deepcopy(traj_est)
    traj_est_aligned.align(traj_ref, correct_scale=False, correct_only_scale=False)

    tum_ate_equivalent = metrics.APE(metrics.PoseRelation.translation_part)
    tum_ate_equivalent.process_data((traj_ref, traj_est_aligned))

    # ===== RPE =======
    delta = 1

    tum_rpe_equivalent = metrics.RPE(metrics.PoseRelation.translation_part, delta, metrics.Unit.frames, all_pairs=True)
    tum_rpe_equivalent.process_data((traj_ref, traj_est))

    # ===== extract result =======
    # ATE
    ate_rmse = tum_ate_equivalent.get_statistic(metrics.StatisticsType.rmse)
    ate_std = tum_ate_equivalent.get_statistic(metrics.StatisticsType.std)
    # print(f'ATE: rmse: {rmse}, std: {std}')

    # RPE
    rpe_rmse = tum_rpe_equivalent.get_statistic(metrics.StatisticsType.rmse)
    rpe_std = tum_rpe_equivalent.get_statistic(metrics.StatisticsType.std)
    # print(f'RPE: rmse: {rmse}, std: {std}')

    return ate_rmse, ate_std, rpe_rmse, rpe_std

KeyFrameTrajectory_Kitti_01.txt

KeyFrameTrajectory_Kitti_01_track_person.txt

KeyFrameTrajectory_RGB-D_rgbd_dataset_freiburg3_sitting_xyz_track_person.txt

Thank you in advance

MichaelGrupp commented 1 year ago

Could you provide the Python code to calculate ATE and RPE for mono KITTI? Where can I find the ground truth data for mono KITTI?

Please ask a specific question that is related to evo. You're writing a customized script and I can't help you by writing code for you or do research about your dataset.