/behaviour_clonning

Primary LanguagePythonMIT LicenseMIT

Behavioral Cloning Project

Dependencies

This lab requires:

The lab enviroment can be created with CarND Term1 Starter Kit. Click here for the details.

The following resources can be found in this github repository:

  • drive.py
  • video.py
  • writeup_template.md

The simulator can be downloaded from the classroom. In the classroom, we have also provided sample data that you can optionally use to help train your model.

Details About Files In This Directory

drive.py

Usage of drive.py requires you have saved the trained model as an h5 file, i.e. model.h5. See the Keras documentation for how to create this file using the following command:

model.save(filepath)

Once the model has been saved, it can be used with drive.py using this command:

python drive.py model.h5

The above command will load the trained model and use the model to make predictions on individual images in real-time and send the predicted angle back to the server via a websocket connection.

Note: There is known local system's setting issue with replacing "," with "." when using drive.py. When this happens it can make predicted steering values clipped to max/min values. If this occurs, a known fix for this is to add "export LANG=en_US.utf8" to the bashrc file.

Saving a video of the autonomous agent

python drive.py model.h5 run1

The fourth argument, run1, is the directory in which to save the images seen by the agent. If the directory already exists, it'll be overwritten.

ls run1

[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_424.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_451.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_477.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_528.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_573.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_618.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_697.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_723.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_749.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_817.jpg
...

The image file name is a timestamp of when the image was seen. This information is used by video.py to create a chronological video of the agent driving.

video.py

python video.py run1

Creates a video based on images found in the run1 directory. The name of the video will be the name of the directory followed by '.mp4', so, in this case the video will be run1.mp4.

Optionally, one can specify the FPS (frames per second) of the video:

python video.py run1 --fps 48

Will run the video at 48 FPS. The default FPS is 60.

Extra Notes

Model Architecture and Training Strategy
  1. An appropriate model architecture has been employed My model consisit of 5 5 kernal and filter size from 24 to 64. Activation I have used is relu and for normalization I have used lamda layer. At the end I have used dense layer from 100, 50 and 10 layers respectively. Intially I have used strides of 2 2 and later reduced ro 1 * 1.

  2. Attempts to reduce overfitting in the model Gatherd more data and used augmention to reduce over fiting

  3. Model parameter tuning No parameter tunning is done as used most of param from nvidi model.

  4. Appropriate training data Trainig data was gathered by driving car in clockwise and anticlock wise as I want model to predict correct angle for left and right turn. I have used a combination of center lane driving, recovering from the left and right sides of the road Additional data was generated through augmentation.

Model Architecture and Training Strategy

  1. Solution Design Approach To find the soltion as provided in lecture collect the training data by driving car on center & left and right side in clockwise and anti clockwise directions. Then combined the data using python script.

Then define the nvidi model archtrature with some modification. Added dropout to reduce overfitting and created dense layers at the end.

Run the model with adam optimzer and followed the step in lactures.

2. Final Model Architecture

Final architracture defined in model.py from line no 84 to 96

  1. Creation of the Training Set & Training Process I have collected image from track1 by driving on center and left and right edge of lane and then recovering from them. Below is the image for that