This LEGO machine can sort any kind of LEGO

Originally published at: https://boingboing.net/2020/11/26/this-lego-machine-can-sort-any-kind-of-lego.html

3 Likes

Just don’t let any megabloks get in there, it’ll self destruct.

2 Likes

Ok. Now build a machine to assemble and build lego sorting machines en masse. :wink:

More seriously, I hope it is possible to dynamically alter the sorting algorithms to adjust what goes into each of the 18 bins.

Further, could it be recalibrated to sort by colour instead/as well, I wonder.

1 Like

Give this man an honorary PhD for contributions to humanity.

1 Like

Now we just need universal Lego self assembler. Would it still be grey goo if it’s made from Legos?

1 Like

I wonder what sort of taxonomy he used for the organization of the bricks? I have sorted lots of bricks with my son, and we came up with an organization we liked, but it was mostly based on the amount of drawers we had in a small cabinet. Has anyone looked at various lego organizational systems, trying to find the best one? I assume that shape is going to dominate, but how about color or size?

Clipboard01

5 Likes

I know people who sort by color as well as by type… it requires a lot more storage bins to do it that way. Putting mixed colors in a bin with different types, is much easier to pluck a brick from, than mixed types in the same color.

Sorting by color basically requires an entire room’s worth of storage to do a decent job with.

I was thinking of a second stage sort - once parts sorted by type, then sort each bin/type by colour.

@Jerry_Vandesic That scheme hurts my brain. Beige/Black/Brown/Gray WHAT?? Everything except windows/wheels/misc/signs/tech/vehicles/weapons/western/ladders/gears/flat/doors/carparts/accessories?

Too many conflicts. :wink:

1 Like

This is where my world breaks down. I sort things like Earnie of Sesame Street.

Source: YouTube clip from Sesame Street, season3, episode “2081”, 1971 11 22, as uploaded by user Tiny Dancer on 2014 12 29

“Now, I’m putting away all the fire engines…and all the big toys…and all the red toys… and all the toys with wheels, and all the toys with ladders.
Yessir, I’m really putting away the toys." Source: Transcript as made by TinyDancer , site unavailable, archived at Archive.Org of www.tinyd.net/ernietoy.html ,snapshot taken 2008 03 07

I just have a terrible way of organizing things. I organize things using unuseful traits, I think that’s why I like taxonomy- it always seems magical and new. A large part of it is related to being dyslexic, as I have often run into people with similar issues and they to had problems with organization and grouping things in coherent taxons.

2 Likes

Me too. It’s not a picture of my organizer (I found it on the web), but for someone that scheme must make some sense. I’m actually surprised that they need an entire bin just for ladders.

1 Like

Personally I kind of use all of the above, in the order shape → size → colour, with zip-lock bags inside bins. I think it works pretty well. The bags are more space efficient than having tons of little bins, and it’s easy to see what’s inside them.

It’s also kind of nicely scaleable according to how much you have, so you could start out with just a bin for “standard bricks” with bags for different sizes, then start splitting the bags up by colour class as they get unmanageable, and eventually end up with a bin for “1 x 2 bricks - special colours” with bags for Dark Turquoise and Medium Lavender and Earth Orange, at which point your family may start to grumble about staging an intervention.

3 Likes

Chunky goo.

1 Like

More seriously, I hope it is possible to dynamically alter the sorting algorithms to adjust what goes into each of the 18 bins.

My take would be to maximize the Hamming Distance, based on the attributes of the detected part (not the image itself), between the bins. You’d get similar-ish parts in each bin.

Alternatively, you might want to maximize the Hamming Distance in the same bin. This would make it much, much easier for the human to do the secondary sort (since the parts would be highly variable in the bin, but each ‘group’ of parts would be the same… you’d have a bunch of 2x2s, a number of 1x8s, small wheels, a green windshield… and the next bin would be 4x4s, 2x6s, large wheels, monitors, etc.). Oh! And if you did it this way, you’d have strong results if you emptied the bin into the machine when it was full for a second pass.

Furthermore, if you went with maximized Hamming Distance, you’d have an even distribution of bin fillage… you could collect 18 runs into 18 larger buckets, then drop the buckets in one at a time for 18 subsequent full-hopper passes.

Also a note: The Raspberry Pi is just a glorified relay*. The laptop is running the actual neural network.

Looking at the results I’m… not exactly sure what his algorithm is doing. :smiley:

* Ok, reading his paper, the Raspberry Pi doing the object extraction and relaying the cropped image only to the laptop. Still no clue how he’s determining which bin to drop them into.

