Xrf calibration curve intelligent modeling and error compensation method based on transfer learning

By employing transfer learning and nonlinear residual correction mapping, the problem of large prediction errors in X-ray fluorescence spectroscopy under complex matrix or sample variability was solved, achieving accurate prediction and error compensation of elemental content, thus improving analytical efficiency and accuracy.

CN122455152APending Publication Date: 2026-07-24ZHONGKE STANDARD SAMPLE (JIANGSU) TESTING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHONGKE STANDARD SAMPLE (JIANGSU) TESTING TECHNOLOGY CO LTD
Filing Date
2026-04-02
Publication Date
2026-07-24

Smart Images

  • Figure CN122455152A_ABST
    Figure CN122455152A_ABST
Patent Text Reader

Abstract

The application provides an XRF calibration curve intelligent modeling and error compensation method based on transfer learning, relates to the technical field of transfer learning, and comprises the following steps: acquiring X-ray spectrum intensity data of a source domain and a target domain, respectively extracting feature matrices, and establishing a source domain regression mapping relationship; solving a transformation matrix by minimizing the distribution difference between the domains, reconfiguring a transfer regression mapping relationship suitable for the target domain, and obtaining an initial prediction value; and finally training a nonlinear residual correction model based on the prediction deviation of representative samples, compensating the initial prediction value, and outputting corrected element content analysis values. The application effectively solves the model adaptation problem under the condition of insufficient target domain standards, and improves the analysis accuracy and generalization ability across instruments or sample matrices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of transfer learning technology, and in particular to a method for intelligent modeling and error compensation of XRF calibration curves based on transfer learning. Background Technology

[0002] X-ray fluorescence spectroscopy, as an important method for quantitative elemental analysis, hinges on establishing a calibration curve between spectral intensity data and elemental content. In conventional modeling practices, an empirical modeling approach based on standard samples is commonly employed. Specifically, analysts prepare a series of standard samples with matrix matching to the sample to be analyzed and known elemental contents, and collect their X-ray fluorescence spectra. Subsequently, using chemometric methods such as multiple linear regression, principal component regression, or partial least squares regression, a mathematical mapping relationship from spectral characteristics to elemental content is directly established—the calibration model. This model is then used to predict the elemental content of unknown samples. This method is highly dependent on the quality and representativeness of the standard samples, requiring a high degree of consistency between the standard samples and the sample to be analyzed in terms of physical state, chemical matrix, and elemental distribution to ensure effective model transfer.

[0003] However, the aforementioned conventional modeling methods have significant limitations in practical industrial applications. The preparation of standard samples is complex, costly, and time-consuming, especially in applications with complex and variable matrices where obtaining a large number of ideal standard samples is difficult, such as geological exploration, scrap metal recycling, or online process analysis. Establishing accurate, universal calibration models is extremely challenging. When the matrix effects, particle size, or surface condition of the sample to be tested differ significantly from the standard samples used for modeling, directly applying the original model leads to a sharp increase in prediction errors and insufficient model robustness. To address this issue, it is often necessary to prepare new standard samples and establish dedicated models for each new type of sample, which severely restricts analytical efficiency, increases costs, and fails to meet the needs of rapid and flexible analysis. Furthermore, even with attempts to reduce matrix effects through mathematical preprocessing (such as standardization and differentiation), the compensation ability of traditional methods remains limited for data with large distributional differences, and systematic biases in the prediction results are difficult to completely eliminate. Summary of the Invention

[0004] This invention provides a method for intelligent modeling and error compensation of XRF calibration curves based on transfer learning, which can solve the problems in the prior art.

[0005] A first aspect of the present invention provides a method for intelligent modeling and error compensation of XRF calibration curves based on transfer learning, comprising: Acquire the first X-ray spectral intensity data and elemental content standard values ​​of the source domain standard sample set, and the second X-ray spectral intensity data of the target domain sample to be calibrated; The first X-ray spectral intensity data is subjected to baseline correction and peak identification processing. The peak position, peak intensity and full width at half maximum (FWHM) of the characteristic spectral lines are extracted to form a source domain feature matrix. A source domain regression mapping relationship is established based on the source domain feature matrix and the element content standard values. The same baseline correction and peak identification processing is performed on the second X-ray spectral intensity data to extract the target domain feature matrix. By minimizing the distribution distance metric between the source domain feature matrix and the target domain feature matrix in the projection space, the domain adaptation transformation matrix is ​​solved. The weight coefficients in the source domain regression mapping relationship are reconstructed using the domain adaptation transformation matrix to generate a migration regression mapping relationship that adapts to the target domain. The target domain feature matrix is ​​input into the migration regression mapping relationship for calculation to obtain the initial element content prediction value of the target domain sample; A representative sample in the target domain is selected for chemical analysis to obtain a reference true value. The deviation sequence between the initial element content prediction value of the representative sample and the reference true value is calculated. A nonlinear residual correction mapping relationship is trained based on the deviation sequence and the corresponding target domain feature matrix. The nonlinear residual correction mapping relationship is used to perform compensation calculation on the initial element content prediction value, and the corrected element content analysis value is output.

[0006] Baseline correction and peak identification are performed on the first X-ray spectral intensity data. The peak position, peak intensity, and full width at half maximum (FWHM) of characteristic spectral lines are extracted to form a source domain feature matrix. Based on the source domain feature matrix and the elemental content standard values, a source domain regression mapping relationship is established, including: A polynomial fitting algorithm is used to estimate the background baseline of the continuous spectral band of the first X-ray spectral intensity data. The difference between the first X-ray spectral intensity data and the estimated background baseline is used to obtain the net spectral intensity distribution after background subtraction. The second derivative operation is performed on the net spectral line intensity distribution to identify the extreme position of the spectral peak. A peak shape function is fitted in the neighborhood of the extreme position of the spectral peak. The center energy value of the peak shape function is extracted as the peak position feature. The peak response value of the peak shape function is extracted as the peak intensity feature. The energy width corresponding to half of the peak response value of the peak shape function is extracted as the half-width at half-maximum feature. The peak position features, peak intensity features, and full width at half maximum (FWHM) features corresponding to each standard sample in the source domain standard sample set are arranged in rows to form a source domain feature matrix. Using the source domain feature matrix as the input independent variable and the element content standard value as the output dependent variable, the linear function relationship between the input independent variable and the output dependent variable is fitted by the least squares method. The regression coefficient vector and intercept term in the linear function relationship are determined, and the source domain regression mapping relationship is established.

