Vision classifiying wood panels with color defects

The premise

Imagine working for a company which produces wooden panels. Like any production process, wood panel production has some variance. The lumber used has natural variation, sensors are inaccurate to a degree and the operators manage the process differently. This all leads to varying quality of the final product.

Customers expect to get the quality that they are paying for. Some customers are more strict when it comes to quality while others don't mind visual hindrances, but you as a producer would like to extract the exact value for the products from the market. This is where production classification comes in.

The company's wood panels can be categorized into three classes: OK, COLOR DEFECT and SHAPE DEFECT. OK products can be sold directly to all customers, COLOR DEFECT products can be sold to a specific minority and SHAPE DEFECTS can be repurposed into another product.

In the current process all the products are deemed incorrectly as OK and packed into the same box and shipped to customers. The goal is to classify products before packing, so they can be separated on the production line into different boxes by quality class.

Left: OK, Middle: COLOR DEFECT and Right: SHAPE DEFECT

How can the production be classified?

In this case classifying is done visually - as opposed to by functionality, weight or some other metric. Visual inspection for the product in question is made extra tricky by the fact that the product contains natural color and size variance. Green, yellow and even black color variance is accepted, but large black areas are not. Additionally, it is specified that the shape of the product is a rectangle (the size of the rectangle can vary), but any shape defected products should be removed for repurposing.

Even a few years back, the only solution for this would have been a rule-based solution, where an engineer would try to make IF-ELSE statements on what pixel colors, sizes and shapes are acceptable. This type of solution works for simple machine vision tasks (such as determining whether or not a soda bottle is filled correctly), but in this case the model would be a non-starter because of the natural variance in the product. Furthermore it takes substantial effort to write such statements and they can't be applied to new products or specifications.

The modern solution is to use a model which learns the task (i.e. learns the rules) just like I would teach you what constitutes OK, COLOR DEFECT and SHAPE DEFECT. Enter deep learning. With our machine vision system you can collect a set of examples of your quality classes, train a neural network to learn the task and use that neural network to classify the production.

Training and setting up a classification model

Let me solve the production classification problem with Labra AI Vision. For training a classification model I need to first create a model and the classes of the model. As you'll see from the image below, to start off with the classes have 0 samples, but my aim is to gather 100 samples per class to train the neural network.

I named the model Wood panel classifier and gave it the previously mentioned quality classes.

Now that I have the model I can go ahead and start collecting samples for the quality classes. At this point I should say that at the factory I have installed one camera above the conveyor belt and a computer running the Vision software. The Vision system collects one image for each wood panel and puts it into the class I am collecting data for. The images can be also labelled individually retroactively.

This video shows how Vision collects images for training a deep learning model.

Now that I have collected 100 samples per quality class it is time to train the neural network. This might sound hard, but its as easy as clicking one button. During training the neural network loops through all the images and learns which visual features make the classes unique.

During training the model achieved 97% accuracy. Nice!

Now we have a deep learning model which during training achieved a 97% accuracy. It's time to see how it performs in real life. I will give it 5 units of each category to see how it fairs.

This video shows how Vision does quality assurance using deep learning. Predictions for the newest object can be seen in the top right hand corner.

The factory is now capable of extracting more value

Alright! 15 out of 15 ain't bad! Okay, okay, it was a small sample size. But the fact still stands - we are able to solve previously unsolvable machine vision problems. Vision can extract more information from your production and therefore extract more value.