In this project, I've used convolutional neural networks for cloning driving behavior. This model will output a steering angle to an autonomous vehicle. A lot of inspiraion for this model was taken from Udacity Self driving car module as well End to End Learning for Self-Driving Cars model from NVIDIA.
Approximately 63,000 images, 3.1GB. Data was recorded by SullyChen around Rancho Palos Verdes and San Pedro California.
Download the dataset here and extract the files into main directory.
train_model.py
The script used for training the model.helper.py
The script used for image processing and augmentation.model.h5
The model weights. (i.e ModelCheckpoint)visualize_test.py
The script for visualizing the prediction.
- You can install all required dependencies with pip install requirements.txt (or) conda install --file requirements.txt
I've used transfer learning approach, to build a Hybrid model. The bottom part of the model is based on of VGG16 which was pre-trained on ImageNet dataset. The output from first two non-trainable convolutional blocks of VGG16 is then connected to two trainable convolutional layers, three fully connected layers and a output layer.
Here's the architecture of the model,
Layer (type) | Output Shape | Param # |
---|---|---|
input_1 (InputLayer) | [(None, 66, 200, 3)] | 0 |
block1_conv1 (Conv2D) | (None, 66, 200, 64) | 1792 |
block1_conv2 (Conv2D) | (None, 66, 200, 64) | 36928 |
block1_pool (MaxPooling2D) | (None, 33, 100, 64) | 0 |
block2_conv1 (Conv2D) | (None, 33, 100, 128) | 73856 |
block2_conv2 (Conv2D) | (None, 33, 100, 128) | 147584 |
block2_pool (MaxPooling2D) | (None, 16, 50, 128) | 0 |
conv2d (Conv2D) | (None, 6, 23, 256) | 819456 |
conv2d_1 (Conv2D) | (None, 4, 21, 128) | 295040 |
dropout (Dropout) | (None, 4, 21, 128) | 0 |
flatten (Flatten) | (None, 10752) | 0 |
dense (Dense) | (None, 256) | 2752768 |
dense_1 (Dense) | (None, 128) | 32896 |
dense_2 (Dense) | (None, 64) | 8256 |
dense_3 (Dense) | (None, 1) | 65 |
Total params | 4,168,641 |
- First, install all the required dependencies from
requirements.txt
then download and extract the dataset into the main directory. - Now run
python train_model.py
for training the model. After successful n-epochs training, this will save best models in the format ofmodel-best-{epoch_no}.h5
(i.e epochs with least MSE on validation set). - Then load the saved model, test and visualize on test-set with
python visualize.py
.
- Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D. Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, Xin Zhang, Jake Zhao, Karol Zieba. End to End Learning for Self-Driving Cars
- Mariusz Bojarski, Philip Yeres, Anna Choromanska, Krzysztof Choromanski, Bernhard Firner, Lawrence Jackel, Urs Muller. Explaining How a Deep Neural Network Trained with End-to-End Learning Steers a Car
- Behavioral Cloning Project