Quality Monitoring for Laser Welding Based on High-Speed Photography and Support Vector Machine

In order to improve the prediction ability of welding quality during high-power disk laser welding, a new approach was proposed and applied in the classification of the dynamic features of metal vapor plume. Six features were extracted through the color image processing method. Three features, including the area of plume, number of spatters, and horizontal coordinate of plume centroid, were selected based on the classification accuracy rates and Pearson product-moment correlation coefficients. A support vector machine model was adopted to classify the welding quality status into two categories, good or poor. The results demonstrated that the support vector machine model established according to the selected features had satisfactory prediction and generalization ability. The classification accuracy rate was higher than 90%, and the model could be applied in the prediction of welding quality during high-power disk laser welding.


Introduction
As an important new laser processing technology, high-power disk laser welding has been increasingly widely used in the manufacturing field. Welding stability monitoring plays an important role in the modern welding process. Therefore, proper sensors and signal processing methods are helpful for detecting the possible presence of weld defects.
Various kinds of sensor methods are applied in the field, such as the use of photodiode signals [1][2][3], spectroscopy [4,5], high-speed photography [6][7][8], acoustic signals [9,10], electrical signals [11], X-rays [12], and so on. Among these sensor methods, high-speed photography, which can observe the interaction region between the laser and the workpiece directly, is a kind of non-destructive inspection technique. It has become one of the main development trends for online monitoring of the welding process. Zhang et al. [7] designed an active vision system using a high-speed camera to obtain the morphology information of a molten pool during high-power disk laser welding. The casting shadows of the molten pool were analyzed, and four features, including the area, maximal width, and tilt of casting shadow, as well as maximal distance between casting shadow and the keyhole position, were defined. Pinto-Lopera et al. [13] applied a passive vision system using a high-speed camera and an optical filter in real-time measuring of the width and height of weld beads during gas was used to produce a high-intensity laser beam. The beam diameter of the laser spot was 480 µ m, and the wavelength of the laser was 1030 nm. A MOTOMAN 6-axis robot (EA1400N, Yaskawa, Kitakyushu, Japan) was responsible for controlling the scanning track of the laser beam on the surface of specimen. The welding speed was 4.5 m/min. The shielding gas was argon in order to ensure the chemical stability of the welding surface environment, and the nozzle angle was 45°. A high-speed camera system (Memrecam fx RX6, NAC, Tokyo, Japan), with complementary metal oxide semiconductor (CMOS) image sensors, was mounted to record the plume images. The frame rate was 2000 f/s, and the image resolution was 512  512. An optical filter was placed in front of RX6 to filter unnecessary signals. The spectral band-pass filter setup on camera was 320-750 nm (measurement of UV and visible light induced plume and spatter). The specimen was a stainless steel 304 plate with dimensions of 119 mm × 51 mm × 20 mm. The intensity and the direction of the shielding gas remained unchanged during the welding process, and its impact on the state of plume was relatively stable. To simplify the model, the impact of shielding gas was not considered. Other parameters in the laser welding are shown in Table 1.

Image Processing
The image processing was accomplished by using a Matlab platform. The schematic diagrams of color image processing are shown in Figure 2a-e. An original metal vapor image is shown in Figure 2a. In order to reduce the amount of calculations and facilitate subsequent analyses, the original image was cut into 320 × 320, and the key region was extracted, as shown in Figure 2b. Compared to RGB (red, green, blue) color space, the HSI (hue, saturation, intensity) color space was better due to two reasons. First, it uses three components of color image: hue (H), saturation (S), intensity (I), which are intimately related to the way in which human beings perceive color. Second, the geometric distance between two colors does not mean the visual differences between the two colors in the RGB color space, which means using perceptual color space is more suitable for human intuition than using the primary colors (RGB). The cut image was mapped into the HSI color space, as shown in Figure 2c.
The most important step of image processing is image segmentation. It is the process of assigning a label to each pixel in an image so that pixels with the same label share certain features, such as color, intensity, or texture. There are various methods to implement segmentation, for example,