[0007] A peak shape function is fitted within the neighborhood of the extreme value of the spectral peak. The center energy value of the peak shape function is extracted as the peak position feature, the peak response value of the peak shape function is extracted as the peak intensity feature, and the energy width corresponding to half the peak response value is extracted as the full width at half maximum (FWHM) feature, including: With the extreme position of the spectral peak as the center, a preset energy range is extended to the left and right sides to determine the energy range for peak shape fitting; Within the energy range, a linear combination of the Gaussian function and the Lorentz function is selected as the mathematical expression of the peak shape function. The peak shape function includes a center parameter characterizing the peak position, an amplitude parameter characterizing the peak intensity, and a broadening parameter characterizing the peak width. The values ​​of the center parameter, amplitude parameter, and broadening parameter are adjusted using a nonlinear optimization algorithm to minimize the sum of squared residuals between the calculated value of the peak shape function and the measured value of the net spectral intensity distribution within the energy range, thereby determining the optimal values ​​of the center parameter, amplitude parameter, and broadening parameter. The optimal value of the center parameter is used as the peak position feature, the optimal value of the amplitude parameter is used as the peak intensity feature, and the energy width of the peak shape function at half the optimal value of the amplitude parameter is calculated based on the optimal value of the broadening parameter. The energy width is used as the half-width feature.

[0008] By minimizing the distribution distance metric between the source domain feature matrix and the target domain feature matrix in the projection space, the domain adaptation transformation matrix is ​​solved. This domain adaptation transformation matrix is ​​then used to reconstruct the weight coefficients in the source domain regression mapping relationship, generating a transfer regression mapping relationship adapted to the target domain, including: Calculate the sample mean vector and covariance matrix of the source domain feature matrix and the target domain feature matrix in the original feature space, respectively; Construct a projection transformation matrix, and map the source domain feature matrix and the target domain feature matrix to a low-dimensional projection space through the projection transformation matrix to obtain the source domain projection feature matrix and the target domain projection feature matrix; Calculate the Euclidean distance between the sample mean vector of the source domain projection feature matrix and the sample mean vector of the target domain projection feature matrix, and the matrix norm difference between the covariance matrix of the source domain projection feature matrix and the covariance matrix of the target domain projection feature matrix. Define the weighted sum of the Euclidean distance and the matrix norm difference as the distribution distance metric. The element values ​​of the projection transformation matrix are iteratively updated using the gradient descent method until the distribution distance metric converges to a minimum, thus obtaining the domain adaptation transformation matrix. The domain adaptation transformation matrix and the weight coefficient vector in the source domain regression mapping relationship are multiplied by matrix to obtain the reconstructed weight coefficient vector. The reconstructed weight coefficient vector is then combined with the intercept term in the source domain regression mapping relationship to generate the migration regression mapping relationship that adapts to the target domain.

[0009] A nonlinear residual correction mapping relationship is trained based on the deviation sequence and the corresponding target domain feature matrix. This nonlinear residual correction mapping relationship is then used to compensate for the initial element content prediction values, outputting corrected element content analysis values, including: Representative samples covering the elemental content range are selected from the target domain calibrated samples, and the representative samples are measured by standard chemical analysis methods to obtain the reference true value of the representative samples. The target domain feature matrix corresponding to the representative sample is input into the migration regression mapping relationship for calculation to obtain the initial element content prediction value of the representative sample; the numerical difference between the initial element content prediction value of the representative sample and the reference true value is calculated to form a deviation sequence. Using the target domain feature matrix corresponding to the representative sample as the input feature and the deviation sequence as the output label, a nonlinear residual correction mapping relationship is constructed using a multi-layer neural network structure. The connection weights and bias terms in the multi-layer neural network structure are adjusted through the backpropagation algorithm to minimize the mean square error between the output value of the nonlinear residual correction mapping relationship and the deviation sequence, thus completing the training of the nonlinear residual correction mapping relationship. The target domain feature matrix of the sample to be calibrated in the target domain is input into the nonlinear residual correction mapping relationship to obtain the predicted residual compensation value; the initial element content prediction value is subtracted from the predicted residual compensation value to output the corrected element content analysis value.

[0010] A nonlinear residual correction mapping relationship is constructed using a multi-layer neural network structure. The connection weights and bias terms in the multi-layer neural network structure are adjusted using the backpropagation algorithm to minimize the mean square error between the output value of the nonlinear residual correction mapping relationship and the bias sequence. This completes the training of the nonlinear residual correction mapping relationship, including: Construct a multi-layer neural network structure comprising an input layer, a hidden layer, and an output layer. The number of neurons in the input layer is consistent with the feature dimension of the target domain feature matrix, the number of neurons in the output layer is consistent with the number of element types, and the hidden layer comprises at least one intermediate processing layer. Randomly initialize and assign values ​​to the connection weight matrix and bias vector between each layer in the multi-layer neural network structure. The target domain feature matrix corresponding to the representative sample is input into the input layer, and linear transformation is performed sequentially through the connection weight matrix between each layer. After the output of each layer, a nonlinear activation function transformation is applied, and finally the residual prediction output value is obtained in the output layer. The mean square error between the residual prediction output value and the deviation sequence is calculated as the loss function value; the partial derivatives of the loss function value with respect to the connection weight matrix and the bias vector are calculated, and the gradient values ​​of the parameters of each layer are calculated using the backpropagation algorithm; Adjust the values ​​of the connection weight matrix and the bias vector in the opposite direction of the gradient value, and repeat the forward and backward propagation process until the loss function value converges to below the preset threshold, thus completing the training of the nonlinear residual correction mapping relationship.

