← 开源
idreesshaikh

Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning

Deep Reinforcement Learning (PPO) in Autonomous Driving (Carla) [from scratch]

Model DevelopmentReinforcement LearningPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
565
Star
98
Fork
+1
本周
2
贡献者
创建于 2022-05-18 · 更新于 2026-10-10 · 今日第 16922 名
主要开发者
idreesshaikh

idreesshaikh/Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning 排名第 16,922,有 565 个星标。

同类别比较

idreesshaikh/Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning 排名第 16,922,此处有 8 个同类条目;kmeng01/memit 排名第 16,923。

同类别比较
名称排名指标
yandex-research/tab-ddpm16,912
语言:
Python
星标数:
566
分叉数:
139
简介:
[ICML 2023] The official implementation of the paper "TabDDPM: Modelling Tabular Data with Diffusion Models"
ShuangXieIrene/ssds.pytorch16,915
语言:
Python
星标数:
565
分叉数:
163
简介:
Repository for Single Shot MultiBox Detector and its variants, implemented with pytorch, python3.
aiqm/torchani16,916
语言:
Python
星标数:
565
分叉数:
139
简介:
TorchANI 2.0 is an open-source library that supports training, development, and research of ANI-style neural network interatomic potentials. It was originally developed and is currently maintained by the Roitberg group.
facebookresearch/atlas16,919
语言:
Python
星标数:
565
分叉数:
74
简介:
Code repository for supporting the paper "Atlas Few-shot Learning with Retrieval Augmented Language Models",(https//arxiv.org/abs/2208.03299)
kmeng01/memit16,923
语言:
Python
星标数:
565
分叉数:
77
简介:
Mass-editing thousands of facts into a transformer memory (ICLR 2023)
movehand/raisr16,925
语言:
Python
星标数:
565
分叉数:
154
简介:
A Python implementation of RAISR
thuml/OpenLTM16,929
语言:
Jupyter Notebook
星标数:
565
分叉数:
64
简介:
Implementations, Pre-training Code and Datasets of Large Time-Series Models
voidful/TextRL16,931
语言:
Python
星标数:
565
分叉数:
61
简介:
Implementation of ChatGPT RLHF (Reinforcement Learning with Human Feedback) on any generation model in huggingface's transformer (blommz-176B/bloom/gpt/bart/T5/MetaICL)
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Reinforcement Learning
关键词Autonomous vehicles, RL
星标数565
分叉数98
贡献者2
创建日期2022-05-18
更新日期2026-10-10
1 天星标数0
7 天星标数1
排名16,922
上次排名16,712
排名变化-210
7 天星标排名11,324
上次 7 天星标排名11,389
7 天星标排名变化65
总星标排名17,609
上次总星标排名17,576
总星标排名变化-33
国家Germany
README 摘录

Implementing a Deep Reinforcement Learning Model for Autonomous Driving Artificial Intelligence (AI) is growing extraordinarily in almost every area of technology, and research into self-driving cars is one of them. In this work, we will take the liberty to utilize state-of-the-art methods to train our agent to drive autonomously using the Deep Reinforcement Learning (DRL) approach. We will use an open-source simulator, CARLA, to conduct our experiment, providing a hyper-realistic urban simulation environment to

train our models. We cannot use our raw algorithms in the real world because they come with many risks and moral questions, so we use these simulators to help us test them. Moreover, DRL has shown promising results in learning complex decision-making tasks, from strategic games to challenging puzzles. Here, we will look at how an on-policy DRL algorithm called Proximal Policy Optimization (PPO) will be used in a simulated driving environment to learn to navigate on a

predetermined route. The primary goal of this work is to investigate how a DRL model can train an agent on a continuous state and action space. Our main contribution is a PPO-based agent that can learn to drive reliably in our CARLA-based environment. In addition, we also implemented a Variational Autoencoder (VAE) that compresses high-dimensional observations into a potentially easier-to-learn low-dimensional latent space that can help our agent learn faster. About the Project This

work aims to develop an end-to-end solution for autonomous driving that can send commands to the vehicle to help it drive in the right direction and avoid crashes as much as possible, and is divided in the following components: 1. 8) as our environment (Urban Simulator). We have also summarized some results and analyses to simplify this problem further. Find the documented work here to better understand this whole project. We're mainly focused on two towns which are