Image Processing
The image processing was accomplished by using a Matlab platform. The schematic diagrams of color image processing are shown in Figure 2a-e. An original metal vapor image is shown in Figure 2a. In order to reduce the amount of calculations and facilitate subsequent analyses, the original image was cut into 320 × 320, and the key region was extracted, as shown in Figure 2b. Compared to RGB (red, green, blue) color space, the HSI (hue, saturation, intensity) color space was better due to two reasons. First, it uses three components of color image: hue (H), saturation (S), intensity (I), which are intimately related to the way in which human beings perceive color. Second, the geometric distance between two colors does not mean the visual differences between the two colors in the RGB color space, which means using perceptual color space is more suitable for human intuition than using the primary colors (RGB). The cut image was mapped into the HSI color space, as shown in Figure 2c.
The most important step of image processing is image segmentation. It is the process of assigning a label to each pixel in an image so that pixels with the same label share certain features, such as color, intensity, or texture. There are various methods to implement segmentation, for example, thresholding methods, clustering methods, texture methods, transform methods, and so on. The image based on HSI color space was segmented with a thresholding technique, which replaced pixels in the image with a white pixel if the image intensity was greater than the threshold, or a black pixel if the image intensity was less than the threshold. The results of the repeated experiments showed that it was possible to segment accurately when choosing H = 200, S = 50, I = 200 as the threshold values. The result is shown in Figure 2d. In order to eliminate the spatters, we first began with the open operation, then used the close operation for further processing, and the final result was shown in Figure 2e. As can be seen, the morphologic features of the metal vapor plume were well preserved.
Appl. Sci. 2017, 7, 299 4 of 13 thresholding methods, clustering methods, texture methods, transform methods, and so on. The image based on HSI color space was segmented with a thresholding technique, which replaced pixels in the image with a white pixel if the image intensity was greater than the threshold, or a black pixel if the image intensity was less than the threshold. The results of the repeated experiments showed that it was possible to segment accurately when choosing H = 200, S = 50, I = 200 as the threshold values. The result is shown in Figure 2d. In order to eliminate the spatters, we first began with the open operation, then used the close operation for further processing, and the final result was shown in Figure 2e. As can be seen, the morphologic features of the metal vapor plume were well preserved.

Definition of Features
After the color image was segmented, six features, which reflected the welding quality, were extracted. They were defined as the area, the height and the average intensity of metal vapor plume region, the horizontal coordinate and the vertical coordinate of plume centroid, and the number of spatters.
The pixel number of the effective plume was set equal to the area of the metal vapor plume, which was defined as: where ( , ) Binary i j was the value of pixel (i, j).
The height of the metal vapor plume was defined as the vertical distance between the highest point and the lowest point.
The average intensity of the metal vapor plume region was defined as:

Definition of Features
After the color image was segmented, six features, which reflected the welding quality, were extracted. They were defined as the area, the height and the average intensity of metal vapor plume region, the horizontal coordinate and the vertical coordinate of plume centroid, and the number of spatters.
The pixel number of the effective plume was set equal to the area of the metal vapor plume, which was defined as: where Binary(i, j) was the value of pixel (i, j). The height of the metal vapor plume was defined as the vertical distance between the highest point and the lowest point. The average intensity of the metal vapor plume region was defined as: where I(i, j) was the intensity of pixel (i, j).
The centroid coordinate of the metal vapor plume region was defined as: where g(i, j) was the grey value of pixel (i, j).
After the color image was segmented, we removed the region that had an area that was more than 450 pixels. The number of pixels in the remaining region was set equal to the number of spatters.

SVM Method
Support vector machine is a widely used classification model. The basic idea is to obtain the maximum-margin separating hyperplane in feature space [21,26]. For the training data set . . , n and the selected penalty parameter C > 0, Lagrange multipliers α = (α 1 , α 2 , . . . , α n ) were applied to construct a convex quadratic programming problem [26]: The solution α * can be used to calculate w * and b * , which are the normal vector and intercept of the separating hyperplane equation: Thus, the classification decision function is: When the classification problem is nonlinear, the kernel trick can be used, implicitly mapping the inputs into high-dimensional feature spaces. SVM can efficiently perform a nonlinear classification under the condition. The most widely used kernel function is the radial basis kernel function, which is shown as: where x and z could be any sample, and σ is a width parameter to control the radial range of the function.

Features Extraction and Data Preprocessing
During the whole welding process, 2400 images of the welding speed 4.5 m/min were captured by the high-speed camera, and 1480 continuous images from No. 521 to 2000 were analyzed. The features, including the area, the height, the average intensity and the centroid coordinate of metal vapor plume region, and the number of spatters, were calculated. In order to eliminate the periodic fluctuation of the data and the influence of individual singularity, the extracted features were median filtered, as shown in Figure

