In this project, I will use deep neural networks and convolutional neural networks to classify traffic signs. I will train and validate a model so it can classify traffic sign images using the German Traffic Sign Dataset.
The goals / steps of this project are the following:
- Load the data set (see below for links to the project data set)
- Explore, summarize and visualize the data set
- Design, train and test a model architecture
- Use the model to make predictions on new images
- Analyze the softmax probabilities of the new images
- Summarize the results with a written report
This project requires Python 3.5 and the following Python libraries installed:
- Download the dataset. This is a pickled dataset in which we've already resized the images to 32x32.
I used the numpy library to calculate summary statistics of the traffic signs data set:
- The size of training set is 34799 images
- The size of the validation set is 4410 images
- The size of test set is 12630 images
- The shape of a traffic sign image is (32, 32, 3)
- The number of unique classes/labels in the data set is 43
I normalized the image data and also divided by the standard deviation of each feature (pixel) value as well. Subtracting the mean centers the input to 0, and dividing by the standard deviation makes any scaled feature value the number of standard deviations away from the mean,so that all the inputs are at a comparable range.
My final model consisted of the following layers:
Layer | Description |
---|---|
Input | 32x32x3 RGB image |
Convolution 5x5 | 1x1 stride, outputs 28x28x6 |
RELU | Activation Function |
Max pooling | 2x2 stride, outputs 14x14x6 |
Convolution 5x5 | 1x1 stride, outputs 10x10x16 |
RELU | Activation Function |
Max pooling | 2x2 stride, outputs 5x5x16 |
Flatten | output 400 |
Fully connected | output 120 |
RELU | Activation Function |
Dropout | 50% |
Fully connected | output 84 |
RELU | Activation Function |
Dropout | 50% |
Fully connected | output 43 |
To train the model, I used an Adam Optimizer , batch size of 128 , number of epochs is 45 and a learning rate of 0.0008
My final model results were:
- training set accuracy of 0.999
- validation set accuracy of 0.965
- test set accuracy of 0.951
Here are the results of the prediction:
Image | Prediction |
---|---|
Turn left ahead | Turn left ahead |
Speed limit (70km/h) | Speed limit (70km/h) |
Priority road | Priority road |
Slippery road | Slippery road |
Speed limit (50km/h) | Speed limit (60km/h) |
General caution | General caution |
Double curve | children crossing |
Bumpy road | no entry |