BLAME#

invertedai.api.blame(location: str, colliding_agents: Tuple[int, int], agent_state_history: List[List[AgentState]], agent_attributes: List[AgentAttributes], traffic_light_state_history: Optional[List[Dict[int, TrafficLightState]]] = None, get_reasons: bool = False, get_confidence_score: bool = False, get_birdviews: bool = False) BlameResponse[source]#
Parameters:
  • location – Location name in IAI format.

  • colliding_agents – Two agents involved in the collision. These integers should correspond to the indices of the relevant agents in the lists within agent_state_history.

  • agent_state_history – Lists containing AgentState objects for every agent within the scene (up to 100 agents) for each time step within the relevant continuous sequence immediately preceding the collision. The list of AgentState objects should include the first time step of the collision and no time steps afterwards. The lists of AgentState objects preceding the collision should capture enough of the scenario context before the collision for BLAME to analyze and assign fault. For best results it is recommended to input 20-50 time steps of 0.1s each preceding the collision. Each AgentState state must include x: [float], y: [float] coordinates in meters, orientation: [float] in radians with 0 pointing along the positive x axis and pi/2 pointing along the positive y axis, and speed: [float] in m/s.

  • agent_attributes – List of static AgentAttribute objects for all agents. Each agent requires, length: [float], width: [float], and rear_axis_offset: [float] all in meters.

  • traffic_light_state_history – List of TrafficLightStatesDict objects containing the state of all traffic lights for every time step. The dictionary keys are the traffic-light IDs and value is the state, i.e., ‘green’, ‘yellow’, ‘red’, or None.

  • get_reasons – Whether to return the reasons regarding why each agent was blamed.

  • get_confidence_score – Whether to return how confident the BLAME is in its response.

  • get_birdviews – Whether to return the image visualizing the collision case. This is very slow and should only be used for debugging.


class invertedai.api.BlameResponse(*, agents_at_fault: Optional[Tuple[int, ...]], reasons: Optional[Dict[int, List[str]]], confidence_score: Optional[float], birdviews: Optional[List[Image]])[source]#

Response returned from an API call to iai.blame().

agents_at_fault: Optional[Tuple[int, ...]]#

A tuple containing all agents predicted to be at fault. If empty, BLAME has predicated no agents are at fault.

birdviews: Optional[List[Image]]#

If get_birdviews was set, this contains the resulting image.

confidence_score: Optional[float]#

Float value between [0,1] indicating BLAME’s confidence in the response where 0.0 represents the minimum confidence and 1.0 represents maximum.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'agents_at_fault': FieldInfo(annotation=Union[Tuple[int, ...], NoneType], required=True), 'birdviews': FieldInfo(annotation=Union[List[invertedai.common.Image], NoneType], required=True), 'confidence_score': FieldInfo(annotation=Union[float, NoneType], required=True), 'reasons': FieldInfo(annotation=Union[Dict[int, List[str]], NoneType], required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

reasons: Optional[Dict[int, List[str]]]#

A dictionary with agent IDs as keys corresponding to “agents_at_fault” paired with a list of reasons why the keyed agent is at fault (e.g. traffic_light_violation).