Features Extraction and Data Preprocessing
During the whole welding process, 2400 images of the welding speed 4.5 m/min were captured by the high-speed camera, and 1480 continuous images from No. 521 to 2000 were analyzed. The features, including the area, the height, the average intensity and the centroid coordinate of metal vapor plume region, and the number of spatters, were calculated. In order to eliminate the periodic fluctuation of the data and the influence of individual singularity, the extracted features were median filtered, as shown in Figure 3a-f.    Figure 4. Welding quality is mainly related to several factors, including the fluctuation in the welding process, the uniformity of the bead width of the weld, the number of internal pores, as well as the number and the size of spatters. From the surface appearance of the welded seam, the surface weld width of region A and region C were relatively stable and of high welding quality, while the weld width of region B became narrow suddenly and was of poor weld quality. As such, region A and region C were treated as a class, denoted with R, and region B was treated as another class, denoted with E.  Figure 4. Welding quality is mainly related to several factors, including the fluctuation in the welding process, the uniformity of the bead width of the weld, the number of internal pores, as well as the number and the size of spatters. From the surface appearance of the welded seam, the surface weld width of region A and region C were relatively stable and of high welding quality, while the weld width of region B became narrow suddenly and was of poor weld quality. As such, region A and region C were treated as a class, denoted with R, and region B was treated as another class, denoted with E. As shown in Figure 4, three different cross sections of the sample marked with 1, 2, and 3 were selected for further observation of the internal quality. The bead width (the width of the welded seam in the horizontal direction on the sample surface) and the weld penetration of the three cross sections denoted 1, 2, and 3 were shown in Figure 5a-c. As shown in Figure 5 and Table 2, the depth-width ratio of the second cross sections was the largest, and the quality of its underfilled surface was the worst.  Observing the cross sections through a metallurgical microscope (XJP-6/6A), several pores were found in the cross section, as shown in Figure 6. The captions of each image were named as i-j, which meant the j-th pores in the i-th cross sections. Two pores were found in the first cross section, as shown in Figure 6(1-1),(1-2), five pores were found in the second cross section, as shown in Figure 6(2-1)- (2)(3)(4)(5), and two pores were found in the third cross section, as shown in Figure 6  As shown in Figure 4, three different cross sections of the sample marked with 1, 2, and 3 were selected for further observation of the internal quality. The bead width (the width of the welded seam in the horizontal direction on the sample surface) and the weld penetration of the three cross sections denoted 1, 2 and 3 were shown in Figure 5a-c. As shown in Figure 5 and Table 2, the depth-width ratio of the second cross sections was the largest, and the quality of its underfilled surface was the worst.  Figure 4. Welding quality is mainly related to several factors, including the fluctuation in the welding process, the uniformity of the bead width of the weld, the number of internal pores, as well as the number and the size of spatters. From the surface appearance of the welded seam, the surface weld width of region A and region C were relatively stable and of high welding quality, while the weld width of region B became narrow suddenly and was of poor weld quality. As such, region A and region C were treated as a class, denoted with R, and region B was treated as another class, denoted with E. As shown in Figure 4, three different cross sections of the sample marked with 1, 2, and 3 were selected for further observation of the internal quality. The bead width (the width of the welded seam in the horizontal direction on the sample surface) and the weld penetration of the three cross sections denoted 1, 2, and 3 were shown in Figure 5a-c. As shown in Figure 5 and Table 2, the depth-width ratio of the second cross sections was the largest, and the quality of its underfilled surface was the worst.  Observing the cross sections through a metallurgical microscope (XJP-6/6A), several pores were found in the cross section, as shown in Figure 6. The captions of each image were named as i-j, which meant the j-th pores in the i-th cross sections. Two pores were found in the first cross section, as shown in Figure 6(1-1),(1-2), five pores were found in the second cross section, as shown in Figure 6(2-1)-(2-5), and two pores were found in the third cross section, as shown in Figure 6  Observing the cross sections through a metallurgical microscope (XJP-6/6A), several pores were found in the cross section, as shown in Figure 6. The captions of each image were named as i-j, which meant the j-th pores in the i-th cross sections. Two pores were found in the first cross section, as shown in Figure 6(1-1),(1-2), five pores were found in the second cross section, as shown in Figure 6(2-1)-(2-5), and two pores were found in the third cross section, as shown in Figure 6(3-1), . Most of the pores were rounded. The number of pores found in the second cross section were more than the other two sections, and the diameter of the pores were bigger than those of the other two sections.

