l5kit.sampling.agent_sampling_vectorized module

l5kit.sampling.agent_sampling_vectorized.generate_agent_sample_vectorized(state_index: int, frames: numpy.ndarray, agents: numpy.ndarray, tl_faces: numpy.ndarray, selected_track_id: Optional[int], history_num_frames_ego: int, history_num_frames_agents: int, future_num_frames: int, step_time: float, filter_agents_threshold: float, vectorizer: l5kit.vectorization.vectorizer.Vectorizer, perturbation: Optional[l5kit.kinematic.perturbation.Perturbation] = None) dict

Generates the inputs and targets to train a deep prediction model with vectorized inputs. A deep prediction model takes as input the state of the world in vectorized form, and outputs where that agent will be some seconds into the future.

This function has a lot of arguments and is intended for internal use, you should try to use higher level classes and partials that use this function.

Parameters
  • state_index (int) – The anchor frame index, i.e. the “current” timestep in the scene

  • frames (np.ndarray) – The scene frames array, can be numpy array or a zarr array

  • agents (np.ndarray) – The full agents array, can be numpy array or a zarr array

  • tl_faces (np.ndarray) – The full traffic light faces array, can be numpy array or a zarr array

  • selected_track_id (Optional[int]) – Either None for AV, or the ID of an agent that you want to

  • from (predict the future of. This agent is centered in the representation and the returned targets are derived) –

  • states. (their future) –

  • history_num_frames_ego (int) – Amount of ego history frames to include

  • history_num_frames_agents (int) – Amount of agent history frames to include

  • future_num_frames (int) – Amount of future frames to include

  • step_time (float) – seconds between consecutive steps

  • filter_agents_threshold (float) – Value between 0 and 1 to use as cutoff value for agent filtering

  • agent (based on their probability of being a relevant) –

  • perturbation (Optional[Perturbation]) – Object that perturbs the input and targets, used

  • data (to train models that can recover from slight divergence from training set) –

Raises
  • IndexError – An IndexError is returned if the specified selected_track_id is not present in the scene

  • or was filtered by applying the filter_agent_threshold probability filtering.

Returns

a dict containing e.g. the future offset coordinates (meters), the future yaw angular offset, the future_availability as a binary mask, the vectorized input representation features, and (optional) a raster image

Return type

dict