Project 1.3: Behavioral Cloning

Behavioral Cloning Project

GitHub Repository

 

The goals / steps of this project are the following:

  • Use the simulator to collect data of good driving behavior

  • 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

  • Summarize the results with a written report

Here I will consider the rubric points individually and describe how I addressed each point in my implementation.

Files Submitted & Code Quality

    1. Submission includes all required files and can be used to run the simulator in autonomous mode

    My project includes the following files:

  •         train.py containing the script to create and train the model

  •         drive.py for driving the car in autonomous mode (original file)

  •         model.h5 containing a trained convolution neural network generated by trian.py

  •         writeup_report.md summarizing the results

  •         run1.mp1 The video generated by video.py describes the trainging result.

    2. Submission includes functional code

    Using the Udacity provided simulator and my drive.py file, the car can be driven           autonomously around the track by executing “python drive.py model.h5”

    3. Submission code is usable and readable

    The train.py file contains the code for training and saving the convolution neural network. The file shows the pipeline I used for training and validating the model, and it contains     comments to explain how the code works.

Model Architecture and Training Strategy

    1. An appropriate model architecture has been employed

    My model consists of a convolution neural network with 5×5 filter sizes and depths between 24 and 64 (train.py lines 118-123)

     The model includes RELU layers to introduce nonlinearity, and the data is normalized in the model using a Keras lambda layer (code line 111).

    2. Attempts to reduce overfitting in the model

    A dropout layer was added to reduce overfitting.

    The model was tested by running it through the simulator and ensuring that the vehicle could stay on the track.

    3. Model parameter tuning

    The model used an adam optimizer, so the learning rate was not tuned manually (train.py line 132).

    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 to make trainging data.

    Model Architecture and Training Strategy

    Solution Design Approach

    The overall strategy for deriving a model architecture was to decrease measn square error to be minimium for training dataset and validation dataset.

    My first step was to use a convolution neural network model similar to the LeNet. I thought this model might be appropriate because both of them are pattern classification problems.

    In order to gauge how well the model was working, I split my image and steering angle data into a training and validation set. The model worked good with training workflow. I did see some underfitting issue, after adding more convolutional layer, the issue was addressed.

    The final step was to run the simulator to see how well the car was driving around track one. The trainging data includes driving in the center of lane, driving off the road and drive back to center lane, slowly turn when vehical is at sharp corner.

    The tips from previous student was very helpful. I chose the lowest screen resolution and the highest graphics quality to make my training data contains more information meanwhile has small size.

    At the end of the process, the vehicle is able to drive autonomously around the track without leaving the road.

    Creation of the Training Set & Training Process

    To capture good driving behavior, I first recorded two laps on track one using center lane driving. Here is an example image of center lane driving:

    I then recorded the vehicle recovering from the right sides of the road back to center so that the vehicle would learn to drive back if vehicale drives to offroad. The images shows 1 images every 5 continuous images:

    After the collection process, I had 16812 number of data points. I then preprocessed this data by augmented the total number of images. Use steering angle as labels and center, left and right images as trainging dataset.

    I used this training data for training the model. The validation set helped determine if the model was over or under fitting. The ideal number of epochs was 10 but after several tests I decided to change is to 3. I used an adam optimizer so that manually training the learning rate wasn’t necessary.

    I did not perform any magical technique but the result shows very good fitting. The vehicle drives almost at the center of lane, and can drive back if it is little off the road.