Evaluation Scripts
Theevaluation/ directory contains Python tools for trajectory analysis:
Trajectory Alignment
Timestamp Association
Theassociate.py script matches timestamps between estimated and ground truth trajectories:
associate.py Parameters
associate.py Parameters
Arguments:
first_file: Ground truth trajectory (format:timestamp tx ty tz qx qy qz qw)second_file: Estimated trajectory (same format)--offset: Time offset between trajectories (default: 0.0)--max_difference: Maximum time difference for matching (default: 0.02s)--first_only: Output only first file timestamps
Coordinate Frame Alignment
For EuRoC visual-only trajectories, ground truth must be transformed from IMU frame to left camera frame.
EuRoC provides ground truth for each sequence in the IMU body reference. As pure visual executions report trajectories centered in the left camera, we provide in the “evaluation” folder the transformation of the ground truth to the left camera reference.
Absolute Trajectory Error (ATE)
Computing ATE with Scale Estimation
Theevaluate_ate_scale.py script computes ATE using the method of Horn for trajectory alignment:
ATE Computation Method
The script performs SE(3) alignment using SVD (evaluate_ate_scale.py:49-99):Alignment Algorithm Details
Alignment Algorithm Details
-
Zero-center both trajectories:
-
Compute rotation using SVD:
-
Compute scale factor:
-
Compute translation:
-
Calculate alignment error:
Script Parameters
evaluate_ate_scale.py Options
evaluate_ate_scale.py Options
first_file: Ground truth trajectorysecond_file: Estimated trajectory
--offset: Time offset (default: 0.0)--scale: Pre-apply scale to second trajectory (default: 1.0)--max_difference: Max timestamp difference in ns (default: 20000000)--save: Save aligned trajectory to file--save_associations: Save associated trajectory pairs--plot: Generate comparison plot (PDF)--verbose: Print detailed statistics--verbose2: Print both scaled and unscaled RMSE
--verbose):EuRoC Dataset Evaluation
Ground Truth Files
Theevaluation/Ground_truth/ directory contains pre-transformed ground truth:
Available Ground Truth Files
Available Ground Truth Files
EuRoC Left Camera Frame (
EuRoC_left_cam/):MH01_GT.txtthroughMH05_GT.txt- Machine Hall sequencesV101_GT.txtthroughV203_GT.txt- Vicon Room sequences
EuRoC_imu/):MH_GT.txt- Machine HallV1_GT.txt,V2_GT.txt- Vicon Room
Use
EuRoC_left_cam/ for visual-only SLAM, EuRoC_imu/ for visual-inertial SLAM.Example Evaluation Workflow
Relative Pose Error (RPE)
While ORB-SLAM3 provides ATE evaluation, RPE can be computed using external tools:Computing RPE with evo Package
Computing RPE with evo Package
--delta: Distance between pose pairs (meters)--pose_relation:trans_part(translation only) orfull(SE(3))--all_pairs: Use all pose pairs instead of consecutive
TUM-VI Dataset Evaluation
From README.md:146-151:In TUM-VI ground truth is only available in the room where all sequences start and end. As a result the error measures the drift at the end of the sequence.
TUM-VI Evaluation Example
Trajectory File Formats
TUM Format (ORB-SLAM3 Output)
TUM Format Specification
TUM Format Specification
Columns:
timestamp: UNIX timestamp (seconds)tx, ty, tz: Translation vector (meters)qx, qy, qz, qw: Quaternion rotation (Hamilton convention)
- Camera frame for visual-only SLAM
- IMU frame for visual-inertial SLAM
KITTI Format
ORB-SLAM3 outputs TUM format by default. Convert to KITTI format using external tools if needed.
Ground Truth Comparison
Visual Comparison
Generate trajectory plots using the--plot option:
Plot Interpretation
Plot Interpretation
The generated PDF shows:
- Black line: Ground truth trajectory
- Blue line: Estimated trajectory (aligned)
- Red lines: Point-wise errors between trajectories
- Large systematic offsets indicate alignment issues
- Periodic errors suggest scale drift
- Localized spikes indicate tracking failures
Saving Aligned Trajectories
aligned_trajectory.txt: Estimated trajectory after SE(3) + scale alignmentmatched_pairs.txt: Associated ground truth and estimated poses
Python Evaluation Tools
Requirements
From README.md:71-72:Required to calculate the alignment of the trajectory with the ground truth. Required Numpy module.
Custom Evaluation Script
Example: Batch Evaluation Script
Example: Batch Evaluation Script
Benchmark Datasets
EuRoC MAV Dataset
Characteristics:- Stereo pinhole cameras (752×480 @ 20 Hz)
- IMU data (200 Hz)
- Accurate ground truth from motion capture
- Indoor environments
- Easy sequences (MH01-MH03): < 0.1 m RMSE
- Medium sequences (V101-V103): 0.1-0.2 m RMSE
- Difficult sequences (V201-V203): 0.2-0.5 m RMSE
TUM-VI Dataset
Characteristics:- Fisheye stereo cameras (512×512 @ 20 Hz)
- IMU data (200 Hz)
- Limited ground truth (room start/end only)
- Indoor and outdoor environments
- Indoor sequences: < 0.5 m
- Outdoor sequences: 0.5-1.5 m
KITTI Odometry Dataset
Characteristics:- Stereo grayscale cameras (1241×376 @ 10 Hz)
- GPS/IMU ground truth
- Outdoor driving scenarios
- Easy sequences: < 1% of trajectory length
- Difficult sequences: 1-3% of trajectory length
Troubleshooting Evaluation Issues
No Matching Timestamps
No Matching Timestamps
Error: “Couldn’t find matching timestamp pairs”Solutions:
- Check timestamp format (should be in seconds, not nanoseconds)
- Increase
--max_differenceparameter (try 0.1 or 0.2) - Verify both files use the same time reference
- Check for consistent timestamp ordering
Large Scale Errors
Large Scale Errors
Symptoms: Scale factor much greater than 1.0 or much less than 1.0Causes:
- Monocular SLAM has inherent scale ambiguity
- Incorrect ground truth coordinate frame
- Units mismatch (meters vs. millimeters)
- Use stereo or visual-inertial for metric scale
- Verify ground truth transformation
- Check trajectory units consistency
High RMSE Despite Good Visual Tracking
High RMSE Despite Good Visual Tracking
Possible Issues:
- Coordinate frame mismatch: Using IMU GT with camera trajectory
- Timestamp synchronization: Check
--offsetparameter - Partial tracking loss: Inspect trajectory continuity
- Map scale drift: Check if scale factor varies over time
Best Practices
- Use appropriate ground truth frame (camera vs. IMU) for your SLAM mode
- Verify timestamp synchronization before evaluation
- Generate visual plots to inspect alignment quality
- Report both ATE and RPE for comprehensive evaluation
- Include scale factor in results for monocular systems
- Evaluate multiple sequences to assess robustness
- Compare against published results from the ORB-SLAM3 paper