l5kit.evaluation.csv_utils module¶
- l5kit.evaluation.csv_utils.MAX_MODES = 3¶
These utilities write and read csv with ground-truth and prediction data. Both share the first two fields (timestamp and track_id) which are used to identify a single record.
GT: Single mode future prediction with availabilities (either 1->available or 0->unavailable). Header fields have these meanings: timestamp, track_id, avail_time_0, avail_time_1, …, coord_x_time_0, coord_y_time_0, …
PRED: Multi mode future prediction with confidence score (one value per mode up to MAX_MODES, sum to 1). Header fields have these meanings: timestamp, track_id, conf_mode_0, conf_mode_1, …, coord_x_time_0_mode_0, coord_y_time_0_mode_0, …, coord_x_time_0_mode_1, coord_y_time_0_mode_1, …
- l5kit.evaluation.csv_utils.read_gt_csv(csv_path: str) Iterator[dict] ¶
Generator function that returns a line at a time from the csv file as a dict
- Parameters
csv_path (str) – path of the csv to read
- Returns
dict keys are the csv header fieldnames
- Return type
Iterator[dict]
- l5kit.evaluation.csv_utils.read_pred_csv(csv_path: str, max_modes: int = 3) Iterator[dict] ¶
Generator function that returns a line at the time from the csv file as a dict
- Parameters
csv_path (str) – path of the csv to read
max_modes (int) – maximum number of predicted modes
- Returns
dict keys are the csv header fieldnames
- Return type
Iterator[dict]
- l5kit.evaluation.csv_utils.write_gt_csv(csv_path: str, timestamps: numpy.ndarray, track_ids: numpy.ndarray, coords: numpy.ndarray, avails: numpy.ndarray) None ¶
Encode the ground truth into a csv file
- Parameters
csv_path (str) – path to the csv to write
timestamps (np.ndarray) – (num_example,) frame timestamps
track_ids (np.ndarray) – (num_example,) agent ids
coords (np.ndarray) – (num_example x future_len x num_coords) meters displacements
avails (np.ndarray) – (num_example x future_len) array with value 0 (discard in eval) or 1 (keep in eval)
Returns:
- l5kit.evaluation.csv_utils.write_pred_csv(csv_path: str, timestamps: numpy.ndarray, track_ids: numpy.ndarray, coords: numpy.ndarray, confs: Optional[numpy.ndarray] = None, max_modes: int = 3) None ¶
Encode the predictions into a csv file. Coords can have an additional axis for multi-mode. We handle up to max_modes modes. For the uni-modal case (i.e. all predictions have just a single mode), coords should not have the additional axis and confs should be set to None. In this case, a single mode with confidence 1 will be written.
- Parameters
csv_path (str) – path to the csv to write
timestamps (np.ndarray) – (num_example,) frame timestamps
track_ids (np.ndarray) – (num_example,) agent ids
coords (np.ndarray) – (num_example x (modes) x future_len x num_coords) meters displacements
confs (Optional[np.ndarray]) – (num_example x modes) confidence of each modes in each example.
1 (Rows should sum to) –
max_modes (int) – maximum number of predicted modes
Returns: