Spectral element quantitative analysis method based on multivariate feature dynamic extraction
By combining one-dimensional convolutional neural network and multi-layer perceptron and introducing an attention mechanism, the quantitative analysis method of spectral elements is solved, and the problems of low accuracy and high noise interference when processing complex spectral data are solved, achieving high-precision and efficient quantitative analysis of elements.
Patent Information
- Application Number
- CN202411936549.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-25
AI Technical Summary
When traditional quantitative analysis methods of spectral elements are processed with complex samples and spectral data with high noise, they often face problems such as low accuracy, high noise interference and low analysis efficiency. They fail to fully consider the correlation and complexity of spectral data and ignore important nonlinear features.
The quantitative analysis method of spectral elements based on dynamic extraction of multivariate features is adopted, and the low-energy, medium-energy and high-energy spectrometer is used to collect low-energy, medium-energy and high-energy spectroscopy data. Through a one-dimensional convolutional neural network (1DCNN) and a multi-layer perceptron (MLP), the attention mechanism module is embedded to dynamically extract and weight the characteristics of the fusion spectral data, and the quantitative analysis results of the target elements in the sample are output.
It improves the accuracy and robustness of element quantitative analysis, especially in complex spectral data and high noise environments, effectively reducing the impact of noise and improving the accuracy and efficiency of analysis results.
Smart Images

