igp2.data package¶
Submodules¶
igp2.data.data_loaders module¶
Modified version of code from https://github.com/cbrewitt/av-goal-recognition/blob/master/core/ based on https://github.com/ika-rwth-aachen/drone-dataset-tools
- class igp2.data.data_loaders.DataLoader(config_path: str, splits: List[str] | None = None)[source]¶
Bases:
ABC
Abstract class that is implemented by every DataLoader that IGP2 can use.
A set of recordings are collected into an Episode. Episodes and the corresponding Map and configuration are managed by a Scenario object. The created DataLoader is iterable.
- class igp2.data.data_loaders.InDDataLoader(config_path: str, splits: List[str] | None = None)[source]¶
Bases:
DataLoader
igp2.data.episode module¶
- class igp2.data.episode.Episode(config: EpisodeConfig, metadata: EpisodeMetadata, agents: Dict[int, TrajectoryAgent], frames: List[Frame])[source]¶
Bases:
object
An episode that is represented with a collection of Agents and their corresponding frames.
- class igp2.data.episode.EpisodeConfig(config)[source]¶
Bases:
object
Metadata about an episode
- property recording_id: str¶
Unique ID identifying the episode
- class igp2.data.episode.EpisodeLoader(scenario_config)[source]¶
Bases:
ABC
Abstract class that every EpisodeLoader should represent. Also keeps track of registered subclasses.
- EPISODE_LOADERS = {'ind': <class 'igp2.data.episode.IndEpisodeLoader'>}¶
- classmethod get_loader(scenario_config: ScenarioConfig) EpisodeLoader [source]¶
Get the episode loader as specified within the ScenarioConfig
- Parameters:
scenario_config – The scenario configuration
- Returns:
The corresponding EpisodeLoader
- load(config: EpisodeConfig, road_map=None, **kwargs)[source]¶
- class igp2.data.episode.EpisodeMetadata(config)[source]¶
Bases:
object
- property frame_rate: int¶
Frame rate of the episode recording.
- property max_speed: float¶
The speed limit at the episode location.
- class igp2.data.episode.Frame(time: float, dead_ids: Set[int] | None = None)[source]¶
Bases:
object
A snapshot of time in the data set
- add_agent_state(agent_id: int, state: AgentState)[source]¶
Add a new agent with its specified state.
- Parameters:
agent_id – The ID of the Agent whose state is being recorded
state – The state of the Agent
- property agents: Dict[int, AgentState]¶
- property all_agents: Dict[int, AgentState]¶
- class igp2.data.episode.IndEpisodeLoader(scenario_config)[source]¶
Bases:
EpisodeLoader
- load(config: EpisodeConfig, road_map: Map | None = None, agent_types: List[str] | None = None, scale: float | None = None)[source]¶
igp2.data.scenario module¶
- class igp2.data.scenario.InDScenario(config: ScenarioConfig)[source]¶
Bases:
Scenario
- classmethod load(file_path: str, split: List[str] | None = None)[source]¶
Initialise a new Scenario from the given config file. :param file_path: Path to the file defining the scenario :param split: The data set splits to load as given by indices. If None, load all.
- Returns:
A new Scenario instance
- class igp2.data.scenario.Scenario(config: ScenarioConfig)[source]¶
Bases:
ABC
Represents an arbitrary driving scenario with interactions broken to episodes.
- classmethod load(file_path: str, split: List[str] | None = None)[source]¶
Initialise a new Scenario from the given config file. :param file_path: Path to the file defining the scenario :param split: The data set splits to load as given by indices. If None, load all.
- Returns:
A new Scenario instance
- property loader: EpisodeLoader¶
The EpisodeLoader of the Scenario.
- class igp2.data.scenario.ScenarioConfig(config_dict)[source]¶
Bases:
object
Metadata about a scenario used for goal recognition
- property agent_types: List[str]¶
Gets which types of agents to keep from the data set
- property background_image: str¶
Path to background image
- property background_px_to_meter: float¶
Pixels per meter in background image
- property buildings: List[List[List[float]]]¶
Return the vertices of the buildings in the map.
- property check_lanes: bool¶
True if Lane data should be checked when loading frames for agents
- property check_oncoming: bool¶
True if ChangeLane macro action should check for other agents in the lane before switching.
- property cost_factors: Dict[str, float]¶
Default cost weights.
- property data_format: str¶
Format in which the data is stored
- property data_root: str¶
Path to directory in which the data is stored
- property dataset_split: Dict[str, List[int]]¶
Get the which data split each episode belongs to
- property episodes: List[EpisodeConfig]¶
Configuration for all episodes for this scenario
- Type:
list of dict
- property goal_threshold: float¶
Threshold for checking goal completion of agents’ trajectories
- property goal_types: List[List[str]]¶
Possible goals for agents in this scenario
- property goals: List[Tuple[int, int]]¶
Possible goals for agents in this scenario
- property goals_priors: List[float]¶
Priors for goals in this scenario
- property lat_origin: float¶
Latitude of the origin
- classmethod load(file_path)[source]¶
Loads the scenario metadata into from a json file :param file_path: path to the file to load :type file_path: str
- Returns:
metadata about the scenario
- Return type:
- property lon_origin: float¶
Longitude of the origin
- property name: str¶
Name of the scenario
- property reachable_pairs: List[List[List[float]]]¶
Pairs of points, where the second point should be reachable from the first Can be used for validating maps
- property scale_down_factor: int¶
Scale down factor for visualisation
- property scaling_factor: float¶
Constant factor to account for mismatch in the scale of the recordings and the size of the map
- property target_switch_length: float¶
Target length for lane switch maneuver.