Skip to content

This Repo contains my work for Udacity Self Driving cars Nano Degree Project 3

License

Notifications You must be signed in to change notification settings

mibrahimali/CarND-Behavioral-Cloning-P3

Repository files navigation

Behaviorial Cloning Project

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

Overview


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

Data Set Preparation:

Creation of the Training Set

  1. 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.
  2. Also record two laps in reverse dirction for further generalization of dataset
  3. to increase generalization of dataset also rondom image on training phase is flipperd horizontally as shown here alt text alt text
import numpy as np
Flipped_Image = np.fliplr(Image)
Flipped_Steering_Angle = -1 * float(steering_angle)
  1. 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 alt text alt text alt text

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 alt text alt text

  • Training Dataset size = 32544
  • Validation Dataset size = 1713

Design and Test a Model Architecture

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:

alt text

  • Total params: 479,541
  • Trainable params: 479,541
  • Non-trainable params: 0

Training Phase

After Multiple Tunning cycles of parameters

  1. Adam Optimizer Used with learning rate = 5e-4
  2. Batch Size = 512 Images
  3. Epochs Numbers = 25
  • Following Figure show Training loss over epochs

alt text

Finally Video of Model Testing can be found on YouTube (Click on next Image) IMAGE ALT TEXT HERE

alt text

Further Improvment

  1. Introduce translation factor on Training Images to enhance stability of model by learning intermadiate recovery steps
  2. Using LSTM Network as Steering command normally depend not only on this time stamp but also on history of commands
  3. generalize Training Dataset by augmenting lights and shadow effect to generalize netowork for Track 2

About

This Repo contains my work for Udacity Self Driving cars Nano Degree Project 3

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages