Jump to main content

Identify Road Signs with Machine Learning

1
2
3
4
5
41 reviews

Abstract

Driverless cars use machine learning, a type of artificial intelligence, to identify road signs and other things they encounter on the road, like pedestrians and other vehicles. In this project you will take your own pictures of different types of road signs and use machine learning to identify the signs using a free online tool (no programming is required). You will then attempt to improve your machine learning model so it can identify signs in a variety of environments.

Summary

Areas of Science
Difficulty
 
Time Required
Short (2-5 days)
Prerequisites
None
Material Availability
Readily available
Cost
Very Low (under $20)
Safety
Be careful when taking pictures of road signs. Do not stand in the road.
Credits
Ben Finio, PhD, Science Buddies

Objective

Train a machine learning model to classify pictures of different types of road signs.

Introduction

Humans are very good at identifying objects visually. For example, you can look at Figure 1 and immediately tell that one sign is a "curve ahead" sign and the other is a stop sign. This is a very important skill when driving, since drivers constantly need to identify and obey traffic signs.

A 'curve ahead' sign and a stop sign along the side of the road at two different locations, with farmland, trees and blue sky in the background. Image Credit: Science Buddies
Figure 1. Left: A curve sign. Right: A stop sign.

While it is very easy for humans to perform this task, it is very difficult to write a computer program that can do it. Traditional programs follow strict predefined rules that are written by a human. If you were to write a program like this, you might write a description of each sign and then write rules telling the computer to look for certain characteristics. For example, the curve sign is yellow and diamond-shaped and has a curved black arrow in the middle. The stop sign is red and octagonal and has the word "stop" in white in the middle. You could write a computer vision program—a computer program that analyzes images or videos to extract information—to search for these characteristics in an image.

This approach only works well, however, if you have near-perfect pictures of the signs. What if a sign is splattered with mud, partially covered with snow, or marked with graffiti? What if it is nighttime, so the lighting in the picture is different and the sign appears to be a slightly different color?

Or what if the picture of the sign is taken at an odd or extreme angle, like the sign in Figure 2? As a human, you can still readily identify the curve sign, but a computer program written to look for a wider diamond shape, like the one in Figure 1, might have trouble.

All of these factors make identifying road signs and other objects a challenging task for driverless cars (also called autonomous or self-driving vehicles). To operate safely, they must be able to identify signs and objects in a wide variety of conditions and from many different angles.

A picture of a curve sign taken from an extreme angle, resulting in a skewed, narrow diamond shape in the imageImage Credit: Science Buddies
Figure 2. A picture of a curve sign taken at an extreme angle.

Ultimately, it is not feasible to write a set of rules to describe every possible view of a sign that a driver might encounter. Given that limitation, a driverless car that is programmed to follow a strict set of predefined rules might fail to properly identify a sign in a new or unexpected situation, and that could result in a crash. This is where machine learning comes in. Machine learning is a type of artificial intelligence.

With machine learning, instead of writing a program with pre-defined rules, programmers use a type of program called a neural network that functions more like the human brain. The program is given a massive amount of training data (see Figure 3), typically consisting of thousands or even millions of images—more images than humans could ever sit down to write rules for or descriptions of. Using advanced math, the neural network looks for patterns and develops its own rules. In other words, it "learns" to identify the images.

Four pictures of stop signs. Two of the pictures are of signs in different locations, and two of the pictures are of the same sign from slightly different angles. Image Credit: Science Buddies
Figure 3. Example training images of stop signs. Training images could also include pictures taken at different times of day or in different weather conditions.

There are many different types of machine learning. Supervised learning, the type you will use in this project, uses training data that has been pre-classified by a human (the "supervisor"). This type of learning works well when you want to teach a machine learning model (program) to classify different sets of objects, like road signs. This video provides an overview of supervised learning:

One challenge with machine learning models is that they can be subject to bias from their training data. For example, notice how all of the pictures in Figure 3 have a clear blue sky in the background, some snow on the ground, and trees without leaves. All of these pictures were taken near each other on the same day. A machine learning model trained with only this data might learn to associate these features with stop signs and have trouble identifying pictures of stop signs with other backgrounds (for example, a cloudy day, an urban environment with buildings, or a summer day with green plants). This video provides a brief overview of bias in machine learning models:

You can help prevent a model from developing bias by providing a diverse set of training data. In this case, that would mean pictures of road signs in a wide variety of settings: in different locations, at different times of day, and in different weather conditions.