[0011] A second aspect of the present invention provides an intelligent modeling and error compensation system for XRF calibration curves based on transfer learning, comprising: The data acquisition unit is used to acquire the first X-ray spectral intensity data and elemental content standard values ​​of the source domain standard sample set, and the second X-ray spectral intensity data of the target domain sample to be calibrated. The feature extraction unit is used to perform baseline correction and peak identification processing on the first X-ray spectral intensity data, extract the peak position, peak intensity and full width at half maximum of the feature spectral lines to form a source domain feature matrix, and establish a source domain regression mapping relationship based on the source domain feature matrix and the element content standard value. The migration adaptation unit is used to perform the same baseline correction and peak identification processing on the second X-ray spectral intensity data, extract the target domain feature matrix, solve the domain adaptation transformation matrix by minimizing the distribution distance metric of the source domain feature matrix and the target domain feature matrix in the projection space, and use the domain adaptation transformation matrix to reconstruct the weight coefficients in the source domain regression mapping relationship to generate a migration regression mapping relationship adapted to the target domain. An initial prediction unit is used to input the target domain feature matrix into the migration regression mapping relationship for calculation to obtain the initial element content prediction value of the target domain sample. The residual correction unit is used to select a representative sample in the target domain for chemical analysis to obtain a reference true value, calculate the deviation sequence between the initial element content prediction value of the representative sample and the reference true value, train a nonlinear residual correction mapping relationship based on the deviation sequence and the corresponding target domain feature matrix, use the nonlinear residual correction mapping relationship to perform compensation operation on the initial element content prediction value, and output the corrected element content analysis value.

[0012] A third aspect of the present invention provides an electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.

[0013] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.

[0014] The introduction of a nonlinear residual correction mapping in this application further compensates for systematic errors and complex nonlinear effects not captured by the model. Trained on a prediction bias sequence of representative samples, this correction module can dynamically learn and correct prediction biases caused by matrix effects, spectral interference, or minor fluctuations in instrument status. This two-level modeling strategy combines the global adaptability of transfer regression with the local accuracy of residual correction, improving the overall robustness and accuracy of the model.

[0015] This application achieves intelligent and automated calibration processes. From raw spectral data preprocessing and feature extraction to transfer modeling and error compensation, a complete closed loop is formed, reducing reliance on operator experience. The final output of calibrated elemental analysis values ​​has higher reliability, providing more accurate quantitative results for component analysis, and has significant application value in rapid non-destructive testing in fields such as mining, metallurgy, and environmental monitoring. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating the intelligent modeling and error compensation method for XRF calibration curves based on transfer learning. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0019] Figure 1 This is a flowchart illustrating the intelligent modeling and error compensation method for XRF calibration curves based on transfer learning. Figure 1 As shown, the method includes: Acquire the first X-ray spectral intensity data and elemental content standard values ​​of the source domain standard sample set, and the second X-ray spectral intensity data of the target domain sample to be calibrated; The first X-ray spectral intensity data is subjected to baseline correction and peak identification processing. The peak position, peak intensity and full width at half maximum (FWHM) of the characteristic spectral lines are extracted to form a source domain feature matrix. A source domain regression mapping relationship is established based on the source domain feature matrix and the element content standard values. The same baseline correction and peak identification processing is performed on the second X-ray spectral intensity data to extract the target domain feature matrix. By minimizing the distribution distance metric between the source domain feature matrix and the target domain feature matrix in the projection space, the domain adaptation transformation matrix is ​​solved. The weight coefficients in the source domain regression mapping relationship are reconstructed using the domain adaptation transformation matrix to generate a migration regression mapping relationship that adapts to the target domain. The target domain feature matrix is ​​input into the migration regression mapping relationship for calculation to obtain the initial element content prediction value of the target domain sample; A representative sample in the target domain is selected for chemical analysis to obtain a reference true value. The deviation sequence between the initial element content prediction value of the representative sample and the reference true value is calculated. A nonlinear residual correction mapping relationship is trained based on the deviation sequence and the corresponding target domain feature matrix. The nonlinear residual correction mapping relationship is used to perform compensation calculation on the initial element content prediction value, and the corrected element content analysis value is output.

[0020] In one optional implementation, baseline correction and peak identification processing are performed on the first X-ray spectral intensity data. The peak position, peak intensity, and full width at half maximum (FWHM) of characteristic spectral lines are extracted to form a source domain feature matrix. Based on the source domain feature matrix and the elemental content standard values, a source domain regression mapping relationship is established, including: A polynomial fitting algorithm is used to estimate the background baseline of the continuous spectral band of the first X-ray spectral intensity data. The difference between the first X-ray spectral intensity data and the estimated background baseline is used to obtain the net spectral intensity distribution after background subtraction. The second derivative operation is performed on the net spectral line intensity distribution to identify the extreme position of the spectral peak. A peak shape function is fitted in the neighborhood of the extreme position of the spectral peak. The center energy value of the peak shape function is extracted as the peak position feature. The peak response value of the peak shape function is extracted as the peak intensity feature. The energy width corresponding to half of the peak response value of the peak shape function is extracted as the half-width at half-maximum feature. The peak position features, peak intensity features, and full width at half maximum (FWHM) features corresponding to each standard sample in the source domain standard sample set are arranged in rows to form a source domain feature matrix. Using the source domain feature matrix as the input independent variable and the element content standard value as the output dependent variable, the linear function relationship between the input independent variable and the output dependent variable is fitted by the least squares method. The regression coefficient vector and intercept term in the linear function relationship are determined, and the source domain regression mapping relationship is established.

[0021] In one specific implementation, when preprocessing the X-ray spectral data of the source domain standard sample set, a fifth-order polynomial fitting algorithm is used to estimate the background baseline of the first X-ray spectral intensity data in the continuous spectral band of the energy range of 0-40 keV. Specifically, let the first X-ray spectral intensity data be I(E... i ), where E i Let i represent the i-th energy channel, i = 1, 2, ..., N. A polynomial function is fitted using iterative weighted least squares. As the background baseline estimate, where coefficient a k The net spectral intensity distribution after background subtraction is obtained by minimizing the weighted sum of squared residuals. The difference between the first X-ray spectral intensity data and the background baseline estimate is calculated.

