# Man Buys Two Metric Tons of LEGO Bricks; Sorts Them Via Machine Learning

iStock // Ekaterina Minaeva

Jacques Mattheij made a small, but awesome, mistake. He went on eBay one evening and bid on a bunch of bulk LEGO brick auctions, then went to sleep. Upon waking, he discovered that he was the high bidder on many, and was now the proud owner of two tons of LEGO bricks. (This is about 4400 pounds.) He wrote, "[L]esson 1: if you win almost all bids you are bidding too high."

Mattheij had noticed that bulk, unsorted bricks sell for something like €10/kilogram, whereas sets are roughly €40/kg and rare parts go for up to €100/kg. Much of the value of the bricks is in their sorting. If he could reduce the entropy of these bins of unsorted bricks, he could make a tidy profit. While many people do this work by hand, the problem is enormous—just the kind of challenge for a computer. Mattheij writes:

There are 38000+ shapes and there are 100+ possible shades of color (you can roughly tell how old someone is by asking them what lego colors they remember from their youth).

In the following months, Mattheij built a proof-of-concept sorting system using, of course, LEGO. He broke the problem down into a series of sub-problems (including "feeding LEGO reliably from a hopper is surprisingly hard," one of those facts of nature that will stymie even the best system design). After tinkering with the prototype at length, he expanded the system to a surprisingly complex system of conveyer belts (powered by a home treadmill), various pieces of cabinetry, and "copious quantities of crazy glue."

Here's a video showing the current system running at low speed:

The key part of the system was running the bricks past a camera paired with a computer running a neural net-based image classifier. That allows the computer (when sufficiently trained on brick images) to recognize bricks and thus categorize them by color, shape, or other parameters. Remember that as bricks pass by, they can be in any orientation, can be dirty, can even be stuck to other pieces. So having a flexible software system is key to recognizing—in a fraction of a second—what a given brick is, in order to sort it out. When a match is found, a jet of compressed air pops the piece off the conveyer belt and into a waiting bin.

After much experimentation, Mattheij rewrote the software (several times in fact) to accomplish a variety of basic tasks. At its core, the system takes images from a webcam and feeds them to a neural network to do the classification. Of course, the neural net needs to be "trained" by showing it lots of images, and telling it what those images represent. Mattheij's breakthrough was allowing the machine to effectively train itself, with guidance: Running pieces through allows the system to take its own photos, make a guess, and build on that guess. As long as Mattheij corrects the incorrect guesses, he ends up with a decent (and self-reinforcing) corpus of training data. As the machine continues running, it can rack up more training, allowing it to recognize a broad variety of pieces on the fly.

Here's another video, focusing on how the pieces move on conveyer belts (running at slow speed so puny humans can follow). You can also see the air jets in action:

