*3.2. Signal Analysis*

Table 3 shows the color-coded images, which helps to visualize a 3D image of the spectrum intensity (Figure 4) in a 2D form of the spectrum during 0.2 s (0.4–0.6 s). In the color-coded image, the horizontal and vertical axes represent the time and wavelength, respectively, and the intensity is mapped in color. The used color scale was the same used by Viridis [28], and the minimum and maximum values of the color scale were set as 0 and 65535, respectively. It was seen that higher intensities were observed, mainly in the wavelength range of 350–650 nm. In general, when the laser power was kept constant, a higher welding speed increases the intensity. In terms of the size of weld bead, i.e., the penetration and width, this signifies that smaller the weld bead, more was the light, reflected into the spectrometer. Similarly, in case of constant welding speeds, the higher the welding power, the larger was the intensity. However, in this case, even if the size of the weld bead increased, the intensity increased, as the laser power increased. This means that the intensity is influenced more by the laser power, than the weld bead size. These trends were quite clearly observed, in the range of 1000–2500 W of the laser power. However, these trends were rarely observed in all values of laser power more than 3000 W, and rather, all color-coded images in these conditions were almost identical. Additionally, in these conditions, the size of the weld beads, at each welding speed, was almost identical, regardless of the laser power. The growth of the weld bead seems to saturate at a laser power above 3000 W. It is thought that two experimental results, observed when the laser power was more than 3000 W, are related to each other. Table 4 presents the color-coded images of spectrum at all conditions, at a gap of 0.8 mm, and the other configurations except the gap setting are same as those of Table 3. In this case, the pattern of the spectrum intensity was irregular, and the intensity level was smaller, compared to those of Table 3. This result indicates that the irregular geometry of the welding area, caused by the gap, caused a higher irregular reflection of the visible light and laser light. The 3D images (Figure 4) and color-coded images (Tables 3 and 4) may be difficult to be interpret, and their color and form can also change quite drastically, when compared to a referenced color scale and other configurations. Therefore, in this study, we used the color space created by the International Commission on Illumination in 1931 (CIE 1931 color space), to convert the measured spectrum data to a standard form. The measured spectrum data were converted into CIE 1931 XYZ values, and then these values were further converted into CIE 1931 RGB values by Colour, an open-source Python package, providing algorithms and datasets for color science [29]. The RGB format is effective for showing the features of data measured by the spectrometer and it consists of much smaller data converted using the spectrum data, which allows to estimate models and handle data, with less computation time. Additionally, the maximum value of wavelength for each sample was searched and added.

**Table 3.** Color-coded images of spectrum, according to the laser power and welding speed; in each image, the horizontal axis is time (s), the vertical axis is wavelength (nm), and intensity is mapped in color (color scale: Viridis, date from [28]).

**Table 4.** Color-coded images of spectrum at a gap of 0.8 mm according to the laser power and welding speed: in each image, the horizontal axis is time (s), the vertical axis is wavelength (nm), and intensity is mapped in color (color scale: Viridis, data from [28]).

To investigate the effect of the weld penetration on the spectrum intensity, the maximum wavelength and RGB values, at a laser power of 2000 W and different welding speeds, are shown in Figure 7. It is seen that the welding heat input (expressed in kJ/mm) increases, as the welding speed decreases, when the laser power was kept constant. Likewise, the weld penetration increased with increasing heat input, as the welding speed decreased (Table 2). The RGB value, which is converted from the intensity data, decreased when the penetration was increased, which is similar to the results shown in Table 3. It might be inferred that the amount of light reflected from the welding area decreases, as the penetration depth increases, when the laser power is limited to 3000 W, as used in this study. The maximum values of the wavelength were found to be distributed in the range of 500–540 nm, and these values in the case of welding speed 1.5 m/min were slightly lower, when a different welding speed was used. Figure 8 shows the maximum wavelength and RGB values wavelength, at a welding speed of 2.5 m/min, according to different laser powers. The RGB values increased, as the laser power increased, even though the size of weld bead increased due to the high laser power. In addition, the RGB values were almost same, in the conditions of the laser power more than 3000 W. These results were found to be in good agreement, with those of Table 3. The maximum values of wavelength were distributed in the range of 530–540 nm. Figure 9 shows the RGB values and maximum wavelength at a gap of 0.8 mm, and a 3000 W laser power, according to the welding speed. In this case, the maximum wavelength and RGB values were almost same as those shown in Figure 8c, which had conditions of a 3000 W laser power and a 2.5 m/min welding speed. However, overall waveforms of the RGB curves were found to be uneven and irregularly-shaped, and the variations of the RGB and maximum wavelength values were relatively small, as compared to those of the cases when the laser power was above 3000 W. For this reason, the green curve is clearly separated from the red and blue curves, as seen in Figure 9.

