An artificial neural network approach for parametric study on welding defect classification

In this paper, a welding defect prediction model has been developed and investigated through training an artificial neural network (ANN) based model. The input data were three welding process measurements (welding current, travel speed, and protective gas flow). The output data were non-destructive test results of respective weldments on four defect types (underfill, lack of penetration,incomplete fusion, and porosity) to ensure the consistency of the welding following the designed parameters; all data were obtained from 289 specimens produced by an automated GMAW welding manufacturing system. The 2-stages model comprises 13 inputs, hidden layers with 80–100 neurons and 4 outputs. The outputs were used to evaluate the classification accuracy in the confusion matrix for the prediction of weld quality. A further 73 specimens were used to test the accuracy of the trained ANN model. The model achieved 85% accuracy.


Introduction
GMAW welding is one of the most widely used processes in shipbuilding, automobile manufacturing, and especially for section prefabrication in construction industry. GMAW using externally supplied gas or gas mixture as shielding to minimize contact of the molten metal with air as the constituent of air such oxygen and nitrogen is reactive with metal in high temperature seriously damage the strength and toughness of the weld joint. There is a continuous market demand for a master welder in different industries. Application of a welding robot would alleviate the situation on the problem raised by the heavy workload of the welders and man-power limitation. However, welded joint inspection is still needed to be undertaken by the skilled welder/inspector. Both destructive testing (DT) and non-destructive testing (NDT) are used for quality control of the welding in the construction industry. Destructive testing of welds includes macro etch testing, fillet weld break test, transverse tension test, and guided bend test. For example, visual surface inspection is needed for every welded joint; ultrasonic inspection and eddy current testing are employed to test on-site. Other testing such as acoustic emission, magnetic particle inspection, and cross-sectional inspection through an optical microscope and radiographic imaging are used frequently as well in the laboratory for welded samples. These tests are known as a manual operation which is time-consuming and laborintensive. With the increase of application of robotic welding, a high requirement of automated, systematic, and speedy sample quality checking is put forward.
Although the quality of welding could be estimated or modeled by welding input parameters, welding processes are non-linear complex systems with multiple input/output correlated parameters. Owing to this, the experiences for the determination of critical parameters play a very significant role in monitoring the quality of the final welded structure. Artificial intelligence for interconnecting the elements with highly hierarchical design could be applied as a tool to analyze the welding parameters for incorporating knowledge in welding technology, to eliminate some tests, and thus to achieve faster defect classification.
Several researchers have studied the optimization and prediction of GMAW subtype MAG welding process parameters. Achebo and Amberar and Wadhokar optimize the input parameters including welding current, travel speed, and other variables against mechanical properties through the Taguchi method [1,2].
It is one of today's most rapidly growing technical fields, lying at the intersection of computer science and statistics, and the core of artificial intelligence and data science [3,4]. An ANN is a learning system based on a computational technique, which attempts to simulate human intuition in making decisions and drawing conclusions when presented with complex, noisy, irrelevant, and partial information [5,6]. An ANN is a data-driven self-adaptive method and able to approximate any reasonable function arbitrarily well. The ability of an ANN to learn and generalize the behavior of any complex and non-linear process makes it a powerful modeling tool [7]. Haken et al. predicted the tensile strength, impact strength, elongation, and hardness from welding input variable gas mixtures through artificial neural networks [8]. Kumar et al. applied the ANN to optimize the MIG welding parameters welding current, voltage, and travel speed through output parameters' ultimate tensile strength [9]. Patel et al. developed an ANN model to predict the weld height through the input variables: welding current, welding speed, and gas flow rate [10]. Teimouri and Baseri studied the relationship of input and output results of friction stir welding through developing artificial neural networks [5].
However, limited studies have been conducted to discuss the relationship between the current (taking the fluctuation of the current during the welding into account, welding speed and gas flow, and the welding defect classification. In this paper, an ANN model is proposed for prediction of welding defect and optimization for the welding parameters in MAG welding to prevent the domination of the current to gas flow and welding speed; a two-stage network has been designed for further investigation.

Methodology
To control the welding quality, the automated MAG specimen welding system was designed and developed. Figure 1 is the automated MAG welding testbed. The main components in the system include (1) an industrial MAG welder with calibrated control of filler feed rate, voltage, and current; (2) an automated modular drive system to move the welding torch of (1) at preset velocity; (3) a specimen fixture is designed to position the parts for welding and secure the geometry of the product parts; (4) two welding cameras to capture the video image of weld pool from two field-ofviews; (5) a gas flow regulator to control the shielding-gas flow at preset rate; and (6) a process control and data logging system to control the operation of different components and capture the test data for further analysis.
The welding parameters were welding current of 200A, wire feed speed of 7 m/min, wire diameter of 1.2 mm, and shielding gas M21 Ar + 15-20% CO 2 of 12 L min.
The specimen geometry (Fig. 2) and preparation are conformed to ISO 9692-1 "Welding and allied processes -Types of joint preparation -Part 1: Manual metal arc welding, gas-shielded metal arc welding, gas welding, TIG welding and beam welding of steels". The material is 50 mm × 140 mm × 6 mm mild steel plate with one backing strip 25 mm × 140 mm × 6 mm [11].
A design of experiments (DOE) was created to vary three input process parameters: current, welding speed, and gas flow. A total of 362 samples were prepared and tested for ANN training and testing. Table 1 shows the parameters used in this study and its range. The data logger recorded the current at a rate of 1 Hz, and the data were divided into 11 groups. The mean of each group of data was obtained as the input variable for AI training. The travel speed was filed, and gas flow was measured through a gas flow regulator.
After the welding, a visual inspection is conducted using Wiki-scan to measure the bead width and height through laser sensor technology. Using AWS D1.1 chapter 6 [12] and ISO16811:2012 [13] as a reference, the SONATEST VEO + 16:64 PAUT flaw detector was used with Olympus phased-array probe 5 MHz, 16 elements, and 0.6 mm pitch probe for UT non-destructive testing. Angle beam examination (transverse wave) using high frequency sound waves by angle beam transducers and wedges was performed to conduct the examinations and make the measurement. Standard small footprint wedge SA10P-N55S was applied to provide a specific angle and transducer designed for weld joint inspection for detecting the flaws and sizing of weld defect. Sectional scan images in 10 mm were captured and stored for defect recognition. A scanning fixture was designed and tailor-made to control the scanning distance and minimize the extraneous damping. It takes the groove scan plus an extra 6 dB as reference dB. Currently, 45 dB is adjusted to perform the ultrasonic testing of the specimens. The procedures of the ultrasonic inspection were guided by ISO 13588:2019 (E) [14]. Due to the risk of delayed cracking, a period of at least 48 h is generally required before the final inspection is made of as-welded fabrications. Fixed angles at fixed probe position to weld were performed on both sides of the weld.

Result and discussion
According to ISO 17635:2016 [15], welded joints should typically be tested and evaluated by visual testing, before testing for internal discontinuities. The weld bead profile parameters such as width and height were measured by WiKi-Scan (laser scan), to specify the quality level of imperfections (BS EN ISO 5817:2014) [3]. The weld defects including underfill and undercut were verified by observation and laser scanning. Other surface defects such as burn through and spatter were checked through visual inspection.  Table 2).
For each specimen, 22 ultrasonic images in total will be captured from both the left and right sides of the welding.   Each image corresponds to a specific section of the welding with a length of 10 mm. Therefore, the samples were divided into14 sections, and only 3rd to 13th images were used (11 images) which is match with the number of the current data. For simplifying the data formatting, "2" for very poor defect, "1" for fair defect and "0" for the proper and clean weld were used to classified the severity of the indication. The severity is based on the intensity of imperfection. Then, it will have 22 imperfection values for each of the specimens, and here comes the methodology of deciding whether the whole sample is defective or clean. Among 362 welded samples, there are 194 samples which include lack of penetration, 143 samples include lack of fusion, 189 samples include porosity, and 125 samples include underfill. The acceptance of weld discontinuity is determined based on its indication rating and its length, following ISO 17640 [3] and AWS D1.1/D1.1 M. Four levels of acceptances including large, medium, small, and minor are applied to classify the discontinuity. Those discontinuities classified as class A to class D referred to large, medium, small, and minor are necessary to be recorded in the test report. Table 3 is the indication of imperfections in samples.
Data including welding current captured through realtime data logging and defect classified through laser scanning, visual and UT inspection is pro-processed. [1 × 13] array was created for each specimen and the welding process parameters including current, welding speed, and gas flow were assigned to an element in an array.
The collection of the data was completed based on two data logs: machine log data and route card data. Welding process parameters which takes as input datasets and is matched with the UT testing result which takes as output dataset for the network by every section in 10 mm. Welding current was captured by data logger with 0.1 s. Therefore, a simple python script was designed that will help us to manage all input dataset and output datasets. Basically, the program script was executed to extract all data in the input dataset, and the welding current values were stored for each sample individually. After that, an array splitter was used to partition the current data of each sample into 11 arrays. The arithmetic mean of each array was measured and as the first 11 elements of the input dataset [1 × 13] array of each specimen.
Consequently, the welding speed value for every sample is extracted from the microcontroller log and assigned as the 12th element of the [1 × 13] array. The amount of gas  (Table 4). And the gas flow is recorded by the analogical input. Weld defect data were obtained from surface and ultrasonic inspection and assigned by Python script as the known output values as a vector from a collected dataset. Meanwhile, the outputs are classified as 1 or 0 for such defects as incomplete penetration, incomplete fusion, porosity, and underfill.
The two-stage ANN model is developed and depicted in Fig. 5. The ANN model consists of an input layer, a hidden layer, and an output layer. The input is multiplied by the weight associated with the synapse connecting the input to the current neuron. As there are 11 current inputs, 1 welding speed input, and 1 gas flow input, the data of the current may dominate the prediction. Therefore, to balance the importance of the 3 parameters, two-stage ANN model has been developed. The model was separated into 3 parts including "right input", "left input", and "concatenate". Right input supports processing the current data to obtain a result between "0" and "1". Left input supports processing the gas flow and welding speed data to obtain two outputs; the outputs are the number between "0" and "1". Three outputs were obtained as input for prediction on welding defect.
Network optimization can be conducted to optimize network hyperparameters for improving network performance and accuracy. The final output results obtained from the  neural network are the probabilities of the outcomes. The overall hyperparameters of ANN are depicted in Table 2.
Neural networks apply a non-linear activation function to support the network to learn complex data and provide accurate predictions. Using leaky ReLU will provide a faster and higher overall accuracy training which is suitable for training with many input neuron models. Tanh's deviate is steeper, which means it can obtain more value and such function is more efficient because it has a wider range for faster learning and grading [16]. The sigmoid function is commonly used especially for the case in which output is multi-class classification. Using the sigmoid activation in the second stage produces the outputs with the result in [0,1]. The output of the network ranged between 0 and 1. "0" indicates that the corresponding specimen includes "no defect", and 1 means the corresponding specimen with "defect'. Stochastic gradient descent (SGD) optimization was selected for the optimal solution, which is easier and faster to local near the minimum and supportive on local minimum removal. Binary crossentropy is a loss function that is used in binary classification because the target of the studt is either 0 or 1 (defect or clean weld). To control the number of training samples to work through, the batch size was set to 64. The larger initial epochs were set to 1200 and finally set to base on the training and validation accuracy per epoch in the finalized ANN model depicted. Randomly draw samples function from a Gaussian distribution is used for sampling.
The results of the ANN model are shown in Table 5. The ANN model correctly predicts that the positive class is 54.5% (true positive, i.e., sample with the defect is classified as defective). The model incorrectly predicts that the positive class is 8.9% (false positive, i.e., sample without defect is classified as defective). The model correctly predicts the negative class is 30.1% (true negative, the clean weld is classified as nondefective). The model incorrectly predicts the negative class is   Figure 6 shows that the training and validation datasets are suitably representative of the problem domain. Figure 7 is the training curve and the validation loss for the ANN model with binary cross entropy under 800 epochs. The training was stopped at 750 epochs once the model performance stops improving  Figure 7 depicts the tendency of the model to be overfitting.
A user interface has been designed and tailor-made to support the application of the AI system. The first function of the interface is generating the optimized welding parameters using the developed AI system. Figure 8 shows a control panel prototype created for generating the optimized welding parameters based on input either current, speed, or flow rate. For example, input the current will generate the speed and flow based on the AI prediction. Moreover, the user interface can be used through the developed AI system, classifying the potential defects which may be occurred in the welded pieces. The layout of the user interface is shown in Fig. 9; current, speed, and flow rate must be entered by the user to obtain the AI-based welding defect prediction.

Conclusion
In this paper, a welding defect prediction model has been developed and investigated through training an artificial neural network (ANN) based model. The input data were three welding process measurements (welding current, travel speed, and protective gas flow). The output data were non-destructive test results of respective weldments on four defect types (underfill, lack of penetration, incomplete fusion, and porosity) to ensure the consistency of the welding following the designed parameters; all data were obtained from 289 specimens produced by an automated MAG welding manufacturing system. The 2-stages model including 13 inputs, hidden layers with 80-100 neurons and 4 outputs was develop. The outputs were used to evaluate the classification accuracy in the confusion matrix for the prediction of weld quality. A further 73 specimens were used to test the accuracy of the trained ANN model. The model achieved 85% accuracy.