Falling down the rabbit hole

I was frozen. Stunned. A year of study had stripped the mystery from what was essentially many multiplies and additions. So why did it feel like this, watching my first neural net trained to drive a car? Why did it feel so unreal? So irrationally amazing given the simple ingredients. I felt the floor dropping out and something else opening up.

I was watching my neural network drive a car in simulation. I say my, but really this is very much a product of incredible building blocks. As if someone who plugged a lamp into the socket created his own light. I merely plugged some training framework in Keras/Tensorflow, shared by Comma Ai, into a model design published by Nvidia and trained it with the free and excellent Unity 3d tool for simulation. A mashup.

20+ years of programming has taught me that computers need very, very specific instructions to accomplish any task of complexity. The entire time I was putting this together I was running through contingency plans in my mind. Forward projecting the inevitable failures and readying my likely responses, shelving them in my mind. Watching this succeed on the first attempt, and so spectacularly, floored me. It defied years of intuition. It would be like asking your pre-teen to clean their room, checking on them 30 minutes later, and finding everything immaculate. It just doesn’t happen in real life. This felt unreal.

I’ve since learned that I had stumbled into a series of decisions that aided my success. I focused on generating copious amounts of examples to train my NN. And yet I was very lazy. I wanted a huge variety of roads, and I wanted the cpu to drive it while I ate popcorn. So I wrote a road generator, and a PID loop to follow the lane center. It turns out that the oscillation of the PID controller, when implemented by said lazy programmer and sloppily tuned, was ideal for sampling the problem space. And the resulting models were quite robust and tolerant to new road situations, driving well in conditions it had not been trained with.

There were points of failure. Rare situations were not well represented and failed to influence the final model. When 99% of your data is straight or gentle rolling turns, your model does not handle that single hairpin turn. By augmenting the data with many examples of that case, it does begin to show improvement. It’s not clear to me how much is enough. Or how well this will generalize to the real world. That’s the art, I guess.