[0022] When identifying peaks in the net spectral line intensity distribution, the second derivative of the net spectral line intensity distribution is first calculated. The extreme positions of the peaks are identified by finding the zero point where the second derivative changes from positive to negative. When a second derivative value is detected to cross from positive to negative, the energy position is marked as a candidate peak. To avoid noise interference, a threshold condition is set: a candidate peak is only confirmed as a valid peak if the net spectral line intensity value exceeds three standard deviations of the noise level.

[0023] After determining the effective spectral peak extremum location, 15 energy channels are selected on both sides of the spectral peak extremum location as the neighborhood range, and a Gaussian function model is used. A nonlinear least-squares fit is performed on the net spectral intensity distribution within this neighborhood. The center position E0 of the fitted Gaussian function is extracted as the peak position feature, and the peak response value A is extracted as the peak intensity feature. The values ​​are then calculated. As a half-width feature, σ represents the variance, which indicates the energy width of the peak-shaped function at half the peak response value.

[0024] For each standard sample in the source domain standard sample set, extract the peak position, peak intensity, and full width at half maximum (FWHM) features corresponding to its characteristic spectral lines according to the above procedure. Assuming the source domain standard sample set contains M standard samples, and K characteristic spectral lines are extracted from each standard sample, then construct a source domain feature matrix. Each row of this matrix corresponds to a standard sample, and the row vector is composed of the peak position, peak intensity, and FWHM of the K characteristic spectral lines of that sample arranged in sequence.

[0025] When establishing the source domain regression mapping relationship, the source domain feature matrix X is used. 源As input as independent variables, the vector of standard values ​​of element content As the dependent variable, the output is used to establish the mapping relationship using a multiple linear regression model. ,in For the regression coefficient vector, This is the intercept term. The objective function is to minimize the sum of squared residuals between the predicted and standard values ​​using the least squares method. Solving the normal equations yields the optimal regression coefficient vector: and intercept term ,in and These represent the mean vectors of the dependent and independent variables, respectively, thus establishing a complete source-domain regression mapping relationship.

[0026] In one optional implementation, a peak shape function is fitted within the neighborhood of the extreme value of the spectral peak, the center energy value of the peak shape function is extracted as the peak position feature, the peak response value of the peak shape function is extracted as the peak intensity feature, and the energy width corresponding to half the peak response value of the peak shape function is extracted as the full width at half maximum (FWHM) feature, including: With the extreme position of the spectral peak as the center, a preset energy range is extended to the left and right sides to determine the energy range for peak shape fitting; Within the energy range, a linear combination of the Gaussian function and the Lorentz function is selected as the mathematical expression of the peak shape function. The peak shape function includes a center parameter characterizing the peak position, an amplitude parameter characterizing the peak intensity, and a broadening parameter characterizing the peak width. The values ​​of the center parameter, amplitude parameter, and broadening parameter are adjusted using a nonlinear optimization algorithm to minimize the sum of squared residuals between the calculated value of the peak shape function and the measured value of the net spectral intensity distribution within the energy range, thereby determining the optimal values ​​of the center parameter, amplitude parameter, and broadening parameter. The optimal value of the center parameter is used as the peak position feature, the optimal value of the amplitude parameter is used as the peak intensity feature, and the energy width of the peak shape function at half the optimal value of the amplitude parameter is calculated based on the optimal value of the broadening parameter. The energy width is used as the half-width feature.

[0027] After obtaining the extreme position of the spectral peak, it is necessary to perform refined peak shape fitting on the spectral data near that position to extract accurate feature parameters. A local energy window is formed by extending 50 eV to 100 eV towards both low and high energy directions, centered on the energy value corresponding to the extreme position of the peak, as the data range for peak shape fitting. The selection of this energy window must ensure complete coverage of the main part of the spectral peak while avoiding interference from adjacent peaks. In practice, if the influence of other peaks is detected at the window boundary, the window width can be appropriately reduced to 30 eV to ensure that the fitting region contains only a single target peak.

[0028] A pseudo-Voigt function is used as the mathematical expression for the peak shape function, which is a linear combination of a Gaussian function and a Lorentz function in a proportional manner. Specifically, the peak shape function value equals the mixing coefficient multiplied by the Gaussian component plus one minus the mixing coefficient multiplied by the Lorentz component. The Gaussian component is described exponentially by the square of the energy deviation from the center parameter, and the Lorentz component is described fractionally by the ratio of the square of the energy deviation from the center parameter to the square of the broadening parameter. This peak shape function contains four undetermined parameters: the center parameter, the amplitude parameter, the broadening parameter, and the mixing coefficient, corresponding to the position, intensity, width, and shape characteristics of the spectral peak, respectively.

[0029] The parameters were solved using the Levenberg-Marquardt nonlinear least squares optimization algorithm. A residual vector was constructed by comparing the calculated values ​​of the peak shape function at each energy point within a selected energy range with the measured net spectral intensity values ​​after baseline correction. The sum of squares of the components of the residual vector was used as the objective function. The initial values ​​for the center parameter (energy value at the extreme peak), the amplitude parameter (net spectral intensity value at that position), the broadening parameter (2 eV), and the mixing coefficient (0.5) were set. During the iteration process, the Jacobian matrix of the objective function with respect to each parameter was calculated, and the parameter values ​​were updated based on gradient information and damping factors. The iteration was terminated when the change in the objective function between two consecutive iterations was less than a set threshold or the number of iterations reached 200; the parameter values ​​at this point were considered optimal.

[0030] The optimal value of the center parameter is extracted as the peak position feature, representing the energy position of the X-ray characteristic spectral line, and its physical meaning corresponds to the electronic transition energy level difference of a specific element. The optimal value of the amplitude parameter is extracted as the peak intensity feature, reflecting the relative abundance of the element in the sample. When calculating the half-width at half-maximum (HWHM) feature, the peak shape function value is set to half the optimal value of the amplitude parameter. Substituting the optimal values ​​of the center parameter and broadening parameter, the two energy values ​​satisfying this condition are solved, and the difference between them is the HWHM feature. The HWHM feature reflects the broadening degree of the spectral peak and is related to the instrument resolution and the physical state of the sample. The extracted peak position, peak intensity, and HWHM features are arranged element-wise to form a feature vector. The feature vectors of multiple samples are stacked vertically to form a source domain feature matrix or a target domain feature matrix, providing standardized input data for subsequent transfer learning modeling.

