Training a car for an autonomous race

I was very lucky to take part in AWS re:Invent this year. It is a big conference by Amazon, organized in Las Vegas. Events like this serve a number of purposes, among which I could mention new products announcements, existing products and th...

7 months ago, comments: 7, votes: 1228, reward: $12.27

I was very lucky to take part in AWS re:Invent this year. It is a big conference by Amazon, organized in Las Vegas. Events like this serve a number of purposes, among which I could mention new products announcements, existing products and their applications, workshops for existing and new customers, getting feedback and requirements to look for new products, presenting third parties leveraging the possibilities of the existing stack (the more successful they are, the more likely an acquisition is), certifications - these are Amazons goals. In short: get amazed, get hooked, use our products to migrate onto our cloud, use our specialized products to depend on us in a not-easily-escapable way.

deepracer-logo.png

For people like me it was a chance to learn Amazon ways of doing things. I went to workshops, to presentations around DevOps, tried meeting some people from our company, from Poland, from other companies. I had some fun going to a party, spent a penny or two at a casino (just so that I don't have to explain why I went to Vegas and didn't try playing). I enjoyed the food and overall it was a time well spent.

IMG_20181126_170413.jpg

Apart from extremely useful tools for business applications, Amazon usually presents a bit of awesome to encourage people to get involved. In 2017 it was DeepLens - a computer with a camera, specialised to train for image recognition using machine learning solutions that AWS provides.

Machine Learning

Can a computer learn like a human? Not really. Well, it does, but in a specific way which is a bit different from what we do as humans. Let's think about those primitive examples first: humans. One reads a book and remembers what applies to one's needs and expectations. Based on that conclusions are being made, piece of information is put into specific context, then it is being applied in some way as an evaluation, adjusted, repeated, mastered. What happens in the brain that makes that happen? How do neurons store that information, expand it and wire into what we know now? I don't know.
Machine learning usually has a much simplified way of taking the data in - there is some model, an exercise. There are some inputs and some outputs. A reward is being defined to guide whatever learning method we take, to decide what makes a better result than the previous one. Then some test data are being taken in tests repeated. Then we can verify decisions of built decision model and use what the computer has learned.

Amazon introduced Deep Lens as a product that would provide a hands-on learning experience for engineers. Deep Lens can be used to apply trained AI models for image recognition and to combine them with AWS services to perform actions. It could do a number of things. There was for example a test whether an object is a hot dog. Deep Lens introduces developers into the world of deep learning - areas where algorithms are used to learn using unstructured data and it's the algorithm trying to work out which inputs matter the most for a given case and which output is the best reaction for it.

What purpose it serves is an excellent questions. A tool like that will spark curiosity. It will push people to try and make something with it. It will push them to use tools and solutions upon which the toy is built. Such developers will be amazed and will be more likely to work with AWS products in the future.

Imagine a computer that would read a book to you: https://aws.amazon.com/deeplens/community-projects/readtome/ - this is one of the examples how someone used a toy to combine some solutions into a working proof of concept.

New products in 2018

New products are part of the show. Every day something new is presented to the public. Some announcements are big, some are small. Some are instantly available, others are work in progress and customers' input is welcome to help guide their development.

You may be aware that Amazon is heavily involved in artificial intelligence and machine learning. Solutions like that are quite heavily used when developing more human-like interfaces for the customers.

One of new products introduced in the area of machine learning was Reinforcement Learning - a method of deep learning where an already trained model builds on itself to receive even greater result. One defines a reward function and executes a repetitive studying cycle. Lastly the output model can either be evaluated or used for yet another training session. What is more interesting, a model trained for a specific behaviour can then be given a different reward function for next the studying cycles and in this way sophisticated AI behaviours can be created.

Another announcement was about RoboMaker - a service that includes an environment for modelling, testing, training and evaluating physical devices in virtual space. Designing, building and verifying equipment is not an easy task. It's not cheap either. With a solution to simulate machines' behaviour more can be planned and tested. Breaking is just a change of state in the simulation. Running a thousand tests, each with slightly adjusted settings is now a matter of couple clicks. And there are more applications like using AWS services to do some of the computing for the robots or to manage a fleet of complete robots.

DeepRacer

As with Deep Lens, DeepRacer has been introduced to provide fun and engaging way to learn how to use products provided by AWS. One gets a remote controlled car with a camera that can be controlled with a phone. While it's an impressive toy, what's even more impressive is that there is a computer connected to it and it has software to perform autonomous driving action. Yes, it's a self-driving car.

