How AI is helping us take surface inspection to the next level

Written by Henrik Birk
Machine vision Machine learning Industry 4.0 Deep learning New technologies automation Quality control

Inspecting surfaces for defects can be a challenging task. Inspecting shiny, transparent, or irregular surfaces can be difficult enough, but with the right skills and understanding of light and optics, it's possible to create machine vision solutions for such tasks.

The real problem arises when the defects you are looking for are difficult to describe or predict, as it becomes impossible - or at least very expensive - to create a traditional machine vision algorithm that can handle all possible outcomes.

This is where artificial intelligence opens up new possibilities. At JLI, we've been working with machine learning since 2016, and we're constantly exploring how this technology can help us solve problems that were previously unsolvable.

Let's look at some of the surface defect inspection scenarios where machine learning is improving our toolbox. 

Finding aesthetic defects 

Sometimes it's not clear whether a defect is really a defect. For example, if you are inspecting glulam boards, you are looking for knots and resin pockets. But the problem is that not all knots or resin pockets are a functional problem, and we don't want to reject boards for no reason. It takes a trained and experienced eye to distinguish between the knots that are acceptable and those that need to be repaired. 

Traditionally, this would mean using manual inspection, as it wouldn't be feasible to create a vision solution that could take all the parameters into account. 

The problem with manual inspection, however, is that it is not only expensive and tedious, but it also produces inconsistent results. Two inspectors may evaluate the same defect differently, and the tired eye may miss defects that a fresh inspector would catch.

This is where artificial intelligence can help. 

By training a machine learning network on a very large sample of good and bad images - in one specific case we trained the network on 30,000 images - we can create a network that has the ability to distinguish which knots and resin pockets are acceptable and which need to be repaired or discarded. 

In this way, the network will mimic the way the experienced inspector evaluates the boards, but it will do so more cost-effectively and with much greater accuracy and consistency than a manual inspector. 

 

Analyzing a variation of aesthetic defects

Another scenario where AI comes to the rescue is when we need to detect and classify a large number of defects. For example, on a lacquered surface, you can easily have 25 different defects that you want to be able to detect. So it is not just a matter of finding a defect, it is also a matter of determining what type of defect is present.

Creating a traditional algorithm to manage a sample space of this size would not be feasible, but with artificial intelligence it becomes possible to solve the task. 

By annotating a large number of sample images with the different types of defects, we can train a neural network to recognize the specific defects. The network will be able to assess whether a defect is present and simultaneously define what type of defect it is.

The neural network identifies the defects by setting a probability that a particular defect is present in an image section.

Many of these defects in lacquered surfaces would be difficult for a manual inspector to detect, because the shiny surface requires that you look at it from a specific angle to detect the defects. 

Again, the use of machine learning opens up new possibilities for automating a difficult quality control task and achieving more accurate and consistent quality control. 

 

Finding the unexpected with anomaly detection

Sometimes we are looking for defects that only rarely appear but are important to find, and where we don’t know exactly what to look for. 

As an example we have created a vision system for detecting defects in steel rails for railways. The defects in the steel are rare, but they can have serious consequences, so it's very important to detect them.

Here we can turn to anomaly detection for help. Anomaly detection can be done with machine learning-based methods, but instead of training a model to recognize defects, you train it to recognize good items. 

By learning what a good item looks like, the model can then identify the items that stand out from the norm. This can then lead to pre-processing the part of the image that the anomaly detection algorithm has flagged - either with manual inspection or with a vision system that inspects the potential defect for specific characteristics, such as measuring the size to determine if it is within a set tolerance.

 

Combining AI with traditional machine vision for speed and robustness

Using AI can sound like a silver bullet, and a number of off-the-shelf AI vision solutions have become commercially available, but when it comes to complex quality control cases like surface inspection, the technology cannot stand alone. 

First of all, analyzing large images with a neural network requires a lot of resources and is a slow process - at least slower than what you are looking for on an industrial production line. 

That's why we at JLI have developed the concept of hybrid vision, where we combine traditional machine vision methods for pre- or post-processing the images to speed up the quality control process and make the solutions more robust. 

Achieving high accuracy and high speed requires a lot of technical know-how, which is the third element of Hybrid Vision: Craftsmanship.

If you are interested in learning more about how Hybrid Vision can improve quality control, read our in-depth guide here: Hybrid Vision: Pushing the Boundaries of Quality Control