Disclosure of Invention
In order to solve the problems existing in the traditional automobile body welding quality control, the invention provides an LSTM model-based automobile body welding process quality grading prediction method and device, which can collect welding change parameters provided by a welding quality integrated management system in real time according to various factors such as the environment of a welding field, the urgency of equipment and business requirements and the like, and quickly lock the origin of a welding problem through quality grading prediction, thereby quickly making solution and optimization measures, improving the maintenance accuracy, reducing the maintenance time, labor cost, spare part cost and the like.
According to one aspect of the invention, an LSTM model-based automobile body welding process quality score prediction method is provided, which comprises the following steps:
s1: collecting welding spot quality sample data, and performing data restoration and normalization processing to obtain welding spot quality sample data after normalization processing;
s2: performing characteristic relative importance analysis on the welding spot quality sample data after the normalization processing through a preset importance analysis model, and extracting characteristic parameters with strong correlation;
s3: dividing the characteristic parameters with strong correlation into a training data set and a testing data set;
s4: training the LSTM model through the training data set, and obtaining a trained LSTM model after the training is finished;
s5: testing the trained LSTM model through the test data set, and obtaining an optimal LSTM model after the testing is finished;
s6: and (4) carrying out grading prediction on the welding process quality of the automobile body through the optimal LSTM model, and outputting a prediction result.
Preferably, in step S1, the weld spot quality sample data includes: welding spot information parameters, environmental parameters, welding equipment parameters and quality scoring parameters.
Preferably, step S2 includes:
s21: acquiring a LightGBM model and initializing network parameters;
s22: dividing the welding spot quality sample data into a second training data set and a second testing data set;
s23: training the LightGBM model through the second training data set, searching for optimal network parameters through a grid search algorithm in the training process, performing network test through the second test data set, and obtaining the trained LightGBM model if the test result reaches a preset value;
s24: performing characteristic relative importance analysis on the welding spot quality sample data through the trained LightGBM model to obtain a characteristic table influencing the relevance of a model prediction target;
s25: and extracting characteristic parameters of the K-before-relevance rank from the characteristic table for predicting the welding quality score.
Preferably, step S2 includes:
s21: acquiring an XGboost model and initializing network parameters;
s22: dividing the welding spot quality sample data into a second training data set and a second testing data set;
s23: the XGboost model is trained through the second training data set, in the training process, the optimal network parameters are searched through a grid search algorithm, network testing is conducted through the second testing data set, and if the testing result reaches a preset value, the trained XGboost model is obtained;
s24: performing characteristic relative importance analysis on the quality sample data of the welding spot through the trained XGboost model to obtain a characteristic table influencing the relevance of a model prediction target;
s25: and extracting characteristic parameters of the K-before-relevance rank from the characteristic table for predicting the welding quality score.
Preferably, in the process of training and testing the LSTM model by the training data set and the testing data set, the LSTM model is optimized by adopting a sparrow search algorithm, Dropout parameters and regular terms are added to avoid overfitting, and a weight is optimized by adopting an Adam optimization method.
According to a second aspect of the present invention, the present invention further provides an apparatus for predicting quality score of welding process of automobile body based on LSTM model, comprising the following modules:
the sample acquisition and pretreatment module is used for acquiring welding spot quality sample data and carrying out data restoration and normalization processing to obtain the welding spot quality sample data after the normalization processing;
the characteristic parameter extraction module is used for carrying out characteristic relative importance analysis on the welding spot quality sample data after the normalization processing through a preset importance analysis model and extracting characteristic parameters with strong correlation;
the data set dividing module is used for dividing the characteristic parameters with strong correlation into a training data set and a testing data set;
the model training module is used for training the LSTM model through the training data set, and obtaining the well-trained LSTM model after the training is finished;
the model testing module is used for testing the trained LSTM model through the testing data set, and obtaining an optimal LSTM model after the testing is finished;
and the scoring prediction module is used for scoring and predicting the welding process quality of the automobile body through the optimal LSTM model and outputting a prediction result.
Preferably, the preset importance analysis model includes any one of a LightGBM model and an XGBoost model.
The technical scheme provided by the invention has the beneficial effects that:
the prediction model of the LSTM deep learning is established, the characteristic that the deep neural network has memory on long sequence data is utilized, and the defects that the traditional prediction model is easy to fall into a local minimum value, low in convergence speed, poor in generalization and the like are overcome, so that the accurate prediction on the quality score of the automobile body welding process is realized. Welding change parameters provided by the welding quality integrated management system can be collected in real time according to various factors such as the urgency of the environment, equipment and business requirements of a welding site, and the emergence of welding problems can be quickly locked through quality scoring prediction, so that the solution and optimization measures can be quickly formulated, the maintenance accuracy is improved, the maintenance time, the labor cost, the spare part cost and the like are reduced.
Detailed Description
For a more clear understanding of the technical features, objects and effects of the present invention, embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
Specifically, in the present embodiment, the quality score prediction of the electric resistance welding process of the automobile body is explained in detail. In some embodiments, other weld (arc, submerged arc, gas, etc.) quality of the vehicle body may also be scored and predicted, similar to the present embodiment.
First, the present embodiment adopts a dynamic signal detection device installed on a resistance spot welding machine of an automobile body, which can realize real-time monitoring of various information such as welding current, electrode pressure, dynamic resistance, and the like.
As shown in FIG. 1, FIG. 1 is a logic diagram of the invented LSTM model-based automobile body resistance welding process quality score prediction device;
generally, a welding gun is used as a tool in the welding and manufacturing process of an automobile body, two or more than two kinds of metal materials of the same kind or different kinds are connected into a whole in a welding spot mode through the combination and diffusion between atoms or molecules, so the quality of the welding spot greatly influences the overall quality of the automobile, a complete welding process comprises three stages of metal lamination compactness, metal heating and melting and welding nucleus formation and welding completion, the total time consumption is about 400ms, whether the welding seam quality is qualified or not can be observed by professionals after the welding is completed, the general welding seam quality confirmation standards comprise welding spot splashing, false welding, welding leakage, welding penetration and the like, if the quality is unqualified, the welding spot is timely returned to be welded, welding equipment is timely replaced, or equipment is maintained to reduce the production loss. However, the efficiency is lower and lower by manually detecting whether the welding process quality is qualified, and the requirement for improving the production efficiency is difficult to meet.
The automobile body resistance welding spot welding system completes real-time production control, original welding data acquisition and format generation on a production line through a line edge machine, the line edge machine acquires original welding data and determines the type of the data acquired by the automobile body resistance welding line edge machine, and specifically, as an example, the data input to the data analysis unit for data analysis may include the following contents:
1) the parameters of the resistance spot welding process comprise welding time, welding current, welding resistance waveform, welding energy, welding time, welding voltage, welding heat and the like;
2) the information parameters of the welding spots comprise unit numbers, welding gun batch types, welding gun positions, fault types, welding scores and the like.
After the welding spot process parameters and the information parameters are obtained by the line edge machine, the information parameters are transmitted to the server through the FTP transmission protocol, and the server receives the data and stores the welding spot process parameters and the information parameter data into the database in a specified format.
Example 1: taking LightGBM model as an example
As shown in fig. 2, a LightGBM model is deployed on an online server, and the LightGBM model can identify a path of a data feature value transmitted to the server, and determine whether new data exists and what new data is generated by reading the feature value data on the fixed path in real time; if new data generation is found, tracking an identification scheme corresponding to the type of the welding spot in real time, extracting a characteristic data set, generating a data screening file and storing the data screening file to a fixed path; if not found, the online system is not triggered to perform the feature relative importance selection model.
After collected welding spot information data pass through a LightGBM model, characteristic value parameters are generated, the characteristic value parameters are stored in a welding spot information database, meanwhile, a system detects that new characteristic data are generated in a fixed path, then an LSTM model is triggered, and corresponding welding spot type welding quality scores are output; in addition, when welding parameters are changed, retraining and verification are completed on the quality scoring strategy of each welding type aiming at new data release.
And when the characteristic data and the specified quality grading data set are generated according to time scales, screening and problem searching of the data are completed, a report file is generated according to the characteristic data and the specified quality grading data set and stored to a fixed path, meanwhile, the server reads the report file in real time, and if the key parameters in the report file exceed a set value, a report is generated by calling the component and is sent to a related responsible person for corresponding operation.
Establishing a relative importance selection model of the welding characteristic parameters of the automobile body: and the LightGBM model is adopted to extract the relevant importance of the welding parameters, and more important parameters are selected for next prediction, so that the model is simplified and the calculation difficulty is reduced. LightGBM is an integrated learning algorithm, is a decision tree algorithm based on histogram, has the advantages of high calculation speed, good classification regression effect, capability of processing large-scale data, support of multiple languages and the like, and is widely applied to the engineering field. LightGBM has many advantages over other machine learning models:
histogram algorithm: the histogram algorithm reduces the memory consumption, and only needs to traverse the barrel when selecting the splitting characteristic to calculate the income, thereby greatly reducing the calculation complexity;
leaf-wise strategy: selecting the node with the maximum splitting profit from all the current leaf nodes to split, and performing the splitting recursively in such a way, thereby reducing a lot of unnecessary expenses;
unilateral gradient sampling: the GOSS is used, a large number of data examples with small gradients can be reduced, so that the residual data with high gradients can be used when information gain is calculated, and compared with other integrated learning algorithms, the time and space expenses are saved by traversing all characteristic values;
mutually exclusive feature binding: a plurality of mutually exclusive features can be bound into one feature, so that the purpose of reducing the dimension is achieved;
supporting the class feature: the LightGBM supported class features may speed up training by 8 times and be consistent in accuracy. More importantly, LightGBM is the first GBDT tool to directly support class features;
support efficient parallelism: instead of vertical partitioning of the data, all the training data is saved on each machine, and partitioning can be performed locally after the optimal partitioning scheme is obtained, thereby reducing unnecessary communication.
The method comprises the steps of constructing a LightGBM characteristic relative importance selection model, optimizing parameters such as LightGBM model learning rate learning _ rate, tree depth max _ depth, tree particle number n _ estimators and minimum leaf weight min _ child _ weight by utilizing a grid search algorithm, obtaining an optimal parameter combination as LightGBM dust prediction model parameters, then iteratively distributing and optimizing parameters for each decision tree by utilizing a greedy strategy and a quadratic optimization algorithm until an objective function is optimal, finally judging the advantages and disadvantages of the model by utilizing a verification set, and reserving the model with the best effect. The final model parameters selected are as follows.
Table 1: model parameters of LightGBM
Parameter name
|
Value taking
|
learning _ rate (learning rate)
|
0.10
|
max _ depth (Tree depth)
|
1.00
|
n _ estimators (Tree)
|
100.00
|
min _ child _ weight (minimum leaf weight)
|
3.00 |
In the process of model training and model testing, firstly, the sample data set is normalized, the normalization processing can reduce errors caused by different dimensions of data, and the normalization calculation formula is as follows:
in the formula, NmaxRepresents the maximum value of the sample data set, NminRepresenting the minimum value of the sample data set, N "representing the normalized value of the sample data set, N representing the actual value.
And after the normalization operation is carried out on the sample data set, the feature parameter data with the selected feature related importance is divided into a training set, a verification set and a test set. The training set is used for training the model, and the verification set is used for verifying the fitting effect of the model and selecting the relative importance of all parameters. In addition, the proportion of the training set and the test set in the sample data can be adjusted according to specific model training and model test requirements. In the process of outputting the relevant importance influencing the quality of the welding spots, evaluating the index values of various evaluation parameters of the model training and model testing results, and finally outputting the importance ranking of the relevant importance of various features.
When a model feature list ordering influencing a model prediction target is output, selecting features with importance ranking at the top as feature data of a next training prediction model, generally selecting data features with the importance accounting for 80%, and adjusting the selected features according to model prediction performance.
Dividing the data with the selected relative importance of the features into a training set and a verification set again, training an LSTM deep learning prediction model by using the divided data set, firstly initializing hyper-parameters and weights of the prediction model, training the model by using the training set as input, optimizing the LSTM model by a Sparrow Search Algorithm (SSA), adding Dropout parameters and regular terms to avoid over-fitting, and continuously optimizing the model weights and parameters by using an Adam algorithm so as to obtain the required precision.
The sparrow search algorithm is an intelligent optimization algorithm, has stronger global search capability compared with other algorithms such as a genetic algorithm and the like, has a good effect in high-dimensional function calculation search, and can avoid the problem of local optimal solution. The algorithm flow chart is shown in fig. 4.
The LSTM is a special Recurrent Neural Network (RNN), and can effectively solve the long-term dependence of information and avoid gradient disappearance or explosion, and its appearance is specially used to solve the long-term dependence problem. Compared with the traditional RNN, the circulation structure is skillfully designed, a forgetting gate is added on the basis of an input gate and an output gate, and the problems of gradient disappearance and gradient explosion are solved.
The invention searches the hidden layer node number, the batch scale and the time step of the LSTM model respectively by a traversal search method, and finally selects appropriate parameters, wherein the hidden layer node number, the batch scale and the time step of the standard LSTM model are respectively 20, 32 and 5.
Using the mean absolute percentage error MAPERoot mean square error RMSEAnd the mean absolute error MAEAnd (3) evaluating the performance of the standard LSTM prediction model by using the evaluation indexes, wherein the calculation formulas are respectively as follows:
wherein i represents a data number, yi,
Respectively representing an actual value and a predicted value, and N representing the number of test sample sets.
And finally, testing the LSTM prediction model by using the test set to obtain a scoring prediction result, and analyzing and comparing the scoring prediction result with the real scoring data by using an error evaluation formula to obtain the most appropriate prediction model.
Example 2: take XGboost model as an example
As shown in fig. 3, an XGBoost model is deployed on an online server, and the XGBoost model can identify a path of a data feature value transmitted to the server, and determine whether new data exists and what new data is generated by reading the feature value data on the fixed path in real time; if new data generation is found, tracking an identification scheme corresponding to the type of the welding spot in real time, extracting a characteristic data set, generating a data screening file and storing the data screening file to a fixed path; if not found, the online system is not triggered to perform the feature relative importance selection model.
After collected welding spot information data pass through the XGboost model, characteristic value parameters are generated, the characteristic value parameters are stored in a welding spot information database, meanwhile, a system detects that new characteristic data are generated on a fixed path, then an LSTM deep learning welding spot quality score prediction model is triggered, and corresponding welding spot type welding quality scores are output; in addition, when welding parameters are changed, retraining and verification are completed on the quality scoring strategy of each welding type aiming at new data release.
And when the characteristic data and the specified quality grading data set are generated according to time scales, screening and problem searching of the data are completed, a report file is generated according to the characteristic data and the specified quality grading data set and stored to a fixed path, meanwhile, the server reads the report file in real time, and if the key parameters in the report file exceed a set value, a report is generated by calling the component and is sent to a related responsible person for corresponding operation.
Establishing a relative importance selection model of the welding characteristic parameters of the automobile body: relevant importance extraction is carried out on the welding parameters by adopting the XGboost model, more important parameters are selected for next prediction, and the effect of simplifying the model and reducing the calculation difficulty is achieved. The XGBoost is an integrated learning algorithm, is an improvement on a Gradient Boosting Decision Tree (GBDT) algorithm, has the advantages of high calculation speed, good classification regression effect, capability of processing large-scale data, support of multiple languages and the like, and is widely applied to the engineering field. XGBoost has many advantages over other machine learning models:
the regularization term: a regular term is added into a cost function of the model, so that the overfitting of the model is avoided;
and (3) parallel computing: parallel processing and calculation are carried out at a model feature level, and each feature gain calculation is carried out in parallel in a multithreading mode;
pruning: firstly, all sub-trees which can be built are built from top to bottom, and then pruning is carried out reversely from bottom to top, so that the situation that the sub-trees are trapped in local optimum is avoided;
column sampling: column sampling is supported, so that overfitting can be reduced, the calculated amount can be reduced, and the simulation calculation speed is improved;
missing value processing: for a positive sample of the value of a feature, its direction of splitting can be automatically learned.
The method comprises the steps of constructing an XGboost characteristic relative importance selection model, optimizing parameters such as the learning rate learning _ rate of the XGboost model, the depth max _ depth of a tree, the number n _ estimators of the tree, the minimum leaf weight min _ child _ weight and the like by utilizing a grid search algorithm, obtaining an optimal parameter combination as XGboost dust prediction model parameters, then distributing and optimizing parameters of each decision tree in an iteration mode by utilizing a greedy strategy and a secondary optimization algorithm until an objective function is optimal, finally judging the model by utilizing a verification set, and reserving the model with the best effect. The final model parameters selected are as follows.
Table 2: model parameters of XGboost
Parameter name
|
Value taking
|
learning_rate
|
0.10
|
max_depth
|
3.00
|
n_estimators
|
300.00
|
min_child_weight
|
7.00 |
In example 2, the procedure is the same as in example 1 except that the selected feature parameter relative importance selection model is different from that in example 1.
Compared with the prior art, the method can screen and select the acquired sample data parameters, reduce the redundancy of data, lower the complexity of a model trained by the data, enhance the robustness of the model, and widely apply the deep learning model in engineering along with the enhancement of the performance of the deep learning.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third and the like do not denote any order, but rather the words first, second and the like may be interpreted as indicating any order.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.