I’m going to send this week’s article to my middle son Ben, a longtime Lego enthusiast. He’s just returned to Canada from a year working abroad. His job was so time – and attention-intensive, all the poor guy could do to unwind was invest in Lego sets that he obtained through retail therapy (he frequented Amazon.com). He would assemble them at the end of his trying days as a form of meditation, like raking the gravel in a Japanese garden. But to get them back here, he had to take them apart… So he may find the following adventure useful!
After a visit to Legoland in Denmark, where he witnessed patrons buying expensive sets, Jacques Mattheij had a brainwave. Lego has a high resale value, especially for some of the rarer sets and more complicated bricks. But a lot of it is resold in unsorted lots — at a much cheaper price that corresponds with how much of a pain in the neck it is to organize the bricks into something useful.
Mattheij wanted to build an AI that would do that for him, and by golly, he did. His sorting machine started processing the two metric tonnes (!) of Lego he bought off eBay by feeding it onto a conveyor belt through a hopper. This separated the bricks, and allowed the magnifying imaging camera to snap a pic and check the image against examples stored on a PC.
Once Mattheij worked the kinks out of the imaging and checking process, he had to teach his AI how to classify each brick. This was exceptionally difficult — at one point, Mattheij estimated that hand-labeling enough images for his AI to learn from would take six monthsof full time attention. After a bit of thought, Mattheij devised a work around; manually correcting only the images that the AI got wrong, and returning them to the learning pool.
“The first day I managed to label a starter set of about 500 assorted scanned pieces. Using those parts to train the net, the next day the machine sorted 2,000 more parts. About half of those were wrongly labeled, which I corrected. The resulting 2,500 parts were the basis for the next round of training. Another 4,000 parts went through the machine, 90 percent of which were labeled correctly! So, I had to correct only some 400 parts. By the end of two weeks I had a training data set of 20,000 correctly labeled images.
Mattheij reports that his Lego sorting machine just needs to learn a few more of the rarer pieces, and it’ll soon making a dent in the boxes of bricks that have filled his garage. Then, he can sell the sorted bricks for almost four times what he paid for them! Lego really brings out the ingenuity in its users — have fun, Ben!