IMG_20181129_142816.jpg

Amazon provides reinforcement learning projects which can be used to teach the car. The project uses a virtual 3D model of a car and a track to train the model. Once done, model can be downloaded and copied onto the car which can be placed on a track for evaluation. Nice, isn't it?

To engage people even more, a DeepRacer League has been announced where one can submit their models and compete for the best place. Winners are invited to the finals which will take place at the next re:Invent.

DeepRacer League

On the 8th of May AWS Summit is taking place in London and together with it a DeepRacer League event will take place. I would like to train a model and see a car with it complete a whole lap. This will be a very rewarding moment. I couldn't possibly imagine myself training a winning model with so many experienced engineers having their go.

This video from Amazon will show you much more about DeepRacer then I am able to.

What for?

Why would one even consider doing anything like this? Why would a grown man take a toy and waste time playing with it?

I'm not a huge innovator, I don't see myself leading others towards the unknown apart from the case where I go in a wrong direction by accident and suddenly happen to find myself at something new. Leading is scary. It's like running away from others into a thick fog with loads of lamp posts to hit your head with. If you're lucky. If not, there's a cliff edge.

Why would I try things without a clear goal? I can start learning new things. Accidentally, I can solve a problem or two. I can land in a place completely different than where I am now. Remember that guy that made Read To Me with Deep Lens? Here he is:

You never know when wasted time becomes a used opportunity.

Initially I didn't want to take part in all this, I thought that others deserve such car more and would put it to a better use. But then I thought: what if I actually could make it work and use it as a spark to ignite others' curiosity? What if I could use it to promote technology as a career path? We'll see how it works out.

The plan

If you had a look at the video above, you could see a DeepRacer console provided by AWS. Unfortunately I do not have access to it since one needs to be granted rights to use it in the preview phase. I used for a while when I had a DeepRacer workshop account but that one got cut off. The nice thing about it is that it takes away the whole hassle of setting up instances of services in AWS and only exposes a reward function and a couple parameters for you to use.

This raises the bar, but it won't stop me. Amazon provides instructions on how to use SageMaker to train a model. I have also found a blog post that presents steps to start training a model starting with a RoboMaker demo. I already tried both and so far only succeeded with the RoboMaker one.

Screenshot from 2019-04-25 19-25-33.png

What I am missing and need to focus on is bridging the gap between what I already understand and what I don't. I have some understanding of the concept that DeepRacer console is providing, but I don't yet understand all the bits that are engaged in the actual training. I followed some steps and got something trained, but I don't know what it really means apart from building a package with some code in it and letting a SageMaker instance churn through it to get some learning done.

From the video about the DeepRacer League I have learned that a workshop has been prepared to start working with DeepRacer. I will provide links in the resources section below.

Resources

DeepRacer homepage: https://aws.amazon.com/deepracer/
DeepRacer FAQs: https://aws.amazon.com/deepracer/faqs/
DeepRacer Pricing: https://aws.amazon.com/deepracer/pricing/
DeepRacer Getting Started: https://aws.amazon.com/deepracer/getting-started/
DeepRacer League: https://aws.amazon.com/deepracer/league/

DeepRacer Forums: https://forums.aws.amazon.com/forum.jspa?forumID=318
DeepRacer Docs: https://docs.aws.amazon.com/deepracer/index.html
DeepRacer Workshops (from re:Invent and AWS Summits): https://github.com/aws-samples/aws-deepracer-workshops

DeepRacer presentation


AWS DeepRacer training: https://www.aws.training/learningobject/wbc?id=32143

Instructions for setting up a SageMaker Notebook: https://docs.aws.amazon.com/deepracer/latest/developerguide/train-evaluate-models-using-sagemaker-notebook.html

Kloud Blog post on how to start a RoboMaker sample for DeepRacer: https://blog.kloud.com.au/2018/12/21/aws-deepracer-training-your-reinforcement-learning-model-in-aws-robomaker/
AWS GitHub repository for RoboMaker sample app: https://github.com/aws-robotics/aws-robomaker-sample-application-deepracer

AWS GitHub repository for SageMaker Reinforcement Learning example for DeepRacer: https://github.com/awslabs/amazon-sagemaker-examples/tree/master/reinforcement_learning/rl_deepracer_robomaker_coach_gazebo

AWS Machine Learning training path: https://aws.amazon.com/training/learning-paths/machine-learning/

AWS DeepRacer logo has been obtained from the DeepRacer website: https://aws.amazon.com/deepracer/