l5kit.simulation.dataset module

class l5kit.simulation.dataset.SimulationConfig(use_ego_gt: bool = False, use_agents_gt: bool = False, disable_new_agents: bool = False, distance_th_far: float = 30.0, distance_th_close: float = 15.0, start_frame_index: int = 0, num_simulation_steps: Optional[int] = None, show_info: bool = False)

Bases: object

Defines the parameters used for the simulation of ego and agents around it.

Parameters
  • use_ego_gt – whether to use GT annotations for ego instead of model’s outputs

  • use_agents_gt – whether to use GT annotations for agents instead of model’s outputs

  • disable_new_agents – whether to disable agents that are not returned at start_frame_index

  • distance_th_far – if a tracked agent is closed than this value to ego, it will be controlled

  • distance_th_close – if a new agent is closer than this value to ego, it will be controlled

  • start_frame_index – the start index of the simulation

  • num_simulation_steps – the number of step to simulate

  • show_info – whether to show info logging during unroll

disable_new_agents: bool = False
distance_th_close: float = 15.0
distance_th_far: float = 30.0
num_simulation_steps: Optional[int] = None
show_info: bool = False
start_frame_index: int = 0
use_agents_gt: bool = False
use_ego_gt: bool = False
class l5kit.simulation.dataset.SimulationDataset(scene_dataset_batch: Dict[int, l5kit.dataset.ego.EgoDataset], sim_cfg: l5kit.simulation.dataset.SimulationConfig)

Bases: object

static from_dataset_indices(dataset: l5kit.dataset.ego.EgoDataset, scene_indices: List[int], sim_cfg: l5kit.simulation.dataset.SimulationConfig) l5kit.simulation.dataset.SimulationDataset

Create a SimulationDataset by picking indices from the provided dataset

Parameters
  • dataset – the EgoDataset

  • scene_indices – scenes from the EgoDataset to pick

  • sim_cfg – a simulation config

Returns

the new SimulationDataset

get_min_len() int

Return the minimum number of frames between the scenes

Returns

the minimum number of frames

rasterise_agents_frame_batch(state_index: int) Dict[Tuple[int, int], Dict[str, numpy.ndarray]]

Rasterise agents for each scene in the batch at a given frame.

Parameters

state_index – the frame index in the scene

Returns

a dict mapping from [scene_id, track_id] to the numpy dict

rasterise_frame_batch(state_index: int) List[Dict[str, numpy.ndarray]]

Get a frame from all scenes

Parameters

state_index – the frame index

Returns

a list of dict from EgoDatasets

set_agents(state_index: int, agents_infos: Dict[Tuple[int, int], numpy.ndarray]) None

Set multiple agents in the scene datasets.

Parameters
  • state_index – the frame index to set (same for all datasets)

  • agents_infos – a dict mapping (scene_idx, agent_idx) to the agent array

set_ego(state_index: int, output_index: int, ego_translations: numpy.ndarray, ego_yaws: numpy.ndarray) None

Mutate future frame position and yaw for ego across scenes. This acts on the underlying dataset

Parameters
  • state_index – the frame index to mutate

  • output_index – the index in ego_translations and ego_yaws to use

  • ego_translations – output translations (N, T, 2)

  • ego_yaws – output yaws (N, T)