[0031] In one optional implementation, the domain adaptation transformation matrix is ​​solved by minimizing the distribution distance metric between the source domain feature matrix and the target domain feature matrix in the projection space. The weight coefficients in the source domain regression mapping relationship are then reconstructed using the domain adaptation transformation matrix to generate a migration regression mapping relationship adapted to the target domain. This includes: Calculate the sample mean vector and covariance matrix of the source domain feature matrix and the target domain feature matrix in the original feature space, respectively; Construct a projection transformation matrix, and map the source domain feature matrix and the target domain feature matrix to a low-dimensional projection space through the projection transformation matrix to obtain the source domain projection feature matrix and the target domain projection feature matrix; Calculate the Euclidean distance between the sample mean vector of the source domain projection feature matrix and the sample mean vector of the target domain projection feature matrix, and the matrix norm difference between the covariance matrix of the source domain projection feature matrix and the covariance matrix of the target domain projection feature matrix. Define the weighted sum of the Euclidean distance and the matrix norm difference as the distribution distance metric. The element values ​​of the projection transformation matrix are iteratively updated using the gradient descent method until the distribution distance metric converges to a minimum, thus obtaining the domain adaptation transformation matrix. The domain adaptation transformation matrix and the weight coefficient vector in the source domain regression mapping relationship are multiplied by matrix to obtain the reconstructed weight coefficient vector. The reconstructed weight coefficient vector is then combined with the intercept term in the source domain regression mapping relationship to generate the migration regression mapping relationship that adapts to the target domain.

[0032] To address the feature distribution differences between the source and target domains, a projection space alignment strategy is employed to achieve domain adaptation transformation. Specifically, the feature matrices of the source and target domains are read separately. With the target domain feature matrix ,in , Let represent the number of samples in the source and target domains, respectively, and d be the feature dimension. Calculate the sample mean vector of the source domain feature matrix in the original feature space: , Covariance matrix: .

[0033] in, This represents the i-th element in the source domain feature matrix.

[0034] The sample mean vector and covariance matrix of the target domain are obtained using the same calculation method. These two sets of statistics quantitatively describe the distribution characteristics of the two domains in the original space.

[0035] Initialize the projection transformation matrix , where k is the dimension of the projection space and k < d, and the matrix elements are initialized using the Xavier initialization method. Matrix multiplication is then performed. and The source domain projection feature matrix and the target domain projection feature matrix are obtained respectively.

[0036] Recalculate the mean vector in the projection space. and and covariance matrix and .

[0037] Calculate the distributed distance metric between the source and target domains in the projection space. The mean difference term is defined as the Euclidean distance. The covariance difference term is defined as the Frobenius norm. Construct a comprehensive metric function. The weighting coefficients , The value is usually set to 0.5, but it can be adjusted according to the actual data characteristics.

[0038] The gradient descent method is used to optimize the projection transformation matrix. The gradient of the loss function with respect to matrix W is calculated. Execution parameter update Learning rate The initial value is set to 0.01. During the iteration process, the loss function is monitored. Convergence is determined when the loss decreases by less than 0.0001 over 20 consecutive iterations. The converged matrix is ​​the domain adaptation transformation matrix.

[0039] The source domain regression mapping relationship is pre-established as Form, in which Let b be the weight coefficient vector, and b be the intercept scalar. Perform matrix multiplication. The reconstructed weight coefficient vector is obtained. By combining w' with the original intercept term b, a transfer regression mapping relationship is constructed. , where x' is the feature vector of the target domain sample in the projection space. This mapping relationship inherits both the calibration information of the source domain and the distribution characteristics of the target domain, realizing cross-domain calibration model transfer. In practical applications, if the projection dimension $k$ is set too small, it will lead to information loss; it is recommended to retain 70% to 90% of the original dimension.

[0040] A nonlinear residual correction mapping relationship is trained based on the deviation sequence and the corresponding target domain feature matrix. This nonlinear residual correction mapping relationship is then used to compensate for the initial element content prediction values, outputting corrected element content analysis values, including: Representative samples covering the elemental content range are selected from the target domain calibrated samples, and the representative samples are measured by standard chemical analysis methods to obtain the reference true value of the representative samples. The target domain feature matrix corresponding to the representative sample is input into the migration regression mapping relationship for calculation to obtain the initial element content prediction value of the representative sample. The numerical differences between the initial predicted elemental content values ​​and the reference true values ​​of the representative samples are calculated to form a deviation sequence; Using the target domain feature matrix corresponding to the representative sample as the input feature and the deviation sequence as the output label, a nonlinear residual correction mapping relationship is constructed using a multi-layer neural network structure. The connection weights and bias terms in the multi-layer neural network structure are adjusted through the backpropagation algorithm to minimize the mean square error between the output value of the nonlinear residual correction mapping relationship and the deviation sequence, thus completing the training of the nonlinear residual correction mapping relationship. The target domain feature matrix of the sample to be calibrated in the target domain is input into the nonlinear residual correction mapping relationship to obtain the predicted residual compensation value; The initial element content prediction value is subtracted from the predicted residual compensation value to output the corrected element content analysis value.

[0041] After obtaining the initial predicted elemental content values ​​of representative samples, error compensation needs to be achieved by training the nonlinear residual correction mapping relationship. When selecting representative samples from the target domain's calibrated sample set, it should be ensured that the elemental content distribution of these samples covers the complete concentration range of the target domain, including low, medium, and high content ranges. The preferred number of samples is 5 to 15; too few will lead to insufficient generalization ability of the residual model, while too many will increase the cost of chemical analysis. The elemental content of the selected representative samples is determined using standard chemical analysis methods, such as inductively coupled plasma atomic emission spectrometry, atomic absorption spectrometry, or titration analysis. The obtained determination results are used as reference true values.

[0042] The target domain feature matrix corresponding to the representative sample is input into the established migration regression mapping relationship. Matrix multiplication is used to obtain the initial predicted elemental content values ​​for the representative sample. The numerical difference between the initial predicted elemental content value and the reference true value for each representative sample is calculated, i.e., the predicted value minus the reference true value. All difference values ​​are arranged in sample order to form a deviation sequence. This deviation sequence reflects the systematic prediction bias and nonlinear error characteristics of the migration regression mapping relationship in the target domain.

[0043] When constructing the nonlinear residual correction mapping relationship, the target domain feature matrix corresponding to the representative samples is used as the input layer data, and the bias sequence is used as the expected output label. A multi-layer neural network structure is adopted, with 3 to 5 layers, and the number of hidden layer nodes can be selected as 1.5 to 3 times the dimension of the input features. The activation function is preferably a modified linear unit function or a hyperbolic tangent function, and the output layer uses a linear activation function. The network is trained using the backpropagation algorithm, and the connection weights are initialized using the Xavier initialization method. The learning rate is set between 0.001 and 0.01, and the Adam optimizer can be used for optimization. During training, the mean squared error between the network output value and the bias sequence is calculated as the loss function, and the connection weights and bias terms of each layer are continuously updated through gradient descent. The number of training iterations is set to 500 to 2000. Training stops when the loss function value changes less than a set threshold for 20 consecutive iterations or when the maximum number of iterations is reached. At this point, the training of the nonlinear residual correction mapping relationship is completed.

[0044] For other samples to be calibrated in the target domain, their target domain feature matrix is ​​input into a trained nonlinear residual correction mapping relationship. The predicted residual compensation value for each sample is then calculated via forward propagation. The initial elemental content prediction value obtained through the migration regression mapping relationship is then subtracted from the predicted residual compensation value to obtain the corrected elemental content analysis value. This correction value effectively eliminates systematic biases and nonlinear errors introduced by factors such as instrument condition differences and sample matrix effects, significantly improving the accuracy of elemental content analysis and reducing the analytical error of target domain samples to the level of source domain standard samples.

[0045] A nonlinear residual correction mapping relationship is constructed using a multi-layer neural network structure. The connection weights and bias terms in the multi-layer neural network structure are adjusted using the backpropagation algorithm to minimize the mean square error between the output value of the nonlinear residual correction mapping relationship and the bias sequence. This completes the training of the nonlinear residual correction mapping relationship, including: Construct a multi-layer neural network structure comprising an input layer, a hidden layer, and an output layer. The number of neurons in the input layer is consistent with the feature dimension of the target domain feature matrix, the number of neurons in the output layer is consistent with the number of element types, and the hidden layer comprises at least one intermediate processing layer. Randomly initialize and assign values ​​to the connection weight matrix and bias vector between each layer in the multi-layer neural network structure. The target domain feature matrix corresponding to the representative sample is input into the input layer, and linear transformation is performed sequentially through the connection weight matrix between each layer. After the output of each layer, a nonlinear activation function transformation is applied, and finally the residual prediction output value is obtained in the output layer. The mean square error between the residual prediction output value and the deviation sequence is calculated as the loss function value; The partial derivatives of the loss function values ​​with respect to the connection weight matrix and the bias vector are calculated, and the gradient values ​​of the parameters of each layer are calculated using the backpropagation algorithm. Adjust the values ​​of the connection weight matrix and the bias vector in the opposite direction of the gradient value, and repeat the forward and backward propagation process until the loss function value converges to below the preset threshold, thus completing the training of the nonlinear residual correction mapping relationship.

[0046] When training the nonlinear residual correction mapping relationship, the number of neurons in the input layer is first determined based on the feature dimension of the target domain feature matrix. Assuming the feature dimension extracted after peak identification is 15, containing the peak position, peak intensity, and full width at half maximum (FWHM) parameters of each of the five feature spectral lines, then the input layer is set with 15 neurons. The number of neurons in the output layer corresponds to the type of element to be analyzed; if the content of iron, copper, and zinc needs to be analyzed simultaneously, then the output layer is set with 3 neurons. The hidden layer adopts a two-layer structure: the first hidden layer has 32 neurons, and the second hidden layer has 16 neurons. This layer design can fully extract the nonlinear correlation patterns between features.

[0047] When initializing the connection weight matrices and bias vectors in a multi-layer neural network, the Xavier initialization method is used. Specifically, the weight matrix from the input layer to the first hidden layer has a dimension of 15×32, with matrix elements randomly selected from a uniform distribution; the weight matrix from the first hidden layer to the second hidden layer has a dimension of 32×16, and the weight matrix from the second hidden layer to the output layer has a dimension of 16×3. The bias vectors for each layer are initialized to zero, with their dimensions corresponding to the number of neurons in each layer.

[0048] The target domain feature matrix of representative samples is input into the network for forward propagation. The input layer directly receives the feature vector, and the output of the first hidden layer is obtained through a linear transformation and activation function: matrix multiplication is performed on the input feature vector and the weight matrix, a bias vector is added, and then a ReLU activation function is applied for a nonlinear transformation, which sets negative values ​​to zero and retains positive values. The second hidden layer processes the output of the first hidden layer in the same way. After the linear transformation, the output layer does not apply an activation function and directly outputs the residual prediction value of three elements.

[0049] When calculating the loss function, the element-wise difference between the predicted residual value obtained from the output layer and the actual deviation sequence is calculated, and the mean squared error loss value is obtained by squaring the difference. Assuming there are 10 representative samples, the loss function value for this batch is the average of the losses of all samples. When calculating the gradient using the backpropagation algorithm, the partial derivative with respect to the output layer parameters is first calculated: the partial derivative of the loss function with respect to the output layer weights is equal to the cross product of the second hidden layer output value and the residual error. When calculating the partial derivative with respect to the second hidden layer parameters, the gradient of the output layer is backpropagated through the weight matrix and multiplied by the derivative of the ReLU function. The gradient calculation of the first hidden layer follows the same chain rule.

[0050] The network parameters are updated using the calculated gradient values. The Adam optimization algorithm is used for parameter updates, which comprehensively considers the first and second moment estimates of the gradient. The learning rate is set to 0.001, the momentum parameter to 0.9, and the second moment decay coefficient to 0.999. In each iteration, the weight matrix and bias vector of each layer are adjusted along the negative gradient direction, and the adjustment magnitude is controlled by both the learning rate and the adaptive step size. The three steps of forward propagation to calculate the loss, backpropagation to calculate the gradient, and parameter update are repeated until the change in the loss function value is less than 0.0001 within 20 consecutive cycles, or the number of iterations reaches 500, at which point training stops, and the parameters of the nonlinear residual correction mapping relationship are determined. After training, this mapping relationship can compensate for the residual of the initial predicted value of any sample in the target domain, and the compensated value is output as the final elemental content analysis result.

