A PROJECT ON TRAFFIC SIGN CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK
Onumaku Chibuike Victory
Posted on March 14, 2024
In this project, we used a convolutional neural network to build train, and test a traffic sign classification model. We built this model using tensorflow and keras. It is a multiclass classification problem. This model can be used to make smarter cars.
After this project, one can be able to build multiclass classification model using deep learning.
STEPS TAKEN TO SOLVE THE PROBLEMS
1) Finding data on kaggle and loading it into google colab.
2) Preprocessing the image and visualizing them.
3) Finding out the mean of the dimension and resizing all images accordingly.
4) Converting the images into a numpy array and normalize them.
5) Checking class imbalance.
6) Splitting the data and performing one hot encoding.
7) Creating the model architecture, compiling the model and then fitting it.
8) Plotting the accuracy and loss against each Epoch.
9) Preprocessing the test data and make predictions on it.
10) Visualize the original and predicted labels for the test images.
First, we start by connecting to kaggle using kaggle API which can be downloaded from your kaggle account settings and uploading it on your notebook.
Next we would store the data by making a directory and making it as a current directory.
We download the data into colab notebook using using references found in search options.
Also unzip the data which is downloaded and remove irrelevant files.
We plot 12 images to check dataset.
For further processing we will require the images of same dimension. So, we will start storing the dimension of all images from training dataset from all 43 classes.
Now, we will reshape the images into (50,50) and also store their label ids.
We also check the shape of the images. Here we can see below that there are 39209 images with a shape of (50,50,3).
The next step was splitting the data into training and validation with 80% of training data and 20% of validation data. Also converting the classes column into categorical using to_categorical() function.
Next we compile the model using metrics, optimizer and loss as required and printing out the summary of the model.
Now we fit the model and observe how they are getting trained on each epoch.
Next we visualize the accuracy and loss per epoch. For this we will store the model history in the pandas dataframe and plot them.
We create a function to resize the test images converting them into a numpy array and normalize them.
Now we will use the model to make predictions on our test images and save them in y_pred.
Next we store the labels according to the image classes.
Finding out the predicted label for the images above.
Posted on March 14, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 15, 2024
October 25, 2024