LIBS spectrum processing method and device based on residual skewness estimation and storage medium
By using a residual skewness estimation method and employing a Bayesian framework and variational inference to analyze the LIBS spectral model, the problem of noise interference in LIBS spectra was solved, achieving high-precision separation of spectral peaks, baselines, and noise, thus improving the computational efficiency and accuracy of spectral analysis.
Patent Information
- Application Number
- CN202610048919.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-14
- Publication Date
- 2026-05-15
AI Technical Summary
In existing LIBS spectral analysis, spectral peaks are submerged by noise and baseline drift is severe, resulting in a reduced signal-to-noise ratio and affecting the accuracy of subsequent analyses. Traditional stepwise strategies suffer from difficulties in coordinating parameter optimization and error accumulation.
A residual skewness estimation-based method is adopted, which uses a Bayesian framework and variational inference to analyze the LIBS spectral model. The optimal convergence point is determined by iterative bias, and spectral peaks, baselines and noise are separated.
It improves the accuracy and computational efficiency of spectral estimation, effectively handles LIBS spectra in high-noise environments, prevents the accumulation of negative residual bias caused by positive constraints, and ensures the convergence of the algorithm.
Smart Images

Figure CN122045661A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of laser-induced breakdown spectral data processing technology, and in particular to a LIBS spectral processing method, device and storage medium based on residual skewness estimation. Background Technology
[0002] LIBS (Laser-Induced Breakdown Spectroscopy) technology generates plasma spectra by exciting samples with laser pulses, offering advantages for in-situ detection in fields such as metallurgy, environmental monitoring, and biomedicine. LIBS spectra can be decomposed into discrete peaks carrying elemental information, a low-frequency, slowly varying baseline, and additive noise. The peaks, as the core signals for quantitative and qualitative analysis, exhibit a discrete, peak-like structure along the wavelength dimension, and their intensity and position directly reflect the elemental type and abundance. However, in industrial field testing, LIBS spectra are affected by multiple factors: internally, the blackbody radiation, bremsstrahlung radiation, and recombination radiation accompanying plasma evolution create a nonlinear high-float background, and the matrix effect leads to inter-element interference, causing severe baseline fluctuations. Externally, laser energy fluctuations, sample surface inhomogeneities, and detector dark current noise introduce random noise, further reducing the signal-to-noise ratio, causing peaks to be submerged by noise and severe baseline drift, affecting the accuracy of subsequent analysis and even leading to model overfitting. Therefore, effectively separating peaks, baseline, and noise is a crucial prerequisite for LIBS spectral analysis.
[0003] Existing LIBS spectral interference processing methods are mainly divided into two strategies: step-by-step processing and joint estimation. Traditional step-by-step strategies, such as baseline correction methods like ASLS and airPLS, process the spectrum in stages. The parameters of each step are set based on independent criteria, which has the drawbacks of difficulty in coordinating the optimization of the stage parameters and the gradual accumulation of errors. The residual noise from baseline correction can easily mislead subsequent denoising, leading to the missed detection of weak peaks or the introduction of spurious peaks. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a LIBS spectral processing method, device and storage medium based on residual skewness estimation.
[0005] The technical solution adopted by this invention to solve its technical problem is: a LIBS spectral processing method based on residual skewness estimation, comprising the following steps: Step S10: Obtain the observation signal of the LIBS spectrum; Step S20: Morphological analysis based on LIBS spectra, constructing a spectral model using the prior distribution of the Bayesian framework; Step S30: Based on the observed signal, the spectral model is analyzed using variational inference to obtain iteration bias and posterior analytical data; Step S40: Determine whether the iteration deviation meets the iteration termination requirements; if it does, stop the iteration and obtain the actual spectral data based on the posterior analytical data; if it does not meet the requirements, proceed to step S20.
[0006] Optionally, step S20 includes: Based on the morphological analysis, the observed signal is decomposed into pure spectral peak signals and the baseline spectral model according to the prior distribution.
[0007] Optionally, step S30 includes: Based on the spectral model and the observed signal, the posterior distribution is obtained; The posterior distribution is approximated by the variational inference to obtain the posterior analytical expression; The observed signal participates in the iteration of the posterior analytical expression to obtain the iteration bias and posterior analytical data.
[0008] Optionally, the observed signal participates in the iteration of the posterior analytical expression to obtain the iteration bias and posterior analytical data, including: Obtain the latent variables from the previous calculation of the posterior analytical expression; The latent variables are updated using the calculation of the mean and / or variance vector and positive constraints to obtain the updated latent variables; The updated latent variable is substituted into the posterior analytical expression for calculation to obtain the iteration bias and the posterior analytical data.
[0009] Optionally, the step of approximating the posterior distribution using the variational inference to obtain the posterior analytical expression further includes: The posterior analytical expression is verified using simulated spectra to determine the initialization data for the posterior analytical expression.
[0010] Optionally, step S40 includes: Determine whether the skewness of the current iteration deviation has reversed from that of the previous iteration deviation; If so, then the iteration deviation is determined to meet the iteration termination requirement.
[0011] Optionally, step S40 further includes: If the absolute value of the skewness of the current iteration deviation is less than the absolute value of the skewness of the previous iteration deviation, then the posterior analytical data corresponding to the current iteration deviation shall be used as the actual spectral data. If the absolute value of the skewness of the current iteration deviation is greater than the absolute value of the skewness of the previous iteration deviation, then the posterior analytical data corresponding to the previous iteration deviation shall be used as the actual spectral data.
[0012] Optionally, it also includes: The iteration stops when the relative rate of change of the spectral analysis data is lower than a preset change amount or when the iteration reaches a preset maximum number of iterations.
[0013] The present invention also provides an electronic device including a processor and a memory storing computer-readable instructions, the processor being configured to perform the method described in any one of the above description when executing the computer-readable instructions.
[0014] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of the above descriptions.
[0015] The implementation of this invention has the following beneficial effects: This invention utilizes variational inference to analyze the spectral model, determine the optimal convergence point, achieve effective separation of the observed signal, and obtain posterior analytical data, which greatly improves the accuracy and computational efficiency of spectral estimation. Furthermore, it can handle LIBS spectra under high noise conditions and prevent the accumulation of negative residual bias caused by positive constraints under high noise conditions, which could lead to algorithm convergence failure. Attached Figure Description
[0016] The present invention will be further described below with reference to the accompanying drawings and embodiments: Figure 1 This is a flowchart of a LIBS spectral data processing method in one embodiment; Figure 2 This is simulated data for a 5 dB LIBS spectrum in one embodiment; Figure 3 This is simulated data for a 10 dB LIBS spectrum in one embodiment; Figure 4 This is simulated data for a 20 dB LIBS spectrum in one embodiment; Figure 5 This is the processing result of a 5dB LIBS spectrum in one embodiment; Figure 6 This is the processing result of a 10dB LIBS spectrum in one embodiment; Figure 7 This is the processing result of a 20dB LIBS spectrum in one embodiment; Figure 8 This refers to the residual at the first iteration in one embodiment; Figure 9 This refers to the residual at the 4th iteration in one embodiment; Figure 10 This refers to the residual at the 7th iteration in one embodiment; Figure 11 This refers to the residual at the 10th iteration in one embodiment; Figure 12 This represents the residual at the 15th iteration in one embodiment. Figure 13 This refers to the residual at the 20th iteration in one embodiment; Figure 14 This refers to the residual at the 40th iteration in one embodiment; Figure 15 This represents the residual at the 100th iteration in one embodiment. Figure 16 This is the first LIBS spectrum and processing result in one embodiment; Figure 17 This is a second LIBS spectrum and processing result in one embodiment; Figure 18 This is a third LIBS spectrum and processing result in one embodiment; Figure 19 This is the fourth LIBS spectrum and processing result in one embodiment. Detailed Implementation
[0017] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0018] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.
[0019] This invention provides a LIBS spectral processing method based on residual skewness estimation, see [link to relevant documentation]. Figure 1 This includes the following steps: Step S10: Obtain the observation signal of the LIBS spectrum.
[0020] Optionally, the observed signal is the undenoised feedback data from the LIBS spectrometer. This eliminates the need for separate denoising of the LIBS spectrometer data, reducing the use of computing resources.
[0021] Step S20: Morphological analysis based on LIBS spectra, constructing a spectral model using the prior distribution of the Bayesian framework.
[0022] In some embodiments, by analyzing the morphology of historically acquired LIBS spectra, it can be determined that the LIBS spectrum belongs to a Gaussian distribution.
[0023] Step S30: Based on the observed signal, use variational inference to analyze the spectral model and obtain the iteration bias and posterior analytical data.
[0024] Understandably, the spectral model is obtained through the prior distribution, and the observed signal is feedback data from real-time acquired LIBS spectra. Based on Bayesian theory, the spectral model combined with the observed signal can yield the posterior probability. However, calculating the posterior probability involves multiple integrals of the denominator over each random variable, which is impractical when dealing with thousands of spectral data points. Therefore, variational inference is used to solve the spectral model in conjunction with the observed signal, simplifying the calculation process and further enabling the acquisition of posterior analytical data.
[0025] Step S40: Determine whether the iteration deviation meets the iteration termination requirements; if it does, stop the iteration and obtain the actual spectral data based on the posterior analytical data; if it does not meet the requirements, proceed to step S20.
[0026] This invention utilizes variational inference to analyze the spectral model, determine the optimal convergence point, achieve effective separation of the observed signal, obtain posterior analytical data, greatly improve the accuracy and computational efficiency of spectral estimation, and solve the problem of residual negative bias accumulation caused by positive constraints under high noise, which leads to algorithm convergence failure.
[0027] In some executable embodiments, step S20 includes: Based on morphological analysis, the observed signal is decomposed into pure spectral peak signals and a baseline spectral model according to the prior distribution.
[0028] Specifically, based on morphological analysis, it is assumed that the observed signal follows a Gaussian distribution. Under this Gaussian distribution premise, a mathematical model of the observed signal is constructed based on a Bayesian framework. This mathematical model is decomposed into a superposition of pure spectral peak signal, baseline, and noise.
[0029] In some executable embodiments, step S30 includes: Based on the spectral model, the posterior distribution is obtained.
[0030] Specifically, the posterior distribution is obtained using Bayes' theorem and a spectral model. Understandably, the parameters of the posterior distribution can be expressed mathematically.
[0031] To obtain the posterior, the variational inference formula requires the use of the likelihood probability of the observed variable and the prior of the other variables. The likelihood probability of the spectral model is shown below: .
[0032] In the formula, This is a LIBS spectral observation signal; For noise accuracy parameters; It is a pure spectral peak signal; As the baseline; I It is the identity matrix. Here is the noise covariance matrix; Let be the likelihood probability of the spectral model; This represents the total number of data points in the LIBS spectral observation signal.
[0033] By using variational inference to approximate the posterior distribution, we obtain the posterior analytical expression.
[0034] Using variational inference, a distribution q is used to approximate the posterior distribution. For each distribution, the KL divergence is used to measure the similarity between the two distributions, thus transforming the integral problem of solving for the posterior distribution into an optimization problem. This reduces the computational difficulty and allows the posterior probability, which was previously unobtainable, to be obtained through optimization. Furthermore, the optimization process naturally provides the location and shape of the vicinity of the optimal value, enabling noise removal in subsequent iterations without the need for noise reduction of the observed signal, thereby reducing computational resource consumption.
[0035] Since the observed signal is known, the complete likelihood is constant, and the likelihood is the sum of the KL divergence and the lower confidence bound, we can minimize the KL divergence between q and p by maximizing the lower confidence bound (making the distributions of q and p most 'approximate'), thus obtaining the analytical expression for the posterior parameter.
[0036] Furthermore, considering the narrow peak characteristics of the LIBS-acquired signal, the pure spectral peak signal... Modeled as a sparse vector, following a pointwise precision parameter vector =[ , ……, Each component has an independent Gaussian prior, in which The transpose is indicated by Π. Due to the independence of the components, the joint probability density can be written as the product of the marginal probability densities, denoted by Π. The formula between the pure spectral peak signal and the parameter vector following a pointwise precision is as follows: Obeying the point-by-point precision parameter vector The initial value is relatively large, forcing the pure spectral peak signal to be large. It exhibits sparsity. It also follows an uninformative prior gamma distribution and relies on variational inference to update parameters.
[0037] In summary, the posterior analytical expression is as follows: In the formula, This is the posterior probability; It is a vector, which is a set of latent variables and parameters; This is the posterior probability of the pure spectral peak signal used to replace the posterior probability of the pure spectral peak signal in variational inference. This is the baseline posterior probability used to replace the baseline posterior in variational inference; The posterior probability of the noise precision parameter is used to replace the posterior probability of the noise precision parameter in variational inference. In variational inference, this is used to replace the posterior probability of a parameter vector with a pointwise precision.
[0038] The observed signal participates in the iteration of the posterior analytical expression to obtain the iteration bias and posterior analytical data.
[0039] Specifically, the specific data of the observed signal are added to the calculation as initial data during the first iteration of the posterior analytical expression.
[0040] To solve for the distribution of a certain latent variable in the posterior analytical expression, first fix the distributions of other latent variables, and then solve them sequentially using the coordinate ascent method.
[0041] In some scenarios, since conjugate priors are used, the form of the posterior distribution is known, and only the parameters of these distributions are needed.
[0042] In some executable embodiments, the observed signal participates in the iteration of the posterior analytical expression to obtain the iteration bias and posterior analytical data, including: Obtain the latent variables from the previous calculation of the posterior analytical expression.
[0043] It should be noted that the observed signal is the observed variable. If it is the first iteration, the hidden variables are initialized with the initial data.
[0044] In some embodiments, latent variables include pure spectral peak signals, baselines, noise precision parameters, and a vector of pointwise precision parameters.
[0045] In some scenarios, raw spectral files in text and tabular formats are read to obtain the observed signals. The maximum number of iterations is set to M=100, and the relative error of iteration termination is ε=0.01. To ensure that the initial parameters do not change with variations in spectral intensity, the observed signal... Normalization is performed, with the normalization factor being the observed signal. 10 times the maximum value.
[0046] Then the implicit variables are initialized. Set to 1, conforming to the point-by-point precision parameter vector Set to 1× The iteration variable t=0, and these three parameters will change with each iteration. Smoothness With the hyperparameters fixed, different values will result in smooth baselines with different curvatures. The larger the baseline, the smoother it will be. The smaller the value, the better it can capture complex baseline fluctuations. Within a certain range, the estimation results of the final spectral peaks all achieve good results. Here, we take... = .
[0047] During the iteration process, it is necessary to repeatedly solve the equations ( Therefore, before iteration, Performing the Chuleski decomposition yields the upper triangular matrix. Assume a pure spectral peak signal. If the initial value is 0, then the baseline The initial value is: In the formula, The mean vector of the baseline; It is an upper triangular matrix; For observation signals.
[0048] The latent variables are updated by calculating the mean and / or variance vector and applying positive constraints.
[0049] The updated latent variables are substituted into the posterior analytical expression for calculation to obtain the iteration bias and posterior analytical data.
[0050] It should be noted that the approximate posterior of a pure spectral peak signal is still a Gaussian distribution, with its mean being... and variance as follows: In the formula, ,Right now To conform to the point-by-point precision parameter vector γ The function of Diag is to transform a vector into a matrix with the vector as the diagonal element. for The estimated value; This is an estimated value for the noise accuracy parameter; This is the mean vector of the pure spectral peak signal; For observation signals; It is an identity matrix.
[0051] Since the variance of a pure spectral peak signal is a diagonal matrix, its diagonal vector can be used directly. This indicates that the inversion operation is essentially the inversion of a vector. Specifically, it is expressed as follows: In the formula, The estimated value is to conform to the point-by-point precision parameter vector; This is an estimated value for the noise accuracy parameter; For observation signals; This is the mean vector of the pure spectral peak signal; To extract the diagonal elements of the square matrix to form a vector; Let be the diagonal vector of the variance diagonal matrix of the pure spectral peak signal; The mean vector of the baseline.
[0052] Baseline covariance matrix and mean vector : In the formula, for Estimated value; The mean vector of the baseline; For observation signals; I It is the identity matrix; Given a matrix where each row contains only three non-zero elements (1, -2, 1), which successively covers three consecutive adjacent positions of the original sequence, multiply by... After transforming the dimensional vector, convert it into -2-dimensional second-order difference sequences; The accuracy parameters for the baseline; is the covariance matrix of the baseline; .
[0053] because / = Therefore, the updated formula is changed to: In the formula, For smoothness; I It is the identity matrix; D Given a matrix where each row contains only three non-zero elements (1, -2, 1), which successively covers three consecutive adjacent positions of the original sequence, multiply by... After transforming the dimensional vector, convert it into -2-dimensional second-order difference sequences; Observation signal; This is the mean vector of the pure spectral peak signal; The mean vector of the baseline.
[0054] Given a real symmetric matrix, decompose it into an upper triangular matrix using the Chuleski decomposition. The product of and its transpose It can speed up the calculation, assuming, v=A\w Equivalent to solving Av=w The solution. Find the answer. Av=w The solution is often better than the one obtained by searching. A The inverse matrix is then calculated. A inverse matrix multiplied by vector w Even faster. After obtaining the upper triangular matrix using the Chulesky decomposition, a complex system of equations will be solved. Av=w This is transformed into solving two simple systems of equations, effectively improving computational speed. Therefore, the final updated baseline equation is changed to the following: In the formula, for The decomposed triangular matrix, where, For smoothness; It is the identity matrix; Given a matrix where each row contains only three non-zero elements (1, -2, 1), which successively covers three consecutive adjacent positions of the original sequence, multiply by... After transforming the dimensional vector, convert it into -2-dimensional second-order difference sequences; for The transpose of the matrix; For observation signals; This is the mean vector of the pure spectral peak signal; The mean vector of the baseline.
[0055] The noise accuracy parameter follows a gamma distribution, and its posterior also follows a gamma distribution, as shown in the following formula: In the formula, The trace of a matrix is the sum of the elements on its diagonal. Let be the covariance matrix of the pure spectral peak signal; The covariance matrix is the baseline; This is the mean vector of the pure spectral peak signal; The mean vector of the baseline; The rate parameter is twice the sum of the rate parameters of the gamma posterior distribution that the noise accuracy follows.
[0056] The baseline covariance is too small and difficult to calculate, so... By omitting, we get: In the formula, The trace of a matrix is the sum of the elements on its diagonal. Let be the covariance matrix of the pure spectral peak signal; This is the mean vector of the pure spectral peak signal; The mean vector of the baseline; The rate parameter is twice the sum of the rate parameters of the gamma posterior distribution that the noise accuracy follows.
[0057] Due to extremely low noise levels, the noise accuracy parameters It will tend towards infinity, affecting the updating of other parameters, so give Set upper limit .
[0058] The components of the pointwise precision parameter vector are independent and can be solved independently. Converting it to vector form yields: In the formula, To take the diagonal vector of the matrix; This is the mean vector of the pure spectral peak signal; This is the diagonal vector of the pure spectral peak signal; To comply with point-by-point accuracy parameters The rate parameter of the gamma posterior distribution is twice the addend.
[0059] In each iteration, the updated values of the noise precision parameter and the pointwise precision parameter vector are their posterior mean, which is the ratio of the first parameter to the second parameter. In the formula, This represents the total number of data points in the LIBS spectral observation signal. for and The shape parameters of the prior distribution, the gamma distribution, are obeyed. for and γ The rate parameter of the prior distribution, the gamma distribution; The rate parameter is twice the sum of the gamma posterior distribution to which the noise accuracy follows; To comply with point-by-point accuracy parameters The rate parameter of the gamma posterior distribution is twice the addend.
[0060] In some executable embodiments, variational inference is used to approximate the posterior distribution to obtain the posterior analytical expression, and the method further includes: The posterior analytical expression is verified using simulated spectra, and the initial data for the posterior analytical expression are determined.
[0061] In some scenarios, the initial data is the initial data for smoothness ρ.
[0062] In some scenarios, the basic parameters of the simulated spectrum are first determined. N=2000 is set to meet the requirements for displaying spectral details, and M=100 peaks are generated, with each peak having 5 to 7 data points, consistent with the narrow peak width characteristic of actual LIBS spectra. Next, the `linespace` function in MATLAB is used to construct a linear space containing 1000 points. A Gaussian function is used to generate continuous unit Gaussian peaks as the basic template for subsequent peak sampling. Simultaneously, a zero matrix of size N rows and M columns is created to initialize the spectral matrix, preparing for the generation and combination of subsequent peaks.
[0063] Then, peaks are generated one by one. For each peak, the starting position within the range of the width and total number of data points of 5 to 10 data points is randomly selected. The number of left and right sampling points is determined according to the parity of the peak width to ensure that the difference does not exceed 1. The random range of the initial sampling points is set according to the different peak widths to enhance randomness. A suitable sampling interval is calculated to sample the Gaussian peak at equal intervals and to ensure that the sampling index is a positive integer. Then, the sampling peak is extended to the length of the total number of data points and values close to 0 are set to 0.
[0064] Finally, based on the statistical characteristics of LIBS spectral peaks, a weighted column vector is generated, classifying the peaks into three categories: 2% of peaks have heights between 3000-5000, 15% have heights between 1000-3000, and the remaining peaks have heights between 200-1000, ensuring a lower limit of 200 for peak height, which approximately matches the actual spectral peak height distribution characteristics. The spectral matrix is then multiplied by the weighted column vector to obtain the final simulated peak spectrum, which is then saved.
[0065] After superimposing the baseline and noise of different intensities, the simulated spectra with different signal-to-noise ratios are obtained. The results are then used to determine the data for initializing the smoothness ρ by a spectral estimation method based on residual skewness monitoring.
[0066] Simulated spectra of 5 / 10 / 20 dB generated using the method described above. Figures 2 to 4 As shown, the simulated spectral data at different signal-to-noise ratios contains a total of 2000 data points. The spectrum includes peaks, baseline, and noise, with the peaks and baseline remaining constant. The baseline is expressed as: In the formula, i is the data point number of the LIBS spectral observation signal.
[0067] The shape of the noise remains unchanged, but its size changes with different signal-to-noise ratios. Finally, it is superimposed on the spectral peak along with the baseline to generate a simulated spectrum.
[0068] After adjusting the smoothness parameter, the spectral processing results are obtained, and then the actual spectrum can be processed with reference to the experimental parameters. For example... Figures 2 to 4 The spectral processing results, such as Figures 5 to 7As shown in the figure. The black line represents the estimated spectral peaks, the red line represents the estimated baseline, and the estimated noise is not listed.
[0069] In some executable embodiments, step S40 includes: Determine whether the skewness of the current iteration deviation has reversed from that of the previous iteration deviation.
[0070] If so, then the iteration deviation is determined to meet the iteration termination requirement.
[0071] Specifically, since the skewness of the noise gradually decreases, the iteration termination rule is: the iteration terminates when the skewness of the current iteration deviation is greater than 0 and the skewness of the current iteration deviation is less than 0.
[0072] See Figures 8 to 15 Without adding the residual skewness iteration termination condition, the residual changes as the iteration progresses. The residuals for the 1st, 4th, 7th, 10th, 15th, 20th, 40th, and 100th iterations are listed to illustrate that the trend of the residual changes from positive to negative.
[0073] To remove residual skewness, the iteration termination condition is determined by observing the changes in the residuals as the iteration progresses. When the iteration variable iter=15, the residual skewness approaches 0, at which point the iteration terminates.
[0074] In some executable embodiments, step S40 further includes: If the absolute value of the skewness of the current iteration deviation is less than the absolute value of the skewness of the previous iteration deviation, then the posterior analytical data corresponding to the current iteration deviation shall be used as the actual spectral data.
[0075] If the absolute value of the skewness of the current iteration deviation is greater than the absolute value of the skewness of the previous iteration deviation, then the posterior analytical data corresponding to the previous iteration deviation will be used as the actual spectral data.
[0076] The iteration terminates when the absolute value of the skewness is minimized. At this point, the residual is approximately equal to the noise, and the iteration step with the smaller absolute value of the skewness is selected as the final solution. This mechanism captures the optimal state of residual symmetry by monitoring changes in the sign of the skewness, avoiding the convergence failure of traditional criteria.
[0077] By determining the optimal convergence point through the change in the sign of the residual skewness, the spectral peaks, baselines, and noise can be effectively separated, thereby improving the accuracy and computational efficiency of spectral estimation.
[0078] In one embodiment, the present invention is used to perform LIBS spectral processing on a stainless steel 316 sample. The first four spectra of the stainless steel 316 sample and the processing results are as follows. Figures 16 to 19As shown in the figure, the spectral range is approximately 300–400 nm. The red line represents the original spectrum, the blue line represents the estimated peaks, and the thick line represents the estimated baseline. It can be seen from the figure that the algorithm effectively separates the baseline, noise, and peak signals.
[0079] In some executable embodiments, it also includes: The iteration stops when the relative rate of change of the spectral analysis data is lower than the preset change amount or when the preset maximum number of iterations is reached.
[0080] On the one hand, using a relative rate of change below a preset value as a convergence criterion ensures that the iteration terminates immediately when the solution tends to stabilize, avoiding invalid computation, significantly saving resources and shortening the processing cycle. On the other hand, setting a maximum iteration limit can force the exit in extreme cases such as strong data noise, ill-conditioned models, or slow convergence, eliminating the risk of infinite loops and ensuring the robustness of the algorithm and the security of the system.
[0081] The present invention also provides an electronic device, including a processor and a memory storing computer-readable instructions, wherein the processor is configured to perform any of the methods described above when executing the computer-readable instructions.
[0082] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the methods described above.
[0083] The above embodiments only illustrate preferred embodiments of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can freely combine the above technical features without departing from the concept of the present invention, and can also make several modifications and improvements, all of which fall within the protection scope of the present invention. Therefore, all equivalent transformations and modifications made with respect to the scope of the claims of the present invention should fall within the scope of the claims of the present invention.
Claims
1. A LIBS spectral processing method based on residual skewness estimation, characterized in that, Includes the following steps: Step S10: Obtain the observation signal of the LIBS spectrum; Step S20: Morphological analysis based on LIBS spectra, constructing a spectral model using the prior distribution of the Bayesian framework; Step S30: Based on the observed signal, the spectral model is analyzed using variational inference to obtain iteration bias and posterior analytical data; Step S40: Determine whether the iteration deviation meets the iteration termination requirements; If the conditions are met, the iteration stops, and the actual spectral data is obtained based on the posterior analytical data. If the condition is not met, proceed to step S20.
2. The LIBS spectral processing method based on residual skewness estimation according to claim 1, characterized in that, Step S20 includes: Based on the morphological analysis, the observed signal is decomposed into pure spectral peak signals and the baseline spectral model according to the prior distribution.
3. The LIBS spectral processing method based on residual skewness estimation according to claim 1, characterized in that, Step S30 includes: Based on the spectral model, the posterior distribution is obtained; The posterior distribution is approximated by the variational inference to obtain the posterior analytical expression; The observed signal participates in the iteration of the posterior analytical expression to obtain the iteration bias and posterior analytical data.
4. The LIBS spectral processing method based on residual skewness estimation according to claim 3, characterized in that, The observed signal participates in the iteration of the posterior analytical expression to obtain the iteration bias and posterior analytical data, including: Obtain the latent variables from the previous calculation of the posterior analytical expression; The latent variables are updated using the calculation of the mean and / or variance vector and positive constraints to obtain the updated latent variables; The updated latent variable is substituted into the posterior analytical expression for calculation to obtain the iteration bias and the posterior analytical data.
5. The LIBS spectral processing method based on residual skewness estimation according to claim 3, characterized in that, The step of approximating the posterior distribution using the variational inference to obtain the posterior analytical expression further includes: The posterior analytical expression is verified using simulated spectra to determine the initialization data for the posterior analytical expression.
6. The LIBS spectral processing method based on residual skewness estimation according to claim 1, characterized in that, Step S40 includes: Determine whether the skewness of the current iteration deviation has reversed from that of the previous iteration deviation; If so, then the iteration deviation is determined to meet the iteration termination requirement.
7. The LIBS spectral processing method based on residual skewness estimation according to claim 6, characterized in that, Step S40 further includes: If the absolute value of the skewness of the current iteration deviation is less than the absolute value of the skewness of the previous iteration deviation, then the posterior analytical data corresponding to the current iteration deviation shall be used as the actual spectral data. If the absolute value of the skewness of the current iteration deviation is greater than the absolute value of the skewness of the previous iteration deviation, then the posterior analytical data corresponding to the previous iteration deviation shall be used as the actual spectral data.
8. The LIBS spectral processing method based on residual skewness estimation according to claim 7, characterized in that, Also includes: The iteration stops when the relative rate of change of the spectral analysis data is lower than a preset change amount or when the iteration reaches a preset maximum number of iterations.
9. An electronic device, characterized in that, It includes a processor and a memory storing computer-readable instructions, the processor being configured to execute the LIBS spectral processing method based on residual skewness estimation as described in any one of claims 1-8 when executing the computer-readable instructions.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the LIBS spectral processing method based on residual skewness estimation as described in any one of claims 1-8.
