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 labeling 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.