Detecting logs with artificial neural networks. How hard can it be?

How hard can log detection be?

Speaking of Timbeter and log detection, I am often asked questions like: "How hard can it be? Can't you just find circles in the image?"

However real life is quite a bit tougher, because:

  • logs often have a very non-circular shape
  • they are usually partially obstructed by other objects, such as leaves, bark remnants, or the reference stick
  • lighting conditions can make log edges hardly visible
  • the detector doesn't know what to expect: what colour the logs are, do they have a distinct texture or is the bark visible on the outside
  • usually, there's plenty of other stuff that also has a roughly circular shape

Those problems make simplistic geometric approaches essentially useless. That's where machine learning kicks in!

Machine learning and neural networks

Humans learn by observing patterns. Machine learning tries to do the same: instead of programming precise rules how to decide whether there is a log on a picture, the program is given a lot of examples with and without logs. It then tries to find patterns that are specific to images, which contain a log. Those patterns can be used to detect logs in a picture that the program has never seen before. A trending method to implement machine learning is with artificial neural networks - initially inspired by our brain.

In our brain, each neuron receives electrical signals from other neurons and based on those signals and simple rules encoded to connections between neurons; they decide whether to fire signals themselves. Even though each neuron has a relatively simple task to do, as a whole, the network of neurons act as an incredibly complex system. The cool part is that those rules in the connections are not fixed: they adapt to make the brain better at tasks it often encounters.

As the name suggests, artificial neural networks are somewhat similar: they consist of many “neurons” connected to a “network”. Those “neurons” send each other signals as in our brains. The difference is that neurons are not physical objects but are stored in a computer’s or tablet’s memory, and signals are merely some bits flowing between the processor and memory. As in a real brain, the rules by which signals are sent are not explicitly programmed; instead, they are automatically learned using a large number of examples.

How Timbeter uses neural networks

Timbeter has recently started using neural networks as the core machinery behind the log detection process. A huge challenge was to make the neural networks detection process reasonably fast on tablets and phones without sacrificing too much accuracy. To accomplish that, we used modern and efficient techniques to train the neural network, which on the other hand allowed us to use networks with fewer neurons. All in all, this sped up the detection process while reaching even better accuracy levels.

We have been developing the detector for about four years, and in that time the detector has been continuously improving. As of now, we are still experimenting with new improvements and will roll them out as they mature.

Stay tuned!

If you like this, feel free to share!