Code Monkey home page Code Monkey logo

self-driving-car-streeing's Introduction

Prediction Of Steering Angles For Self-Driving Cars Using Deep Learning

This is the code for training and running the Deep Learning Model to predict steering angles.

self

Requirements & Dependencies

This project was developed using a pre-built community AMI of the new AWS P2 instances (Go Deeper AMI), which have NVIDIA Tesla K80 GPUs and already come with much of the necessary tools installed.

Data

This dataset is based on driving data from San Mateo, CA to Half Moon Bay, CA (curvy and highway driving).

For Udacity Evaluation: The converted dataset can be downloaded from here (link expires March 7th, 2017)

Otherwise, the dataset can be downloaded in the ROSBAG format from here: https://github.com/udacity/self-driving-car/tree/master/datasets/CH2 (both CH2_001 and CH2_002)

We used rwightman's Udacity Reader docker tool to convert the images into JPGs.

Even though the imagery is from three different cameras (left, center, right), we only used the center images.

The code assumes the following directory structure for data:

- data
-- models
-- test
--- center
---- 1477431483393873340.jpg
-- train
--- center
---- 1477431802438024821.jpg 

Change data_path value in config.py to point to this data directory.

Pre-processing

The raw images are of size 640 x 480. In our final model, we resized the images to 256 x 192, converted from RGB color format to grayscale, computed lag 1 differences between frames and used 2 consecutive differenced images. For example, at time t we used [x_{t} - x_{t-1}, x_{t-1} - x_{t-2}] as input where x corresponds to the grayscale image. No future frames were used to predict the current steering angle.

To pre-process training data, run:

python preprocess_train_data.py

To pre-process test data, run:

python preprocess_test_data.py

These pre-processing scripts convert image sets to numpy arrays.

Model

The main architecture for this model was inspired by the NVIDIA's self-driving car paper The code includes 3 different models. To choose one of the models, change the model_name in config.py to either "nvidia1", "nvidia2", or "nvidia3".

To train different models, run:

python train.py

You can change these parameters in the config.py file:

  • --data - alias for pre-processed data. There are multiple ways to pre-process the data (how many consecutive frames to use, image size, etc). This parameter value gives us information what data set to use.
  • --num_channels - number of channels the data has. For example, if you use 4 consecutive frames, then num_channels must be 4.
  • --img_height - image height in pixels, default is 192.
  • --img_width - image width in pixels, default is 256.
  • --model_name - model definition file, see models.py for different models.
  • --val_part - which part of the data to use as validation set.
  • --batch_size - minibatch size, default is 32.
  • --num_epoch - number epochs to train, default is 10.
  • --data_path - folder path to pre-processed numpy arrays.

Once you have trained your models, you can choose the one with the best performance, copy it into the submissions folder and rename it to "final_model.hdf5".

To predict steering angles from test data, run:

python predict.py
  • Visualizing predicted steering angles

To visualize model predictions on test data, run:

python visualize.py

White circle shows the true angle, black circle shows the predicted angle. You might need to change the variable VisualizeConfig in config.py to point to the location of phase 2 images.

These visualizations can help us understand the weaknesses of the model. For example, human steering movements are smoother on straight road while the model zig-zags.

Pointers and Acknowledgements

self-driving-car-streeing's People

Contributors

xeron56 avatar

Stargazers

 avatar sazak avatar

Watchers

James Cloos avatar  avatar paper2code - bot 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.