Client SDK for InvertedAI
Project description
InvertedAI
Overview
Inverted AI has trained cutting-edge realistic behavioral driving models that are human-like and close the SIM2Real. Our API provides access to these behavioral models and can be useful for several tasks in autonomous vehicle (AV) research and development.
Get Started
In this quickstart tutorial, you’ll run a simple sample AV simulation with Inverted AI Python API. Along the way, you’ll learn key concepts and techniques that are fundamental to using the API for other tasks. In particular, you will be familiar with two main Inverted AI models:
- DRIVE
- INITIALIZE
Quick Start
-
Locally: Download the examples directory, navigate to the unzipped directory in terminal and run
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
.venv/bin/jupyter notebook Drive-Demo.ipynb
Installation
pip install invertedai
Setting up
Import the invertedai package and set the API key with add_apikey method.
Refer to the product page to get your API key (or recharge for more tokens).
import invertedai as iai
iai.add_apikey("XXXXXXXXXXXXXX")
Browse through available maps (location)
Inverted AI provides an assortment of diverse road configurations and geometries, including real-world locations and maps from simulators (CARLA, Huawei SMARTS, ...).
To search the catalog use iai.available_maps method by providing keywords
iai.available_maps("roundabout", "carla")
To get information about a scene use iai.get_map.
iai.get_map**("CARLA:Town03:Roundabout")
The scene information include the map in Lanelet2 format, map in JPEG format, maximum number of allowed (driveable) vehicles, latitude longitude coordinates (for real-world locations), id and list of traffic light and signs (if any exist in the map), etc.
INITIALIZE
To run the simulation, the map must be first populated with agents.
Inverted AI provides the INITIALIZE, a state-of-the-art model trained with real-life driving scenarios which can generate realistic positions for the initial state of the simulation.
Having realistic, complicated and diverse initial conditions are particularly crucial to observer interesting and informative interaction between the agents, i.e., the ego vehicle and NPCs (non-player characters).
You can use INITIALIZE in two modes:
- Initialize all agents: generates initial conditions (position and speed) for all the agents including the ego vehicle
response = iai.initialize(
location="CARLA:Town03:Roundabout",
agent_count=10,
)
- Initialize NPCs: generates initial conditions (position and speed) only for the NPCs according to the provided state of the ego vehicle.
response = iai.initialize(
location="CARLA:Town03:Roundabout",
agent_count=10,
)
response is a dictionary of states, and agent-attribute (recurrent-states is also returned for compatibility with drive)
response["states"] is a list of agent states, by default the first on the list is always the ego vehicle.
DRIVE
DRIVE is Inverted AI's cutting-edge realistic driving model trained on millions of miles of traffic data. This model can drive all the agents with only the current state of the environment, i.e., one step observations (which could be obtained from INITIALIZE) or with multiple past observations.
response = iai.drive(
location="CARLA:Town03:Roundabout",
agent_attributes=response["attributes"],
states=response["states"],
recurrent_states=response["recurrent_states"],
traffic_states_id=response["traffic_states_id"],
steps=1,
get_birdviews=True,
get_infractions=True,
)
For convenience and to reduce data overhead, *drive also returns recurrent-states which can be feedbacked to the model instead of providing all the past observations.
Furthermore, drive drive all the agents for $steps\times \frac{1}{FPS}$ where by default $FPS=10[frames/sec]$, should you require other time resolutions contact us.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for invertedai-0.0.3rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1cff9a2d173d89ea0cb5029d575afe3e222f412d7b3cde413271a45d978285f |
|
MD5 | c3d98ad782d8fe5f7f474bc4126c9403 |
|
BLAKE2b-256 | 4a2bc3a38c02616e6f085ce11f512709ca2dfaab89542d897bd5787dbd84b37c |