In this project you will use a free online tool called Teachable Machine by Google® to train a machine learning model. The tool allows you to upload sets of training images to different classes (categories), train the model, and then evaluate the model by giving it new images to see if it classifies them correctly. You will attempt to improve your model by providing it with more training data, to see how accurate you can make it. You can do all of this without doing any programming yourself. Those who do have programming knowledge can export the model in order to examine it in more detail (see the Teachable Machine website for more information).

Terms and Concepts

Questions

Bibliography

Materials and Equipment

Experimental Procedure

  1. Choose two different types of road signs that you will use for your machine learning model. You should choose signs where you will have safe, easy access to the same type of sign in different locations in order to take pictures. You may need to explore your neighborhood with an adult to look for signs or use an online tool like Street View in Google Maps®.
  2. Take at least 10 pictures of each type of sign. For example, if there are two stop signs within walking distance, you could take five pictures of each sign. Note that Teachable Machine will crop each image to a square aspect ratio, so make sure the sign is not too close to the edges of the image or it will get cropped out.
  3. Load the pictures onto your computer so they are ready to upload to Teachable Machine.

    Note: As of March 2022, you must use Teachable Machine on a computer; it will not run directly on your phone.

    Note: Websites can change frequently. If the following instructions do not match exactly what you see, just follow the on-screen instructions to use Teachable Machine.

  4. Go to Teachable Machine and click Get Started.
  5. Click Image Project.
  6. Click Standard image model.
  7. Edit the names of the two Classes in the model. For example, you could name them "Stop sign" and "Curve sign."
  8. Under Add Image Samples for your first class, click Upload. Select and upload the pictures of that type of sign from your computer. It may take some time to upload if you have a lot of images.
  9. Repeat Step 9 to add images for your other class.
  10. Click Train Model. Wait for the model to finish training. The model is "learning" to identify your two classes of images while you wait.
  11. Click the drop-down arrow next to Advanced and then click Under the hood.
  12. Read the information that pops up on your screen.

    To summarize, the model only uses 85% of your images for training. It saves the other 15% to use as "test" images. That way, the model can test itself with images it has never seen before. It uses the results from the test images to determine the model accuracy, the percentage of images that were classified correctly for each class (expressed as a number between 0 and 1). It also produces a confusion matrix, which identifies how many images were classified correctly and incorrectly for each class. Hover your mouse over the "?" icon next to each item to learn more about it.

    Note: Each time you re-train your model, it will choose different images as "tests," so the resulting accuracy and confusion matrix might be different.

  13. Now try testing your model with additional images. Try to find images that are different from the ones you used for training. You can go explore your neighborhood to take pictures of new signs, search for pictures of signs online, take screenshots from a tool like Google Maps, or even use an image editing program to edit pictures you already have (e.g., cutting and pasting signs onto different backgrounds).
  14. Under Preview, change the selection in the drop-down menu from Webcam to File.
  15. Under Preview, upload one of your new images. Under Output, the model will assign a probability that the image shows one of your two classes of signs (Figures 4 and 5).

    teachable machine screen shot learning stop signs Image Credit: Google Teachable Machine / Science Buddies
    Figure 4. A machine learning model trained to classify stop signs and curve signs. The output detects a stop sign with 99% probability in the test image.

    Screenshot of the machine learning program. Image Credit: Google Teachable Machine / Science Buddies

    screenshot shows uploaded training images of curve signs and bump signs on the left. On the right is an output preview showing the results for a photo of a bump sign. The program has classified the image as a bump sign with 84% certainty.


    Figure 5. A machine learning model trained to classify curve signs and bump signs. Even though it is obvious to a human viewer that the test image contains a bump sign, the model only assigns 84% probability that the image contains a bump sign.
  16. Test your model's output with a variety of pictures of signs, in as many different environments as you can (different locations, different times of day, different weather, different objects in the foreground or background of the picture, etc.). How accurately does the model classify each image? Are there any images the model gets wrong or has trouble with (e.g., assigns roughly 50/50 probabilities), even if they are obvious to you? Can you identify features in the images that you think are causing problems?

    For example, the test image in Figure 5 has a rectangular "no stopping or standing" sign below the bump sign in the foreground, but none of the training images in that model had additional signs in them. It also has a darker tree in the background, with very little blue sky visible compared to the training images.

  17. Go back and review your training images. Based on problems you saw with your test images, can you identify any potential sources of bias in your training images? For example, maybe you took all your pictures of one type of sign with a blue sky in the background, and all your pictures of another type of sign with a building in the background. Can you figure out how you could add more training images to help eliminate that bias?
  18. Save your model by clicking the Teachable Machine menu in the top left, then click Save to Google Drive.
  19. Based on your analysis in Steps 15 and 16, gather more training images. You may need to explore farther to find more signs, or ask an adult to drive you around or take public transportation to new locations so you can find more signs. You can also take pictures at a different time of day for different lighting or wait for the weather to change and take pictures on a different day. You can also use image editing software to cut and paste signs onto different backgrounds.
  20. Create a new model using the New Project option in the upper left menu. Train it with all of your training images, not just the new ones.

    Note: while you can upload more images and re-train an existing model, this will overwrite the model. Creating a new project for each iteration of your model will allow you to go back and compare them, as opposed to continuously overwriting the same model each time you train it.

  21. Test your new model with the same test images you used on your first model. (Make sure you do not include the test images in your training data). Does your new model do a better job identifying images that the first model had trouble with? What is the result for each individual test image? How do the accuracy and confusion matrix compare to those of your previous model?
  22. You can now repeat the process of testing your model, taking more training images, training a new model, and testing it again. Try to push the limits of your model and test it with more difficult images.

    Think about all the scenarios a self-driving car might encounter where it would be easy for a person to identify the sign, but possibly difficult for the machine learning model—for example, a stop sign partially obscured by a tree branch. If your training data did not include any images of partially obscured signs, can it still identify them in test images? What about damaged or bent signs?

  23. Keep trying to improve your model. This is an open-ended project with no defined "end point." You can always give your model more training data and keep trying to improve it. However, realistically, at some point you have to decide when your model is "good enough." Can you get your model to a point where you think it would be safe to use in a self-driving car?

    If you want more challenges and more ways to expand your model, see the Variations section.

