Solution of Project 2 of Udacity's Self Driving Car Nanodegree.
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
- Source Code: Traffic_Sign_Classifier.ipynb
- The size of training set is 34799
- The size of validation set is 4410
- The size of test set is 12630
- The shape of a traffic sign image is (32, 32, 3)
- The number of unique classes/labels in the data set is 43
The images of the training dataset had 3 color channels. I reduced the channels to only one. Formula I had used - np.dot(X_train[...,:3], np.array([0.299, 0.587, 0.114]).reshape(3,1))
I normalized the data to have 0 mean by dividing by 255 and subtracting 0.5
The input of the CNN is an 32x32x1 image and the output is the probability of each of the 43 possible traffic signs. I tried with original LeNet model but Validation accuracy was never going beyond 93% I also tried AlexNet architecture but it was very slow to train and accuracy was stuck around 50%
I used below architecture with Relu activation and AdamOptimizer
CNN Model Layers :
- Conv layer : 32x32x1 -> 28x28x48
- Max Pooling : 28x28x48 -> 14x14x48
- Conv layer : 14x14x48 -> 10x10x96
- Max Pooling : 10x10x96 -> 5x5x96
- Conv layer : 5x5x96 -> 5x5x192
- Max Pooling : 5x5x192 -> 3x3x192
- Fully connected Layer : 1728 -> 120
- Fully connected Layer : 120 -> 84
- Fully connected Layer : 84 -> 43
Hyper parameters:
- EPOCHS = 30
- BATCH_SIZE = 128
- learning rate = 0.001
- OPIMIZER: AdamOptimizer
My results after training the model:
- Training Accuracy = 100%
- Validation Accuracy = 96.4%
- Test Accuracy = 94.3%
I tried with LeNet. LeNet validation accuracy was not going beyond 93%. I modified model and added more channels and one extra Conv layer and Max Pool layer.
I downloaded images from internet after searching for German Dataset. Using openCV resize function I converted high resolution images to 32x32x3
Performance on new image was 42.9%. One of the reason for this poor performance could be that model over fits. Generating more training example or adding L2 regularization/dropout could have improved performance
Out of 7 samples model correctly predicted on 4 images and incorrectly predicted 3
- Wrongly predicted Right Turn Ahead to Roundabout Mandatory
- Wrongly predicted Beware of ice/snow to Roundabout Mandatory
- Correctly predicted Road work
- Correctly predicted Children Crossing
- Correctly predicted Right of way at the next intersection
- For Stop it got confused with Yield (58% yield - 41% stop)