In many motion forecasting scenarios (autonomous driving, robotics, pedestrian tracking), predicting a single future trajectory is often insufficient because the future is inherently uncertain. Instead, models predict multiple possible future trajectories (called hypotheses), each with an associated probability.
Implement a function that evaluates a set of K predicted trajectory hypotheses against a single ground truth trajectory. Each trajectory is a sequence of T 2D points representing positions over time.
Given:
predictions: A list of K trajectories, where each trajectory is a list of T [x, y] coordinate pairsprobabilities: A list of K probability values (summing to 1) representing the model's confidence in each hypothesisground_truth: A single trajectory of T [x, y] coordinate pairsCompute and return a dictionary with the following keys:
ade_per_hypothesis: list of Average Displacement Error for each hypothesis (mean Euclidean distance across all timesteps)fde_per_hypothesis: list of Final Displacement Error for each hypothesis (Euclidean distance at the last timestep only)min_ade: the minimum ADE across all hypothesesmin_fde: the minimum FDE across all hypothesesbest_hypothesis_idx: index of the hypothesis with the lowest ADEwta_loss: the winner-takes-all loss, equal to the ADE of the best hypothesisprob_weighted_ade: the sum of each hypothesis's probability multiplied by its ADEAll float values in the returned dictionary should be rounded to 4 decimal places.