2019 International Conference on Artificial Intelligence, Control and Automation Engineering (AICAE 2019) ISBN: 978-1-60595-643-5
Research on Surface Defect Detection Based on Semantic Segmentation
Yu-ting LIU
1, Ya-ning YANG
2,*, Chao WANG
1, Xiang-yu XU
2and Tao ZHANG
11
College of Electromechanical Engineering, Dalian Minzu University, Dalian Liaoning 116605, China 2
College of Electromechanical & Information Engineering, Dalian Minzu University, Dalian Liaoning 116605, China
*Corresponding author
Keywords: Defect Detection, Semantic Segmentation, Fully Convolutional Networks.
Abstract. Surface defect detection plays an important role in ensuring product quality. In view of the
problem of surface defect detection in industrial production, a surface defect detection method based on semantic segmentation is introduced, which uses the idea of transfer learning. A better network model can be trained by using fewer defect samples. In addition, the defect can be classified by this method, and the defect type can be labeled, and the defect area can be obtained. In order to verify the effectiveness of the proposed method, the performance of the method is analyzed by DAGM 2007 dataset. The experimental results show that the defect detection accuracy of this method is more than 99.6% and meets the practical requirements of industrial production.
Introduction
Product surface defect detection is the core of the whole industrial production process, its apparent quality will affect the commercial value of the product [1]. Due to the influence of equipment, raw materials and process, different kinds of defects often appear on the surface of the product. Surface quality not only affects the appearance of the product itself, but also affects the functional characteristics of the product itself. At present, the defect detection on the surface of industrial products is mainly based on manual inspection. This process is not only time-consuming and energy-consuming, but also has a high rate of false detection and missed detection, which is not suitable for large-scale industrial production. In recent years, deep learning has been applied to defect detection and recognition, and good results have been achieved. Deep learning has the ability of autonomous learning. Because of its excellent performance, many research results have shown that deep learning has excellent performance in feature learning and recognition tasks.
In reference [3], an automatic defect Detection method for texture Surface based on unsupervised Learning was proposed by S. Mei. This method only uses defect-free samples for model training and does not require manual participation, so it can detect and locate the defect location. It has high detection precision and good robustness. In reference [4], a method of surface defect detection for industrial products was proposed by Z. Yu. with good detection performance. In reference [5], an automatic depth encoder and data-enhanced surface defect detection method was proposed by A. Mujeeb, and good results have been obtained in various types of defect detection.
Semantic Segmentation
Images are composed of many pixels, and the task of semantic segmentation is to group or segment pixels according to the different semantic meanings expressed in the image [6]. Fully Convolutional Networks(FCN) [7] can be said to be the pioneering work of deep learning in image semantic segmentation. It is the development and extension of Convolutional Neural Networks(CNN). The idea of FCN is particularly intuitive, that is, direct end-to-end semantic segmentation at pixel level. The original image is directly used as the input of the whole model, and the input conversion feature is not needed to be trained. It realizes pixel-level classification of images and effectively solves the problem of image segmentation at semantic level. In addition, the full convolution network can accept an input image of any size and use the deconvolution layer to up-sample the feature map on the last convolution layer so that it can be restored to the same size as the input image. Thus, each pixel can be predicted, and the spatial information in the original input image can be preserved. Finally, the upsampling feature map is used to classify the pixel by pixel. FCN is to solve the problem that only defects can be classified in CNN by transforming the full connection layer of CNN into convolution layer. Its network model is shown in Fig. 1.
input Convolutional layer + Pooling layer
Fully Convolutional layer
Pixel level classification layer
Real label image input
Convolutional layer + Pooling layer
Full connected layer
Classification layer
Category prediction
(a)CNN
(b)FCN
[image:2.595.139.463.294.455.2]Defect
Figure 1. Fully Convolutional Networks model.
How semantic segmentation is applied to defect detection is simply introduced before the experimental operation. Assuming that the local information or defect area of the input defect image is sufficiently prominent and does not correlate with other regions in the detection process, the coarse extraction result of the defect feature can be obtained by the full convolution network model of the image. Because the upsampling result of full convolution network is fuzzy and smooth, and it is not sensitive to the detail region in the image, then the final image segmentation result is often not accurate enough. Therefore, the point-to-point conditional random field model is generally used as a post-processing method to optimize the segmentation results after the full convolution network.
Methodology and Approach
Deep Learning Environment Construction. The hardware environment of the system is set up as
follows: processor: Intel Xeon (strongest) E5 / 2623 v4 Quad Core (X2), main hard disk: Samsung MZ7LN256HAJQ-000H1, main Video Card: Nvidia Quadro P4000, display: HPN3504 HP 24y, Deep Learning Library: CUDA-10.0, CUDNN-10.0, memory: 64 GB, operating system: Windows 10. Software environment building: HALCON.HALCON is a complete set of standard machine vision algorithm package developed by MVtec company of Germany. It has a widely used integrated development environment of machine vision.
Dataset. The data set used in this paper is the German DAGM 2007 dataset, which is synthesized
experimental samples. Each dataset has 300 images. 210 images were selected as the training set, 45 images as the test set, and the remaining 45 images as the verification set. Because of the self-training network model in Halcon software, the transfer learning method can be used to train better network model with fewer data sets. After determining the required data set, the defect labeling should be carried out on the data set so that the computer can learn the characteristics of the defect, so as to better classify the defect. The annotation results are shown in Fig. 2.
Dataset 1 Dataset 2 Dataset 3 Dataset 4
Figure 2. Annotation results.
Parameter Setting. Before training the data set formally, it is necessary to pre-train the network
[image:3.595.149.447.162.337.2]model and set the parameters of the model. The selection of the parameters has a significant impact on the training process of the classifier. According to the data sets of different defect types trained in the experiment, the parameters as shown in Table 1 are set. After the parameter setting is completed, the labeled data set is put into the pre-training network model for training.
Table 1. Parameter setting.
Mode1 parameters
Learning_rate 0.000150
batch_size 6
momentum 0.880000
weight_prior 0.000050
NumEpochs 36
Result
Evaluation Criteria. In the semantic segmentation model, there are many standards to measure the
accuracy of the model, among which the commonly used measurement methods are Pixel Accuracy(PA), Mean Pixel Accuracy, Mean Intersection over Union(MIoU) and Frequency Weighted Intersection over Union. These standards are generally the distortion of the PA and the MIoU.PA is the simplest criterion in image segmentation evaluation. In the experimental results, MIoU is an important measure of semantic segmentation accuracy. Because of its precision and strong representativeness, it has become the most commonly used metric. In image semantic segmentation, the criterion is mostly used as the evaluation index of experimental results.
An PA expression, shown as Eq. 1, can be interpreted as the proportion of correctly marked pixels to total pixels.
ij k
j k i
ii k i
p p PA
0 0
0
The MIoU expression, shown as Eq. 2, can be interpreted in semantic segmentation as the average intersection ratio of the true value to the predicted value set, that is to say, the IoU value is calculated on each category.
k
i ji ii
k j ij k
j
ii
p p p
p k
MIoU
0 0 0
1 1
(2)
Assuming a total of k1 classes, in the form (1), (2): piirepresents the true quantity,pijrepresents
the quantity of pixels that belong to Class i but are predicted to be Class j.
Results Analysis. A sample diagram of the test results is given in Fig. 3. The test results show the
location of the defect and the pixel size of the defect area. Each dataset loss function curve and MIoU value are shown in Fig. 4.The overall performance and detection accuracy are shown in Table 2. In Dataset 1 and Dataset 2, the detection accuracy is 99.8%, in Dataset 3 and Dataset 4, 99.7%, 99.6%, respectively. The processing time of the system for single image is 20 ms to 30 ms.
[image:4.595.140.459.251.783.2]Dataset 1 Dataset 2 Dataset 3 Dataset 4
Figure 3. Test results.
mean IoU value Loss function convergence curve
Dataset 1
Dataset 2
Dataset 3
[image:4.595.147.453.273.418.2]Dataset 4
Figure 4. Loss function curve and MIoU value. Table 2. Evaluation results.
measures
Dataset 1 Dataset 2
[image:4.595.154.449.443.678.2]Time for inspection 25.6ms 26ms
measures
Dataset 3 Dataset 4
good defect mean good defect mean IoU 0.996 0.273 0.653 0.997 0.583 0.790 Pixd Acc 0.996 0.991 0.994 0.997 0.997 0.997
Pixd Acc.(overall) 0.996 0.997
Time for inspection 29ms 27.4ms
Summary
A defect detection method based on semantic segmentation is proposed in this paper, which is used to detect defects on the surface of products. Compared with the traditional machine vision method, this method can effectively improve the efficiency of product surface defect detection and reduce the effect of manual feature extraction on the system detection accuracy. Secondly, this method has a strong ability to identify defects. Through the construction of deep learning environment, the training and classification of data sets can be realized effectively. Finally, the method has fast training and recognition time, which can meet the demand of on-line real-time inspection of industrial production, and provide a reference for the practical application of industrial production in the future. However, this method also has some shortcomings, it needs a large number of time labeling defect samples, and the accuracy of labeling has a great impact on the experimental results.
Acknowledgement
This work was supported by Fundamental Research Funds for the Central Universities.
References
[1] R. Gong, C. Wu, M. Chu, Steel surface defect classification using multiple hyper-spheres support vector machine with additional information, J. Chemometrics and Intelligent Laboratory Systems. (2018)109-117.
[2] Z. Li, J. Zhang, T. Zhuang, Q. Wang, Metal Surface Defect Detection Based on MATLAB, C. ieee advanced information technology electronic and automation control conference, (2018)2365-2371.
[3] S. Mei, H. Yang, Z. Yin, An Unsupervised-Learning-Based Approach for Automated Defect Inspection on Textured Surfaces, J. IEEE Transactions on Instrumentation and Measurement, 67(2018)1266-1277.
[4] Z. Yu, X. Wu, X. Gu, Fully Convolutional Networks for Surface Defect Inspection in Industrial Environment, C. Computer Vision Systems, (2017)417-426.
[5] A. Mujeeb, W. Dai, M. Erdt, A. Souri, Unsupervised Surface Defect Detection Using Deep Autoencoders and Data Augmentation, C. International Conference on Cyberworlds (CW), (2018)391-398.
[6] J. Long, E. Shelhamer, T. Darrell, Fully convolutional networks for semantic segmentation, J. computer vision and pattern recognition, (2015)3431-3440.
[7] X. Bian, S. N. Lim, N. Zhou, Multiscale fully convolutional network with application to industrial inspection, C. workshop on applications of computer vision, (2016)1-8.