Jump to main content

Drive a Race Car with Machine Learning

25 reviews


Areas of Science
Time Required
Average (6-10 days)
Ben Finio, PhD, Science Buddies
*Note: For this science project you will need to develop your own experimental procedure. Use the information in the summary tab as a starting place. If you would like to discuss your ideas or need help troubleshooting, use the Ask An Expert forum. Our Experts won't do the work for you, but they will make suggestions and offer guidance if you come to them with specific questions.

If you want a Project Idea with full instructions, please pick one without an asterisk (*) at the end of the title.


How do you design a program that can pilot a self-driving race car? By using machine learning. In this project, you will train your own machine learning model for an autonomous vehicle, the AWS (Amazon Web Services) DeepRacer. You can run your car's machine learning model on a simulated racetrack (Figure 1), or you can purchase a 1/18 scale model vehicle that can race on a physical track (Figure 2).

Screenshot of AWS DeepRacer console. On the left is a graph of learning performance over time, and on the right is a simulated track.
Figure 1. Screenshot of the virtual racing environment.

Photo of the AWS DeepRacer Evo autonomous racing vehicle
Figure 2. The AWS DeepRacer Evo, a second-generation version of the DeepRacer, is equipped with two cameras and a LIDAR sensor.

There are many different machine learning strategies. The AWS DeepRacer uses a type of machine learning called reinforcement learning. Reinforcement learning is similar to training a dog: you give rewards for good behavior and remove rewards for bad behavior. For your dog, the desired behavior might be something like sitting instead of jumping when waiting for a treat. For an autonomous car, the desired behaviors could include things like staying in the middle of a lane, driving below the speed limit, avoiding collisions with other cars, and stopping at red lights.

The unique thing about reinforcement learning is that the model does not "know" in advance what the desired behaviors are—it has to learn through feedback. Other types of learning require more information from the start. For example, a supervised machine learning model intended to categorize images of cats and dogs would first need access to pre-classified sets of images.

A reinforcement learning model, in contrast, learns through trial and error which behaviors are rewarded. This video gives an overview of how reinforcement learning works and why it is a good machine learning strategy for teaching a complex behavior—like driving a race car—that is too hard to explain to a machine step-by-step.

In the AWS DeepRacer console, you will create your own reward function in Python. (You can start out with several simple example functions). You get to decide what kind of behavior you want to reward. For example, do you want to reward your race car for staying close to the center of the track? For driving as fast as possible on straight sections? For avoiding over-steering on turns? A weighted combination of different factors?

Your reward function determines how your car's behavior will evolve over time as it learns. The virtual racing console will show you a 3D simulation of your car on a racetrack as well as a graph indicating how its performance improves over time (Figure 1).

To get started, go to AWS DeepRacer and follow the instructions. You will need to create an AWS account. You can set up a free trial account with a limited amount of storage space and model training time, but you will be required to enter credit card information. Up-to-date pricing information is available on DeepRacer's pricing page, and step-by-step instructions on how to create an account are available from AWS's online support center.

Once you have an AWS account, the best way to get started with DeepRacer is to take the free 90-minute e-learning course offered by AWS. This course will teach you everything you need to know about reinforcement learning in order to get your first machine learning model up and racing on the virtual track. (Note that several videos at the beginning of this course focus on the physical car, so you can skip through those if you only plan on using the simulator.)

Once you have trained an autonomous race car model, you can test it out on different virtual racetracks and even enter it in the virtual racing league to compete against other people.

Here are a few questions to consider if you would like to use your virtual race car for a science project:


  • Amazon Web Services, Inc. (n.d.). AWS DeepRacer. Retrieved February 11, 2022.
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.


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
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. "Drive a Race Car with Machine Learning." Science Buddies, 16 Mar. 2022, https://www.sciencebuddies.org/science-fair-projects/project-ideas/CompSci_p068/computer-science/machine-learning-AWS-DeepRacer. Accessed 24 Feb. 2024.

APA Style

Finio, B. (2022, March 16). Drive a Race Car with Machine Learning. Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/CompSci_p068/computer-science/machine-learning-AWS-DeepRacer

Last edit date: 2022-03-16
Free science fair projects.