Skip to main content

Python API to communicate with the VirtualCity environment

Project description

docs docs

VirtualCity

VirtualCity is a powerful platform to simulate social activities. Agents can interact with the environment through low-level commands (turn left, go forward) or high-level instructions (drive to the park). The interactive environment is based in a densely populated photorealistic city with its own crowd and traffic system.

VirtualCity is built on the Unreal Engine. We provide the Python interface allowing users to change/add environments and control agents easily. Furthermore, the API also provides additional capabilities for training reinforcement learning and computer vision models. We also provide the code required to compile the project in the Unreal Engine 5 editor. The code is designed to be modular, making it easy for you to quickly add new features and capabilities for your research project.

Installation

Note: VirtualCity only supports Nvidia GPUs (Ampere, Turing, Volta, Pascal), and it is recommended to use CPU architectures with high single core performance.

Install using pip

Install the VirtualCity package:

pip install virtualcity

Please read the documentation for more details and alternatives (from source, using docker).

Example

Here is a quick example of how to train and run PPO on a VirtualCity environment:

import gym
import virtualcity
from stable_baselines3 import PPO

env = gym.make("VirtualCity")

model = PPO("MlpPolicy", env, verbose=1)
model.learn(total_timesteps=10000)

obs = env.reset()
for i in range(1000):
    action, _states = model.predict(obs, deterministic=True)
    obs, reward, done, info = env.step(action)
    env.render()
    if done:
      obs = env.reset()

env.close()

Or you can train a model on the VirtualCity environment if the policy is registered in StableBaselines3:

import gym
import virtualcity
from stable_baselines3 import PPO

model = PPO('MlpPolicy', 'VirtualCity').learn(10000)

Please read the documentation for more examples.

Citing the Project

To cite this repository in publications:

@article{virtualcity,
  author  = {Shuang Li and Kabir Swain},
  title   = {VirtualCity},
  year    = {2022}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

virtualcity-0.0.5.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

virtualcity-0.0.5-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file virtualcity-0.0.5.tar.gz.

File metadata

  • Download URL: virtualcity-0.0.5.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.13

File hashes

Hashes for virtualcity-0.0.5.tar.gz
Algorithm Hash digest
SHA256 f347aed7e039988f4f294b3556b63e26475a4162755d40a1a63c744deb20d638
MD5 3c07d1abdbd2398bd85e28fef5e50478
BLAKE2b-256 98fd5b6c19f23555322505a1babb65716f1bb8893226c7ef2f884034051a546e

See more details on using hashes here.

File details

Details for the file virtualcity-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: virtualcity-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.13

File hashes

Hashes for virtualcity-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5c54b1468b4e1c88a8968d3d59f7d988aef95defb59d2778e3f6110d9ce4996f
MD5 93f50da4d3c8a4d8a98f3de855b2eb7e
BLAKE2b-256 9cb59c9e20242162f6c5e12884f7e2ad0e126c69811b90a2948b2b49d5ad49ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page