Features of the Welding Sample
The first cross section belonged to region A, whose surface width was a bit wider. As can be seen from Figure 3, from the 771st to the 790th image, it was found that the area and the height of the metal vapor plume both underwent a sharp upward mutation. There existed two obvious raised knots on the surface of the welded seam in region A, which are some tumor-like particles caused by spatters, but only two pores were found in the corresponding cross section, which indicated that the sudden increase of the area and height of the metal vapor plume corresponded to the formation of the knots on the surface, but it had little relation with the change of the pores. We observed the trail of the spatters from the real-time video, and thought that the formation of knots was due to two reasons. First, when the spatters were big enough, the movement trail of spatters was mainly in the vertical direction under the action of its gravity, leading to the sudden increase of the area and height of metal vapor plume. Some spatters eventually fell onto the surface along the weld axis. The other reason is that knots were possibly from violent turbulence in the molten pool during welding.
The second cross section belonged to region B, whose surface width was the narrowest. By calculating the data in Figure 3, the average area and height of the metal vapor plume in region B were smaller than the other two regions, and five pores were found in the corresponding cross section. This indicated that the temperature of the molten pool in section B is relatively low, and that the solidification of liquid metal became faster. When the bubbles grew to a certain size and began to float, they were more likely to stay in the solidified weld metal to form pores if the floating speed was less than that of the crystallization of the metal pool.
Appl. Sci. 2017, 7, 299 8 of 13 the pores were rounded. The number of pores found in the second cross section were more than the other two sections, and the diameter of the pores were bigger than those of the other two sections. The first cross section belonged to region A, whose surface width was a bit wider. As can be seen from Figure 3, from the 771st to the 790th image, it was found that the area and the height of the metal vapor plume both underwent a sharp upward mutation. There existed two obvious raised knots on the surface of the welded seam in region A, which are some tumor-like particles caused by spatters, but only two pores were found in the corresponding cross section, which indicated that the sudden increase of the area and height of the metal vapor plume corresponded to the formation of the knots on the surface, but it had little relation with the change of the pores. We observed the trail of the spatters from the real-time video, and thought that the formation of knots was due to two reasons. First, when the spatters were big enough, the movement trail of spatters was mainly in the vertical direction under the action of its gravity, leading to the sudden increase of the area and height of metal vapor plume. Some spatters eventually fell onto the surface along the weld axis. The other reason is that knots were possibly from violent turbulence in the molten pool during welding.
The second cross section belonged to region B, whose surface width was the narrowest. By calculating the data in Figure 3, the average area and height of the metal vapor plume in region B were smaller than the other two regions, and five pores were found in the corresponding cross section. This indicated that the temperature of the molten pool in section B is relatively low, and that the solidification of liquid metal became faster. When the bubbles grew to a certain size and began to float, they were more likely to stay in the solidified weld metal to form pores if the floating speed was less than that of the crystallization of the metal pool. (1-1) (1-2) (2-1)

Classification Experiment Based on the SVM Approach, Quadratic Discriminant Analysis, and Linear Discriminant Analysis
After median filtering, support vector machine, linear discriminant analysis [27], and quadratic discriminant analysis [28] were used to build models using each feature separately. In practice, 10-fold cross-validation is widely used to test the accuracy of algorithms [17,29], which meant the entire data set was divided into 10 equal parts, nine parts were taken as training sets and the remaining one was used as a test set. Experiments were conducted ten times, and the average result was taken as the accuracy rate of the model. The results are shown in Table 3 and Figure 7, where the features were sorted in descending order according to the accuracy rate of SVM.