icon scientific method

Ask an Expert

Do you have specific questions about your science project? Our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

Global Connections

The United Nations Sustainable Development Goals (UNSDGs) are a blueprint to achieve a better and more sustainable future for all.

This project explores topics key to Industry, Innovation and Infrastructure: Build resilient infrastructure, promote sustainable industrialization and foster innovation.

Variations

  • You can add more classes to your Teachable Machine model by clicking Add a class. Try training a model that can recognize multiple types of signs.
  • Take pictures with no signs in them and include them as a class in your model. Does your model ever mistakenly identify a sign in an image even when none is present?
  • Try training a model that can recognize other objects an autonomous car would see when driving, like pedestrians, cyclists, and other cars, or red, yellow, or green lights. Remember to be careful and follow all traffic and pedestrian safety laws (e.g., do not stand in the middle of the road to take pictures). You may need to check whether it is legal to take pictures of other people in public in your location.
  • Click the Advanced drop-down under the Train model button to access several different parameters that affect how your model learns. Hover your mouse over the "?" icon next to each parameter to learn more about it. Try adjusting these parameters to see how they influence your model.

Careers

If you like this project, you might enjoy exploring these related careers:

Career Profile
Are you interested in developing cool video game software for computers? Would you like to learn how to make software run faster and more reliably on different kinds of computers and operating systems? Do you like to apply your computer science skills to solve problems? If so, then you might be interested in the career of a computer software engineer. Read more
Career Profile
Many aspects of peoples' daily lives can be summarized using data, from what is the most popular new video game to where people like to go for a summer vacation. Data scientists (sometimes called data analysts) are experts at organizing and analyzing large sets of data (often called "big data"). By doing this, data scientists make conclusions that help other people or companies. For example, data scientists could help a video game company make a more profitable video game based on players'… Read more
Career Profile
Computers are essential tools in the modern world, handling everything from traffic control, car welding, movie animation, shipping, aircraft design, and social networking to book publishing, business management, music mixing, health care, agriculture, and online shopping. Computer programmers are the people who write the instructions that tell computers what to do. Read more

News Feed on This Topic

 
, ,

Cite This Page

General citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.

MLA Style

Finio, Ben. "Identify Road Signs with Machine Learning." Science Buddies, 13 Apr. 2022, https://www.sciencebuddies.org/science-fair-projects/project-ideas/CompSci_p069/computer-science/machine-learning-road-signs. Accessed 26 Apr. 2024.

APA Style

Finio, B. (2022, April 13). Identify Road Signs with Machine Learning. Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/CompSci_p069/computer-science/machine-learning-road-signs


Last edit date: 2022-04-13
Top
We use cookies and those of third party providers to deliver the best possible web experience and to compile statistics.
By continuing and using the site, including the landing page, you agree to our Privacy Policy and Terms of Use.
OK, got it
Free science fair projects.