Sorting Lego sucks, so here’s an AI that does it for you

sorting-lego-sucks-so-heres-an-ai-that-does-it-for-you photo 1 PA Wire/PA Images

Neural networks are currently being tasked with everything from adding animations to video games to reproducing images taken from MRI scans. Training the AI, which needs to be fed vast amounts of data, can be a slog and even then it may not produce completely accurate results. But when it comes to recognizing and classifying images and objects the AI can cut out a lot of leg work, as Jaques Mattheij found out when he built his own neural network for the novel task of sorting through his massive Lego collection.

You see, Mattheij decided he wanted in on the profitable cottage industry of online Lego reselling, and after placing a bunch of bids for the colorful little blocks on eBay, he came into possession of 2 tons (4,400 pounds) of Lego -- enough to fill his entire garage.

As Mattheij explains in his blog post, resellers can make up to €40 ($45) per kilogram for Lego sets, and rare parts and Lego Technic can fetch up to €100 ($112) per kg. If you really want to rake in the cash, however, you have to go through the exhaustive process of manually sorting through your bulk Lego before selling it in smaller groupings online. Instead of spending an eternity sifting through his own, intimidatingly large collection, Mattheij set to work on building an automated Lego sorter powered by a neural network that could classify the little building blocks. In case you were wondering, Lego comes in more than 38,000 shapes and over 100 shades of color, which amounts to a lot of sorting even with the aid of AI.

Starting with a proof of concept (built using Lego, naturally), Mattheij spent the following six months improving upon his prototype with a lot of DIY handiwork. In his own words, he describes his present setup as a "hodge-podge of re-purposed industrial gear" stuck together using "copious quantities of crazy glue" and a "heavily modified" home treadmill.

The current incarnation uses conveyor belts to carry the Lego past a web camera that is set up to take images of the blocks. These are then fed to the neural network as part of its classification training, and all Mattheij has to do is spot the errors in its judgement.

"As the neural net learns, there are fewer mistakes, and the labelling workload decreases," he states. "By the end of two weeks I had a training data set of 20,000 correctly labeled images."

With his prototype up and running, Mattheij claims he is just waiting for the machine learning software to reliably class all of the images itself, and then he can start selling off the lucrative toy. If Matthiej manages to get the system working, he could then rechannel those profits into new expensive Lego projects.

Recommended stories

Fix TV Show Sorting Issues on iOS Devices

If you’ve populated your iOS device with televisions shows from sources outside of iTunes you may have noticed that many shows get sorted incorrectly. Fix the sort issue by amending the show’s metadata.

More stories

The best clothing iron

The Maytag M400 Speed Heat Iron and Vertical Steamer is affordable, lightweight and easy to use.