Laser welding penetration state prediction method based on XGBoost model
By predicting weld penetration status using acoustic feature data based on the XGBoost model, the problem of insufficient monitoring accuracy in existing technologies is solved, achieving high-precision and rapid penetration status identification, applicable to various working conditions, and reducing hardware costs.
Patent Information
- Application Number
- CN202510959883.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-11
- Publication Date
- 2025-11-18
AI Technical Summary
Existing technologies lack sufficient accuracy in monitoring weld penetration and have limited model generalization capabilities, making it difficult to meet application requirements under various working conditions.
A machine learning algorithm based on the XGBoost model is adopted to collect sound signals during the laser welding process through a microphone. By combining feature optimization strategy and SHAP value for feature selection, a high-precision melt penetration state prediction model is established, and real-time prediction is performed using acoustic feature data.
It achieves high-precision and rapid weld penetration status monitoring, is suitable for various working conditions, has high accuracy and strong robustness, and reduces hardware costs.
Smart Images

Figure CN120977334A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of welding monitoring, specifically a laser welding penetration state prediction method based on an XGBoost model. This method collects sound signals during the laser welding process, combines machine learning technology, and realizes real-time monitoring and prediction of the weld penetration state. It is particularly suitable for laser welding processes of materials such as aluminum alloys and can effectively identify penetration and non-penetration states, providing reliable technical support for welding quality control. BACKGROUND
[0002] In recent years, laser welding has been widely used in industrial production due to its high energy density, small heat-affected zone, and fast processing speed. However, due to the high requirements of laser welding technology on workpiece position, welding parameters, clamping precision, and other conditions, defects such as incomplete penetration and poor weld formation may occur during the welding process. These defects can directly lead to unqualified weld quality, increase production costs, and reduce manufacturing efficiency.
[0003] Using sound, light, visual, and other sensing means can monitor the laser welding process, and the monitoring data can be used to judge the weld penetration state. With the development of machine learning technology, machine learning models have been used to judge the weld penetration state. However, the types of machine learning models currently being researched are single, and the application of machine learning technology in the field of welding monitoring still needs to be promoted. SUMMARY
[0004] The present application proposes a laser welding penetration state prediction method based on an XGBoost model, aiming to solve the problems of insufficient monitoring precision and limited model generalization ability in existing technology. This method collects sound signals during the laser welding process, combines advanced machine learning algorithms and feature optimization strategies, and realizes high-precision and real-time prediction of the weld penetration state. It has the advantages of high accuracy, fast speed, and strong applicability to meet the monitoring requirements of weld penetration state under various working conditions.
[0005] The technical solution of the present application is as follows:
[0006] A laser welding penetration state prediction method based on an XGBoost model, comprising the following steps:
[0007] S1: Use a microphone to obtain sound signals during the welding process, ensuring that the signals cover the acoustic characteristics of the entire welding process;
[0008] S2: Perform noise reduction, truncation, and frame preprocessing on the collected original sound signals to improve signal quality and extract effective information;
[0009] S3: Extracting time-domain (such as total energy, root mean square, kurtosis, etc.) and frequency-domain features (such as center of gravity frequency, spectral bandwidth, frequency band power, etc.) from each frame of sound signal, constructing high-dimensional feature dataset, including training and test dataset;
[0010] S4: Establishing a machine learning model based on XGBoost algorithm, training with training dataset, and verifying accuracy with test dataset;
[0011] S5: Calculating the SHAP (Shapley Additive Explanations) average absolute value of the trained XGBoost model.
[0012] S6: Feature selection according to SHAP average absolute value, gradually increasing the number of features and retraining the model to obtain the correlation between model precision and feature number and the optimal XGBoost prediction model.
[0013] S7: Collecting sound signals during actual laser welding process, obtaining signal feature data after preprocessing and feature extraction, inputting the optimal XGBoost model, and obtaining the prediction result of the penetration state.
[0014] On the basis of the above technical scheme, preferably, the step S2 further comprises the following sub-steps:
[0015] S2.1: Denoising the collected sound signal to obtain a denoised signal;
[0016] It should be further pointed out that the main purpose of the denoising process is to weaken the sound pressure of common air knife noise and other noises in the laser welding process. The denoising process mainly includes two steps, the first step is to analyze the noise signal in frequency domain, and the second step is to select a suitable filter to process the noise.
[0017] S2.2: The denoised signal includes welding segment signal and non-welding segment signal, and the welding segment sound signal is intercepted as effective acquisition signal;
[0018] S2.3: According to the requirement of power spectral density estimation and Fourier transform resolution, frame length FL and frame shift FM, the effective acquisition signal is frame processed to obtain sound frame signal.
[0019] It should be further pointed out that the frame length refers to the length of each frame of sound signal, and the frame shift refers to the distance moved each time the frame is divided. Both can be expressed by sound sequence length or duration. The larger the frame length, the higher the frequency resolution when each frame of signal is extracted in frequency domain
[0020] The selection process of frame length FL is as follows:
[0021] Suppose there is a sound signal with a frame length of FL and a sampling frequency of f. The Welch method is used for power spectral density estimation, and the number of Welch segments is set to N, and the length of each signal segment is L.
[0022] The resolution of the power spectral density estimation is The resolution of the fast Fourier transform for each signal segment is The selection of the frame length is related to the resolutions r1 and r2 of the power spectral density estimation and the fast Fourier transform, and the frame length
[0023]
[0024] In addition, for the convenience of computer calculation, the frame length is generally a power of 2.
[0025] The frame shift is usually half of the frame length, that is, On the basis of the above technical scheme, preferably, the step S3 further comprises the following sub-steps:
[0026] S3.1: Extracting the time-domain features of each frame of sound signal, including but not limited to: total energy, minimum value, maximum value, standard deviation, variance, range, average value, skewness, kurtosis, root mean square, waveform factor, peak factor, pulse factor, and margin factor. S3.2: Extracting the frequency-domain features of each frame of sound signal, including but not limited to: center of gravity frequency, average frequency, root mean square frequency, frequency variance, spectral bandwidth, spectral attenuation, spectral flatness, spectral contrast, and frequency band power.
[0027] It should be further explained that the frequency band power represents the power in the selected frequency range, which is obtained by integrating the power spectral density estimation of the sound frame signal in the selected frequency range, and the calculation formula is as follows.
[0028]
[0029] Where P(f) represents the power spectral density estimation of the sound frame signal, and the integration of the frequency range [f1, f2] gives the frequency band power bp(f) in the frequency range.
[0030] S3.3: Aligning the time-domain features, frequency-domain features, and penetration state labels of each frame of sound signal to obtain a data set.
[0031] S3.4: Randomly shuffling the data set and dividing it into a training data set and a test data set in a ratio of 4:1. On the basis of the above technical scheme, preferably, the step S4 further comprises the following sub-steps:
[0032] S4.1: Build the XGBoost model and initialize the hyperparameters. The initial hyperparameters include, but are not limited to: number of iterations, minimum sum of leaf node weights, maximum tree depth, penalty term coefficient, row sampling rate, column sampling rate, L1 regularization coefficient, L2 regularization coefficient, and learning rate.
[0033] S4.2: Define the hyperparameter space, use methods such as grid search, random search, and Bayesian optimization to find the optimal hyperparameters of the model in the hyperparameter space, and use the optimal hyperparameters to train the model;
[0034] It should be further noted that the categories of hyperparameters in the hyperparameter space include, but are not limited to: number of iterations, minimum sum of leaf node weights, maximum depth of the tree, penalty term coefficient, row sampling rate, column sampling rate, L1 regularization coefficient, L2 regularization coefficient, and learning rate.
[0035] S4.3: Validate the trained XGBoost model on the test dataset and obtain the model's accuracy on the test dataset.
[0036] Based on the above technical solution, preferably, step S5 further includes the following sub-steps:
[0037] S5.1: Calculate the SHAP values for all features on the training dataset, with each feature corresponding to a sequence of SHAP values {x1, x2, ..., x...}. n ,}。 Where, x n This represents the influence of feature F on the model output in the nth sample.
[0038] S5.2: Sequence the SHAP values of each feature {x1, x2, ..., x} n After taking the absolute value, calculate the average value to obtain the mean absolute SHAP value (MS) of each feature. The calculation formula is as follows.
[0039]
[0040] The SHAP absolute mean (MS) is used to measure the importance of the extracted features to the model results.
[0041] Based on the above technical solutions, preferably, step S6 further includes the following sub-steps:
[0042] S6.1: Sort the features in descending order based on the mean absolute SHAP value of each feature. Features ranked higher are considered more important for model training.
[0043] S6.2: Feature selection is performed based on the average absolute value of SHAP, and the XGBoost model is retrained by gradually increasing the number of features. It should be further noted that the features are sorted in descending order according to the average absolute value of SHAP, resulting in the sequence {F1, F2, ... F...}. n}. Among them, F i Let i represent the feature with rank i, where i = 1, 2, ..., n.
[0044] Retrain the XGBoost model with an increasing number of features N (N = 1, 2, ..., n), prioritizing the use of sequences {F1, F2, ..., Fn}. n The features that are at the forefront are used for training by repeating step S4.
[0045] Record the accuracy of the XGBoost model on the test dataset to obtain the accuracy sequence {A1, A2, ..., A...}. n}, where A i This represents the accuracy of the XGBoost model built using the number of features N (N=i) on the test dataset.
[0046] S6.3: To ensure the robustness of the results, M models are repeatedly trained for each number of features, and their average values are calculated and compared to obtain a series of models with the highest average accuracy. The optimal XGBoost model is obtained by finding the XGBoost model with the highest accuracy among them.
[0047] It should be further noted that M (M = 1, 2, ..., m) models are repeatedly trained for each number of features to obtain the accuracy sequence {A} corresponding to each number of features. i1 A i2 ,…,A im}, where A ij This represents the accuracy of the j-th model when repeatedly trained with N (N=i) features.
[0048] Calculate their average to obtain the average accuracy for each number of features. Comparison of average accuracy results We obtained a series of models with the highest average accuracy.
[0049] Compared to existing technologies, it has the following advantages:
[0050] (1) This invention uses a microphone to collect acoustic signals during the laser welding process, and obtains acoustic feature data after preprocessing and feature extraction. Finally, the weld penetration state is predicted based on the acoustic feature data. Among these features, acoustic signals are easy to collect, the collection equipment is simple, and the cost is low. The acoustic feature data occupies little memory, has low hardware requirements for training models, and is more versatile.
[0051] (2) The present application is based on the XGBoost model to predict the weld penetration state, and the sound characteristic data is used as the input and the penetration state is used as the output. The XGBoost model searches for the optimal hyperparameters in the hyperparameter space through grid search, random search, Bayesian optimization and the like, and has the advantages of high accuracy.
[0052] (3) The present application is based on SHAP value for feature screening, and the correlation between model accuracy and feature quantity is obtained after repeated verification, and finally the optimal XGBoost model is selected according to the correlation. The optimal XGBoost model has the advantages of high accuracy and strong robustness. BRIEF DESCRIPTION OF DRAWINGS
[0053] Figure 1 is a flow chart of the method of the present application.
[0054] Figure 2 is a schematic diagram of the frequency range corresponding to each frequency band power feature.
[0055] Figure 3 is a distribution diagram of the top 5 features in SHAP average absolute value ranking.
[0056] Figure 4 is a graph of the relationship between the accuracy of the XGBoost model and the number of features. DETAILED DESCRIPTION
[0057] The following will be described taking the monitoring of the penetration state of the aluminum alloy laser self-melting welding process as an example, as shown in Figure 1 The specific implementation steps are as follows:
[0058] Step 1, use a microphone to collect the sound signal of the laser welding process;
[0059] In this embodiment, the experimental workpiece is 6063 aluminum alloy, and the size is: 150mmx50mmx2.4mm. The welding experiment parameters are 3 groups, as shown in Table 1, Table 1
[0060] Number Laser power (W) Welding speed (mm / s) Penetration state 1 3000 50 Penetration 2 2500 50 No penetration 3 3000 60 Penetration
[0061] Among them, 5 experiments are repeated under each group of experimental parameters.
[0062] In this embodiment, the sampling frequency of the microphone is 48kHz, the distance between the placement position and the laser welding position is 30cm in horizontal and vertical directions, and the microphone points to the laser welding position. Start collecting signals before the laser welding starts, and continue collecting for 10 seconds, which contains the complete laser welding process.
[0063] Step 2, denoising, intercepting and framing preprocessing are performed on the collected sound signal;
[0064] In this embodiment, the sound signal is denoised using the pre-emphasis method, and the main purpose is to weaken the air knife noise in the welding process. The sound signal of the welding section is intercepted after denoising, and the time length of the intercepted sound signal is about 2.6s. The intercepted signal is processed by frame, and the frame length is 4096 sampling points and the frame shift is 2048 sampling points.
[0065] Step 3, extract time domain and frequency domain features for each frame of sound signal, and construct training and test data sets;
[0066] In this embodiment, 16 time domain features are extracted for each frame of sound signal, including total energy, minimum value, maximum value, standard deviation, variance, range, average value, skewness, kurtosis, root mean square, waveform factor, peak factor, pulse factor, and margin factor. And 20 frequency domain features are extracted for each frame of sound signal, including center of gravity frequency, average frequency, root mean square frequency, frequency variance, spectral bandwidth, spectral attenuation, spectral flatness, spectral contrast, and frequency band power. Among them, the frequency band power is 12 features. Each feature corresponds to a 2kHz frequency range, and the frequency ranges corresponding to the 12 features are uniformly divided in [0, 24kHz], as shown in the following table. Figure 2
[0067] According to the signal source, the penetration state label of each frame of sound signal is labeled. The welds under the conditions of No. 1 and No. 3 are penetrated, and the corresponding sound signals are labeled as 1. The welds under the condition of No. 2 are not penetrated, and the corresponding sound signals are labeled as 0. Finally, 750 sound samples are obtained, each sample corresponds to 36 feature values and a penetration state label.
[0068] Step 4, establish a machine learning model based on XGBoost algorithm, and use the training data set for training, and use the test data set for verification;
[0069] In this embodiment, the XGBoost model is established, and the initialization of the hyperparameters includes: the number of iterations n_estimators=100, the minimum leaf node weight min_child_weight=1, the maximum depth of the tree max_depth=3, the penalty term coefficient gamma=0, the row sampling rate subsample=0.8, the column sampling rate colsample_bytree=0.8, the L1 regularization coefficient reg_alpha=0, and the L2 regularization coefficient reg_lambda=1.
[0070] In this embodiment, the hyperparameter space is: the number of iterations n_estimators∈{100, 150, 200}, the minimum leaf node weight min_child_weight∈{1, 3}, the maximum depth of the tree max_depth∈{3, 5, 8}, and the penalty term coefficient gamma∈{0, 0.1, 0.2}. The optimal hyperparameter combination is obtained in the hyperparameter space by the grid search algorithm, and is used to train the XGBoost model to obtain the optimal XGBoost model, which has an accuracy of 95.27% on the test set.
[0071] Step 5, calculate the SHAP average absolute value of the trained XGBoost model;
[0072] In this embodiment, the SHAP value is calculated on the training data set, and the absolute value and the average value are processed in sequence to obtain the SHAP average absolute value. Then, the features are sorted in descending order according to the SHAP average absolute value, and the top 5 features are as shown in Figure 3
[0073] Step 6, feature selection according to the SHAP average absolute value, gradually increasing the number of features and training the model again. Repeat training 10 models under each number of features to obtain the correlation between the average accuracy of the model and the number of features, as shown in Figure 4 The results show that when the XGBoost model is trained using the 10 features with the largest SHAP average absolute value, the average accuracy of the model on the test data set is the highest, reaching 95.33%. Among the 10 models trained repeatedly using 10 features, the optimal XGBoost accuracy is 96.7%.
[0074] Step 7, in the actual welding process, the acoustic signal is collected and preprocessed and feature extraction to obtain signal feature data, which is input into the optimal XGBoost model to obtain the prediction result of the penetration state.
[0075] This embodiment proves that the method of the present application can achieve a penetration state recognition accuracy higher than 95%, a real-time response speed lower than 50ms, and strong robustness to welding parameter fluctuations in aluminum alloy laser welding.
[0076] The above only describes the preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed by the present application can be easily thought of by those skilled in the art, and should be covered within the protection scope of the present application.
Claims
1. A method for predicting a laser welding penetration state based on an XGBoost model, characterized in that: The method comprises the following steps: S1: Real-time acquisition of sound signals during laser welding by microphone, the microphone has a frequency response range of 20Hz-20kHz, and is placed 30±5cm away from the laser welding point in both horizontal and vertical directions; S2: Noise reduction, interception and frame preprocessing of the collected sound signals; S3: Parallel extraction of time domain and frequency domain features of each frame of preprocessed sound signals, construction of a dataset including a training dataset and a test dataset according to the extracted features and penetration state labels; S4: Establishment of an initial prediction model based on the XGBoost algorithm, training using the training dataset, and verification of the model accuracy on the test dataset; S5: Calculation of the SHAP average absolute value of each feature of the trained XGBoost model; S6: Feature selection according to the SHAP average absolute value, gradual increase in the number of features, retraining of the model, determination of the optimal feature combination and the corresponding optimal XGBoost model; S7: Input of the optimal feature subset and the corresponding hyperparameter combination into the XGBoost model to obtain a final penetration state prediction model; S8: Real-time acquisition of sound signals during actual welding and execution of the preprocessing and feature extraction steps S2-S3, input of the features into the final prediction model and output of the penetration state.
2. The method of claim 1, wherein the XGBoost model is based on a laser welding penetration state prediction model. In step S2, the noise reduction processing comprises: Frequency domain analysis of the noise signal to determine the main frequency range of the noise; Selection of a filtering method based on the determined main frequency range of the noise, wherein a pre-emphasis method is preferably used to process the air knife noise.
3. The method of claim 1, wherein the XGBoost model is based on a laser welding penetration state prediction model. In step S2, the frame processing uses a frame length FL and a frame shift FM, wherein the frame length FL refers to the length of each frame of sound signals, and the frame shift FM refers to the distance moved each time the frame is divided, both of which can be expressed in terms of the length or duration of the sound sequence. The larger the frame length, the higher the frequency resolution when performing frequency domain feature extraction on each frame of signal The calculation formula of the frame length FL is as follows: where f is the sampling frequency, r1 is the resolution of the power spectral density estimate, r2 is the resolution of the fast Fourier transform, and 4. The method of claim 1, wherein the XGBoost model is based on a laser welding penetration state prediction method, characterized by, In step S3, the time domain features include total energy, minimum value, maximum value, standard deviation, variance, range, average value, skewness, kurtosis, root mean square, waveform factor, peak factor, pulse factor, and margin factor; the frequency domain features include center of gravity frequency, average frequency, root mean square frequency, frequency variance, spectral bandwidth, spectral attenuation, spectral flatness, spectral contrast, and frequency band power; wherein the frequency band power represents the power in the selected frequency range, which is obtained by integrating the power spectral density estimate of the sound frame signal in the selected frequency range, and its calculation formula is as follows. Wherein P(f) represents the power spectral density estimate function of the sound frame signal, which is integrated in the frequency range [f1, f2] to obtain the frequency band power bp(f) in the frequency range.
5. The method of claim 1, wherein the XGBoost model is based on a laser welding penetration state prediction method, characterized by, In step S4, the XGBoost model uses grid search, random search, Bayesian optimization and other methods to search for optimal hyperparameters in the hyperparameter space and use them to train the model, and the hyperparameter categories in the hyperparameter space include but are not limited to the number of iterations, the minimum leaf node weight sum, the maximum depth of the tree, the penalty term coefficient, the row sampling rate, the column sampling rate, the L1 regularization coefficient, the L2 regularization coefficient, and the learning rate.
6. The method of claim 1, wherein the XGBoost model is based on a laser welding penetration state prediction model. In step S5, the SHAP average absolute value of each feature of the trained XGBoost model is calculated, including: For each feature F, first calculate its SHAP value sequence {x1, x2, ..., x n ,}。 Where, x n This represents the influence of feature F on the model output in the nth sample; The SHAP value sequence is taken to absolute value processing, and then the average value is calculated to obtain the SHAP average absolute value MS. The SHAP absolute average value is used to measure the importance of the extracted features to the model result, and the result is calculated on the training data set.
7. The method of claim 1, wherein the XGBoost model is based on a laser welding penetration state prediction method, characterized by, In step S6, feature screening is performed according to the SHAP average absolute value, the number of features is gradually increased, and the model is trained again, including: According to the SHAP average absolute value, the features are ranked in descending order to obtain a sequence {F1, F2,…, F n}, wherein F i represents the feature ranked i, i=1, 2,…n; The XGBoost model is retrained using an increasing number of features N (N = 1, 2, …, n), with preference given to features early in the sequence {F1, F2, …, Fn} and the training process is repeated step S4. n} record the accuracy of the XGBoost model on the test dataset to obtain an accuracy sequence {A1, A2, …, N} n}, wherein A i represents the accuracy of the XGBoost model constructed using the feature number N (N = i) on the test dataset; Repeat training M (M = 1, 2, …, m) models under each feature quantity, get the accuracy sequence corresponding to each feature quantity {A i1 ,A i2 ,…,A im}, where A ij represents the accuracy of the jth model repeatedly trained using the feature quantity N (N = i); calculate the average value to get the average accuracy under each feature quantity Compare the average accuracy results Get the series model with the highest average accuracy; The XGBoost model with the highest accuracy is found in the series of models with the highest average accuracy, and the optimal XGBoost model is obtained.