Skip to main content

Bird-eye's view for CARLA

Freeway-oriented shape Learning By Cheating-like shape Centerlines layer
cruising square-cruising centerlines

(GIFs above present feature maps after applying as_rgb() function)

Motivation

During our research we found a very inspiring paper called Learning By Cheating. Bird-eye's view is made specifically to learn faster thanks to much simpler, 2D world representation (cheating oracle) which we think fits well in Reinforcement Learning setup.

This repository is an almost complete reimplementation that gives better performance and compatibility with most recent versions of CARLA. You can use it out-of-the-box as input for your model, and if necessary convert and visualize into RGB.

Features

  • one-hot 3D feature map (8x2D layers, each representing other entities, e.g. road layer, pedestrians layer) - made specifically to feed your CNN
  • feature map can be converted to an RGB image
  • layers can be easily removed
  • caching mechanism for static layers like: roads and lanes
  • using OpenCV rendering (efficient, multi-threading friendly) instead of slow Pygame method
  • huge FPS speedup thanks to restricted rendering (only agent's surroundings, not whole map)
  • all CARLA maps are supported out-of-the-box, custom maps with valid OpenDrive file made in RoadRunner are also supported
  • current implementation is specifically adjusted for highway scenarios (prolonged shape), but other shapes and crops are easy to implement

Installation

pip install carla-birdeye-view

How to run

Make sure that PYTHONPATH env variable contains CARLA distribution egg, so that carla package can be imported.

# Launch server instance
./CarlaUE4.sh

# (optional) For CARLA 0.9.8+ you may get additional performance improvement with this
python PythonAPI/util/config.py --no-rendering

# Preview while cruising on autopilot (birdview/__main__.py)
python -m carla_birdeye_view

Basic code usage

from carla_birdeye_view import BirdViewProducer, BirdViewCropType, PixelDimensions

birdview_producer = BirdViewProducer(
    client,  # carla.Client
    target_size=PixelDimensions(width=150, height=336),
    pixels_per_meter=4,
    crop_type=BirdViewCropType.FRONT_AND_REAR_AREA
)

# Input for your model - call it every simulation step
# returned result is np.ndarray with ones and zeros of shape (8, height, width)
birdview = birdview_producer.produce(
    agent_vehicle=agent  # carla.Actor (spawned vehicle)
)

# Use only if you want to visualize
# produces np.ndarray of shape (height, width, 3)
rgb = BirdViewProducer.as_rgb(birdview)

Contribution and feedback

We'd ❤️ to collct any feedback, issues and pull requests!

Credits

Project born at deepsense.ai, made by:

Michał Martyniak (@micmarty)

Metadata

Release files for carla-birdeye-view 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for carla-birdeye-view 1.1.1
File Size Uploaded Provenance
carla-birdeye-view-1.1.1.tar.gz 14.0 kB Without provenance Details

Release files / carla-birdeye-view-1.1.1.tar.gz

Download URL carla-birdeye-view-1.1.1.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f6fb8babede81d27f132a8978f2f4f92346693b1f3b71b641cd735699314a506
BLAKE2b-256 checksum
How to use checksums
ebc317486f8fa3aeb65a6b1a1b22e76991fbeb0fe5c694ceaf47f741878674d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.10

Security for carla-birdeye-view 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page