News

Industrial vision defect detection-metal surface sefect setection

1. Introduction
Defect detection is the most important component of industrial vision technology. It has a wide range of businesses, rich scenarios, high technical difficulties and a large workload. Different cameras and recognition methods are selected for different scenarios.
Generally speaking, industrial vision cameras are divided into area array and line array. Most of the cameras required for scenes with certain requirements are relatively expensive. The cameras also need to be equipped with light sources and lenses to form an imaging system. The cost of algorithm research and development is also relatively expensive. The research and development cycle of a product defect is at least one month, and it often requires a small team to develop it together. The defects of many scenes have not been solved or are not practical so far. This has resulted in some scenes with low profits, where it is more cost-effective to use manual labor than machines, and some scenes with high profits, but unfortunately no one can make a practical system.

2. Methods
Different algorithms are suitable for different defects. The algorithm introduced is only applicable to smooth surface defect detection and is not applicable to detection in other directions.
2-1. Object and imaging - as shown below

The specific industry of the object is not very clear, we call it a metal part, probably used in special fields. The imaging effect is as follows
As shown in the figure above, the image is obtained by scanning a circle with a line array camera. The clarity is relatively high, but the price of the equipment is relatively high.

2-2. Defect classification
For the categories of defects, the definition in the national standard is divided into many situations, and there are different requirements for different manufacturers. For example, printing: can be divided into embossing, scratches, and pits. Here it is mainly divided into three categories, printing, poor electroplating and dirt. As shown in the following figure
The green frame indicates dirt, the red frame indicates poor electroplating, and the blue frame indicates printing.

2-3. Data annotation
This method uses deep learning classification technology and uses masks to label samples. Different mask grayscale values ​​are used to indicate categories. As shown in the following figure

2-4. Classifier training
The training process is as follows
(1) Scale the scanned image to a specified size according to the width of the metal part, and perform slight random zooming in and out.
(2) Set the window size to 15x15, scan the metal parts in the form of a sliding window, and obtain samples. The positive samples are those whose defect area occupies more than 20% of the window and whose category is the type with the largest area (taking into account the case of communication). The negative samples are those whose defect area occupies less than 1% of the window. Other cases are discarded (retaining the middle area for boundary distinction).
(3) A simple convolutional network is used as a classifier for training, and multiple classifiers form a cascade classifier.

2-5. Prediction process
The prediction process is as follows
(1) Scale the input image to a specified size according to the width of the metal part.
(2) The sliding window classifies each piece of the defect.
(3) Use the growth algorithm to combine small defect frames into a large frame output.

3. Core Thinking
The algorithm design is relatively simple, but there are several points that are very important but easy to overlook
3-1. The sample marking should be as detailed as possible, taking into account the size of the metal parts and the size of the window, which greatly affects the definition of defects.
3-2. The samples involved in training are clearly divided into positive and negative, and some intermediate samples are discarded. These samples are often the boundaries of defects and small defects that do not need to be detected.
3-3. The shapes of defects are varied and there is no fixed appearance pattern. General target detection is prone to errors and is relatively costly.
3-4. There is no need to consider sample enhancement too much, and the imaging situation is usually stable.
3-5. The cascade classification method will greatly improve the speed, and the overall effect is no different from that of a single classifier.
3-6. The segmentation method (point pixel classification) requires many samples and there is no mechanism for sample interval. To achieve the same effect, the time complexity is significantly higher.

4. Results
A total of more than 200 samples were annotated, covering various types of defects. In the test of more than 2,000 samples that did not participate in the training, the detection rate of obvious defects was 100%, and the false detection rate was 0.1% (mostly relatively small). The results are as follows
The left side shows the effect of not growing the defect frame, and the right side shows the growth result.
 
x
弹出图片