How to Run DeepRacer Locally to Save your Wallet

Jul 20 · 5 min read

The AWS DeepRacer can be expensive. With some top competitors in the league spending +$700 to train their DeepRacers and learn how to do it effectively the activity can be very cost-prohibitive. Plus, if you are like me, you want total control over the training of your model and the ability to use RL algorithms that AWS does not provide (as of writing this they only provide PPO). In this tutorial, I will walk you through how to run the DeepRacer locally on your Ubuntu (I am using 18.04) machine with docker. I will also show places where I got stuck so that you do not get stuck there. It took me several days of research and tinkering to get it right, so hopefully, you find this before you spend that time so you can get right into the fun stuff, watching your DeepRacer learn without your wallet shrinking!

Step 1: If you do not have one already, make an AWS account. I recommend that you at least have some time playing around with the DeepRacer console so you can be familiar with everything there. You get around 10 hours of free training anyway so it doesn’t hurt to play around with the official console for a bit.

Step 2: Make sure you have git installed on your computer and that it is docker compatible.

Step 3: Make a folder called github wherever you feel most comfortable and run the following command in a terminal that is pointing into your github directory. We will be using the Github repository deepracer-for-dummies credited by Alex Schultz.

git clone && cd deepracer-for-dummies && ./

Step 4: Setup the aws-cli. Begin by installing it on your computer. The setup the configure file by running `aws configure` in a terminal. Watch this video starting at the 10-minute mark to learn how to go through the aws configure queries related to keys. Set your region `us-east-1` and do not put anything for the output format (this will use the default).

Step 5: Download and install vncviewer (get the .deb if you are using Linux): You can install it by opening it with ubuntu software or using sudo dpkg -i /path/to_deb

Step 6: Install Docker, Docker Compose, and the Nvidia Docker Runtime. Make sure to follow the docker post-installation steps in order to Manage Docker as a non-root user and Configure Docker to start on boot. Once complete run docker network create sagemaker-local

Step 7: Begin training with the scripts provided by the repository. See the repositories for information on the available scripts and their usage.

When you run the script to start training you should see three terminals like the ones below. The one to the right is the terminal that you ran the command in and the one in the middle being the log terminal after an hour or so of training.

A VNC window should also open up showing the DeepRacer simulation. After everything boots up correctly you should see the DeepRacer start learning by racing around the track just as it does in the AWS DeepRacer console. The simulation backend is all through ROS which is easy to tinker with if you like to add your world or adjust the car to your liking. You no longer need to deal with the restrictions placed by the DeepRacer console so see what you can come up with!

The DeepRacer repo provided by Alex Schultz also contains convenience scripts for running the log analysis tool locally. You can learn more about that here. I will be making a tutorial about it in more detail in the future.

I will be making another tutorial about manually uploading your local models to the official console for submission into the DeepRacer league. Doing the model upload manually helps develop a better understanding of the AWS DeepRacer architecture and how it is structured in S3.

If you want to go ahead and play around with the hyperparameters, action space, and reward function like you can on the DeepRacer console you can follow the directions provided by the deepracer-for-dummies Otherwise, you can just follow the pictures below that show the location for changing each part of the DeepRacer.

Change the track in `deepracer-for-dummies/docker/.env`. The track options are highlighted in the image and listed below: AWS_track, Bowtie_track, easy_track, hard_loopy_track, hard_speed_track, hard_track, medium_track, New_York_Track, Oval_track, reinvent_base, reinvent_base_jeremiah, reinvent_carpet, reinvent_concrete, reinvent_wood, Straight_track, Tokyo_Training_track, Tokyo_Training_track_original, Virtual_May19_Train_track
Adjust the hyperparameters list in the deepracer-for-dummies/docker/volumes/minio/bucket/custom_files/model_metadata.json file. Make sure to update the action indices as you add more actions.
Adjust the hyperparameters in the deepracer-for-dummies/ file. If they are commented out, make sure to uncomment them before you start making edits.

After spending some time working with the local simulation I have found that the checkpoint files for the DeepRacer quickly start eating away at your storage. To delete the checkpoint files, as you might want to do frequently so the simulation does not crash after using up all your machines available space, run `sudo rm -R ~/github/deepracer-for-dummies/docker/volumes/robo/checkpoint/checkpoint`. That should empty your checkpoint folder assuming that you cloned the deepracer-for-dummies into the github folder in your root directory.

I have recently released a local DeepRacer console or graphical user interface (GUI) to make the experience of running the DeepRacer better. You can check it out here.


Written by


Organization founded by Michael Equi to inspire and teach people about AI and Machine Learning (ML) through the application of autonomous race cars. See

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade