Coder Social home page Coder Social logo

traffic-sign-classifier's Introduction

Traffic Sign Recognition


Build a Traffic Sign Recognition Project

The goals / steps of this project are the following:

  • Load the data set (using German Traffic Sign Dataset)
  • Explore, summarize and visualize the data set
  • Design, train and test a model architecture
  • Use the model to make predictions on new images randomly downloaded on the web
  • Analyze the softmax probabilities of the new images

Data Set Summary & Exploration

1. Use numpy.shape to get the shape of the data set.

2. Use pandas.value_counts() to get the distribution of labels.

Here is an exploratory visualization of the data set. It is a bar chart showing how the labels distribute in training, validation and test datasets.

alt text

Design and Test a Model Architecture

1. For normalization, I divided the images by 255 to scale the data between 0 and 1.

2. My model basically follows the structure of Lenet.

My final model consisted of the following layers:

Layer Description
Input 32x32x3 RGB image
Convolution 5x5 1x1 stride, valid padding, outputs 28x28x6
Relu
Max pooling 2x2 2x2 stride, outputs 14x14x6
Convolution 5x5 1x1 stride, valid padding, outputs 10x10x16
Relu
Max pooling 2x2 2x2 stride, outputs 5x5x16
Fully connected outputs 120 hidden nodes
Fully connected outputs 84 hidden nodes
Fully connected outputs 43 logits
Softmax outputs 43 probabilities

3. Training

To train the model, I choose the Adam as my first choice, which combines the advantages of RMSprop and Momentum, and the hyperparameters I used are shown below:

Hyperparameter Value
Batch Size 128
EPOCHS 10
Learning Rate 0.01

4. Discussion

My final model results were:

  • the training set accuracy of 1, apparently, it is overfitting.
  • the validation set accuracy of 0.952
  • the test set accuracy of 0.903

As the model shown above, I chose Lenet as my CNN architecture and luckily the training results of my first architectural selection met the accuracy requirements.

The results showed that Lenet is very powerful in image classification. Also, there are some other tricks I used to improve the model like a small learning rate and a xavier_initializer() which can make the gradients contour more round.

There are some other ways I think would help improve the model's performance.

  • Turn images into gray scale
  • Augment the training data by rotating or shifting images or by changing colors
  • Use dropout layer instead of max pooling layer
  • Add batchnorm layer

Test a Model on New Images

1. New German traffic signs

Here are seven German traffic signs that I found on the web:

The 1st, 2nd, 4th, 7th images contain watermarks, which may cause the model to fail.

2. Prediction and probabilities on each new images

Here are the results of the prediction:

Image Prediction Probability
Bicycles Crossing Stop 0.999
Bumpy Road Stop 0.863
Roadworks Roadworks 1
Slippery Road Speed limit 120km/h 0.778
Speed Limit 70km/h Speed Limit 70km/h 0.999
Stop Stop 0.999
Wild Animals Crossing Slippery road 0.999

The model gives an accuracy of 42.8%, which is much lower than it performed on the test set. And even for the misclassified images, it gives a very high certainty.

3. Discussion on misclassified new images

We can see that the results above are very interesting. And there is a commonality for the misclassified pictures, that is, they all have watermarks. For the human eye, we can easily ignore the impact of the watermark. But for CNNs, this seems to be fatal, like a specific attack.

For this problem, I think there may be two solutions:

  • Add watermarked images to the training set, it should be the most effective way.
  • Use Gaussian blur to fade the watermarks.

traffic-sign-classifier's People

Contributors

andrewpaster avatar domluna avatar awbrown90 avatar brok-bucholtz avatar dsilver829 avatar citlaligm avatar alfred-liu96 avatar mvirgo avatar baumanab avatar davidawad avatar swwelch avatar antorsae avatar josemacenteno avatar ryan-keenan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.