The goals / steps of this project are the following:
The code for this step is contained in the second code cell of the IPython notebook.
I used the pandas library to calculate summary statistics of the traffic signs data set:
The code for this step is contained in the third code cell of the IPython notebook.
Here is an exploratory visualization of the data set. It is a histogram showing how the data:
The code for this step is contained in the fourth code cell of the IPython notebook.
I shuffled the dataset and applied a simple normalization to the input data which scaled the X_train and X_test values from [0:255] to [0.1:0.9] interval.
The code for splitting the data into training and validation sets is already provided in the first code cell of the IPython notebook.
My final training set had 34799 number of images. My validation set and test set had 4410 and 12630 number of images.
The code for my final model is located in the fifth cell of the ipython notebook.
My final model consisted of the following layers:
Layer | Description |
---|---|
Input | 32x32x3 RGB image |
Convolution 5x5, | stride 1x1, valid padding, outputs 28x28x6 |
RELU | |
Max pooling | stride 2x2, outputs 14x14x6 |
Convolution 5x5, | stride 1x1, valid padding, outputs 10x10x16 |
RELU | |
Max pooling | 2x2 stride, outputs 5x5x16 |
Flatten | |
Fully connected | Input: 400 Output: 120 |
RELU | |
Fully connected | Input: 120 Output: 84 |
RELU | |
Fully connected | Input: 84 Output: 43 |
Softmax |
The code for training the model is located in the seventh cell of the ipython notebook.
To train the model, I used a default cross entropy method, reduced mean (mean of elements across dimensions of a tensor) and Adam optimizer with rate 0.001.
The code for calculating the accuracy of the model is located in the sixth cell of the Ipython notebook.
My final model results were:
First epoch training set accuracy of 0.740
Highest validation set accuracy of 0.911
Test set accuracy of 0.899
The architecture from Nvidia’s End to End Learning for Self-Driving Cars was first chosen. The reason is that I have found this network pretty efficient in the behavioral cloning project.
However, it didn’t perform well enough to utilize for traffic sign images if the images were scaled to 32x32. I believe the architecture could be proven effective if the images were in the original size.
Afterwards, LeNet architecture was thus chosen. The motivation is that LeNet was built for small size images like 32x32.
It’s working pretty good actually. I didn’t expect it to achieve almost perfect accuracy like other complicated network and LeNet was still able to give me around 90% accuracy in both training and testing stages.
Here are the five German traffic signs that I found on the web:
The first image must be difficult to classify because it is a new invented sign to remind people playing with cell phones.
The second, fourth and fifth shouldn’t be hard since they exist in the dataset.
The third might be challenging because there are numbers within the sign.
Ground-Level Traffic Lights
Road Work
Steep Downgrade
Stop Sign
Watch for Children
The code for making predictions on my final model is located in the eleventh cell of the Ipython notebook.
Here are the results of the prediction:
Image | Prediction |
---|---|
Ground-Level Traffic Lights | Speed Limit (30km/h) |
Road Work | Road Work |
Steep Downgrade | No passing for vehicles over 3 |
Stop Sign | Stop sign |
Watch for Children | Slippery Road |
The model was able to correctly guess 2 of the 5 traffic signs, which gives an accuracy of 40%.
The code for making predictions on my final model is located in the 12th and 13th cell of the Ipython notebook.
For the Ground-Level Traffic Lights image, the model is relatively sure that this is a Speed Limit (30km/h) (probability of 0.755), yet that was incorrect. The top five soft max probabilities were
Probability | Prediction |
---|---|
0.755 | Speed Limit (30km/h) |
0.21 | Stop |
0.034 | Speed Limit (20km/h) |
0.01 | Bicycles crossing |
0.00 | Children crossing |
And the rest look like this: