Disclosure of Invention
Based on the problems, the invention provides a quantitative analysis method for magnetic anomaly of defects on the surface of a high-temperature alloy, which is characterized in that under the environment of a natural geomagnetic field, the surface or the near surface of the high-temperature alloy is scanned by a weak magnetic detection instrument, the change of magnetic induction intensity in the direction vertical to the surface of a test piece is collected and is subjected to data processing, the characteristic value of a defect magnetic anomaly signal is taken as an input value, the length, width and depth parameter values of the corresponding defect are taken as output values to train a Support Vector Machine (Support Vector Machine) model, the mapping relation between the defect parameters is established, the kernel function parameters of the Support Vector Machine are optimized by adopting a K-fold cross validation method and a genetic algorithm, the defect prediction model is established by utilizing the optimized parameters, the defect inversion precision is improved, and the quantitative analysis of the defects of the high-temperature alloy can be realized without an additional excitation source.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method for quantitatively analyzing the magnetic anomaly of the surface defects of the high-temperature alloy comprises the following steps:
s1, designing 4 high-temperature alloy test pieces, establishing a high-temperature alloy material defect sample library, and processing and manufacturing the test pieces with surface defects;
s2, scanning the test piece by using a weak magnetic detection instrument with a high-precision magnetic sensor to acquire signals, and acquiring original detection data of the defects;
s3, optimizing kernel function parameters of the support vector machine by adopting a cross validation method and a genetic algorithm, and comparing the prediction effects of the two methods to obtain optimal parameters;
and S4, quantitatively evaluating the acquired magnetic signals by adopting a support vector machine algorithm to obtain a defect inversion model, and predicting the length, width and depth of the defect.
Further, the algorithm in step S3 is explained as follows:
1. cross validation method
The cross validation is used as a common model selection method, and an original data set is randomly segmented into three parts during model parameter selection, and the three parts are respectively used as training sets and used for training a model; a validation set for model selection; and the test set is used for evaluating the quality of the model generated by the learning method. Because the cross validation can reuse data, under the condition that actual data is insufficient, original data is repeatedly segmented and trained and tested for many times in order to fully utilize the existing data. Firstly, randomly cutting given data into k mutually disjoint subsets with the same size; then training the model by using the data of k-1 subsets, and testing the model by using the rest subsets; this process is repeated for the possible k choices; and finally, selecting the model with the minimum average test error in k evaluations.
2. Genetic algorithm
The genetic algorithm is a parallel search algorithm based on the biological law and the natural genetic mechanism. The genetic algorithm simulates the principle of natural selection and survival of suitable persons in the natural evolution process and is mainly characterized by a search method among groups and the exchange of individual information. The algorithm mainly comprises a coding mode, a fitness function and a genetic operation. The main encoding modes include integer encoding, real number encoding, binary encoding, and data structure encoding. The fitness function takes 3-fold cross-check classification precision as an objective function.
In genetic algorithms, each individual of a population is called a chromosome, and the individual is continuously updated through genetic manipulation in an iterative process. The individual competence is mainly evaluated by the fitness function 3-fold cross test accuracy. And the parent population generates new filial generations through operations of selection, intersection and variation with the filial population according to the fitness value, namely the size of the 3-fold cross-checking classification precision, until the population converges to the globally optimal individual of the 3-fold cross-checking precision through iterative computation. The fitness is a standard for evaluating the quality of individuals in the population evolution process.
Further, in step S4, the feature value of the magnetic anomaly signal of the defect of the test piece is extracted as an input value, the length, width and depth parameter values of the corresponding defect are used as output values, and the SVM model is trained, so that the data of the magnetic anomaly feature quantity of the defect can be separated in a high-dimensional space, and a mapping relation with the defect parameter is established.
Further, the surface defect on the test piece in step S1 is a groove defect or a crack.
The invention has the beneficial effects that:
in the invention, under the environment of a natural geomagnetic field, a weak magnetic detection instrument is used for scanning the surface or the near surface of a high-temperature alloy material, the change of magnetic induction intensity in the direction vertical to the surface of a test piece is collected and processed, the characteristic value of a defect magnetic anomaly signal is used as an input value, the length, width and depth parameter values corresponding to a defect are used as output values to train a defect inversion model, and the mapping relation between the defect inversion model and the defect parameters is established.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to examples and accompanying drawings, and the exemplary embodiments and descriptions thereof are only used for explaining the present invention and are not meant to limit the present invention.
Referring to fig. 8, fig. 8 is a flowchart of defect inversion, taking a high-temperature alloy GH4169 as an example, collecting weak magnetic signals and size parameters of defects of a high-temperature alloy test piece as training samples by using a high-precision magnetic measurement sensor and a weak magnetic detection instrument, introducing the weak magnetic signals into an inversion model, calculating characteristic values of magnetic anomalies of the weak magnetic signals of each defect, forming an input set and an output set with the size parameters of the defect, constructing a length, width and depth inversion model by using a support vector machine algorithm, training an SVM inversion model by using the input set and the output set, and fitting a mapping relationship between the two; after training is completed, a mature defect inversion model is formed, and the defect inversion result is tested.
Designing a surface crack defect of the high-temperature alloy GH4169, and simulating by using an artificial groove type defect.
In this example, the defect lengths were 10mm, 13mm, 16mm, and 20mm, the widths were 0.3mm, 0.35mm, 0.4mm, and 0.45mm, and the depths were 1mm, 2mm, 3mm, and 4mm, to obtain 16 sets of defects with different lengths, widths, and depths, as shown in table 1. Four high temperature alloy GH4169 specimens, all 300mm by 100mm by 5mm (length by width by height), were manually machined to 4 sets of defects on each specimen, as shown in FIG. 1.
TABLE 1 Defect Specification
The above table 1 shows the design of the high-temperature alloy GH4169 defect test piece, and the large defect interval is designed on the test piece with the length of 300mm as far as possible, so that the mutual interference of weak magnetic signals among the defects during scanning by a magnetic probe is avoided, namely the defect interval is 60mm, and the artificial groove type defect of each test piece is positioned in the center of the width of the test piece.
And acquiring signals by using a weak magnetic detection instrument to obtain original detection data of the defects.
And (3) detecting a high-temperature alloy GH4169 test piece by using a weak magnetic detection instrument. Due to the fact that a natural magnetic field of an external environment is weak, magnetic anomaly caused by crack defects of the high-temperature alloy GH4169 is small, and external interference factors are large. Therefore, the weak magnetic signal of the collected test piece is in a space with a stable geomagnetic field, and all ferromagnetic interference substances are removed as far as possible. The weak magnetic detection process is shown in fig. 1. And (3) placing a magnetic probe at the left end of the test piece, wherein the magnetic probe is vertical to the surface of the test piece, and scanning at a constant speed from left to right. Four sets of detection data are obtained, as shown in fig. 2, 3, 4 and 5, and correspond to test pieces No. 1, 2, 3 and 4 in sequence. The abscissa represents the scan path and the ordinate represents the magnetic induction in the direction perpendicular to the surface of the test piece. The result is the original defect detection data.
Data preprocessing: and taking the defect characteristic data set as an experimental object, and dividing the original data set into a training set and a testing set. And (3) preprocessing the data of the training set and the test set, and normalizing the training set and the test set to a [0,1] interval by using a most value normalization method. The data was then divided into a training set and a test set, with 15 groups used to train the model and 1 remaining group as the test.
Optimizing model parameters based on a cross validation method and a genetic optimization algorithm: in the embodiment, from the perspective of supporting the parameters of the vector machine model, a cross verification method and a genetic optimization algorithm are provided, and the effects of the two optimization methods are compared, so that the model is optimized, the precision of defect inversion quantification is improved, and subsequent quantitative evaluation is facilitated.
1. Cross validation method optimization
In the optimization method, the cross verification method is a common optimization algorithm which is suitable for a data set with a small data volume and can effectively avoid the occurrence of over-learning and under-learning states. The cross verification method is introduced into the model for optimization, so that overlarge errors are prevented when the test set tests the classification model, the robustness of the model is higher, and the classification function of the prediction model is more obvious. The main parameters for determining the convergence speed and the convergence precision of the optimized model of the cross validation algorithm are a penalty factor and the step size of a kernel function parameter. The specific steps of optimizing SVM kernel function parameters by the cross validation method are as follows:
(1) the total training set S is divided into k disjoint subsets, and assuming that the number of training samples in S is m, each subset has m/k training samples, and the corresponding subset is called { S1, S2, …, Sk }.
(2) And taking out one from the divided subsets each time as a test set, and taking the other k-1 as a training set.
(3) A model or hypothesis function is trained from the training set.
(4) The model is put on a test set to obtain the prediction accuracy.
(5) And calculating the average value of the classification rates obtained by k times as the true prediction accuracy of the model or the hypothesis function.
The cross validation algorithm optimization process is shown in fig. 6, the abscissa is the search range of the parameters C and g, and the ordinate represents the root mean square error, and fig. 6 describes the process of the cross validation method for searching the optimal parameters within a certain range so that the root mean square error is the minimum.
2. Genetic algorithm
The genetic algorithm is an optimization algorithm which takes genetic genetics as a principle and simulates the evolution process of the nature. The method adopts three operators of selection, crossing and mutation to carry out genetic operation, and the whole population evolves and develops under the selection mechanism of high-quality and low-quality selection until the population is close to the optimal state. The specific steps of the genetic algorithm for optimizing the SVM kernel function parameter are as follows:
(1) an encoding strategy is selected. Common encoding methods are integer encoding, real number encoding, binary encoding, and data structure encoding. The real number coding does not need to carry out numerical value conversion and has high calculation precision, so the real number coding is selected as a coding mode;
(2) and defining a proper fitness function and ensuring that the fitness function is not negative.
(3) Determining genetic strategies, including selecting population size, selecting, crossing, mutating methods, and determining other parameters such as crossing probability, mutating probability, etc.
(4) Random initialization generates population N, common population size: n is 20 to 200.
(5) The decoded adaptation values of the individual bit strings in the population are calculated.
(6) And according to a genetic strategy, applying selection, crossing and mutation operators to act on the population to form a next generation population.
(7) And (4) judging whether the group performance meets a certain index, outputting an optimal result if the group performance meets the certain index when the preset iteration times are finished, and returning to the step (6) if the group performance does not meet the preset iteration times, or modifying the genetic strategy and returning to the step (6).
The genetic algorithm optimization process is shown in fig. 7, in which the abscissa is an evolution algebra and the ordinate is fitness, and the figure illustrates a process in which the genetic algorithm obtains the optimal parameters after evolution by taking a population as an example so that the root mean square error reaches the optimal adaptive value.
In general, we classify research problems into regression problems and classification problems based on the nature of the output variables. When the output variable is a quantitative variable, we call it a regression problem; when the output variable is a qualitative variable, we call it a classification problem. Due to the different properties of the output variables, their corresponding average test errors are also different, and their corresponding test errors are given below. When the output variable is a quantitative variable, i.e. in the regression problem, the mean square error is generally used to represent the test error as:
wherein, y
iRepresents the true observation value of the ith time,
represents the predicted value of the i-th observation given by the model f (x).
In the regression problem, the average test error is expressed as:
wherein k is cross validation index, MSEiThe mean square error at the ith cross validation is shown. The quantitative inversion problem of the high-temperature alloy defect is essentially a regression prediction problem of data, but not a classification problem, namely, an approximate expression of a functional relation between various characteristic quantities (independent variables) and the length, width and depth (dependent variables) of the defect is found, and then the size of the defect is inverted by using the known characteristic quantities.
And (3) carrying out quantitative evaluation by a support vector machine algorithm: the support vector machine algorithm is beneficial to small sample training prediction and nonlinear high-dimensional classification, is not easy to fall into local minimization, and solves the problems of dimension disaster and the like. In the invention, a support vector machine algorithm is adopted, and when the SVM is applied to regression prediction, the basic idea is that an optimal plane is not searched to separate two types of samples, but an optimal classification surface is searched to minimize the error of all training samples from the classification surface. The algorithm was implemented by Matlab software, with the final aim of obtaining quantitative dimensions of surface defects.
In order to obtain the relationship between the surface defect magnetic anomaly signals and the surface defect parameters (length, width and depth), 15 groups of characteristic values of the defect magnetic anomaly signals are extracted as input values, the parameter values of the length, the width and the depth of the corresponding defect are used as output values, a model is trained, and the rest group is used as a test, so that the data of the defect magnetic anomaly characteristic quantity can be separated in a high-dimensional space, and the mapping relationship between the data and the defect parameters is established. FIG. 8 is a flow chart of a defect inversion structure. In the figure, the input is the characteristic quantity of the magnetic anomaly of the defect signal, and the output set is composed of the values of the length, width and depth of the defect parameter as categories. 3 prediction models are constructed for training, and the inversion accuracy of the length, the width and the depth of 16 groups of defects is tested respectively. The characteristic parameters of the defect magnetic anomaly signal participating in the inversion calculation are morphological characteristic parameters (the area, the occupation width and the amplitude of the magnetic anomaly). And comparing the two different optimization methods with the unoptimized model; the optimization results are shown in table 2.
TABLE 2 results of parameter optimization
Model classes
|
Cross validation optimization results
|
Optimization results of genetic algorithm
|
Length prediction model
|
C=1,g=1
|
C=50.24,g=0.028
|
Width prediction model
|
C=4,g=0.125
|
C=15.15,g=51.51
|
Depth prediction model
|
C=2,g=0.25
|
C=33.29,g=49.65 |
Defect inversion is performed on the basis, and after verification, the error of predicting the defect size is shown in table 3.
TABLE 3 quantitative accuracy (%)
Variation of size
|
Original model
|
Cross validation optimization
|
Genetic algorithm optimization
|
Length of
|
76.17
|
95.24
|
95.87
|
Width of
|
86.15
|
87.31
|
91.92
|
Depth of field
|
40.92
|
50.37
|
78.56 |
The above table shows that the optimized support vector machine model is used for inversion quantification, the length, width and depth errors of defect quantification can be effectively reduced, particularly the precision of depth prediction is improved from 40.92% to 78.56%, and the precision after genetic algorithm optimization is higher than that of a prediction model optimized by a cross validation method. Therefore, parameters optimized by a genetic algorithm are selected as the optimal parameters to establish a defect inversion model.
The above is an embodiment of the present invention. The embodiments and specific parameters in the embodiments are only for the purpose of clearly illustrating the verification process of the invention and are not intended to limit the scope of the invention, which is defined by the claims, and all equivalent structural changes made by using the contents of the specification and the drawings of the present invention should be covered by the scope of the present invention.