jagjeet-singh / argoverse-forecasting

Official Repository for Argoverse Motion Forecasting Baselines
BSD 3-Clause Clear License
242 stars 66 forks source link

KeyError Constant Velocity model #21

Closed han1222 closed 2 years ago

han1222 commented 2 years ago

(argoverse) han@han:/media/han/E46A4C3C6A4C0E2C/hsi_ws/argoverse-forecasting$ python eval_forecasting_helper.py --metrics --gt /media/han/E46A4C3C6A4C0E2C/hsi_ws/argoverse-forecasting/ground_truth_data/ground_truth_val.pkl --forecast /media/han/E46A4C3C6A4C0E2C/hsi_ws/argoverse-forecasting/forecasted_trajectories/const_vel.pkl --horizon 30 --obs_len 20 --features /media/han/E46A4C3C6A4C0E2C/hsi_ws/argoverse-forecasting/forecasting_features/forecasting_features_val.pkl --max_n_guesses 6 Traceback (most recent call last): File "eval_forecasting_helper.py", line 252, in args.miss_threshold, File "/media/han/E46A4C3C6A4C0E2C/hsi_ws/argoverse-api/argoverse/evaluation/eval_forecasting.py", line 215, in compute_forecasting_metrics forecasted_probabilities, File "/media/han/E46A4C3C6A4C0E2C/hsi_ws/argoverse-api/argoverse/evaluation/eval_forecasting.py", line 94, in get_displacement_errors_and_miss_rate max_num_traj = min(max_guesses, len(forecasted_trajectories[k])) KeyError: 31171

I used below code to make gt file

import os import pickle

df = pd.read_pickle("./forecasting_features/forecasting_features_val.pkl") print(df) save_path = "./ground_truth_data"

if not os.path.exists(save_path): os.makedirs(save_path)

val_gt = {} for i in range(len(df)): seq_id = df.iloc[i]['SEQUENCE'] curr_arr = df.iloc[i]['FEATURES'][20:][:, 3:5] val_gt[seq_id] = curr_arr

with open(save_path + '/ground_truth_val.pkl', 'wb') as f: pickle.dump(val_gt, f)

Screenshot from 2022-01-26 03-05-31

I tried to run Evaluation metrics with constant_velocity baseline. how can I solve this ?

han1222 commented 2 years ago

I solved this error

python eval_forecasting_helper.py --metrics --gt /media/han/E46A4C3C6A4C0E2C/hsi_ws/argoverse-forecasting/ground_truth_data/ground_truth_val.pkl --forecast /media/han/E46A4C3C6A4C0E2C/hsi_ws/argoverse-forecasting/forecasted_trajectories/const_vel_val.pkl --horizon 30 --obs_len 20 --features /media/han/E46A4C3C6A4C0E2C/hsi_ws/argoverse-forecasting/forecasting_features/forecasting_features_val.pkl --max_n_guesses 6

I used val_features instead of test_features.

NaelsonDouglas commented 2 years ago

Use df.iterrows() instead of for i in len(df)