M2M Day 194: This car definitely crashed. Many times.
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.
A few days ago, I was able to run some code and get my self-driving car to successfully steer through the streets (at least virtually, based on NVIDIA’s video footage).
Today, I wanted to take the next step, and see if I can use the self-driving car model on a different set of a data. After all, a self-driving car should be able to drive on any road, not just the roads it was trained on.
Thus, I decided to see if the model I trained last week could perform on Udacity’s dataset, which features a different set of roads.
The first step was to format the Udacity dataset, so that it could be processed by my self-driving car model.
Unlike, the NVIDIA dataset, which contains a video clip nicely broken down into sequentially numbered frames (0.jpg, 1.jpg, 2.jpg, 3.jpg, etc.), the Udacity dataset is a collection of confusingly numbered images: There are odd, inconsistently-sized gaps between the numbers, and the dataset starts counting at 1479425441182877835.
Udacity probably had some rationale for this numbering scheme, but I can’t seem to figure out what that rationale is.
Therefore, my first step was to rename all of these files to conform to the NVIDIA-style numbering scheme (i.e. start at zero and count up by ones).
At first, I thought about putting in my headphones, turning on an audiobook, and manually renaming each file. Then, I realized that there were over 5000 files, and that I should probably figure out how to automatically do it with some code (after all, I’m trying to improve my coding skills this month).
After about 12 minutes of noodling around, I was able to write a small Python script to rename all the Udacity files.
i = 0
for file_name in os.listdir(directory):
new_file_name = str(i) + '.jpg'
old_file_name = file_name
i += 1
PATH = os.path.abspath('/Users/maxdeutsch/Desktop/nvidia/udacity_data')
I ran the script, and within a few moments, all the files were renamed (I’m glad I didn’t do it by hand).
Next, with the dataset prepared, it was time to test the model on the new dataset, output the graphics of the autonomously controlled steering wheel, and then overlay the graphic on top of the original footage to see how the car performs.
Sadly, the performance is very bad: If the self-driving car actually followed these instructions in real-life, it would crash almost immediately.
Tomorrow, I’ll experiment with the model and figure out how to better generalize my self-driving car so it doesn’t crash every time it’s introduced into a new driving environment.
Read the next post. Read the previous post.