Use Deep Learning to Clone Cars Driving Behavior
Goals
- Use the simulator to collect data of good driving behavior. Udacity provided a simulator application where we can steer a car around a track for data collection. The collected data is comprised of image data captured from a car’s set of cameras as well as steering angles
- Build, a convolution neural network in Keras that predicts steering angles from images
- Train and validate the model with a training and validation set
- Test that the model successfully drives around track one without leaving the road
Model Architecture
1. An appropriate model architecture has been employed
My model consists of a convolution neural network with 3x3 filter sizes and depths between 32 and 128 (model.py lines 18–24)
The model includes convolutional neural networks (CNNs) My initial approach was to use LeNet, but it was hard to have the car inside the street with three epochs (this model could be found here). After this, I decided to try the nVidia Autonomous Car Group model, and the car drove the complete first track after just three training epochs (this model could be found here).
2. Attempts to reduce overfitting in the model
I decided not to modify the model by applying regularization techniques like Dropout. Instead, I decided to keep the training epochs low: only three epochs. In addition to that, I split my sample data into training and validation data. Using 80% as training and 20% as validation.
3. Model parameter tuning
The model used an Adam optimizer, so the learning rate was not tuned manually (model.py line 146).
4. Appropriate training data
Training data was chosen to keep the vehicle driving on the road. I used a combination of center lane driving, recovering from the left and right sides of the road …
For details about how I created the training data, see the next section.
Training Strategy
1. Solution Design Approach
The overall strategy for deriving a model architecture
My first step was to try the LeNet](http://yann.lecun.com/exdb/lenet/) model with three epochs and the training data provided by Udacity. On the first track, the car went straight to the lake. I needed to do some pre-processing. A new Lambda
layer was introduced to normalize the input images to zero means. This step allows the car to move a bit further, but it didn't get to the first turn. AnotherCropping
layer was introduced, and the first turn was almost there, but not quite.
The second step was to use a more powerful model: nVidia Autonomous Car GroupThe only modification was to add a new layer at the end to have a single output as it was required. This time the car did its first complete track, but there was a place in the track where it passes over the “dashed” line. More data was needed. Augmented the data by adding the same image flipped with a negative angle(lines 85–87). In addition to that, the left and right camera images were introduced with a correction factor on the angle to help the car go back to the lane(lines 50–63). After this process, the car continues to have the same problem with the same “dashed” line. I needed more data, but it was a good beginning.
2. Creation of the Training Set & Training Process
To have more data, the following tracks were capture:
- First track.
- One track driving forward.
- One track driving backward.
- Three second track driving forward.
All this data was used for training the model with three epochs. The data was shuffled randomly.
After this training, the car was driving down the road all the time on the first and second track.
Autonomous Driving Test
This is the video of a successful ride around track 1
Track 1
Desktop Capture of Track 1 Test
This is the video of a successful ride around track 2
Track 2
Repository(GitHub)
The final content of the project is available in my personal repository in Github.
model.py
: source code that reads the dataset, creates the CNN model and trains it.drive.py
: source code that feeds the trained model to the simulator. Also used to save frames generated by simulation.video.py
: program that converts frames generated bydrive.py
into an MP4 video.model.h5
: the final trained model used to driving on Trackvideo.mp4
: video of Track 1 simulation generated byvideo.py
.video_second_track.mp4
video of Track 1 simulation generated byvideo.py
.