The purpose of this repository is to use a Nvidia model to control an autonomous car. The model uses image data as input and uses polynomial regression to predict the steering angle.
The file Behavioral_Cloning.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. The data comes from manual drives stored at https://github.com/tylerlum/self-driving-car-data-track-1
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 drive.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.