Skip to content

pankaj02/CarND-Traffic-Sign-Classifier-Project

 
 

Repository files navigation

Project: Build a Traffic Sign Recognition Program

Udacity - Self-Driving Car NanoDegree

Overview

Solution of Project 2 of Udacity's Self Driving Car Nanodegree.

The Project

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

Notebook

Basic summary of the data set

  • 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

Design and Test a Model Architecture

Preprocessing

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

Model Architecture

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

Model Training

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%

Solution Approach

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.

Test on new images

Acquiring New Images

I downloaded images from internet after searching for German Dataset. Using openCV resize function I converted high resolution images to 32x32x3

Performance on New Images

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

Softmax Probabilities

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)

About

Classify Traffic Signs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 63.7%
  • Jupyter Notebook 36.3%