Behavioral Cloning Project
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
- Download and run the simulator-linux and choose the TRAIN MODE, save the traing data. The simulator is very great!
-
source activate carnd-term1
-
python model.py
-
python drive.py model.h5
- run the simulator-linux and choose the AUTONOMOUS MODE
- Enjoy it or ... destory it ? Maybe enjoy.
- A rule of thumb to choose training data and validation data quantity A rule of thumb could be to use 80% of your data for training and 20% for validation or 70% and 30%. Be sure to randomly shuffle the data before splitting into training and validation sets.
- underfitting If model predictions are poor on both the training and validation set (for example, mean squared error is high on both), then this is evidence of underfitting. Possible solutions could be to:
- a.increase the number of epochs
- b.add more convolutions to the network.
- overfitting When the model predicts well on the training set but poorly on the validation set (for example, low mean squared error for training set, high mean squared error for validation set), this is evidence of overfitting. If the model is overfitting, a few ideas could be to:
- use dropout or pooling layers
- use fewer convolution or fewer fully connected layers
- collect more data or further augment the data set
- normalizing the data(model.py line 163)
- mean centering the data(model.py line 163)
- Flipping Images And Steering Measurements (model.py line 116) because the model is learning to steer to the left, we have to flipping images. benefits: 1. we have more date to use for trainging the network; 2. the date is more comprehensive
My final model come from nvida's End to End Learning for Self-Driving Cars, you can get in in 'doc/', too. The model architecture:
The model was trained and validated on different data sets to ensure that the model was not overfitting (model.py line 189). The model was tested by running it through the simulator and ensuring that the vehicle could stay on the track.
The model used an adam optimizer, so the learning rate was not tuned manually (model.py line 201).
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 .
- First, I use the nvida’s network and only use the middle camera's images. But the car only turn left.
- Fliping the middle camera's images and train again. Great.
- And then, I revise the images size which include road or only trees, it's greater.
- Finally I find a little overfitting, I decrease the numbers of epochs and use more images. All the data: 48216 Length of X_train: 38572 Length of X_valid: 9644 The final loss is: loss: 0.0152 - val_loss: 0.0132 And the most important is that it not overfitting.And the car can successfully drives around track one without leaving the road
- I modify the speed to 22 ( drive.py line 47), it can successfully drives around track one without leaving the road, too.