This project uses simple Convolutional Neural Network to classify German Traffic Signs.
The goals / steps of this project are the following:
- Load the 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
I used the numpy library to calculate summary statistics of the traffic signs data set:
- The size of training set: 34799
- The shape of a traffic sign image: 32x32x3
- The number of unique classes in the data set: 43
Here is an exploratory visualization of the data set. It is a bar chart showing the number of training samples of each class.
The image data has been normalized so that the data has mean zero and equal variance. The simple and quick normalization technique used in this project is subsract each pixel value with 128 and divide by 128 as shown below,
(pixel - 128)/ 128
The architecture is based upon LeNet Model, with an additional layer of dropout(). My final model consisted of the following layers:
| Layer | Description |
|---|---|
| Input | 32x32x3 RGB image |
| Convolution 5x5x3 | 1x1 stride, VALID Padding, outputs 28x28x6 |
| RELU | |
| Max pooling | 2x2 stride, outputs 14x14x6 |
| Convolution 5x5x3 | 1x1 stride, VALID Padding, outputs 10x10x16 |
| RELU | |
| Max pooling | 2x2 stride, outputs 5x5x16 |
| Flatten | outputs 400 |
| Fully connected | 400 to 120 |
| Dropout | |
| RELU | |
| Fully connected | 120 to 84 |
| RELU | |
| Fully connected | 84 to 10 |
I have used Adam optimizer to train the model. The hyper parameters which best worked for me are as below
Learing Rate = 0.00092, Epochs = 38, Batch Size = 128
From LeNet architecture I was able to get the accuracy of around 85%. Further I thought of avoiding overfitting by using dropout method. and also reduced learning rate and increased epochs to achieve even higher accuracy of 93%.
1. Choose five German traffic signs found on the web and provide them in the report. For each image, discuss what quality or qualities might be difficult to classify.
Here are six German traffic signs that I found on the web:
2. Discuss the model's predictions on these new traffic signs and compare the results to predicting on the test set. At a minimum, discuss what the predictions were, the accuracy on these new predictions, and compare the accuracy to the accuracy on the test set (OPTIONAL: Discuss the results in more detail as described in the "Stand Out Suggestions" part of the rubric).
The model did a good job on new set of images, it was able to predict 5 images correctly out of 6.
Here are the results of the prediction:
| Image | Prediction |
|---|---|
| Yield | Yield |
| Slippery Raod | Slippery Raod |
| Pedestrians | Pedestrians |
| Speed Limit(60Km/h) | Speed Limit(30Km/h) |
| Wild Animal Crossing | Wild Animal Crossing |
| Keep Right | Keep Righ |
The model's accuracy was about 83%.
3. Describe how certain the model is when predicting on each of the five new images by looking at the softmax probabilities for each prediction. Provide the top 5 softmax probabilities for each image along with the sign type of each probability. (OPTIONAL: as described in the "Stand Out Suggestions" part of the rubric, visualizations can also be provided such as bar charts)
Consider the case of slippery road, the model is very much sure that this is a slippery road sign (probability of 0.5), and the model was right. The top five soft max probabilities were
| Probability | Prediction |
|---|---|
| .50 | Slippery Road |
| .20 | Dangerous curve to the left |
| .15 | Speed limit (60km/h) |
| .08 | Beware of ice/snow |
| .07 | None |
The LeNet model which was originally developed for handwriting recognition does pretty well with traffic sign recognition with minimal modifications as shown in this project.






