Read tips seciton below and snap a photo!


You'll get top 4 predictions with highest confidence level.

Machine learning for Lego Community!


A little bit of technical background to this awesome project :)



This project was inspierd by Jacques Mattheij and his post Sorting two metric tons of Lego. I was thinking about the same concept but couldnt find a time to start it out. Jacques led me to Jeremy Howard and Rachel Thomas' excellent starter course on machine learning. While following lessons there I was keen to try it out and since I had tons of minifigs to sort, and particular love towards SW sets I decided to preapre torso detector as a part to my sorter. It was a breeze but with limited class number (Darth Vader only). I decided to try it out on a larger class base and following sugestion from Lego community members made it so that it can classify whole figures. With 850+ Star Wars figures it seamd like a good start.

Couple of weeks later I had a traing set and first model :) It is still very limited and some minifigures have only couple of samples but I'm sure with a bigger set this network could perform much better.

From software perspective it uses Vgg16 (exactly as in lesson 2 of the above course) Keras with Tensorflow backend. It was to be installed on Amazon Web Service small instance and has led to several decisions. First of all small instance is small and slow so in order to run prediciton I had to come up with the way to balance processing. I decided to use single processor and queue. Keras was lauched as a single consumer of RabbitMQ queue with queue support by Pika. File upload and results pooling was lauched as Flask app (15 threads) and deployed via WSGI with Apache.


Keras is an open source neural network library written in Python. It is capable of running on top of Deeplearning4j, Tensorflow or Theano. Designed to enable fast experimentation with deep neural networks, it focuses on being minimal, modular and extensible. It was developed as part of the research effort of project ONEIROS (Open-ended Neuro-Electronic Intelligent Robot Operating System), and its primary author and maintainer is Francois Chollet, a Google engineer.


TensorFlow is an open source software library for machine learning across a range of tasks, and developed by Google to meet their needs for systems capable of building and training neural networks to detect and decipher patterns and correlations, analogous to the learning and reasoning which humans use. It is currently used for both research and production at Google products, often replacing the role of its closed-source predecessor, DistBelief. TensorFlow was originally developed by the Google Brain team for internal Google use before being released under the Apache 2.0 open source license on November 9, 2015.


Flask is a micro web framework written in Python and based on the Werkzeug toolkit and Jinja2 template engine. It is BSD licensed. Flask is called a micro framework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools. Extensions are updated far more regularly than the core Flask program


RabbitMQ is open source message broker software (sometimes called message-oriented middleware) that implements the Advanced Message Queuing Protocol (AMQP). The RabbitMQ server is written in the Erlang programming language and is built on the Open Telecom Platform framework for clustering and failover. Client libraries to interface with the broker are available for all major programming languages.








team img

Radoslaw Korbecki



Don't hasitate to contact me if you'd like some more info on the poject or would like to contribute.