Giter VIP home page Giter VIP logo

bayesianrlforautonomousdriving's Introduction

Tactical Decision-Making in Autonomous Driving by Reinforcement Learning with Uncertainty Estimation

This repo contains the code that was used in the paper Tactical Decision-Making in Autonomous Driving by Reinforcement Learning with Uncertainty Estimation. If this code is used, please cite the paper and the repo.

Videos of the resulting agents are shown below.


Videos

This section shows how the trained ensemble RPF and DQN agents perform in a few testing episodes within the training distribution, and in situations that are outside of the training distribution.

Test episodes within the training distribution

Ensemble RPF agent:

Displayed in x4 real time.

Situations outside of the training distribution

Standstill vehicle (white)

DQN agent:

Ensemble RPF agent:

Displayed in x1 real time.

Fast overtaking vehicle (purple)

DQN agent:

Ensemble RPF agent:

Displayed in x1 real time.


Source code

Prerequisites

Python and Simulation of Urban Mobility (SUMO), version 1.8 (something have changed in the interface in later versions, and I have not had the time to update the code).

Install SUMO from source (tested for ubuntu 18.04):

$ apt-get update
$ apt-get install -y git cmake python3.7 python3-pip g++ libxerces-c-dev libfox-1.6-dev libgdal-dev libproj-dev libgl2ps-dev
$ git clone --depth 1 --branch v1_8_0 https://github.com/eclipse/sumo
$ mkdir sumo/build/cmake-build
$ cd sumo/build/cmake-build
$ cmake ../..
$ make -j$(nproc)
$ make install
$ cd ../../..
$ rm -r sumo
$ export SUMO_HOME="/usr/local/share/sumo"

Install dependencies:

$ pip3 install -r requirements.txt

Docker

Using Docker makes it even easier to get started. From the top folder, simply build with Dockerfile:

$ docker build -t <name> -f Dockerfile .

Usage

The code is relatively well documented. The following steps help to get you started.

Training process

To start the training of the agent, from src/, run:

$ python3 train_agent.py <log_name>

The performance of the agent is regularly tested on a set of test episodes. Logs are saved in logs/, where among other things the following are saved:

  • Rewards and number of steps of the test episodes
  • Weights of the neural networks for the test episodes
  • A tensorboard log

The training process can be followed in tensorboard.

Parameters

The parameters of the agent are set in parameters.py and the parameters of the simulation environment are set in parameters_simulation.py.

Observe trained agent

The performance of the trained agent can be observed in SUMO's GUI, both on the test episodes and on the special cases that are mentioned in the paper.

In run_trained_agent.py, set filepath and agent_name to the agent you would like to test. Then, from src/, run:

$ python3 run_trained_agent.py

An example of the output is shown below.

The rows below the road show the estimated Q-values of the different ensemble members for all the actions, followed by the mean Q-values and the coefficient of variation for all the actions.

Tests

To make sure that the code is working and all dependencies are fulfilled, run the tests from tests/ by

$ python3 -m unittest discover .

License

This code is released under the MIT license, see LICENSE.md for details.

Contact

Just send an email if you have any questions, [email protected].

bayesianrlforautonomousdriving's People

Contributors

carljohanhoel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.