**Figure 7.** RGB values and maximum wavelength at laser power of 2000 W: welding speed of (**a**) 1.5 m/min; (**b**) 2.0 m/min; (**c**) 2.5 m/min.

**Figure 8.** RGB values and maximum wavelength at welding speed of 2.5 m/min: laser power of (**a**) 1000 W; (**b**) 2000 W; (**c**) 3000 W; (**d**) 4000 W.

**Figure 9.** RGB values and maximum wavelength, at 0.8 mm gap and 3000 W laser power: welding speed of (**a**) 1.5 m/min; (**b**) 2.0 m/min; (**c**) 2.5 m/min.

### *3.3. Weld Quality Prediction Model*

To predict the weld quality, a DNN model was used as the prediction model. As shown in Figure 10, we modeled a neural architecture, as a seven-hidden-layer DNN, and assigned 256 neurons to each of the hidden layer. The neurons of every preceding layer were fully connected, to those of the succeeding layer. The eight values, which were the average and standard deviation of the RGB values and the maximum wavelength, were used as the inputs to the network (see Nomenclature). Especially, considering the weld size and speed of welding, the model was designed to predict the weld quality, per 0.5 mm of the weld length. The outputs are the four joint types, described in Section 2.3: unwelded (*Y*1), incomplete penetration (*Y*2), full penetration (*Y*3), and unwelded by a gap (*Y*4). The other specifications of the DNN implementation model is summarized in Table 5. All the hidden layers utilized rectified linear unit (ReLU) functions, to calculate their respective intermediate outputs. The output layer had four nodes, and the output layer with the Softmax activation function computed and returned the type probability with respect to each of the output types. The prediction of the weld quality, by the model, was determined based on the type probability. A total of 5400 data sets (4320 training sets and 1080 test sets) were used to generate the DNN model. Each dataset contained the given eight input variables, and four output variables. The backpropagation algorithms were carried out with a batch size of 50, with 500 epochs. Figure 11 shows the training results, including the cost, training accuracy, and test accuracy. After training, the cost value was calculated as 0.2806, the training accuracy was 0.8993, and the test accuracy was 0.9083.

**Figure 10.** Structure of the deep neural network (DNN) model to classify the weld quality.

**Table 5.** Summary of DNN model implementation.

To test the developed model, we produced 100 test datasets, for each class, by carrying out an additional welding experiment. Figure 12 shows the result of testing the developed DNN model using 400 test datasets, the confusion matrix and prediction result according to weld seam length. In Figure 12, the vertical and horizontal axes represent the predicted value of the DNN model and the data sequence, respectively. The four symbols, green, gray, red, and blue, represent the class to which each dataset belongs. It is seen that most of the errors occurred owing to the false prediction of *Y*<sup>2</sup> as *Y*1. That is, 22 of the 100 datasets of class 2 (*Y*2) made false predictions, and among them, the 21 datasets were predicted as class 1 (*Y*1). Although *Y*<sup>1</sup> and *Y*<sup>2</sup> are divided into unwelded and incomplete penetration, respectively, in this study, *Y*<sup>1</sup> and *Y*<sup>2</sup> can be the same case, which is not full penetration. In particular, in the lap joint configuration of the two same metal sheets, if the penetration depth is less than 50% of the sum of the thickness of the two sheets, the weld quality is classified *Y*1. If the penetration depth

is more than 50% but less than the sum of thickness of the two sheets, the weld quality is classified *Y*2. It is considered that this relationship between *Y*<sup>1</sup> and *Y*<sup>2</sup> causes this error. In addition, most errors occurred at the beginning of welding, which could be due to the relatively unstable spectral signal at the beginning of welding. In the case of *Y*4, 9 of the 100 datasets made false predictions. The errors, which occur, by predicting *Y*<sup>4</sup> as the other classes, might be due to excessively irregular signal of *Y*4. In the case of *Y*3, there is no error in predicting the weld quality because its signal was stable and had a distinct distribution in the RGB space. In summary, the biggest prediction error was seen to have occurred in predicting *Y*2. This error could be explained by the relatively small amount of available training data needed to increase the prediction accuracy of *Y*2. That is, it is assumed that there were insufficient training data that otherwise could have made the quality prediction model more accurate in classifying *Y*<sup>2</sup> and *Y*1. As presented in Tables 3 and 4, the range of the welding conditions in which the data for *Y*<sup>2</sup> can be obtained is smaller than that of other classes, and these welding conditions exist in the range of laser power of 1500–2000 W. If sufficient training data is obtained through more detailed experiments in the same range of laser power, the obtained data can reduce the prediction errors by more clearly learning a prediction model the boundary of *Y*<sup>2</sup> and *Y*1.

**Figure 12.** Verification results: (**a**) confusion matrix; (**b**) prediction result according to data sequence.