Town 2 and Town 7, therefore we'd advice you download Additional Maps file alongside the CARLA server. You can copy/paste the maps from **Additional Maps** directory to **Main** CARLA directory to ensure everything is seemless. Moving forth we'd advice you to setup your project on **Windows** or **Linux** as these are the two OSs supported by CARLA at the moment. Project Setup (Installations) In order to setup this project you're advised to clone this repository and make sure you

have **Python v3. After clonding this repository we can create a python virtual environment for this project 💥 let's call it **venv** . You can call it something else if you want :) Now we can activate our virtual env , and don't forget to do so before installing any of the dependencies. Moving forward we can install the dependencies with with the following command . We're not only using **pip** as our depency manager but **poetry** as well, therefore execute the following command in

the repo. This will install all the other dependencies now with **poetry**. Once everything is setup up we're nearly there!

常见问题

记录了多少星标和分叉?

idreesshaikh/Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning 有 565 个星标和 98 个分叉。

仓库排名是多少?

idreesshaikh/Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning 排名第 16,922。

记录的语言和类别是什么?

idreesshaikh/Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning 有 565 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

idreesshaikh/Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning 与 kmeng01/memit 比较,后者排名第 16,923,有 565 个星标。

README

Implementing a Deep Reinforcement Learning Model for Autonomous Driving

Artificial Intelligence (AI) is growing extraordinarily in almost every area of technology, and research into self-driving cars is one of them. In this work, we will take the liberty to utilize state-of-the-art methods to train our agent to drive autonomously using the Deep Reinforcement Learning (DRL) approach. We will use an open-source simulator, CARLA, to conduct our experiment, providing a hyper-realistic urban simulation environment to train our models. We cannot use our raw algorithms in the real world because they come with many risks and moral questions, so we use these simulators to help us test them.

Moreover, DRL has shown promising results in learning complex decision-making tasks, from strategic games to challenging puzzles. Here, we will look at how an on-policy DRL algorithm called Proximal Policy Optimization (PPO) will be used in a simulated driving environment to learn to navigate on a predetermined route. The primary goal of this work is to investigate how a DRL model can train an agent on a continuous state and action space. Our main contribution is a PPO-based agent that can learn to drive reliably in our CARLA-based environment. In addition, we also implemented a Variational Autoencoder (VAE) that compresses high-dimensional observations into a potentially easier-to-learn low-dimensional latent space that can help our agent learn faster.

About the Project

This work aims to develop an end-to-end solution for autonomous driving that can send commands to the vehicle to help it drive in the right direction and avoid crashes as much as possible, and is divided in the following components:

  1. CARLA Environment setup.
  2. Variational Autoencoder.
  3. Proximal Policy Optimization.

We have used CALRA (version 0.9.8) as our environment (Urban Simulator). We have also summarized some results and analyses to simplify this problem further.

Find the documented work here to better understand this whole project.

Prerequisites

We're using CARLA (0.9.8) + Additional Maps. We're mainly focused on two towns which are Town 2 and Town 7, therefore we'd advice you download Additional Maps file alongside the CARLA server. You can copy/paste the maps from Additional Maps directory to Main CARLA directory to ensure everything is seemless.

Moving forth we'd advice you to setup your project on Windows or Linux as these are the two OSs supported by CARLA at the moment.

Project Setup (Installations)

In order to setup this project you're advised to clone this repository and make sure you have Python v3.7.+ (64bit) version installed. After clonding this repository we can create a python virtual environment for this project 💥 let's call it venv python -m venv venv. You can call it something else if you want :) Now we can activate our virtual env source venv/Script/activate, and don't forget to do so before installing any of the dependencies. Moving forward we can install the dependencies with pip with the following command pip install -r requirements.txt. We're not only using pip as our depency manager but poetry as well, therefore execute the following command cd poetry/ && poetry update in the repo. This will install all the other dependencies now with poetry. Once everything is setup up we're nearly there!

