/Simulated-Self-Driving-Car

Self driving car running over udacity's "unity car simulator" using Convolutional neural networks.

Primary LanguagePythonMIT LicenseMIT

Simulated Self Driving Car

Overview

This is the code for training a machine learning model to drive a simulated car using Convolutional Neural Networks. I used Udacity's self driving car simulator as a testbed for training an autonomous car.

Demo

Simulated Self Driving Car Project Demo

Dependencies

  1. You can install all dependencies by running one of the following commands

    You need a anaconda or miniconda to use the environment setting.

    # Use TensorFlow without GPU
    conda env create -f environments.yml
    
    # Use TensorFlow with GPU
    conda env create -f environment-gpu.yml

    Or you can manually install the required libraries (see the contents of the environemnt*.yml files) using pip.

  2. Download Udacity's self driving car simulator from here.

Usage

Clone this repository

Type the following commands in your terminal:

cd path/to/directory/you/like/
git clone https://github.com/anubhavshrimal/Simulated_Self_Driving_Car.git
cd Simulated_Self_Driving_Car/

Run the pretrained model

Start up the Udacity self-driving simulator, choose a scene and press the Autonomous Mode button. Then, run the model as follows:

python drive.py model-mix.h5

To train the model

  1. Start up the Udacity self-driving simulator, choose a scene and press the Training Mode button.

  2. Then press R key and select the data folder, where our training images and CSV will be stored.

  3. Press R again to start recording and R to stop recording. Let the processing of video complete.

  4. You should do somewhere between 1 and 5 laps of the simulated road track.

  5. The run the following command:

    python model-mix.py

This will generate a file model-<epoch>.h5 whenever the performance in the epoch is better than the previous best. For example, the first epoch will generate a file called model-000.h5.

Vote of Thanks

NVIDIA's paper: End to End Learning for Self-Driving Cars for the inspiration and model structure.

Siraj Raval & naokishibuya for the knowledge and code help.