The kinds of visual inspection AI and how they work, from inside the industry — and how they differ from image processing
An engineer in the field on how visual inspection AI works, and how it differs from image processing

What this article covers
What is actually different about AI? There are a lot of similar-looking products on the market — how do they differ, and what should you look at when comparing them? You do not often find an article that answers that honestly. Here is an honest answer, from a vendor.
What visual inspection AI is
Image processing and AI
Until around 2016, image inspection systems mostly ran on what is called image processing. In recent years detection with AI has become common, and many people trying to gather information before buying are stuck on the question of what the difference is. Let us look at that first.
What image processing is
What kind of processing is it? An example.
Say you want to find a stain on a piece of cloth, as in the figure below. For that defect mode, you would first extract the regions matching the colour of the stain (the extracted regions are shown in white). Some parts of a similar colour remain, so you run noise removal. Even then, a little of what you did not mean to detect is still there. That is what produces false detections.

What AI is
What is AI, exactly? In visual inspection as elsewhere, AI today almost always means deep learning. What is deep learning doing in a visual inspection?
Deep learning imitates the complicated neural circuitry of a person; it is also called a neural network, with a deep structure of layers. Looking at the image above, a person has a vague sense that this is probably the defect. The neural processing that leads to that vague judgement is not simple in the way image processing is. Put the other way round: a combination of complicated processing can extract the defect accurately.
That is what deep learning can do. Take a neural network with the image as its input, and give it a great many pairs of image and correct defect location to learn from. It works out the complicated processing by itself, and once the inspection runs and data arrives, it can find defects. Because it can do complicated processing, it tends to be accurate.
In fact, deep learning — particularly a CNN (convolutional neural network), whose structure is specialised for images — has something like the receptive fields of human vision, and each learned processing unit, each layer, is said to resemble an image-processing filter. Which is to say that training optimises each of a stack of filters.
See also our other article.

Before you adopt good-product learning AI, read this
Image processing and AI, side by side
| Approach | What it is | Strengths | Weaknesses |
|---|---|---|---|
| Image processing | A defect is found by stacking processing steps | You can see why something was called a defect by reading the settings of the steps | Hard to configure for products of complicated shape. Many false detections. |
| AI | Defects are found by learning from data what a defect or a good product looks like | Works on complicated products. Once it has learned, configuration is simple. | Data has to be prepared for the training, which is sometimes a great deal of work. |
The kinds of AI in visual inspection
The example above paired defect images with the answer of where the defect was, but AI output comes in several forms. Here are the main methods used in the products on the market. Which kinds of AI a product handles differs, and it is worth paying attention to.
The two broad classes
・Supervised learning: also called defect learning. Defect data is taught to the AI. Learn the defects you give it thoroughly and it can be very accurate, and it can even name the defect type. But on a floor where defects are not plentiful, the burden of collecting data for training is heavy, and — this bears repeating — it cannot handle a new defect.
・Unsupervised learning: also called good-product learning, anomaly detection. Good products are learned, and whatever is not one is detected. Teaching defects is “supervised”; not teaching them is “unsupervised”. Since good products accumulate as a matter of course, it is an attractive approach, and plenty of factories go looking for it, both because it avoids the defect-collection burden of supervised learning and because it can respond to defects nobody has seen.
| Approach | What it is | Strengths | Weaknesses |
|---|---|---|---|
| Supervised (defect learning) |
Defect data is taught to the AI. | Accurate classification once enough data is gathered. | Collecting defect data is hard. Defect modes not learned may go undetected. |
| Unsupervised (good-product learning) |
Good products are learned and anything unlike them is detected. | Good products are plentiful, so it is easy to train and easy to start. | Cannot classify defects. Usually produces more false detections. |
Varieties of supervised learning
Pay attention to which kind of AI the product you are considering uses, and to what that kind is like. Teaching the AI the answers about defects is generally called annotation, so that is the word used below.
・Classification: within defect learning, also called classification. Defect data is taught to the AI, but the annotation does not use the location of the defect; it says only whether the image is defective or good. Hence the name. (Sometimes it classifies by defect type as well.) For the person gathering data this is easy, since the defect does not have to be located. But from the AI’s point of view there is no strong clue — the defect’s location — for learning what the defect looks like, so it tends not to become very accurate.
・Object detection: within defect learning, object detection means the detected region is given as a rectangle. The output can show the defective region as a box. Because the defect’s location is needed, annotation takes effort, but accuracy tends to be higher than classification, and because the location is given, the AI’s judgement is easy for a person to follow. Compared with segmentation below, though, a rectangle is a coarse thing when you want to analyse the size or the area of a defect.
・Segmentation: within defect learning, segmentation means the detected region is given as a free shape. The output shows the defective region itself. Here both the location and the detailed shape are needed, so annotation takes effort. In return, the location and the shape of the defect allow a detailed analysis and judgement.

A summary of supervised learning follows. In this author’s view segmentation is the one to go for. The hard work of inspection on a factory floor is collecting the defect data itself, and dealing with false detections, so you should choose the method most likely to be accurate; how easy the annotation is does not amount to a large difference in cost. Note too that algorithmic work to need fewer defect images changes how much collection and annotation is required.
| Approach | What it is | Strengths | Weaknesses |
|---|---|---|---|
| Classification | The AI is told whether data is defective. | Annotation is just sorting images: simple. | Tends to be less accurate. |
| Object detection | Defects are detected as rectangles. | Annotation is drawing boxes, so relatively simple. The defect’s location is pinned down. | Gives the location but not the detailed shape. |
| Segmentation what we recommend |
Defects are detected as free shapes. | Gives the most detailed information: location and shape. | The most laborious to annotate. |
Varieties of unsupervised learning
Again, pay attention to which kind of AI a product uses and what that kind is like.
・Classification: an image goes in, and only whether it is anomalous comes out. It exists in research; you rarely see it in a product.
・Semi-segmentation: the region is indicated, but not strictly at pixel level — the location is identified loosely.
・Segmentation: the strictest output of the region. This form makes judgements by the size and shape of the defect straightforward, and is the most useful.
We have pushed accuracy as far as it will go, detecting fine defects of two or three pixels — a thousandth of the image — and no other form will do for that.

Generative AI for making defects
Supervised defect learning often runs into the problem that defects cannot be collected. The idea here is to take the small quantity of defect data you do have, multiply it with AI, and train on that. From a user’s point of view it can be hard to see why or when this is needed. We do work with defect generation, but this author treats it as a last resort.

In short
That is an outline of AI and the kinds of it. Out of long experience in this industry we supply our products as a domestic AI vendor that takes the science of AI seriously, and we are glad to be compared against others in a competitive evaluation. Do get in touch.


