Traffic sign classification using Convolutional Neural Network
Objective: For higher levels of vehicle autonomy to be able to drive safely, detection of traffic signs and identifying each of the signs becomes essential for AV’s to steer accordingly by classifying them. This project focuses on developing a convolutional neural network that reads the road sign images and classifies them correctly.
Implementation: The project was implemented following the below steps:
- Importing data(traffic sign images) visualizing the dataset
- Preprocessing images and data augmentation
- Developing a CNN model
- Training and validate the model
- Optimizing model by changing hyperparameters for better accuracy
- Testing the model
Importing data and visualizing dataset:
The German Traffic Sign Dataset consists of 39,209, 32×32 px color images[RGB color space]that we are supposed to use for training and 12,630 images that we will use for testing. Each image is a photo of a traffic sign belonging to one of 43 classes.
Each image is encoded within a class that ranges from 0 to 42. We then check the distribution of the training dataset in these 43 classes.
The dataset is unbalanced, with some classes representing significantly sample data than the others. We plot the image set which belongs to a particular class and thus plot images for 43 classes for different traffic signs.
Image preprocessing & data augmentation:
Gray scaling: Apply the Grayscale transform on the image, which will return an image with only one color channel.
Histogram equalization: Perform histogram equalization: It is a technique used in image processing to improve the contrast of the image by spreading out the frequent intensities and stretch the intensity range of the image. This allows for areas of lower local contrast to gain a higher contrast in our images.
To increase the amount of data that is unbalanced and for the model to generalize it, we apply data augmentation techniques:
ImageDataGenerator module from Keras library is used to perform horizontal and vertical shifting, zoom and shear the image and also rotate the image.
Building a CNN: LeNet being a well-established model was used for this project to start with. Its architecture was implemented with the goal to achieve maximum accuracy of the model.
Training and validation of the model:
Using LeNet architecture, the model was trained with the training data set.
Optimizing the model:
To reduce the overfitting, the model was optimized using a different set of hyperparameters until a maximum validation accuracy was obtained.
Testing the trained model:
The model was tested by importing different test images for which it correctly predicted the class (label) to which the traffic sign belonged to
The code for this project can be found on my GitHub page.