1 Like

Riiiiight. (Nodding sagely, while failing to really understand most of that, even having read the reference.)

Ah, yes… the Lego Sorting Sollution…

Back in the 80’s, it seemed like a simple problem, coming up with broad categories to put bricks into. But The Lego Group kept inventing new kinds of bricks, and stopped production of the older styles, improving and tweaking and mutating these things…

And now one can look at a site like Bricklink and even their categories don’t make a whole lot of sense sometimes. Brick you’d think were slopes, turn out to be under the “cockpit” heading, despite being opaque.

The geneology of a Lego part is often much like the fossil record, with evolutionary dead ends that nobody builds with today, though they are fascinating.

Or more to the point, like a living breathing language that’s constantly being evolved by its users - as MOCs get published on the internet and the mothership takes notice, to then produce official versions of homebrew builds…

The One True Way to sort legos has everything to do with how and what the sorter likes to build. There is no other method that can possibly make sense to all AFOL all the time.

2 Likes

There are so many categories that can be useful in sorting bricks, I’ve decided I would need a relational database to properly classify all my bricks.

1 Like

Looks a bit like a Presidential Cognition Test.

1 Like

Basically, you could imagine the ‘string’ to be a sequence of one-character attributes mushed together. so a 2x2x1 beige block might be 221BB. A 4x4x1 beige block would have a Hamming Distance of 2.

That said, there are several other distance models: Distance Metrics | Different Distance Metrics In Machine Learning (analyticsvidhya.com)

One of the most surprising was the word2vec discovery that linear word models can use vector math in Euclidean space. You can actually ask the model for what word is King - Man + Woman, and it’ll give you back Queen. The amazing power of word vectors | the morning paper (acolyer.org)

Another dimension reduction technique leverages space-filling curves. Turns out the distance between two points on the said curves can be used to perform very fast bounding box & similarity searches.

This is actually what I had in mind when I mentioned Hamming distances. You’d map the brick’s qualities into an N-dimensional space (one dimension for width, one dimension for length, one dimension for height, one dimension for Hue, one dimension for Saturation, one dimension for “Curviness”, one dimension for “Slope”, etc.)… and then reduce it using a space-filling curve: now you can do very fast similarity queries.

1 Like

Having read the reference I understood your first paragraph, but it was still a ‘so what?’.

As for the rest…?

Whoosh.

Further exposition will not help, I fear

Well, the idea is to have a logical sorting for the arbitrary 18 bins. You want watever you decide to either:
A) Make it so that the bin has lots of things that look close to each other, or
B) Make it so that the bin has lots of things that look very different.

Now, how do you tell a computer “This looks the same, or is different”? Well, we typically use attributes of the brick. That’s straightforward. But how do you tell the computer "map these bricks into a number line, from 1 to 18 (the bins), such that 1 has an equal probability of 2, as does 3, as does 4 (don’t want one bin filling up at 5x the speed of the others, that’s not efficient)… and the bricks in 1 look the same (or are very different, depending on A or B selected).

The way to do this is to take all the different attributes, and figure out some way to squeeze those attributes (dimensions) down to a single pseudo-attribute/dimension (our integer number line that ranges from Bin #1 to Bin #18).


Lots of people would naively choose option A, since the point is to “sort the bricks.” But with option A you’ll have a bin with parts that are hard to distinguish. The point, after all, is to be making it easier to sort them into their final destination!

I, however, advocate for choosing B. This will result in bins with very random-looking collections of parts (and it’ll be easier to keep them relatively full at the same rates). You can grab all the small blue parts, and know they’re all 2x2 bricks, then grab all the wheels, and know they’re the same type, etc. Or you can dump that bin into the hopper again… let’s say there were 24 different types of parts in that now-full bin… and now you’d have 6 bins with two parts sorted into them and 12 bins with a single type of part in them.

The maths above is just one of a few different ways to solve for “How do I take a 10-dimensional space that represents each block uniquely, and determine how to most uniquely represent it on a one-dimensional (sorting) line?” Or, stated another way, “How do I determine if this block is the same as another block? How do I determine how similar this block is to another block? Which bin can I add it to, to minimize the differences between the blocks / maximize the differences between the blocks?”

Your original observation was “I hope they dynamically alter the algorithm to change what gets sorted where.” While one could deterministically dictate that, I argue that having a more generic algorithm will solve the underlying problem of optimizing final-destination routing (while also supporting a variable numbers of bins, and dynamically handle different distributions of legos in each run).

1 Like