Part I- Lego bricks dataset preprocessing

This post shows the selection and processing for an image dataset to be used on an application on a Jetson nano.

We wanted to create a Deep Learning model using CNN that were capable of sorting Lego Bricks by image classification. The first step was to choose a dataset to be used for this purpose.

After going through several options we found a dataset that was ideal for the project. We use a dataset from kaggle . It contained 20,300 images of lego and generic bricks, but we choose to use only the Lego images, also it contained normal and cropped images, we used only the cropped images as it would give better results for training the model.

Now that we have the dataset we started by creating the needed structure for the model. We opted for a method using folder structure as the way to define classes and subclasses. For this case, we needed only 6 classes as the dataset contained only these categories.

Folder and classes for application.

After we defined the dataset and separated the images as we intended, we proceed to do a preprocessing of the data. For this stage, we took the images passed it to grayscale, reshaped the dimensions of all images to the same one and converted the images to an array.

Preprocessing images to be used for DeepLearning model

Once the data were ready we save it so that it is not needed to be processed again every time we run a test over the dataset.

On the next post, we will talk about the process of choosing a framework and a convolutional network that could give better performance in the Jetson nano. Also, we show how we trained the model using the preprocessing images that we just obtained.

References

Garcia, F. (2019). Lego vs. Generic Brick — Image Recognition | Kaggle. Retrieved August 22, 2019, from https://www.kaggle.com/pacogarciam3/lego-vs-generic-brick-image-recognition

Harrison. (2019). Python Programming Tutorials. Retrieved August 22, 2019, from https://pythonprogramming.net/loading-custom-data-deep-learning-python-tensorflow-keras/

--

--