In an email interview, Mattheij told Mental Floss that the system currently sorts LEGO bricks into more than 50 categories. It can also be run in a color-sorting mode to bin the parts across 12 color groups. (Thus at present you'd likely do a two-pass sort on the bricks: once for shape, then a separate pass for color.) He continues to refine the system, with a focus on making its recognition abilities faster. At some point down the line, he plans to make the software portion open source. You're on your own as far as building conveyer belts, bins, and so forth.

Check out Mattheij's writeup in two parts for more information. It starts with an overview of the story, followed up with a deep dive on the software. He's also tweeting about the project (among other things). And if you look around a bit, you'll find bulk LEGO brick auctions online—it's definitely a thing!

# 17 Things to Look for the Next Time You Watch Office Space

20th Century Fox Home Entertainment

Twenty years ago (yes, you’re really that old) Office Space forever changed how we look at cubicle life. Like a much funnier Dilbert meets Beavis and Butt-head meets the then-largely misunderstood world of Silicon Valley, the comedy movie from Beavis creator Mike Judge ably skewered everything from didactic middle-management bosses to chain restaurant uniforms. And it gave us a charming Jennifer Aniston love story plus a rap mini-music video dedicated to the destruction of malfunctioning printers.

For all that and more, the 1999 film that originally performed poorly at the box office has become a widely quoted cult sensation. Here are the interesting facts and references to look for the next time you watch Office Space.

## 1. It was shot very, very far from Silicon Valley.

20th Century Fox Home Entertainment

Office Space keeps its setting purposefully vague, but the opening driving shots clue a perceptive viewer into the location: Notice the sign for Preston Road on Highway 289 in the background, which indicates that we’ve been dropped around Plano, Texas. The movie was shot in and around Austin, where Mike Judge lives, making him something of a Hollywood outsider. But Office Space is clearly attuned to the rituals and lingo of Silicon Valley’s tech scene. In fact, Judge worked as an engineer in the California area in the 1980s, which would go on to inform much of his satire, especially his popular HBO show Silicon Valley.

## 2. It was Mike Judge's first foray into movies ... and it didn't work out as planned.

20th Century Fox Home Entertainment

Starting out as a self-taught animator in Texas, Judge made his name in entertainment with cartoons that aired on Saturday Night Live and, eventually, turned into his own MTV show. Beavis and Butt-head premiered in 1993, when the cable network’s scripted offerings were still in their infancy, and quickly became both a commercial hit and a cause of nationwide controversy. He went on to co-create Fox’s slightly more family-friendly King of the Hill, but Office Space marked his live-action directorial debut in film (he previously helmed the movie adaptation Beavis and Butt-head Do America). Made on an estimated \$10 million budget, it earned only slightly more than that at U.S. theaters. Sadly, that failure has become something of a pattern for Judge’s movie work: Future efforts Idiocracy and Extract failed to catch on with initial audiences, though the former has also grown into a cult hit.

## 3. It didn't exactly make Ron Livingston a household name.

20th Century Fox Home Entertainment

Office Space had all the makings of a breakout for its handsome, top-billed star, who was coming off a smaller part in the comedy phenomenon Swingers. But given its early commercial disappointment, he continued to seek out smaller parts and interesting, left-field projects like Adaptation. and The Cooler. He finally got his mainstream cred as the boyfriend of Carrie Bradshaw on Sex and the City (he's the one who broke up with her via Post-it note) with the massively popular horror flick The Conjuring. He's currently starring in two series: A Million Little Things and Loudermilk.

## 4. Initech has a very symbolic statue.

20th Century Fox Home Entertainment

The statue outside the Initech office shows a square peg in a round hole. No coincidence, it’s a reference to the common idiom referring to an individualist who doesn’t fit into a particular social mold. That could describe Livingston’s Peter, his co-worker friends, Jennifer Aniston’s Joanna—or, more self-referentially, Judge himself, who has always made movies and series about outsiders.

## 5. You can tell a lot about Bill Lumbergh from his vanity plate.

20th Century Fox Home Entertainment

Everything you need to know about Division V.P. Bill Lumbergh (Gary Cole) is established in an early shot of him pulling into his reserved parking space at Initech in a blue Porsche with a customized license plate that reads, “MY PRSHE.” Low-key. (Also notice the lack of any regional designation on the license plates in the film.)

## 6. "TPS" has a real meaning.

20th Century Fox Home Entertainment

Lumbergh’s single-minded obsession with the details of “TPS reports” drives much of the cubicle-set humor, but what exactly is a TPS report? Potential meanings abound, especially given that companies love an abbreviation, but Judge revealed that TPS refers to Test Program Set reports, which dated back to his engineering days.

## 7. The food at Chotchkie's sounds less than appetizing.

20th Century Fox Home Entertainment

A sign at the restaurant promotes its “shrimp poppers,” a food name that leaves a lot to the imagination. Later, chipper server Brian highlights “pizza shooters” and “extreme fajitas.” Whatever a pizza shooter is, it can’t be good.

## 8. Diedrich Bader had a very specific look in mind for Lawrence.

20th Century Fox Home Entertainment

Diedrich Bader, who plays everyone’s favorite beer-guzzling neighbor Lawrence, came to his Office Space role with clear inspiration. “What I really wanted to look like was somebody who loved the Allman Brothers,” he told The A.V. Club in 2012. Sounds about right.

## 9. There's a real Milton out there.

20th Century Fox Home Entertainment

Judge based the vengeful staffer, also the focus of several of his animated shorts, on one of his real-life co-workers when he was an engineer. Judge asked the man how he was doing, and he responded that he was going to quit his job because his desk had been moved around too many times.

## 10. Jennifer Aniston helped the movie get made.

20th Century Fox Home Entertainment

The cast of Office Space has one instantly recognizable name: Jennifer Aniston, who was by then of course already a superstar for playing Rachel on NBC’s Friends. In a reunion for the film, Judge thanked Aniston just for signing on (though he added that she was great in the part), saying, “It helped us put the studio at ease a little bit—at least they had one famous person."

## 11. Michael Bolton has embraced the punchlines about him.

20th Century Fox Home Entertainment

Peter’s co-worker Michael Bolton (played by David Herman) hates the fact that he shares a name with a musician who is, in his words, a “no-talent ass-clown." While the real-life Bolton initially seemed peeved about the mockery, he now signs Office Space DVDs for fans.

## 12. Chotchkie's is a thinly veiled TGI Fridays.

20th Century Fox Home Entertainment

The chain restaurant by the office is notable not just for its fried food but for its emphasis on “flair” worn by the servers (15 pieces of flair is the minimum). Office Space is clearly mocking TGI Fridays, whose staff used to dress with seemingly endless buttons and ornamentation. TGI Fridays actually phased out flair by 2005, supposedly as a result of the movie.

## 13. Y2K makes a cameo.

20th Century Fox Home Entertainment

Peter tells Joanna while having lunch that in his job he updates software for the “2000 switch.” In 1999, the impending change of the millennium was in fact a massive headache for tech companies and their programming of dates, a phenomenon that became known as Y2K.

## 14. The movie reintroduced red Swingline staplers.

20th Century Fox Home Entertainment

Milton’s beloved red stapler was actually painted that color by the prop department, so that it would pop on the screen. As it was one of the more hilarious throughlines in Office Space, viewers started to seek it out in real life. The brand Swingline, which had phased out red staplers, decided to bring the product back. Design-minded executive assistants everywhere can thank Judge.

## 15. Mike Judge is hiding in plain sight.

20th Century Fox Home Entertainment

In an uncredited role, the writer and director plays Joanna’s boss at Chotchkie's, reprimanding her about her lack of flair. (Though it’s hard to recognize him under the mustache and wig.)

## 16. Judge is a not-so-secret hip-hop head.

20th Century Fox Home Entertainment

Hip-hop is repeatedly played and referenced throughout Office Space, particularly gangsta rap, which was ascendant in the '90s. The famous printer-smashing sequence is set to the Geto Boys’ “Damn It Feels Good to Be a Gangsta.” Also notice Michael Bolton rapping along to Scarface while driving in the movie’s opening. Judge has cleverly curated hip-hop in much of his work, from rap videos in Beavis and Butt-head to a collaboration with Danny Brown for Silicon Valley.

## 17. Milton foreshadows the climax a lot.

20th Century Fox Home Entertainment

Milton mentions the possibility of burning down the Initech office several times before actually doing it, making it perhaps the least surprising act of arson depicted in film.

BioLite

But in reality, the awkward design—with a bulky light that digs into your skin and slides down your forehead—cancels out much of the product's appeal. Luckily, it doesn't have to be this way, as the folks at BioLite have demonstrated with their reinvented headlamp.

The BioLite HeadLamp 330, which debuted on Kickstarter in 2018 and is now available on Amazon, promises to make you forget you're even wearing it. Inspired by modern wearables, BioLite has retooled various elements of the clunky traditional design to make it as comfortable as it is functional.

BioLite

The ultra-thin light sits flat against your skull, which means you won't have any painful marks in the middle of your forehead when you take it off. The band itself is made from a moisture-wicking fabric that feels good on your skin, even when you're working up a sweat. And unlike conventional headlamps, BioLite has redistributed the power source to the back of the head in its design, balancing the weight and taking care of any slippage issues.

As is the case with other BioLite products, technology is an essential part of the design. The 330-lumen lamp projects light up to nearly 250 feet in front of you. There are variable lighting settings, too: You can opt for either a white spot or floodlight, both with dimming options, or a strobe light feature; there's also a red floodlight. It can run for three and a half hours at maximum brightness or 40 hours at minimum brightness, and when it needs to be recharged, you can just plug it into a micro-USB source like a solar panel or powerbank.

Get your own BioLite Headlamp for \$49 on Amazon. It's available in in ember red, ocean teal, sunrise yellow, or midnight gray.

BioLite

arrow
LIVE SMARTER
arrow
LIVE SMARTER