Classification Experiment Based on the SVM Approach, Quadratic Discriminant Analysis, and Linear Discriminant Analysis
After median filtering, support vector machine, linear discriminant analysis [27], and quadratic discriminant analysis [28] were used to build models using each feature separately. In practice, 10-fold cross-validation is widely used to test the accuracy of algorithms [17,29], which meant the entire data set was divided into 10 equal parts, nine parts were taken as training sets and the remaining one was used as a test set. Experiments were conducted ten times, and the average result was taken as the accuracy rate of the model. The results are shown in Table 3 and Figure 7, where the features were sorted in descending order according to the accuracy rate of SVM.  As shown in Table 3, the accuracy rate of SVM was significantly higher than that of quadratic discriminant analysis and linear discriminant analysis when using Feature 1, 2, 4, and 5. For Feature 3 and Feature 6, the accuracy rate of SVM was a little better and worse than the other two models, respectively. In other words, the results showed that SVM was more suitable for predicting the welding quality in the experiment. There were two possible reasons. On one hand, SVM was based on margin maximization, which ensured its advantage in generalization ability. On the other hand, as the kernel function was used, SVM could analyze and classify data not only in feature space, but also in high-dimensional space.
The experimental results above showed that the accuracy rate could reach 83.04% when using SVM with Feature 1. To further improve the classification ability, two other features were chosen based upon Pearson product-moment correlation coefficient. The Pearson product-moment correlation coefficient r between two features x and y was calculated by [30]: As shown in Table 3, the accuracy rate of SVM was significantly higher than that of quadratic discriminant analysis and linear discriminant analysis when using Feature 1, 2, 4 and 5. For Feature 3 and Feature 6, the accuracy rate of SVM was a little better and worse than the other two models, respectively. In other words, the results showed that SVM was more suitable for predicting the welding quality in the experiment. There were two possible reasons. On one hand, SVM was based on margin maximization, which ensured its advantage in generalization ability. On the other hand, as the kernel function was used, SVM could analyze and classify data not only in feature space, but also in high-dimensional space.
The experimental results above showed that the accuracy rate could reach 83.04% when using SVM with Feature 1. To further improve the classification ability, two other features were chosen based upon Pearson product-moment correlation coefficient. The Pearson product-moment correlation coefficient r between two features x and y was calculated by [30]: where n was the size of sample, and r was a measure of the correlation between two features. A greater absolute value of r indicated stronger correlation. Pearson correlation coefficients between each feature and Feature 1 are shown in Table 4. The features of the table were sorted by the absolute value of r in ascending order. The absolute value of the correlation coefficient between Feature 4 and Feature 1 was about 0.0665, which indicated that the correlation between them was very weak and thus adding Feature 4 to the subset would provide lots of new information. The second lowest correlation coefficient was between Feature 3 and Feature 1, and the value was close to 0.2210, which meant the new information it could provide was still considerable. The coefficient r between other features and Feature 1, such as 0.4497, 0.5225 and 0.5603, indicated that they had much stronger correlations with Feature 1, and therefore adding them to the subset should not be able to improve the classification accuracy as much as Feature 4 and Feature 3. Scatter plots of three selected features are shown in Figure 8. As can be observed in the figure, most of the data from different classes were distributed in different areas, which could not be easily separated by linear or quadratic models. More complex and nonlinear models, such as SVM, were needed.
where n was the size of sample, and r was a measure of the correlation between two features.
A greater absolute value of r indicated stronger correlation. Pearson correlation coefficients between each feature and Feature 1 are shown in Table 4. The features of the table were sorted by the absolute value of r in ascending order. The absolute value of the correlation coefficient between Feature 4 and Feature 1 was about 0.0665, which indicated that the correlation between them was very weak and thus adding Feature 4 to the subset would provide lots of new information. The second lowest correlation coefficient was between Feature 3 and Feature 1, and the value was close to 0.2210, which meant the new information it could provide was still considerable. The coefficient r between other features and Feature 1, such as 0.4497, 0.5225, and 0.5603, indicated that they had much stronger correlations with Feature 1, and therefore adding them to the subset should not be able to improve the classification accuracy as much as Feature 4 and Feature 3. Scatter plots of three selected features are shown in Figure 8. As can be observed in the figure, most of the data from different classes were distributed in different areas, which could not be easily separated by linear or quadratic models. More complex and nonlinear models, such as SVM, were needed. The classification results using the Feature 1, Feature 4, and Feature 3 above are shown in Table 5, and the confusion matrices for each experiment are shown in Tables 6-8. The classification results using the Feature 1, Feature 4, and Feature 3 above are shown in Table 5, and the confusion matrices for each experiment are shown in Tables 6-8.    Tables 5-8, it was noticed that the performance of SVM was improved with the introduction of features. Using only Feature 1, the accuracy rate was only 83.04%. As Feature 4 was added to the feature subset, the accuracy rate increased to 91.55%, especially the accuracy rate of Class E had a sharp increase from 68.65% to 81.92%. With all three selected features, the accuracy rate reached 93.58%. Consequently, SVM was able to achieve satisfactory classification performance with new information provided by the two additional features

Conclusions
(1) During the high-power laser welding process, high-speed photography was used to obtain dynamic metal vapor plume images. Six features were extracted and defined. The experimental results show that three features, including the area of plume, number of spatter, and horizontal coordinate of plume centroid, are closely related to the welding quality. A SVM model based on these three features was established and 93.58% of 10-fold cross-validation accuracy rate was achieved, which indicates high prediction and generalization ability. As such, it is feasible to predict the welding performance and be applied in the control welding process. (2) The combination of SVM and Pearson product-moment correlation coefficient was used to select the features with the best predictive capacity. The method is simple and effective, which provides a valuable technique to select features for characterizing the welding quality in the welding process.
A real-time monitoring model of welding status was established based on the consideration of laser-induced metal vapor plume by combining modeling with experimental testing, which helped ensure high reliability, and then on the basis of the results, a welding quality prediction model was established based on the characteristics of the metal vapor plume, so that it can be applied to real-time monitoring in the high-power laser welding process.