This project was completed as part of the Udacity Self Driving Car program. This project served as a warm up for further applications of Deep Learning, and so we used TensorFlow with networks of our own design (rather than re-training well tested networks like GoogLenet).
The goals of the project were to:
- Explore, summarize, and visualize the INI German Traffic Sign Dataset,
- Design, train, and test a model architecture to classify the signs, and to
- Use the model to make predictions on new images and inspect their softmax probabilities.
In its broad strokes, the classifier is remarkably simple:
- Separate the training, validation, and testing sets.
- Apply a center crop on every image, removing 3 pixels from each edge.
- Normalize and center-mean the image pixel intensities to the [-1, 1] range.
- Train the images in a convolutional neural network inspired by the simplicity of VGG, with:
- A 32x32x3 RGB image input.
- Four consecutive 3x3 kernel convolutions followed by a RELU, 50% dropout, and max pooling on all but the first.
- Three consecutive fully connected layers (including the final output).
To make this work at peak performance and to determine the exact structure and parameterization of the neural network, plenty of tuning and experimentation was needed. This was supported by the conv()
function, which makes it easy to apply TensorFlow convolution without manually entering input sizes and provides simple flags for applying RELUs, pooling, and change the padding type.
The final testing accuracy was 97.3%, which is only 1.5% below human accuracy for the images in this data set.
For a deeper dive into the top 5 softmax scores for a selection of example images, read the last section of Traffic_Sign_Classifier.ipynb
.
Download this repository by running:
git clone https://github.com/peter-moran/german-taffic-sign-classifier.git
cd german-taffic-sign-classifier
This project utilizes the following, easy to obtain software:
- Python 3
- TensorFlow
- OpenCV
- Jupyter
- Matplotlib
- Numpy
- Scikit-learn
An easy way to obtain these is with the Udacity CarND-Term1-Starter-Kit and Anaconda. To install the software dependencies this way, see the full instructions or simply run the following:
git clone https://github.com/udacity/CarND-Term1-Starter-Kit.git
cd CarND-Term1-Starter-Kit
conda env create -f environment.yml
activate carnd-term1
You will also need the latest version of TensorFlow (the page above uses an outdated version) and it is also recommended you install TensorFlow with GPU support. To get the latest version, use the TensorFlow installation guide.
This project uses the INI German Traffic Sign Dataset. Udacity has provided this in a pickled form and can be downloaded here, who's contents should then be extracted to the data/signs
folder.
This project is entirely contained in a Jupyter Notebook. Simply open Traffic_Sign_Classifier.ipynb
in Jupyter and start running the cells.
jupyter notebook Traffic_Sign_Classifier.ipynb