## 3 Results and Discussion
### CNN-Based Prediction Model for Classification of Penetration Condition  
#### 3.3.1 CNN Model for Predicting Penetration Condition  
A CNN model was developed to predict the penetration conditions by converting the welding current/voltage into dynamic resistance. Figure 8 and Table 3 depict the model for predicting the penetration condition classification from the dynamic resistance transformed using the STFT. We obtained a random set of 2000 data points, which was divided into a training set of 60% (1200 points), a validation set of 20% (400 points), and a test set of 20% (400 points). The classified dynamic resistance information in the STFT was utilized as the input variable for the operations. The CNN model comprises three convolutional layers and two pooling layers. In the convolutional layers, a kernel size of 3 \(\times\) 3 pixels and a stride of 1 pixel were selected. The kernel size has to be selected to balance computational efficiency and feature extraction capabilities. Smaller kernels reduce the number of network parameters, lowering computational load and mitigating the risk of overfitting. We determined that a 3 \(\times\) 3-pixel kernel size is optimal for the model through preliminary testing and evaluation based on prediction accuracy. ReLU and Softmax activation functions were used, and dropout was applied to some parts of the CNN at a rate of 30% to prevent overfitting between the two functions; the CNN model was trained for 50 epochs. Adam was used as the function for model optimization, whereas cross-entropy was employed as the loss function to obtain the difference between the predicted and actual values. Finally, the performance of the model was evaluated using accuracy as a metric to assess its performance.  
Figure 7: Input/output data preprocessing and data classification: (**a**) convert current/voltage to dynamic resistance and classify output data; and (**b**) STFT conversion of dynamic resistance data to utilize input data.  
The test data can be evaluated using the information from the confusion matrix in Figure 10, which includes the accuracy, precision, recall, and F1-score, as presented in Table 4. Accuracy represents the proportion of correctly predicted instances out of the total data; in this model, the accuracy was 97.7%. Of the 400 test data points, prediction errors occurred for nine data points at the boundary where the actual CJP and burn-through events were observed. Precision measures the proportion of true-positive predictions among all positive predictions made by the classification model. In this case, the precision for class 0, class 1, and class 2 was 100%, 96.2%, and 100%, respectively. Recall represents the proportion of true-positive predictions from all actual positive instances in the dataset. In this context, the recall for class 0, class 1, and class 2 was 100%, 100%, and 86.3%, respectively. The F1-score, the harmonic means of precision and recall, is particularly critical when evaluating model performance in datasets with imbalanced class distributions. It integrates precision and recall, thus preventing one from compensating for the lack of the other. This balanced performance provides significant advantages when applying the model in real-world settings. In this study, the high F1-scores indicate that the CNN model not only effectively predicts challenging penetration conditions in V-groove but welding processes but also handles each class with balanced accuracy. The F1-score, which is the harmonic means of precision and recall, was 100%, 98.1%, and 92.7%, for class 0, class 1, and class 3, respectively. The CNN model developed in this study is suitable for predicting the penetration conditions in GMAW for V-groove but joints with gaps ranging from 1.0 to 2.0 mm based on accuracy, precision, recall, and F1-score. However, if the gap size falls outside the proposed range or if there are changes in the welding process, such as using a flux-cored arc wire, additional data collection and model validation will be necessary.