In this project we are going to learn how to train a self driving car using Convolution neural networks CNN. We will be using the open source Self driving car simulator provided by Udacity that is used in their Self driving car Nano degree program. Using this simulator we will first drive the car and collect data. Then we will train a CNN model to learn this behavior and then test it back on the simulator. The model we will use was proposed by NVIDIA. They used this model to train a real car data and got promising results when they drove it autonomously
Libraries --> numpy,pandas,matplotlib,sklearn,opencv,keras,tensorflow Simulator --> Nvdia Self Driving Car Simulator by Udacity
The file Untitled1.ipynb
does the following:
The program first retrieves csv data representing the steering angle
, throttle
, reverse
and speed
, as well as the images corresponding camera images (left, center and right). The program then cleans and unbiases the data.
To improve the robustness of the model, the program uses augmentation techniques to vary the dataset. These include:
Performs a horizontal flip of the image. Also requires the steering angle be flipped as well to still be accurate.
Varies brightness of image. Mostly darkens, as it proved more effective for the model.
The program augments images in a random distribution to ensure that variety is preserved.
Next, the program converts the RBG images to YUV images, which have proven very effective for Nvidia models.
The program then creates a Nvidia model, based on the following diagram.
A file called <name>.h5
will be saved, which stores the trained and validated Nvidia model.
The model file can then be used in the following procedure.
Ensure that <name>.h5
is in the same directory as drive.py
. Then edit the drive.py
source code to replace the line
model = load_model('<name>.h5')
and adjust speed_limit
to any number between 0 and 30.
Run the following from Anaconda Prompt + download any dependencies that come up.
python test.py
Install the Self Driving Car Simulator (Version 1) from: https://github.com/udacity/self-driving-car-sim and run the program. Then start the Autonomous mode in either track.