AWS DeepRacer Build New Vehicle

 

How to use AWS DeepRacer Build New Vehicle?

Before going through those steps, if you’d like to learn the basics about AWS DeepRacer, check the AWS DeepRacer starting guide.

The default Car may be utilized, “The Original DeepRacer”, or AWS DeepRacer build new vehicle through going over the below procedure:

  1. Head to the AWS DeepRacer Console, then click on Reinforcement Learning. Go to your garage, then click on Build New Vehicle.
    AWS DeepRacer Build New Vehicle - Build a New Vehicle

    AWS DeepRacer Build New Vehicle – Build a New Vehicle

     

  2. The setting for Sensor and Camera should be left the same. Click on Next.
    AWS DeepRacer Build New Vehicle - Camera and Sensor specifications

    AWS DeepRacer Build New Vehicle – Camera and Sensor specifications

     

  3. Leave the action space settings like the values set in the following screenshot. Click on Next.
    AWS DeepRacer Build New Vehicle - Action Spaces

    AWS DeepRacer Build New Vehicle – Action Spaces

     

  4. Fill in the name of your car then select a specific color. Click on Done.

    AWS DeepRacer Build New Vehicle - Name and Color

    AWS DeepRacer Build New Vehicle – Name and Color

 

What is Action Space when working with AWS DeepRacer Build New Vehicle?

You can make your car steer right or left, and drive forward at multiple speeds. Those choices reflect the action spaces of your Car, and they are dependent upon the below parameters:

– Maximum Steering Angle: 1 to 30

– Maximum speed: 0.1m/s to 4m/s

– Steering angle granularity: 3, 5 or 7

– Speed granularity: 1, 2 or 3

Beginners are recommended to utilize the following values:

  • Three steering angles as well as Three speeds, which means 3*3 = 9 action spaces
  • maximum speed: 1m/s for training your car at a faster pace

You will need to concentrate on how reliable and accurate your model is, rather than focusing merely on speed and lap time. After learning more about the whole process, you will be able to start training your car through adding more action spaces and more max speed.

How to Create a Model?

AWS DeepRacer offers 5 out of the box models:

Model Name Model Description Model Status Model Sensors
Sample-Head-to-Head Its training has a reward function for head to head racing Ready Stereo camera and Lidar
Sample-Object-Avoidance Its training has a reward function for avoiding objects Ready Stereo camera
Sample-Time-Trial-PreventZigZag Its training has a reward function for penalizing the agent in case of over steering Ready Camera
Sample-Time-Trial-StayOnTrack Its training has a reward function for keeping the agent inside the borders of the track Ready Stereo camera
Sample-Time-Trial-FollowCenterLine Its training has a reward function for keeping the agent following the center line Ready Camera

It is advised that you start clicking on every model one by one, and head to their Training Configuration. Check the Reward Function and Action Space that are going to provide you with the basis of designing your very own unique model.

Go through the below steps to get your own model created:

  1. Open the AWS DeepRacer Console using the following link https://console.aws.amazon.com/deepracer/home?region=us-east-1#welcome. Click on Reinforcement Learning, and then Your models. After that, select the option Create Model.

    AWS DeepRacer Build New Vehicle - Create a Model

    AWS DeepRacer Build New Vehicle – Create a Model

  2. Fill in a Model name and give it a specific description.
  3. Select a Racing Track. For example you can pick ⦿ re:Invent 2018 and click on Next.
  4. Select a Race Type. For example, pick ⦿ Time trial.
  5. Select an Agent, which refers to a Car. For example select a recently created car. Otherwise, you can simply select the default car, which is “The Original DeepRacer”.
  6. Start clearing the Reward Function Code Editor. After that, go ahead with Copying and Pasting the below reward function into the code editor. Select the option Validate in order to ensure that the code is valid.

def reward_function(params):
 
'''
 
An example that rewards the Agent (Car) whenever it follows the center line
 
'''
 
# Go over the input parameters
 
track_width = params['track_width']
 
distance_from_center = params['distance_from_center']
 
all_wheels_on_track = params['all_wheels_on_track']
 
speed = params['speed']
 
SPEED_THRESHOLD = 1.0
 
# Calculation of three markers located at changing distances that are not at the center line
 
marker_1 = 0.1 * track_width
 
marker_2 = 0.25 * track_width
 
marker_3 = 0.5 * track_width
 
# Offer a greater reward in case the car goes closer to the center line and a less reward if it is far from the center line
 
if distance_from_center <= marker_1:
 
reward = 1.0
 
elif distance_from_center <= marker_2:
 
reward = 0.5
 
elif distance_from_center <= marker_3:
 
reward = 0.1
 
else:
 
reward = 1e-3 # probably got crashed or closed to going off track
 
if not all_wheels_on_track:
 
reward = 1e-3 # Penalizes when car is off track
 
elif speed < SPEED_THRESHOLD:
 
reward *= 0.5 # Penalizes when car is extremely slow
 
return float(reward)
 

  1. Leave the the setting of Training Algorithm as default ⦿ PPO and hyperparameters.
  2. Fill in the Stop Condition and set the Maximum time to 60 minutes.

What happens now?

You have finally gotten your special model configured. The upcoming step will be for creating, training and evaluating your model. Please note that you have not charged anything till this point. Subsequent steps will charge you money based on AWS resource utilization.

  1. After selecting Create Model, AWS resources shall get provisioned for getting your model trained for a period of sixty minutes.

what is AWS DeepRacer


AUTHOR