├── CODEOWNERS ├── checkpoint ├── lenet.index ├── lenet.meta ├── images ├── sign.jpg ├── top5_1.jpg ├── top5_2.jpg ├── top5_3.jpg ├── top5_4.jpg ├── result_images.jpg ├── test_images.jpg └── data_visualization.png ├── test-images ├── 1.jpg ├── 2.jpg ├── 3.jpg ├── 4.jpg ├── 5.jpg ├── 6.jpg ├── 7.jpg └── 8.jpg ├── lenet.data-00000-of-00001 ├── set_git.sh ├── LICENSE ├── signnames.csv └── README.md /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @domluna 2 | -------------------------------------------------------------------------------- /checkpoint: -------------------------------------------------------------------------------- 1 | model_checkpoint_path: "lenet" 2 | all_model_checkpoint_paths: "lenet" 3 | -------------------------------------------------------------------------------- /lenet.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/lenet.index -------------------------------------------------------------------------------- /lenet.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/lenet.meta -------------------------------------------------------------------------------- /images/sign.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/images/sign.jpg -------------------------------------------------------------------------------- /images/top5_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/images/top5_1.jpg -------------------------------------------------------------------------------- /images/top5_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/images/top5_2.jpg -------------------------------------------------------------------------------- /images/top5_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/images/top5_3.jpg -------------------------------------------------------------------------------- /images/top5_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/images/top5_4.jpg -------------------------------------------------------------------------------- /test-images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/test-images/1.jpg -------------------------------------------------------------------------------- /test-images/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/test-images/2.jpg -------------------------------------------------------------------------------- /test-images/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/test-images/3.jpg -------------------------------------------------------------------------------- /test-images/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/test-images/4.jpg -------------------------------------------------------------------------------- /test-images/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/test-images/5.jpg -------------------------------------------------------------------------------- /test-images/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/test-images/6.jpg -------------------------------------------------------------------------------- /test-images/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/test-images/7.jpg -------------------------------------------------------------------------------- /test-images/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/test-images/8.jpg -------------------------------------------------------------------------------- /images/result_images.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/images/result_images.jpg -------------------------------------------------------------------------------- /images/test_images.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/images/test_images.jpg -------------------------------------------------------------------------------- /lenet.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/lenet.data-00000-of-00001 -------------------------------------------------------------------------------- /images/data_visualization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/A7med01/CarND-Traffic-Sign-Classifier/master/images/data_visualization.png -------------------------------------------------------------------------------- /set_git.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure you have the latest version of the repo 4 | echo 5 | git pull 6 | echo 7 | 8 | # Ask the user for login details 9 | read -p 'Git repository url: ' upstreamVar 10 | read -p 'Git Username: ' userVar 11 | read -p 'Git email: ' emailVar 12 | 13 | echo 14 | echo Thank you $userVar!, we now have your credentials 15 | echo for upstream $upstreamVar. You must supply your password for each push. 16 | echo 17 | 18 | echo setting up git 19 | 20 | git config --global user.name $userVar 21 | git config --global user.email $emailVar 22 | git remote set-url origin $upstreamVar 23 | echo 24 | 25 | echo Please verify remote: 26 | git remote -v 27 | echo 28 | 29 | echo Please verify your credentials: 30 | echo username: `git config user.name` 31 | echo email: `git config user.email` 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016-2018 Udacity, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /signnames.csv: -------------------------------------------------------------------------------- 1 | ClassId,SignName 2 | 0,Speed limit (20km/h) 3 | 1,Speed limit (30km/h) 4 | 2,Speed limit (50km/h) 5 | 3,Speed limit (60km/h) 6 | 4,Speed limit (70km/h) 7 | 5,Speed limit (80km/h) 8 | 6,End of speed limit (80km/h) 9 | 7,Speed limit (100km/h) 10 | 8,Speed limit (120km/h) 11 | 9,No passing 12 | 10,No passing for vehicles over 3.5 metric tons 13 | 11,Right-of-way at the next intersection 14 | 12,Priority road 15 | 13,Yield 16 | 14,Stop 17 | 15,No vehicles 18 | 16,Vehicles over 3.5 metric tons prohibited 19 | 17,No entry 20 | 18,General caution 21 | 19,Dangerous curve to the left 22 | 20,Dangerous curve to the right 23 | 21,Double curve 24 | 22,Bumpy road 25 | 23,Slippery road 26 | 24,Road narrows on the right 27 | 25,Road work 28 | 26,Traffic signals 29 | 27,Pedestrians 30 | 28,Children crossing 31 | 29,Bicycles crossing 32 | 30,Beware of ice/snow 33 | 31,Wild animals crossing 34 | 32,End of all speed and passing limits 35 | 33,Turn right ahead 36 | 34,Turn left ahead 37 | 35,Ahead only 38 | 36,Go straight or right 39 | 37,Go straight or left 40 | 38,Keep right 41 | 39,Keep left 42 | 40,Roundabout mandatory 43 | 41,End of no passing 44 | 42,End of no passing by vehicles over 3.5 metric tons 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # **Traffic Sign Recognition** 2 | [![Udacity - Self-Driving Car NanoDegree](https://s3.amazonaws.com/udacity-sdc/github/shield-carnd.svg)](http://www.udacity.com/drive) 3 | 4 | Combined Image 5 | 6 | 7 | Overview 8 | --- 9 | In this project, I will use deep neural networks and convolutional neural networks to classify traffic signs. I will train and validate a model so it can classify traffic sign images using the [German Traffic Sign Dataset](http://benchmark.ini.rub.de/?section=gtsrb&subsection=dataset). 10 | 11 | The goals / steps of this project are the following: 12 | * Load the data set (see below for links to the project data set) 13 | * Explore, summarize and visualize the data set 14 | * Design, train and test a model architecture 15 | * Use the model to make predictions on new images 16 | * Analyze the softmax probabilities of the new images 17 | * Summarize the results with a written report 18 | 19 | 20 | [//]: # (Image References) 21 | 22 | [image1]: ./images/data_visualization.png "Visualization" 23 | [image2]: ./images/test_images.jpg "Test" 24 | [image3]: ./images/result_images.jpg "Result" 25 | [image4]: ./images/top5_1.jpg "Result5_1" 26 | [image5]: ./images/top5_2.jpg "Result5_2" 27 | [image6]: ./images/top5_3.jpg "Result5_3" 28 | [image7]: ./images/top5_4.jpg "Result5_4" 29 | 30 | 31 | ### Dependencies 32 | 33 | This project requires **Python 3.5** and the following Python libraries installed: 34 | 35 | - [Jupyter](http://jupyter.org/) 36 | - [NumPy](http://www.numpy.org/) 37 | - [TensorFlow](http://tensorflow.org) 38 | - [Matplotlib](http://matplotlib.org/) 39 | - [Pandas](http://pandas.pydata.org/) 40 | 41 | ## Dataset 42 | 43 | 1. [Download the dataset](https://d17h27t6h515a5.cloudfront.net/topher/2016/November/581faac4_traffic-signs-data/traffic-signs-data.zip). This is a pickled dataset in which we've already resized the images to 32x32. 44 | 45 | 46 | ### Data Set Summary & Exploration 47 | 48 | #### 1. A basic summary of the data set. 49 | 50 | I used the numpy library to calculate summary statistics of the traffic 51 | signs data set: 52 | 53 | * The size of training set is   34799   images 54 | * The size of the validation set is   4410   images 55 | * The size of test set is   12630   images 56 | * The shape of a traffic sign image is   (32, 32, 3) 57 | * The number of unique classes/labels in the data set is   43 58 | 59 | 60 | #### 2. An exploratory visualization of the dataset. 61 | 62 | ![alt text][image1] 63 | 64 | 65 | ### Design and Test a Model Architecture 66 | 67 | #### 1.Pre-processing 68 | I normalized the image data and also divided by the standard deviation of each feature (pixel) value as well. Subtracting the mean centers the input to 0, and dividing by the standard deviation makes any scaled feature value the number of standard deviations away from the mean,so that all the inputs are at a comparable range. 69 | 70 | #### 2. My final model architecture : 71 | 72 | My final model consisted of the following layers: 73 | 74 | | Layer | Description | 75 | |:---------------------:|:---------------------------------------------:| 76 | | Input | 32x32x3 RGB image | 77 | | Convolution 5x5 | 1x1 stride, outputs 28x28x6 | 78 | | RELU | Activation Function | 79 | | Max pooling | 2x2 stride, outputs 14x14x6 | 80 | | Convolution 5x5 | 1x1 stride, outputs 10x10x16 | 81 | | RELU | Activation Function | 82 | | Max pooling | 2x2 stride, outputs 5x5x16 | 83 | | Flatten | output 400 | 84 | | Fully connected | output 120 | 85 | | RELU | Activation Function | 86 | | Dropout | 50% | 87 | | Fully connected | output 84 | 88 | | RELU | Activation Function | 89 | | Dropout | 50% | 90 | | Fully connected | output 43 | 91 | 92 | 93 | #### 3. Training the model : 94 | 95 | To train the model, I used an Adam Optimizer , batch size of 128 , number of epochs is 45 and a learning rate of 0.0008 96 | 97 | #### 4. Training Results : 98 | 99 | My final model results were: 100 | * training set accuracy of   0.999 101 | * validation set accuracy of   0.965 102 | * test set accuracy of   0.951 103 | 104 | 105 | 106 | ### Test a Model on New Images 107 | 108 | #### 1. An eight German traffic signs found on the web : 109 | 110 | ![alt text][image2] 111 | 112 | Here are the results of the prediction: 113 | ![alt text][image3] 114 | 115 | 116 | | Image | Prediction | 117 | |:---------------------:|:---------------------------------------------:| 118 | | Turn left ahead | Turn left ahead | 119 | | Speed limit (70km/h) | Speed limit (70km/h) | 120 | | Priority road | Priority road | 121 | | Slippery road | Slippery road | 122 | | Speed limit (50km/h) | Speed limit (60km/h) | 123 | | General caution | General caution | 124 | | Double curve | children crossing | 125 | | Bumpy road | no entry | 126 | 127 | 128 | 129 | #### 3. The top 5 softmax probabilities for each image : 130 | 131 | ![alt text][image4] 132 | ![alt text][image5] 133 | ![alt text][image6] 134 | ![alt text][image7] 135 | 136 | 137 | 138 | 139 | 140 | 141 | --------------------------------------------------------------------------------