Nowdays the technology focus on creating Autonomous vehicles. Deep learning takes a major role in such progress in the field.
In this project, End to End Control Pipeline of vehicle Steering Angle is developed using Deep learning methods. The Main purpose is that autonomously drive a vehicle in a Simulator using only Front Facing camera Images
This repository contains files for the Behavioral Cloning Project as Follow:
- dataset_augmentor : contains script for dataset preperation and augmentation
- dataset_analysis : contains script for dataset analysis for ex. histogram of dataset
- dataset_generator : contains dataset generator function and set of augmentatoin steps on data
- train.py : contains the script to create and train the model
- train_log.csv : contains Training dataset
- Valid_log.csv : contains Validation dataset
- drive.py : for driving the car in autonomous mode
- model_nvidia_bt_512_e_25_resize_60_200_lr_5e-4_s_32256 folder:
- model_nvidia_bt_512_e_25_resize_60_200_lr_5e-4_s_32256.h5: contains a trained convolution neural network
- README.md summarizing the results
- Using Simulator Provided by Udacity, I first recorded two laps on track one in the forward direction along with dataset sample provided by Udaicty also To capture good driving behavior.
- Also record two laps in reverse dirction for further generalization of dataset
- to increase generalization of dataset also rondom image on training phase is flipperd horizontally as shown here
import numpy as np
Flipped_Image = np.fliplr(Image)
Flipped_Steering_Angle = -1 * float(steering_angle)
- for further increase my Training data, images from both left and right shifted front facing cameras were used to simulate bad examples to the network instead of driving recovery laps in the simulator
a manully tunned steering correction factor is add to these images = 0.15 as follow
Left_steering = center_steering + correction value
Right_steering = center_Steering - correction value
5- most of data set is baised to zero steering angle so filtering process was done to normlize dataset
Final Dataset for both Training and Validation
- Training Dataset size = 32544
- Validation Dataset size = 1713
Model Architecture
Starting with well known Nvidia CNN Architecture for "End to End Learning for self-driving cars" which can be found in this paper. as first step and modifying this model as follow
- introducesing two Dropout layers to prevent overfitting
- removing last convolution layer and fully connected layer of 50 neuran to simplify model.
- Using Elu as Activation function instead of normal relu to enhance learning capabilites
My final model is presented in next figure:
- Total params: 479,541
- Trainable params: 479,541
- Non-trainable params: 0
Training Phase
After Multiple Tunning cycles of parameters
- Adam Optimizer Used with learning rate = 5e-4
- Batch Size = 512 Images
- Epochs Numbers = 25
- Following Figure show Training loss over epochs
Finally Video of Model Testing can be found on YouTube (Click on next Image)
Further Improvment
- Introduce translation factor on Training Images to enhance stability of model by learning intermadiate recovery steps
- Using LSTM Network as Steering command normally depend not only on this time stamp but also on history of commands
- generalize Training Dataset by augmenting lights and shadow effect to generalize netowork for Track 2