Writeup
Build a Traffic Sign Recognition Project
The goals / steps of this project are the following:
* Load the data set (see below for links to the project 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
Writeup / README
1. Provide a Writeup / README that includes all the rubric points and how you addressed each one. You can submit your writeup as markdown or pdf. You can use this template as a guide for writing the report. The submission includes the project code.
You’re reading it! and here is a link to my project code
Data Set Summary & Exploration
1. Provide a basic summary of the data set and identify where in your code the summary was done. In the code, the analysis should be done using python, numpy and/or pandas methods rather than hardcoding results manually.
The code for this step is contained in the second code cell of the IPython notebook.
I just use the numpy library to calculate summary statistics of the traffic
signs data set:
- The size of training set is 34799
- 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
2. Include an exploratory visualization of the dataset and identify where the code is in your code file.
The code for this step is contained in the third code cell of the IPython notebook.
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.hist(y_train, n_classes, normed=1, histtype='bar', facecolor='b', alpha=0.75)
ax.set_title('label frequency')
ax.set_xlabel('labels')
ax.set_ylabel('frequency')
plt.show()
Here is an exploratory visualization of the data set. Here I use matplot library function ax.hist()
to directly plot the frequency of the labels.
Design and Test a Model Architecture
1. Describe how, and identify where in your code, you preprocessed the image data. What tecniques were chosen and why did you choose these techniques? Consider including images showing the output of each preprocessing technique. Pre-processing refers to techniques such as converting to grayscale, normalization, etc.
The code for this step is list here:
import cv2
# convert color image to gray-scale image,here we use opencv api function,
# gray= R*0.299+G*0.587+B*0.114
def color2gray(image):
gray_img=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
return gray_img
def Images_color2Gray(image_group):
X_train_gray=[]
for train_image in image_group:
gray_img=color2gray(train_image)
gray_img = gray_img[:, :, np.newaxis]
X_train_gray.append(gray_img)
return X_train_gray
##################################
# plot two images
fig, axs = plt.subplots(1,2, figsize=(5, 2))
axs = axs.ravel()
axs[