Since I’m very interested in the self-driving car industry, I used Python to create a Convolution Neural Networks (CNN) model to simulate a self-driving car. It’s very similar to the ongoing self-driving experiments conducted by Tesla, Google, Uber, and so on. My process is simpler, but the idea is the same.

Project Images
Here are the steps:

1. Used a self-driving simulator provided by Udacity. Trained and drove a car about 10 laps and generated about 30,000 images and 10,000 rows of data.

2. Imported the data and image into python. Created utlis file to store all of my modules.

3. Balanced the data and split the data into the training and validation data set.

4. Augmented the data by using imgaug package. Pan, zoom, brightness, and flip were used.

5. Preprocessed the data and used OpenCV. Cropped the images and got out of the trees. Changed color space, resized and normalized the images.

6. Used Convolution neural network CNN to create a model. Used sequential model Adam optimizer. Used activation function elu rather than relu. 10 layers in total, 5 convolutional layers, 1 Flatten layer, and 4 dense layers. Learning rate=0.0001. Loss function=mse

7. Tested the model by using the code provided by Udacity. Set the Max speed to 10 mph and imported the model. Because the data was preprocessed in the training and validation parts, I also had to preprocess the data in the test. Used the model to predict the steering angle.

Software used: Python, Pycharm, Git, Udacity self-driving simulator

Packages used: tensorflow, keras, sklearn, cv2, pandas, numpy, os, matplotlib, imgaug

Click the "Code" button to see the code of this project