Figure CN119884646A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of digital signal processing, and in particular to a spectrum element quantitative analysis method based on dynamic extraction of multivariate features. Background Art
[0002] Spectral element quantitative analysis is an important means of analyzing material composition and is widely used in environmental monitoring, material science, food safety and other fields. X-ray fluorescence (XRF) technology excites elements in the sample to emit characteristic X-rays. The content of elements in the sample can be determined based on the intensity and energy of these rays. However, traditional spectral element quantitative analysis methods often face problems such as low accuracy, large noise interference, and low analysis efficiency when dealing with complex samples and spectral data with more noise. Traditional noise processing methods (such as wavelet denoising and Kalman filtering) are difficult to effectively retain important element characteristics in the spectrum while removing noise, which affects the accuracy of quantitative analysis. In addition, traditional feature extraction methods fail to fully consider the correlation and complexity of spectral data, and often ignore important nonlinear characteristics in spectral signals. Therefore, the accuracy and robustness of quantitative analysis are not high.
[0003] With the continuous development of deep learning technology, feature extraction and analysis methods based on deep learning have gradually shown their great potential in spectral data processing, especially the combination of convolutional neural network (CNN) and attention mechanism, which can effectively extract key features from complex spectral data, reduce the impact of noise on the analysis results, and improve the accuracy of quantitative analysis. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides a spectral element quantitative analysis method based on dynamic extraction of multivariate features to solve the problems raised in the background technology.
[0005] The above technical objectives of the present invention are achieved through the following technical solutions:
[0006] A spectral element quantitative analysis method based on multivariate feature dynamic extraction comprises the following steps:
[0007] S1. Collect low-energy, medium-energy and high-energy spectral data of the sample using an X-ray fluorescence spectrometer;
[0008] S2. The spectral data of the three energy states are respectively input into a one-dimensional convolutional neural network (1DCNN) for feature extraction, wherein the 1DCNN includes a convolution layer, a batch normalization layer, a ReLU activation function, a pooling layer, and a Dropout layer;
[0009] S3. An attention mechanism module is embedded in 1DCNN, and an attention weight sequence of the same length as the spectral sequence is generated through dynamic calculation. The spectral features are weighted using the weight sequence to highlight the characteristic area of the target element.
[0010] S4. Input the feature vectors of low, medium and high energy state spectral data into independent multi-layer perceptron (MLP) models for pre-training to obtain preliminary prediction results;
[0011] S5. Dynamically weight the initial prediction results of the three energy states through the weighted fusion module, calculate the weights through Softmax normalization, and output the fusion features;
[0012] S6. Input the fused features into the final multi-layer perceptron model and output the quantitative analysis results of the target elements in the sample.
[0013] Preferably, the spectral data consists of characteristic peak signals of the target element and noise, and the noise includes Rayleigh scattering, Compton scattering and environmental noise.
[0014] Preferably, the workflow of the attention mechanism module is:
[0015] A1. Generate a first feature map by performing a one-dimensional convolution operation on the input spectral data;
[0016] A2. Use ReLU activation function to enhance the nonlinear expression ability of feature maps;
[0017] A3. Perform one-dimensional convolution operation again to generate a second feature map;
[0018] A4. Use the Sigmoid activation function to generate an attention weight sequence, multiply the weight sequence by the spectral data point by point, and generate weighted spectral data.
[0019] The calculation formula of attention weight is as follows:
[0020] attention=σ(W att *Conv(f(Conv(x))))
[0021] Among them, W att is the attention convolution kernel, σ represents the Sigmoid function, and * represents the convolution operation. After generating the attention weight, it is applied to the corresponding energy state data: weighted x =x×attention.
[0022] Preferably, the 1DCNN processes low, medium and high energy state spectral data independently, and its network structure includes:
[0023] B1. Convolutional layer, used to extract local feature information from spectral data;
[0024] B2. Batch normalization layer, used to standardize the output activation values of the convolutional layer to improve training efficiency and model stability;
[0025] B3. ReLU activation function, used to enhance the model's nonlinear expression ability for spectral data;
[0026] B4. Pooling layer, used to reduce feature dimensions and reduce the amount of calculation;
[0027] B5.Dropout layer, used to randomly block some neurons to prevent the model from overfitting.
[0028] Among them, the convolutional neural network structure is independent for the spectra of the three energy states, that is, independent convolution feature extraction operations are performed on the spectra of the three energy states. The three energy state spectra are low, medium and high energy states, corresponding to the tube voltage of the X-ray tube. For different types of elements, the excitation voltage that can excite the element characteristic rays is also different. The excitation voltage is proportional to the element number, that is, when you want to detect elements with higher atomic numbers, you need a larger tube voltage, that is, observe from the high-energy state spectrum. The first half of the entire network has three independent branches, which are the addition of a multi-layer perceptron after 1DCNN for quantitative prediction of elements, which is the pre-training part of the network;
[0029] Since the convolutional neural network combined with the attention mechanism only extracts and weights the peak features of a single energy state spectrum, and the peak areas corresponding to the elements are often not necessarily scattered in the same energy state spectrum, it is necessary to analyze each element independently in the data set that fuses different energy state spectra. Each energy state branch contains an attention module to generate attention weights for each energy state. The weighted fusion of multiple energy states is achieved through this learnable fusion weight parameter. The formula is as follows:
[0030]
[0031] Among them, α i represents the fusion weight of the i-th branch, and the sum is ensured to be 1 through Softmax normalization;
[0032] For the above pre-training settings, the number of epochs can be set to 5 to 10, and preliminary predictions of the three energy states for each element can be obtained by calculating R 2 To visualize this result, we set the normalized weights for dynamic allocation based on the predicted performance of each element in different energy states;
[0033] After multi-energy state fusion, each element is quantitatively analyzed, and the final element quantitative analysis is performed based on the multi-layer perceptron. At this time, the spectral data set corresponding to the element has extracted the features most relevant to the element content through attention. The multi-layer perceptron can quickly perceive the feature area and perform nonlinear regression prediction, greatly improving the prediction accuracy and efficiency.
[0034] Preferably, the pre-trained multi-layer perceptron (MLP) outputs preliminary prediction results of low-energy state, medium-energy state and high-energy state spectral data respectively, and performs weighted fusion by the following formula:
[0035]
[0036] Among them, S i is the initial predicted value of the i-th energy state, w i is the weighted coefficient corresponding to the energy state, and is ensured by Softmax normalization
[0037] Preferably, the final multi-layer perceptron model is used to process the weighted fused feature vector and output the quantitative analysis result of the target element. The model includes at least two hidden layers, and the number of neurons in each layer is set according to experimental optimization.
[0038] Preferably, the energy state classification of the spectral data is based on the tube voltage of the X-ray fluorescence tube, and the spectral data corresponding to different tube voltages are respectively suitable for detecting elements in different atomic number ranges, the high energy state is suitable for high atomic number elements, and the low energy state is suitable for low atomic number elements.
[0039] Preferably, the method is suitable for quantitative analysis of spectral data containing complex background noise, and is particularly suitable for element detection and quantitative analysis in material science, environmental monitoring, food safety and archaeological research.
[0040] In summary, the present invention mainly has the following beneficial effects:
[0041] 1. The present invention combines a one-dimensional convolutional neural network (1DCNN) and a multi-layer perceptron (MLP), and introduces an attention mechanism, which can accurately extract key features in spectral data and improve the accuracy of elemental quantitative analysis, especially in complex spectral data and high-noise environments.
[0042] 2. The present invention can effectively reduce the influence of noise in the spectrum, such as Rayleigh scattering, Compton scattering and background noise, through dynamic feature extraction and weighted fusion technology, and weight the key areas through the attention mechanism, thereby further improving the accuracy of the analysis results.
[0043] 3. By weighted fusion of spectral data of low energy state, medium energy state and high energy state, the present invention can adaptively extract and weight features, avoiding the limitations of manual feature selection in traditional methods and improving the quantitative analysis accuracy after multi-energy state data fusion. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a schematic diagram of the structure of the X-ray fluorescence spectrum of the present invention;
[0045] Figure 2 It is a schematic diagram of the dynamic feature extraction fusion deep learning model of the present invention;
[0046] Figure 3 is a flow chart of the attention mechanism module of the present invention;
[0047] Figure 4 It is a flow chart of multi-energy state branch fusion and final quantitative analysis of the present invention. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the described embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0049] The following examples are used to illustrate the present invention, but they cannot be used to limit the scope of protection of the present invention. The conditions in the examples can be further adjusted according to specific conditions. Simple improvements to the method of the present invention under the premise of the concept of the present invention belong to the scope of protection claimed in the present invention.
[0050] Example 1
[0051] Figure 1 This is a schematic diagram of the structure of an X-ray fluorescence spectrometer, in which the X-ray tube is the ray source, and X-rays of different wavelengths are generated by bombarding the target material with charged particles. The X-ray energy is controlled by the inter-tube voltage. The monochromator is a fully focusing hyperbolic crystal, which is used to filter the incident X-rays and control the emission of rays of a single wavelength, thereby reducing the noise of the sample reflected fluorescence. The sample is the object to be tested, which can be collected from the environment and prepared by grinding, pressing and other methods. The detector receives the X-ray fluorescence reflected from the sample and various scattered light, and converts the optical signal into an electrical signal for storage, which is the final spectral data.
[0052] Example 2
[0053] like Figure 2This is a schematic diagram of the deep learning model for dynamic feature extraction fusion. First, the spectral data and element content labels are input as data sets. The high, medium and low energy states correspond to three different data sets. A random seed is set to ensure the reproducibility of the results. The spectral data is divided into low energy state branches, medium energy state branches and high energy state branches. Each branch processes the corresponding energy state information separately. The branch structure is designed to extract the features of different energy states to prevent the loss of energy state-specific information during fusion. Each branch contains an attention module for generating attention weights. The function of the attention module is to automatically capture the key areas in the spectrum and give them higher weights, so that the model can extract important features more effectively. The obtained weight sequence is then dot-producted with each energy state spectrum.
[0054] After applying the attention module, each branch further extracts features from the input data. Here, features of different energy states are extracted mainly through operations such as convolution and pooling. Figure 2 As shown in the figure, Conv1D is a convolutional layer for a one-dimensional sequence, and ReLU is a commonly used activation function in artificial neural networks, which refers to the ramp function in mathematics, namely:
[0055] f(x)=max(0,x)
[0056] MaxPool is the maximum pooling layer, which can extract the maximum data within the specified window size, significantly reduce the size of the feature tensor, and reduce the computational complexity; Dropout can randomly discard some nodes in the neural network. It is a regularization technique to prevent overfitting of deep neural networks and can increase the generalization ability of the model; Flatten is a dimensionality reduction function for multidimensional data, which is specified as one dimension here;
[0057] After feature extraction, each branch undergoes a pre-training process, uses a multi-layer perceptron (MLP) to further process the features, and outputs a specific prediction value. Each MLP is responsible for predicting the concentration or characteristic value of each target element in the energy state to obtain the pre-training result.
[0058] The output of each branch is passed through MLP to generate independent prediction results, and then these outputs are integrated through a weighted fusion module. The weighted fusion module contains a learnable fusion weight matrix. These weights are normalized by Softmax and applied to the output of each branch.
[0059] At this time, each element has a data set that is a weighted fusion of the three energy states, and then a multi-layer perceptron (MLP) corresponding to each element is input to perform a more detailed quantitative analysis of each element. This MLP outputs the final prediction value of the model.
[0060] Example 3
[0061] Figure 3 This is the attention mechanism flow chart, which mainly explains Figure 1 Detailed structure of the attention module. The input is the spectral data corresponding to the energy state, usually a one-dimensional signal. The attention mechanism module aims to generate a point-by-point attention weight based on the data, which is equal to the length of the input spectral sequence.
[0062] Convolutional layer 1 (Conv1D): Perform a one-dimensional convolution operation on the input spectral data to generate the first feature map. The convolution operation can capture the characteristics of the local area in the spectrum;
[0063] ReLU activation function: The convolutional features are activated by the ReLU activation function to add nonlinearity, thereby enhancing the expressiveness of the model and helping to capture complex features in the input;
[0064] Convolutional layer 2 (Conv1D): Generates the second feature map to further extract deep features of the data;
[0065] Attention Conv1D: A convolutional layer with a channel number of 1 is used to generate attention weights. These weights are constrained by the Sigmoid activation function to be between 0 and 1 to ensure the stability and effectiveness of the weights.
[0066] Sigmoid activation function: limits the attention weight between 0 and 1 to ensure the rationality of the attention weight. A high weight value indicates that the corresponding position is more important.
[0067] Finally, the dot product of the input spectrum and the calculated attention weight is performed to obtain the spectral data of the highlighted area.
[0068] Example 4
[0069] Figure 4 This is a flowchart of multi-energy state branch fusion and final quantitative analysis. The figure visually shows the processing flow of different regions of spectral data in the network. For elements that need to be quantitatively analyzed, the peak area representing the size of the element concentration value may appear in different areas of the three energy state spectra, namely Figure 4 The black area marked in the spectral sequence is trained by the attention module to obtain three corresponding feature sequences and then enters the 1DCNN network to obtain the sequence after feature extraction. At this time, pre-training of three energy states is performed. The pre-training uses the MLP network, which can output different normalized weights for the three energy states, namely Figure 4 The proportion of the black part in the middle rectangle is dot-multiplied and concatenated with the characteristic information of the three energy states extracted previously to obtain the final training set for each element. At this time, it is input into the MLP for further training to obtain a more accurate and effective quantitative prediction of the element.
[0070] Working principle: Please refer to Figure 1-Figure 4 As shown, the present invention is based on a deep learning model for dynamic extraction of multivariate features, combined with a convolutional neural network (CNN) and an attention mechanism, to achieve efficient and accurate spectral element quantitative analysis. It can effectively extract element features from complex spectral data and perform high-precision quantitative analysis, especially in the presence of large noises. It can maintain high accuracy and reliability, and is particularly suitable for the analysis of complex samples.
[0071] Although the embodiments of the present invention have been shown and described, it is understood by those skilled in the art that, unless otherwise defined, the technical terms or scientific terms used in the present invention should have the usual meanings understood by persons with ordinary skills in the field to which the present invention belongs, and the words "include" or "comprise" and the like used in the present invention mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents.
[0072] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A spectral element quantitative analysis method based on dynamic extraction of multivariate features, characterized in that: The following steps are involved: S1. Collect low-energy, medium-energy and high-energy spectral data of the sample using an X-ray fluorescence spectrometer; S2. The spectral data of the three energy states are respectively input into a one-dimensional convolutional neural network (1DCNN) for feature extraction, wherein the 1DCNN includes a convolution layer, a batch normalization layer, a ReLU activation function, a pooling layer, and a Dropout layer; S3. An attention mechanism module is embedded in 1DCNN, and an attention weight sequence of the same length as the spectral sequence is generated through dynamic calculation. The spectral features are weighted using the weight sequence to highlight the characteristic area of the target element. S4. Input the feature vectors of low, medium and high energy state spectral data into independent multi-layer perceptron (MLP) models for pre-training to obtain preliminary prediction results; S5. Dynamically weight the initial prediction results of the three energy states through the weighted fusion module, calculate the weights through Softmax normalization, and output the fusion features; S6. Input the fused features into the final multi-layer perceptron model and output the quantitative analysis results of the target elements in the sample.
2. The method for quantitative analysis of spectral elements based on dynamic extraction of multivariate features according to claim 1, characterized in that: The spectral data consists of characteristic peak signals of the target element and noise, and the noise includes Rayleigh scattering, Compton scattering and environmental noise.
3. The method for quantitative analysis of spectral elements based on dynamic extraction of multivariate features according to claim 1, characterized in that: The workflow of the attention mechanism module is: A1. Generate a first feature map by performing a one-dimensional convolution operation on the input spectral data; A2. Use ReLU activation function to enhance the nonlinear expression ability of feature maps; A3. Perform one-dimensional convolution operation again to generate a second feature map; A4. Use the Sigmoid activation function to generate an attention weight sequence, multiply the weight sequence by the spectral data point by point, and generate weighted spectral data.
4. The method for quantitative analysis of spectral elements based on dynamic extraction of multivariate features according to claim 1, characterized in that: The 1DCNN processes the low, medium and high energy state spectral data independently, and its network structure includes: B1. Convolutional layer, used to extract local feature information from spectral data; B2. Batch normalization layer, used to standardize the output activation values of the convolutional layer to improve training efficiency and model stability; B3. ReLU activation function, used to enhance the model's nonlinear expression ability for spectral data; B4. Pooling layer, used to reduce feature dimensions and reduce the amount of calculation; B5.Dropout layer, used to randomly block some neurons to prevent the model from overfitting.
5. The method for quantitative analysis of spectral elements based on dynamic extraction of multivariate features according to claim 1, characterized in that: The pre-trained multi-layer perceptron (MLP) outputs the preliminary prediction results of the low-energy state, medium-energy state and high-energy state spectral data respectively, and performs weighted fusion through the following formula: Among them, S i is the initial predicted value of the i-th energy state, w i is the weighted coefficient corresponding to the energy state, and is ensured by Softmax normalization 6. The method for quantitative analysis of spectral elements based on dynamic extraction of multivariate features according to claim 1, characterized in that: The final multi-layer perceptron model is used to process the weighted fused feature vector and output the quantitative analysis results of the target element. The model includes at least two hidden layers, and the number of neurons in each layer is set according to experimental optimization.
7. The method for quantitative analysis of spectral elements based on dynamic extraction of multivariate features according to claim 1, characterized in that: The energy state classification of the spectral data is based on the tube voltage of the X-ray fluorescence tube. The spectral data corresponding to different tube voltages are respectively suitable for detecting elements in different atomic number ranges. The high energy state is suitable for elements with high atomic number, and the low energy state is suitable for elements with low atomic number.
8. The method for quantitative analysis of spectral elements based on dynamic extraction of multivariate features according to claim 1, characterized in that: This method is suitable for quantitative analysis of spectral data containing complex background noise, and is particularly suitable for element detection and quantitative analysis in materials science, environmental monitoring, food safety and archaeological research.
Citation Information
Cited By
Element spectrum semi-quantitative analysis system
CN121305243A
LIBS element quantitative analysis method based on double-branch feature fusion and electronic equipment
CN121577609A
LIBS element quantitative analysis method based on double-branch feature fusion and electronic equipment
CN121577609B