Download the CARLA server (0.9.8) + Additional Maps, and make sure you've read the Prerequisites of this repo. Once the server is up and running, we can start our client with python continuous_driver.py --exp-name=ppo --train=False command. Don't forget to start the Carla server beforehand. Yey!!!

Built With

  • Python - Programming language
  • PyTorch - Open source machine learning framework
  • CARLA - An urban driving simulator
  • Poetry - Packaging and dependency manager
  • Tensorboard - Visualization toolkit

Methodology

Architectural layout encapsulating the three most essential components:

  1. CARLA Simulation.
  2. VAE.
  3. PPO Agent.

Architectural Methodology

How to Run

Running a Trained Agent

With the project, we provide you two pretrained PPO agents, one for each town (Town 02 & Town 07). The preTrained serialized files for this model are placed in preTrained_models/PPO/ folder.

python continuous_driver.py --exp-name ppo --train False

By deafult we are on Town 07 but we can changed it to Town 02 with the following argument addition:

python continuous_driver.py --exp-name ppo --train False --town Town02

Training a New Agent

In order to train a new agent use the following command:

python continuous_driver.py --exp-name ppo

This will start training an agent with the default parameters, and checkpoints will be written to checkpoints/PPO// and the other metrics will be logged into logs/PPO//. Same as above, by default we're training on Town07 but we can change it to Town02 with this argument addition --town Town02.

How our Training looks like.

![](info/gifs/town 7.gif)

Town 7

![](info/gifs/town 2.gif)

Town 2

Variational AutoEncoder

The Variational Autoencoder (VAE) training process starts by driving around automatically and manually, collecting 12,000 160x80 semantically segmented images we will be using for training. Then, we will use the SS image as the input to the variational autoencoder (h ∗ 𝑤 ∗ 𝑐 = 38400 input units). VAE’s weights are frozen while our DRL network trains.

Variational Autoencoder

Once we have trained our VAE, we can use the following command to check out the reconstructed images:

cd autoencoder && python reconstructor.py

![](info/diagrams/VAE Reconstruction.png)

Original Image to Reconstructed Image

Project Architecture Pipeline (Encoder to PPO)

The folloing diagram depicts the VAE+PPO training pipeline. Note: all the variable names are missing the subscript 𝑡.

![](info/diagrams/PPO Network (extended).png)

VAE + PPO training pipeline

File Overview

File Description
continuous_driver.py Script for training/testing our continuous agent e.g. PPO agent
discrete_driver.py Script for training our discrete agent e.g. Duelling DQN agent (work in progress)
encoder_init.py script that uses the trained Encoder to turn the incoming images (states) into latent space
parameters.py Contains the hyper-paramters of the Project
simulation/connection.py Carla Environment class that makes the connection with the CARLA server
simulation/environment.py CARLA Environment class that contains most of the Environment setup functionality (gym inspired class structure)
simulation/sensors.py Carla Environment file that contains all the agent's sensor classes (setup)
simulation/settings.py Carla Environement file that contains environment setup parameters
runs/ Folder containing Tensorboard plots/graphs
preTrained_models/ppo Folder containing pre-trained models' serialized files
networks/on_policy/agent.py Contains code of our PPO agent
networks/on_policy/ppo.py Contains code of our PPO network
logs/ Folder containing the logged metrics of our agent while training
info/ Folder containing figures, gifs, diagrams, & documentation of the project
checkpints/ Folder containing serialized parameters of our agent saved while training
carla/ Folder containing CARL egg file, that is used in order to make connection with the server
autoencoder/ Folder containing the code for our Variational Autoencoder (VAE)

To view the training progress/plots in the Tensorboard:

tensorboard --logdir runs/

Authors

Idrees Razak - GitHub, LinkedIn

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

I thank, Dr. Toka László, for his exceptional leadership and unwavering support during this work.

排名相邻
同类项目