[0051] A second aspect of the present invention provides an intelligent modeling and error compensation system for XRF calibration curves based on transfer learning, comprising: The data acquisition unit is used to acquire the first X-ray spectral intensity data and elemental content standard values ​​of the source domain standard sample set, and the second X-ray spectral intensity data of the target domain sample to be calibrated. The feature extraction unit is used to perform baseline correction and peak identification processing on the first X-ray spectral intensity data, extract the peak position, peak intensity and full width at half maximum of the feature spectral lines to form a source domain feature matrix, and establish a source domain regression mapping relationship based on the source domain feature matrix and the element content standard value. The migration adaptation unit is used to perform the same baseline correction and peak identification processing on the second X-ray spectral intensity data, extract the target domain feature matrix, solve the domain adaptation transformation matrix by minimizing the distribution distance metric of the source domain feature matrix and the target domain feature matrix in the projection space, and use the domain adaptation transformation matrix to reconstruct the weight coefficients in the source domain regression mapping relationship to generate a migration regression mapping relationship adapted to the target domain. An initial prediction unit is used to input the target domain feature matrix into the migration regression mapping relationship for calculation to obtain the initial element content prediction value of the target domain sample. The residual correction unit is used to select a representative sample in the target domain for chemical analysis to obtain a reference true value, calculate the deviation sequence between the initial element content prediction value of the representative sample and the reference true value, train a nonlinear residual correction mapping relationship based on the deviation sequence and the corresponding target domain feature matrix, use the nonlinear residual correction mapping relationship to perform compensation operation on the initial element content prediction value, and output the corrected element content analysis value.

[0052] A third aspect of the present invention provides an electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.

[0053] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.

[0054] This invention can be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of the invention.

[0055] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for intelligent modeling and error compensation of XRF calibration curves based on transfer learning, characterized in that, include: Acquire the first X-ray spectral intensity data and elemental content standard values ​​of the source domain standard sample set, and the second X-ray spectral intensity data of the target domain sample to be calibrated; The first X-ray spectral intensity data is subjected to baseline correction and peak identification processing. The peak position, peak intensity and full width at half maximum (FWHM) of the characteristic spectral lines are extracted to form a source domain feature matrix. A source domain regression mapping relationship is established based on the source domain feature matrix and the element content standard values. The same baseline correction and peak identification processing is performed on the second X-ray spectral intensity data to extract the target domain feature matrix. By minimizing the distribution distance metric between the source domain feature matrix and the target domain feature matrix in the projection space, the domain adaptation transformation matrix is ​​solved. The weight coefficients in the source domain regression mapping relationship are reconstructed using the domain adaptation transformation matrix to generate a migration regression mapping relationship that adapts to the target domain. The target domain feature matrix is ​​input into the migration regression mapping relationship for calculation to obtain the initial element content prediction value of the target domain sample; A representative sample in the target domain is selected for chemical analysis to obtain a reference true value. The deviation sequence between the initial element content prediction value of the representative sample and the reference true value is calculated. A nonlinear residual correction mapping relationship is trained based on the deviation sequence and the corresponding target domain feature matrix. The nonlinear residual correction mapping relationship is used to perform compensation calculation on the initial element content prediction value, and the corrected element content analysis value is output.

2. The method according to claim 1, characterized in that, Baseline correction and peak identification are performed on the first X-ray spectral intensity data. The peak position, peak intensity, and full width at half maximum (FWHM) of characteristic spectral lines are extracted to form a source domain feature matrix. Based on the source domain feature matrix and the elemental content standard values, a source domain regression mapping relationship is established, including: A polynomial fitting algorithm is used to estimate the background baseline of the continuous spectral band of the first X-ray spectral intensity data. The difference between the first X-ray spectral intensity data and the estimated background baseline is used to obtain the net spectral intensity distribution after background subtraction. The second derivative operation is performed on the net spectral line intensity distribution to identify the extreme position of the spectral peak. A peak shape function is fitted in the neighborhood of the extreme position of the spectral peak. The center energy value of the peak shape function is extracted as the peak position feature. The peak response value of the peak shape function is extracted as the peak intensity feature. The energy width corresponding to half of the peak response value of the peak shape function is extracted as the half-width at half-maximum feature. The peak position features, peak intensity features, and full width at half maximum (FWHM) features corresponding to each standard sample in the source domain standard sample set are arranged in rows to form a source domain feature matrix. Using the source domain feature matrix as the input independent variable and the element content standard value as the output dependent variable, the linear function relationship between the input independent variable and the output dependent variable is fitted by the least squares method. The regression coefficient vector and intercept term in the linear function relationship are determined, and the source domain regression mapping relationship is established.

3. The method according to claim 2, characterized in that, A peak shape function is fitted within the neighborhood of the extreme value of the spectral peak. The center energy value of the peak shape function is extracted as the peak position feature, the peak response value of the peak shape function is extracted as the peak intensity feature, and the energy width corresponding to half the peak response value is extracted as the full width at half maximum (FWHM) feature, including: With the extreme position of the spectral peak as the center, a preset energy range is extended to the left and right sides to determine the energy range for peak shape fitting; Within the energy range, a linear combination of the Gaussian function and the Lorentz function is selected as the mathematical expression of the peak shape function. The peak shape function includes a center parameter characterizing the peak position, an amplitude parameter characterizing the peak intensity, and a broadening parameter characterizing the peak width. The values ​​of the center parameter, amplitude parameter, and broadening parameter are adjusted using a nonlinear optimization algorithm to minimize the sum of squared residuals between the calculated value of the peak shape function and the measured value of the net spectral intensity distribution within the energy range, thereby determining the optimal values ​​of the center parameter, amplitude parameter, and broadening parameter. The optimal value of the center parameter is used as the peak position feature, the optimal value of the amplitude parameter is used as the peak intensity feature, and the energy width of the peak shape function at half the optimal value of the amplitude parameter is calculated based on the optimal value of the broadening parameter. The energy width is used as the half-width feature.

