M2M Day 189: I think I taught my computer how to steer a self-driving car. But, I just can’t figure out how to confirm this fact.
This post is part of Month to Master, a 12-month accelerated learning project. For May, my goal is to build the software part of a self-driving car.
Last night, after drowning in the “Coding Pit of Despair” for a few hours, I finally made some forward progress.
As a reminder, over the past few days, I’ve been trying to find and run code that can generate steering instructions (for my self-driving car) based on input images of the road.
After many hours of searching and playing around, I found an academic paper written by researchers at NVIDIA (a company that makes self-driving car hardware and software, amongst other things).

As described in the Abstract of the paper, their devised system can “map raw pixels from a single front-facing camera directly to steering commands”.
This is exactly what I need!
I then found a TensorFlow implementation of NVIDIA’s system on Github, and after a few attempts, I was actually able to “train the model” based on some of NVIDIA’s data.
A quick aside to clarify some terms: 1. “The model” is the function that describes how to convert pixels into steering instructions, and 2. “To train the model” means to iteratively improve this function using machine learning techniques. I’ll explain this process in more detail in a future post.
Anyway, NVIDIA’s dataset includes 25 minutes of video broken down frame-by-frame, where each frame is labelled with the true steering angle (i.e. the steering angle the human driver was using).

In Terminal, I ran the program to train the model, and, despite some warnings, it started working:

In this screenshot, a “Step” describes each time a portion of the data is fed through the system for training. An “Epoch” is just a broader category that contains multiple Steps.
To train this model, I used 30 Epochs with a few dozen Steps per Epoch.
In the screenshot, the “Loss” describes how accurate the model (or function) is. Conceptually, to calculate Loss, the true steering angle is compared with the steering angle predicted by the model. The larger the difference, the greater the Loss.
Ultimately, when training the model, the program uses a few mathematical tricks (which I’ll describe in a future post) to try to reduce the Loss via each iterative step.
Thus, “training the model” is just “reducing the Loss”.
Here’s a plot with Steps on the X-axis and Loss on the Y-axis. (Last night, using something called Tensorboard, my computer plotted this while it was training).

At Step 126, for example, the Loss had a value of 5.708.

While, at Step 3,241, almost six hours later, the Loss had a significantly better value of 0.1615.

Now that the training has officially completed, the model is now theoretically ready to steer a car, which is super cool.
When I got home today from work, I tried to test the model (a.k.a. “steer a car”) and see how it performed. Sadly, when I tried to run the program, I got this error…

I spent a good hour trying to overcome this problem, but it seems like some of the code I downloaded can’t be run on a Mac (and if it can, I could not find a way to make it work).
I have an idea for a workaround, but it will have to wait until tomorrow.
In the meantime, I can celebrate the fact that I (likely) have a reasonably functional, already trained self-driving car model ready to be used. Hopefully, tomorrow, I can figure out how to actually use it…
Read the next post. Read the previous post.
