One Step Closer to a Self-Driving Car!

During these times, our usage of vehicles has without a doubt plummeted. However, our innovation, creativity, and ambition continues to grow. Works on creating some amazing new technologies, particularly in the field of transportation, continues. Recently, I wrote an article on come of the really cool transportation technologies being built today. Check that out here!

In this article, I want to dive deeper into one of the more relative technologies which we have already started to see today, the self driving car. The self-driving car is super impactful for many reasons. Firstly, it would drastically change the way cars are managed on the road. It would result in minimal car accidents and in turn it would save many, many lives from drunk driving, texting and driving, among many others. Self-driving cars are already being implemented by companies like Uber and they will continue to become more and more evident. Due to this, I was really fascinated by the self-driving car and decided that it would be really cool to design a feature that is used in the self-driving car.

I then decided to create a road sign detection system.

There are many different parts and systems involved in making a self-driving car. Some of the examples are, control (how the car is able to actually drive itself), path planning (how the car is able to decipher the best possible route to take), localization (how the car is capable of determining where it is located), sensor fusion (how the car is able to sense what is around it, its environment), and finally computer vision (how the car is able to see the different objects around it). I decided to focus on one of these systems, and the system I chose was computer vision.

In my project I created a system using computer vision which is able to detect which sign is which. For example, I would present the system with a stop sign, and it would be able to detect that this is a stop sign. This project was done as a method of learning how to code, but also to gain experience building parts of a self-driving car so that one day, I am able to create a self-driving car myself. In this article, I will first discuss what I did to learn how to code and the skills I learned before starting the project. Then, I will discuss the project itself, and breakdown different parts of the code.

Preparing for the Project

In order to work on this project, coding was a necessary skill. I mean the entire project was code, so learning how to code was imperative. I had 0 experience coding in any language, and after reaching out to many people, I decided that the best language to learn how to code in, was Python. So I went ahead and took a few python courses but what I found most useful was a 7 hour video that I watched which was a whole tutorial of Python and it also included examples of using python with computer vision. If you are learning how to code in python or want to learn how to code in python, I really recommend watching the video. The video is down below:

While learning how to code was essential for the project, I also decided to take a few courses on AI since it was a pivotal aspect of the project. Among the many courses I took, the one that stood out to me the most was a course on Coursera called AI For Everyone. If interested in AI, I really suggest you take a look at this course and enroll yourself. AI For Everyone is a really great course because it not only teaches you about what AI really is but it teaches you about how it can be used today, and how you can implement AI in your business, startup, or any other projects you are working on. It provides real life examples and if I choose to run a start-up, I will definitely come back to this course to better understand how I can use AI to better my company.

Now that I have explained the steps I took prior to starting the project, I think it is time to get into the project itself!

The Project

This was a really lengthy project but it was a project that was worth all the struggles. And trust me there were struggles. You may be wondering what I mean by struggles, do I mean it was hard or difficult? No, what I mean is that sometimes I spent hours and hours to solve one small error in my code. An error which was probably 0.5 percent of my code, yet without fixing the error, the code would not run. What I realized is that, this is coding. Coding is fixing small and minor errors which take a really long time to solve, especially for beginners like me. But throughout all the painful, meticulousness of the code, I got through it and so here is the breakdown of my project.

First Step:

The first step was to access and download a dataset which would contain various different road signs and different versions of each sign. We want to be able to test our system for variances in each road sign, so having multiple of the same road sign with slight variances is important.

Road Signs Data Set

Above is a screenshot of an extremely small portion of the road signs that were present in my dataset. When I say extremely small portion, I mean EXTREMELY small portion, in fact it is only 24 of over 12,500 images. So this was the first step, to attain the needed data and download the dataset.

Step 2:

The second step is to import all the required and useful libraries which will help us carry out different tasks using our code. Here is an image of that step in my code.

Importing Different Libraries

Keep in mind that in order to import and use these libraries, they need to be installed first. If importing these libraries, make sure you have them installed and the correct version installed depending on the python version you are using.

Step 3:

Our next step is to input all of our data into lists. While doing this step it is also important to give each image a name. So we will create a separate list for the names of each image. In my dataset there were 43 different images, however there were multiple versions of each type of images which is why there are over 12,500 images in the dataset.

Placing the Dataset Images into Lists

The code above first places the images and its assigned names into lists. The “for” loop is used for many reasons, which include re-sizing the image and then the “append” function places the images into the lists.

Step 4:

The next major step is to build and compile the actual Convolutional Neural Network model. Convolutional Neural Networks are most commonly used for the analyzation of images, which in our case is very important as our project is designed around image detection.

Building and Compiling the Model

The code above is the model code for our project. It is used to train the software to detect the 43 different types of images. When the software is given an image, it translates it into a binary format and adds it to the model. When another image is given, it is also translated into binary and if it matches with one of the original images, the system is able to confirm that the image is the same. The model is the main part of the code as it is the model which detects which image is which, the goal of this project.

Step 5:

Now Once this is all done, we will be able to run code and the system will be able to detect which image is which. But, how will we upload an image? This is where another page needs to created, called the GUI (Graphical User Interface) for the interface of uploading an image.

The code above is a dictionary of the different types of images that are present in our dataset. This is part of the second page of code, the interface page and the dictionary is useful so that the system can detect what is the name of each type of image.

Step 6:

The last step before we are able to run the code is the coding of the different buttons on the interface.

Interface When Running the Code

When we run the code, this interface pops up and it allows for us to upload an image from the dataset. Once we upload an image, we have to classify it using the button on the right, and the software is able to classify the image because of our code. The Graphical User Interface code is responsible for the coding of the buttons you see on this page. The entire page is created for the proper functioning of this interface that pops up after running the original code. Without the GUI, uploading an image for the system to classify would not be possible.

Conclusion:

This was my first project using python, and because of this project I accomplished many things. I was able to learn how to code in python and I became more familiarized with the concepts of AI and how it can be used in real life projects and companies. I was able to code this project and I don’t plan on stopping just yet. I will be starting another project similar to this one, so keep an eye out, there is more to come. With this project I am one step closer to the final goal, a self-driving car!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A voyage into the back-end

How To Clone DigitalOcean Droplet?

Create multiple documents using Mail Merge (with File Names picked from Excel)

The Risks of Repetition

Handling bulk update or create on Django models through filters — Roman Sorin

Handling bulk update or create on Django models through filters

Making the Profitable Choice Tool: Part II

CI/CD Of Invalidation AWS CDN Using Gitlab Pipeline

Alt Text

Locally Run Amazon Linux 2 for Ruby on Rails Development

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aahil Noorali

Aahil Noorali

More from Medium

Hey join me on substack!

INTRODUCTION ABOUT “CDBIO”

Recent Metaverse Progress

Fortnite: Took The World By “Storm”