4. The method according to claim 1, characterized in that, By minimizing the distribution distance metric between the source domain feature matrix and the target domain feature matrix in the projection space, the domain adaptation transformation matrix is ​​solved. This domain adaptation transformation matrix is ​​then used to reconstruct the weight coefficients in the source domain regression mapping relationship, generating a transfer regression mapping relationship adapted to the target domain, including: Calculate the sample mean vector and covariance matrix of the source domain feature matrix and the target domain feature matrix in the original feature space, respectively; Construct a projection transformation matrix, and map the source domain feature matrix and the target domain feature matrix to a low-dimensional projection space through the projection transformation matrix to obtain the source domain projection feature matrix and the target domain projection feature matrix; Calculate the Euclidean distance between the sample mean vector of the source domain projection feature matrix and the sample mean vector of the target domain projection feature matrix, and the matrix norm difference between the covariance matrix of the source domain projection feature matrix and the covariance matrix of the target domain projection feature matrix. Define the weighted sum of the Euclidean distance and the matrix norm difference as the distribution distance metric. The element values ​​of the projection transformation matrix are iteratively updated using the gradient descent method until the distribution distance metric converges to a minimum, thus obtaining the domain adaptation transformation matrix. The domain adaptation transformation matrix and the weight coefficient vector in the source domain regression mapping relationship are multiplied by matrix to obtain the reconstructed weight coefficient vector. The reconstructed weight coefficient vector is then combined with the intercept term in the source domain regression mapping relationship to generate the migration regression mapping relationship that adapts to the target domain.

5. The method according to claim 1, characterized in that, A nonlinear residual correction mapping relationship is trained based on the deviation sequence and the corresponding target domain feature matrix. This nonlinear residual correction mapping relationship is then used to compensate for the initial element content prediction values, outputting corrected element content analysis values, including: Representative samples covering the elemental content range are selected from the target domain calibrated samples, and the representative samples are measured by standard chemical analysis methods to obtain the reference true value of the representative samples. The target domain feature matrix corresponding to the representative sample is input into the migration regression mapping relationship for calculation to obtain the initial element content prediction value of the representative sample; the numerical difference between the initial element content prediction value of the representative sample and the reference true value is calculated to form a deviation sequence. Using the target domain feature matrix corresponding to the representative sample as the input feature and the deviation sequence as the output label, a nonlinear residual correction mapping relationship is constructed using a multi-layer neural network structure. The connection weights and bias terms in the multi-layer neural network structure are adjusted through the backpropagation algorithm to minimize the mean square error between the output value of the nonlinear residual correction mapping relationship and the deviation sequence, thus completing the training of the nonlinear residual correction mapping relationship. The target domain feature matrix of the sample to be calibrated in the target domain is input into the nonlinear residual correction mapping relationship to obtain the predicted residual compensation value; the initial element content prediction value is subtracted from the predicted residual compensation value to output the corrected element content analysis value.

6. The method according to claim 5, characterized in that, A nonlinear residual correction mapping relationship is constructed using a multi-layer neural network structure. The connection weights and bias terms in the multi-layer neural network structure are adjusted using the backpropagation algorithm to minimize the mean square error between the output value of the nonlinear residual correction mapping relationship and the bias sequence. This completes the training of the nonlinear residual correction mapping relationship, including: Construct a multi-layer neural network structure comprising an input layer, a hidden layer, and an output layer. The number of neurons in the input layer is consistent with the feature dimension of the target domain feature matrix, the number of neurons in the output layer is consistent with the number of element types, and the hidden layer comprises at least one intermediate processing layer. Randomly initialize and assign values ​​to the connection weight matrix and bias vector between each layer in the multi-layer neural network structure. The target domain feature matrix corresponding to the representative sample is input into the input layer, and linear transformation is performed sequentially through the connection weight matrix between each layer. After the output of each layer, a nonlinear activation function transformation is applied, and finally the residual prediction output value is obtained in the output layer. The mean square error between the residual prediction output value and the deviation sequence is calculated as the loss function value; the partial derivatives of the loss function value with respect to the connection weight matrix and the bias vector are calculated, and the gradient values ​​of the parameters of each layer are calculated using the backpropagation algorithm; Adjust the values ​​of the connection weight matrix and the bias vector in the opposite direction of the gradient value, and repeat the forward and backward propagation process until the loss function value converges to below the preset threshold, thus completing the training of the nonlinear residual correction mapping relationship.

7. An intelligent modeling and error compensation system for XRF calibration curves based on transfer learning, used to implement the method as described in any one of claims 1-6, characterized in that, include: The data acquisition unit is used to acquire the first X-ray spectral intensity data and elemental content standard values ​​of the source domain standard sample set, and the second X-ray spectral intensity data of the target domain sample to be calibrated. The feature extraction unit is used to perform baseline correction and peak identification processing on the first X-ray spectral intensity data, extract the peak position, peak intensity and full width at half maximum of the feature spectral lines to form a source domain feature matrix, and establish a source domain regression mapping relationship based on the source domain feature matrix and the element content standard value. The migration adaptation unit is used to perform the same baseline correction and peak identification processing on the second X-ray spectral intensity data, extract the target domain feature matrix, solve the domain adaptation transformation matrix by minimizing the distribution distance metric of the source domain feature matrix and the target domain feature matrix in the projection space, and use the domain adaptation transformation matrix to reconstruct the weight coefficients in the source domain regression mapping relationship to generate a migration regression mapping relationship adapted to the target domain. An initial prediction unit is used to input the target domain feature matrix into the migration regression mapping relationship for calculation to obtain the initial element content prediction value of the target domain sample. The residual correction unit is used to select a representative sample in the target domain for chemical analysis to obtain a reference true value, calculate the deviation sequence between the initial element content prediction value of the representative sample and the reference true value, train a nonlinear residual correction mapping relationship based on the deviation sequence and the corresponding target domain feature matrix, use the nonlinear residual correction mapping relationship to perform compensation operation on the initial element content prediction value, and output the corrected element content analysis value.

8. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 6.