Skip to content

Elliott-Song/legoproject

Repository files navigation


Lego Project

Using machine learning to categorize images of lego pieces

Overview

This project contains several components:

  1. A data collection script that downloads 3D models of lego pieces from the MecaBricks website
  2. A synthetic image generation script that creates images of the 3D models from different angles and lighting conditions
  3. A machine learning model that categorizes the images into different lego piece types

Example Images

Part Image 1 Image 2 Image 3 Image 4 Image 5
1x1 Plate 1x1 Plate 1 1x1 Plate 2 1x1 Plate 3 1x1 Plate 4 1x1 Plate 5
1x2 Plate 1x2 Plate 1 1x2 Plate 2 1x2 Plate 3 1x2 Plate 4 1x2 Plate 5
2x2 Plate 2x2 Plate 1 2x2 Plate 2 2x2 Plate 3 2x2 Plate 4 2x2 Plate 5
2x4 Plate 2x4 Plate 1 2x4 Plate 2 2x4 Plate 3 2x4 Plate 4 2x4 Plate 5

Prerequisites

  • Python 3.6+
  • Blender 2.8+
  • Jupyter Notebook
  • Dependencies: pip install -r requirements.txt

Data Collection

To collect the data, simply run the create_objs.ipynb notebook. This will download the 3D models of the lego pieces from the MecaBricks website as json, convert them to obj files, and save them in the parts_obj directory.

Synthetic Image Generation

To generate synthetic images, open Blender and run the RandomView.py script. This will load the obj files from the parts_obj directory, render images of the 3D models from different angles and lighting conditions, and save them in the output directory.

Training

TODO

Acknowledgments

About

Using machine learning to categorize lego pieces

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published