- invertedai.api.initialize(location: str, agent_attributes: Optional[List[AgentAttributes]] = None, states_history: Optional[List[List[AgentState]]] = None, traffic_light_state_history: Optional[List[Dict[int, TrafficLightState]]] = None, get_birdview: bool = False, location_of_interest: Optional[Tuple[float, float]] = None, get_infractions: bool = False, agent_count: Optional[int] = None, random_seed: Optional[int] = None, model_version: Optional[str] = None) InitializeResponse #
Initializes a simulation in a given location, using a combination of user-defined and sampled agents. User-defined agents are placed in a scene first, after which a number of agents are sampled conditionally inferred from the agent_count argument. If user-defined agents are desired, states_history must contain a list of AgentState’s of all user-defined agents per historical time step. Any user-defined agent must have a corresponding fully specified static AgentAttribute in agent_attributes. Any sampled agents not specified in agent_attributes will be generated with default static attribute values however sampled agents may be defined by specifying agent_type only. Agents are identified by their list index, so ensure the indices of each agent match in states_history and agent_attributes when applicable. If traffic lights are present in the scene, for best results their state should be specified for the current time in a TrafficLightStatesDict, and all historical time steps for which states_history is provided. It is legal to omit the traffic light state specification, but the scene will be initialized as if the traffic lights were disabled. Every simulation must start with a call to this function in order to obtain correct recurrent states for
location – Location name in IAI format.
agent_attributes – Static attributes for all agents. The pre-defined agents should be specified first, followed by the sampled agents.
states_history – History of pre-defined agent states - the outer list is over time and the inner over agents, in chronological order, i.e., index 0 is the oldest state and index -1 is the current state. The order of agents should be the same as in agent_attributes. For best results, provide at least 10 historical states for each agent.
traffic_light_state_history – History of traffic light states - the list is over time, in chronological order, i.e. the last element is the current state. Not specifying traffic light state is equivalent to disabling traffic lights.
location_of_interest – Optional coordinates for spawning agents with the given location as center instead of the default map center
get_birdview – If True, a birdview image will be returned representing the current world. Note this will significantly impact on the latency.
get_infractions – If True, infraction metrics will be returned for each agent.
agent_count – Deprecated. Equivalent to padding the agent_attributes list to this length with default AgentAttributes.
random_seed – Controls the stochastic aspects of initialization for reproducibility.
model_version – Optionally specify the version of the model. If None is passed which is by default, the best model will be used.
- class invertedai.api.InitializeResponse(*, recurrent_states: List[Optional[RecurrentState]], agent_states: List[Optional[AgentState]], agent_attributes: List[Optional[AgentAttributes]], birdview: Optional[Image] = None, infractions: Optional[List[InfractionIndicators]] = None, model_version: str)#
Response returned from an API call to
- infractions: Optional[List[InfractionIndicators]]#
If get_infractions was set, they are returned here.
- model_version: str#