One Weird Trick to See the Bigger Picture

A 30 Day Writing Challenge

Josh Sephton
3 min readApr 12, 2017

It’s Day 12 of my 30 Day Writing Challenge. Yesterday we designed a neural network to recognise handwritten digits, as I prepare for my new job. Tomorrow is my last day at my current job, then I’ve got a week off and I’m straight into building a machine learning team.

I was driving home yesterday and my mind got thinking about the lane departure warning feature on my car. If you start to drift out of the lines on the road, the car alerts you. The neural network we built yesterday was pretty successful at image recognition. Could we implement a lane departure warning with a neural network?

Let’s assume the car has cameras under the wing mirrors which look down at the road, approximately where the lines would be. We should be able to recognise if there’s a line present in the same way that we recognised digits. If we can see the line, we can figure out where it is in relation to the car.

Yesterday, our images had to be 28 x 28 pixels and contain only 1 digit. We’d say they were completely normalised. In the real world, handwriting is rarely so clean. Letters and digits form words and sentences, and may be close together or even joined. We won’t always have perfectly prepared datasets to work with.

When you look at something, you don’t look at things in insolation. You consider what surrounds each feature to put it in context. You recognise a picture of a dog because there’s a nose adjacent to the eyes, which are sort of below the ears. You’d recognise the dog if it tilted its head, or you were standing a distance away. We recognise things by the things that are near it.

There’s a type of neural network that works on this principle. It’s called a Convolutional Neural Network.

Yesterday, we fed the pixels into the fully connected network. With a CNN, there are a number of steps to extract features from the image which are then inputted to the neural network. There are different ways of extracting features. Certain feature extractors will be better at finding sharp edges, others might blur the image and still others will improve the contrast between different colours.

The point is that the individual pixels in an image become irrelevant. Instead we want to find the main features of an image and train the network to consider features which always appear near each other.

Borrowed from https://www.codeproject.com/Articles/16650/Neural-Network-for-Recognition-of-Handwritten-Digi

I’m not going to dive into the details of a Convolutional Neural Network. Frankly, I still have more to learn. However, you should be able to see that we have all the tools at our disposal to implement a lane departure warning system. Using images of the road from each side of the car, we can train the network to recognise if the line is in the safe target region. We’ll know if the line is in a dangerous region so can trigger the warning.

I’m beginning to feel like these techniques are falling into place. I’m still missing huge swathes of implementation details, but it doesn’t matter. My aim currently is to understand the tools available to me so I know how to approach any problems I might encounter.

There’s no other feeling that compares to thinking about a real world problem and knowing how to solve it.

This is a post in my 30 Day Writing Challenge. I’m a software engineer, trying to understand machine learning. I haven’t got a PhD, so I’ll be explaining things with simple language and lots of examples.

Follow me on Twitter to see my latest posts. If you liked this article please click the heart button below to share — it will help other people see it.

--

--

Josh Sephton

Founder of Pritchatts Consulting Ltd., making companies more profitable by making their data work for them.