LIBS element quantitative analysis method based on double-branch feature fusion and electronic equipment
By employing a dual-branch feature fusion method, combining CNN and MLP branches to extract local and global spectral features, and utilizing the WMA-MLP model for feature fusion, the problem of a single network model being unable to simultaneously consider local and global features is solved, thereby improving the accuracy and robustness of LIBS elemental quantitative analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI OCEANHOOD OPTO ELECTRONICS TECH CO LTD
- Filing Date
- 2025-11-17
- Publication Date
- 2026-07-03
Smart Images

Figure CN121577609B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of spectral detection technology, and in particular to a LIBS elemental quantitative analysis method and electronic device based on dual-branch feature fusion. Background Technology
[0002] Laser-induced breakdown spectroscopy (LIBS) has been widely used in quantitative component analysis in industries such as industry, environment, and geology due to its advantages of speed, minimal damage, and no need for complex sample pretreatment. With the development of data science, machine learning-based algorithms, especially deep learning, have become the mainstream technology for processing LIBS spectral data and building high-precision quantitative analysis models.
[0003] Chinese patent document CN112051256A discloses a LIBS measurement method and system for the content of analytes based on a CNN model. The method includes: training a pre-set CNN spectral model based on the LIBS spectra of a liquid sample from a simulated solution to determine the trained CNN spectral model for quantitative analysis; acquiring a liquid sample from an actual solution as the analyte, collecting the LIBS spectrum of the analyte sample, using the trained CNN spectral model to predict the content of the analyte element in the analyte sample, and outputting the predicted content of the element as the measurement result; the LIBS spectrum of each liquid sample is collected based on two or more spectral characteristic peaks of the analyte element. This method, based on the nonlinear regression fitting analysis capability of the CNN model combined with multi-characteristic peak acquisition and input, can simply and efficiently achieve element detection in complex solution field exploration and mining. However, it uses a single CNN model and processes spectral data with a one-dimensional CNN. The input is a one-dimensional array of two or more spectral feature peaks of the element to be measured. This results in a single perspective for information extraction, which cannot simultaneously take into account both local and global spectral features. Consequently, the spectral information is not fully utilized, which in turn affects the accuracy and robustness of the model.
[0004] Chinese patent document CN117235512A discloses a quantitative method for LIBS using a residual learning lightweight convolutional neural network. The method includes: collecting raw spectral data of laser-induced breakdown spectra of training samples; selecting spectral segments for each raw spectrum and averaging the selected segments; establishing and training a residual learning lightweight convolutional neural network model using the selected raw spectral segments; and using the trained residual learning lightweight convolutional neural network model to perform quantitative analysis on test samples. While it uses a residual module for spectral preprocessing to improve the signal-to-noise ratio while preserving spectral signal details, and a lightweight convolutional module for LIBS quantitative analysis, it still relies on a single-path forward propagation, representing a single CNN perspective. Although it introduces Inception multi-scale convolution, it still only extracts local features and cannot consider global features, resulting in insufficient utilization of spectral information and thus affecting the model's accuracy and robustness.
[0005] As can be seen from the above-disclosed technical solutions, existing LIBS elemental quantitative analysis methods typically employ single-structure network models. While CNNs (Convolutional Neural Networks) can effectively extract local features such as the morphology and width of spectral peaks, their local sensitivity is insensitive to long-range dependencies and global correlations between different spectral bands. Single-structure network models suffer from a limited information extraction perspective, failing to simultaneously consider both local and global spectral features, leading to insufficient utilization of spectral information and consequently affecting the model's accuracy and robustness. Summary of the Invention
[0006] The purpose of this invention is to provide a LIBS elemental quantitative analysis method and electronic device based on dual-branch feature fusion, which can obtain a more comprehensive representation of spectral features and improve the accuracy and robustness of spectral analysis models.
[0007] To address the aforementioned technical problems, the present invention provides a technical solution as follows: a LIBS elemental quantitative analysis method based on dual-branch feature fusion, comprising the following steps: S1: preprocessing the acquired LIBS spectral signals, including baseline correction and spectral resampling; S2: inputting the preprocessed spectral signal data into a dual-branch feature extraction network, extracting local features through a CNN branch and extracting global features in parallel through an MLP branch; S3: adaptively weighting and fusing the local features and the global features through a gated fusion module to obtain fused features; S4: inputting the fused features into a WMA-MLP model, wherein the WMA-MLP model is based on MLP, integrates a multi-head self-attention mechanism and a residual module, is used to model the global dependencies between features, and outputs the final elemental quantitative analysis results.
[0008] Furthermore, the baseline correction in step S1 employs an adaptive iterative reweighted penalized least squares method, with the objective function being:
[0009] ;
[0010] Where y is the original spectral signal, z is the baseline function, D is the difference operator, λ is the smoothing factor, and W is the adaptive weight matrix.
[0011] Furthermore, the spectral resampling in step S1 employs cubic spline interpolation, and its interpolation function is:
[0012] ;
[0013] Where S(x) is the fitting function, a, b, c, d are the fitting coefficients, and x is the coordinate variable.
[0014] Furthermore, in step S2, the CNN branch processes the input spectrum through two parallel convolutional paths with kernel sizes of k=5 and k=11. Each path sequentially performs convolution, ReLU activation, and adaptive max pooling operations. The pooling results from the two paths are then concatenated and passed through a fully connected layer to generate a local feature representation f. cnn .
[0015] Furthermore, the MLP branch in step S2 comprises three fully connected layers with channel dimensions of 512, 256, and 128 respectively. Each layer sequentially performs linear transformation, batch normalization, GELU activation function, Dropout regularization, and residual connection, ultimately outputting a global feature representation f. mlp .
[0016] Furthermore, the gating fusion module in step S3 is implemented in the following way: the gating factor α is generated by a small fully connected network, and the calculation formula is: ;
[0017] in, For the Sigmoid function, W1, b1, W2, and b2 are learnable parameters;
[0018] Fusion features Calculated using the following formula:
[0019] ,in This indicates the feature vector concatenation operation.
[0020] Furthermore, the WMA-MLP model uses three cascaded fully connected layers—residual module processing units. Features undergo nonlinear transformation through the fully connected layers, and then the features are further mapped into the residual module. After the output of the third residual module, an eight-head self-attention mechanism is introduced to dynamically model the global dependencies between features, thereby performing in-depth feature extraction and information compression.
[0021] Furthermore, after concatenation and linear mapping of the outputs from each head, the refined feature representation is obtained as follows: Elemental quantitative analysis results Output through a linear regression layer:
[0022] ;
[0023] Where w and b are the weight vector and bias term of the regression layer, respectively; the model is trained using the Huber loss function in conjunction with EarlyStopping, learning rate scheduling, and weight decay strategies. The Huber loss function is defined as:
[0024] ;
[0025] in, This is the threshold parameter.
[0026] Furthermore, the key hyperparameters for training the WMA-MLP model are automatically searched globally using the whale migration algorithm. These hyperparameters include: the number of hidden layer neurons, the Dropout rate, the initial learning rate, the optimizer type, the L2 regularization coefficient, the learning rate decay coefficient, the batch size, and the activation function type.
[0027] To address the aforementioned technical problems, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the LIBS elemental quantitative analysis method based on dual-branch feature fusion as described above.
[0028] This invention provides a LIBS elemental quantitative analysis method and electronic device based on dual-branch feature fusion, which realizes collaborative and multi-view modeling of LIBS spectral information. Compared with existing technologies, through a parallel processing dual-branch feature fusion structure, the CNN branch focuses on capturing local features such as the local morphology, width, and intensity of spectral peaks, while the MLP branch is responsible for modeling long-distance dependencies between spectral segments and global features of global trends. This structural design is more in line with the physical characteristics of the coexistence of local and global information in LIBS spectral data. Through feature fusion, a more comprehensive and discriminative spectral representation is obtained than that from a single perspective, improving the accuracy and robustness of the spectral analysis model. To address the challenges of high-dimensional redundancy in spectral data and unstable training of deep networks, the WMA-MLP model integrates a multi-head attention mechanism and a residual module for deep feature modeling in LIBS quantitative analysis. The multi-head attention mechanism adaptively focuses on key spectral segments, effectively mitigating redundant feature interference and improving model interpretability. By introducing a residual module, stable training of deep networks is ensured, enabling the model to learn complex nonlinear mapping relationships more efficiently, effectively solving the gradient decay and performance degradation problems of deep MLPs during training. In particular, to overcome the drawbacks of inefficient and subjective manual parameter tuning in traditional methods, the Whale Migration Optimization (WMA) algorithm is used to achieve automated global optimization of model hyperparameters, reducing reliance on manual intervention. Furthermore, through a global intelligent search strategy, it effectively avoids getting trapped in local optima, thereby enabling the systematic and repeatable acquisition of high-performance and robust quantitative analysis models, improving modeling efficiency and enhancing model performance stability. Attached Figure Description
[0029] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings represent similar elements. Unless otherwise stated, the figures in the drawings do not constitute a limitation on scale.
[0030] Figure 1 This is a schematic diagram of the LIBS elemental quantitative analysis method based on dual-branch feature fusion in an embodiment of the present invention;
[0031] Figure 2 This is a schematic diagram of the architecture of the LIBS element quantitative analysis method based on dual-branch feature fusion in an embodiment of the present invention;
[0032] Figure 3 This is a schematic diagram of the CNN branch structure in an embodiment of the present invention;
[0033] Figure 4 This is a schematic diagram of the MLP branch structure in an embodiment of the present invention. Detailed Implementation
[0034] To make the objectives, technical solutions, and advantages of this invention clearer, the various embodiments of this invention will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details have been provided in the various embodiments of this invention to facilitate a better understanding of this application. However, the technical solutions claimed in the claims of this application can be implemented even without these technical details and with various variations and modifications based on the following embodiments.
[0035] In the following detailed description, numerous specific details are set forth to provide a more thorough understanding of the invention. However, it will be apparent to those skilled in the art that well-known algorithms are not shown in detail to avoid obscuring the gist of the invention; and the technical terms used in the following embodiments, such as Huber loss function, Early Stopping, learning rate scheduling, weight decay, fish migration algorithm WMA, regularization strength, L2 regularization, ReLU activation, batch normalization, and residual connection, are readily available prior art.
[0036] like Figure 1-2 As shown, one embodiment of the present invention relates to a LIBS elemental quantitative analysis method based on dual-branch feature fusion, comprising the following steps:
[0037] S1: Preprocessing of the acquired LIBS spectral signals includes baseline correction and spectral resampling. For baseline correction, the adaptive iterative reweighted penalized least squares (airPLS) method is preferred to effectively remove background drift and interference. This method avoids excessive peak smoothing by dynamically adjusting weights, thus preserving true peak characteristics. Furthermore, cubic spline interpolation is used to resample and fit the spectrum, enhancing the stability of peak positions and shapes while reducing high-frequency noise, ensuring the continuity and consistency of the input data.
[0038] S2: Input the preprocessed spectral signal data into a dual-branch feature extraction network. Local features are extracted through the CNN branch, and global features are extracted in parallel through the MLP branch. First, a dual-branch feature extraction network structure composed of a convolutional neural network (CNN) and a multilayer perceptron (MLP) is constructed. The CNN branch focuses on local spectral peak pattern recognition, while the MLP branch models global nonlinear interactions. The two complement each other to improve feature representation capabilities.
[0039] S3: The local features and the global features are adaptively weighted and fused through a gating fusion module to obtain fused features; this gating mechanism can assign weights according to feature importance, suppress redundant information and improve discrimination performance.
[0040] S4: The fused features are input into the WMA-MLP model. The WMA-MLP model, based on MLP, integrates a multi-head self-attention mechanism and a residual module to model global dependencies between features and output the final elemental quantitative analysis results. Inputting the fused features into the WMA-MLP model, by embedding a multi-head self-attention mechanism in the multi-layer residual structure, ensures stable gradient propagation and enhances the modeling of global dependencies on key spectral bands, thereby improving the accuracy of regression prediction.
[0041] A parallel dual-branch feature extraction mechanism is used to process LIBS spectral data synchronously. One CNN branch focuses on capturing sequence dependencies, while the MLP branch emphasizes contextual relevance. The outputs of the two are then fused. This parallel architecture makes the feature extraction process more efficient, enabling the simultaneous mining of potential patterns from multiple dimensions. It avoids the temporal dependency problem of serial processing, thereby improving the model's robustness and convergence speed to complex spectral signals and ensuring a more comprehensive semantic representation in elemental quantitative analysis. By introducing a gating mechanism in the feature fusion stage, the local features extracted by the CNN branch are dynamically filtered and weighted, effectively suppressing noise interference while retaining key information. This fusion strategy enhances the model's noise resistance and improves the purity and accuracy of feature representation. It is particularly suitable for background interference scenarios common in LIBS data, ensuring that the final quantitative analysis results are more reliable and have stronger generalization performance.
[0042] During the training of the WMA-MLP model, the Huber loss function can be used to enhance robustness to noise; alternatively, mean squared error (MSE), smoothed L1, or other robust loss functions can be selected, and this invention does not impose any limitations on this. EarlyStopping, learning rate scheduling, and weight decay strategies are combined to further improve the model's convergence stability and generalization ability. Finally, the Whale Migration (WMA) algorithm is used to perform a global search on key hyperparameters such as network capacity, regularization strength, optimizer, and learning rate to obtain the optimal configuration and further improve prediction performance.
[0043] In one embodiment, the present invention relates to a LIBS elemental quantitative analysis method based on dual-branch feature fusion. In laser-induced breakdown spectral (LIBS) signals, to eliminate or reduce the impact of baseline drift and background interference on the accuracy of feature extraction and modeling, the acquired spectral signal is first subjected to baseline correction using an adaptive iterative reweighted penalized least squares (AirPLS) algorithm. This method dynamically adjusts the weights of residual points in each calculation process through iterative optimization, thereby avoiding excessive smoothing of spectral peak regions and ultimately obtaining a smooth baseline that accurately fits background changes. Its objective function can be expressed as:
[0044] ;
[0045] Where y represents the original spectral signal, z represents the baseline function, and D is the difference operator. is the smoothing factor, and is the adaptive weight matrix. After processing by this method, baseline and background interference in the spectrum can be effectively removed or reduced, preserving spectral peak information that is closer to the real signal.
[0046] Even after baseline correction, the spectral signal may still exhibit unstable peak shapes due to uneven sampling point distribution or instrument noise. To further enhance data quality, this invention employs cubic spline interpolation to resample the spectrum. This method constructs a continuous cubic polynomial function within segmented intervals:
[0047] ;
[0048] Among them, S Let be the fitting function, a, b, c, and d be the fitting coefficients, and x be the coordinate variable. This process ensures the continuity of the function values and their first and second derivatives at each node, thus achieving a smooth fit and interpolation of the original spectrum. This process not only improves the stability of the peak positions and shapes but also reduces the influence of high-frequency noise to some extent, resulting in a smoother and more consistent spectrum.
[0049] By combining airPLS baseline correction with cubic spline interpolation resampling for preprocessing, we can effectively remove background interference from spectral signals while enhancing peak stability, providing high-quality and reliable data input for subsequent deep modeling and feature extraction.
[0050] One embodiment involves a LIBS elemental quantitative analysis method based on dual-branch feature fusion. In order to fully capture the multi-scale feature information in the spectral data, a dual-branch parallel feature extraction network structure containing a convolutional neural network (CNN) and a multilayer perceptron (MLP) is adopted for feature extraction of the preprocessed spectral data. The CNN branch is used for spatial pattern recognition from local spectral peaks, and the MLP branch is used for global nonlinear interaction between spectral bands. The two are used in parallel for feature encoding to improve the model's ability to express complex spectral signals and its generalization performance.
[0051] like Figure 3 As shown, the CNN branch can focus on modeling local spatial patterns of elemental information in the spectrum. These patterns often exist in the form of sharp peaks with significant proximity, which helps enhance the ability to model the shape of spectral peaks through CNN. The CNN branch processes the input spectrum through two parallel convolutional paths with kernel sizes of k=5 and k=11, respectively. Each path sequentially performs convolution, ReLU activation, and adaptive max pooling operations, and the pooling results of the two paths are concatenated and passed through a fully connected layer to generate a local feature representation f. cnnThe feature extraction path is as follows:
[0052] Input spectrum After dimensionality expansion, the data enters two parallel convolutional paths, using kernel sizes k=5 and k=11 for feature extraction.
[0053] ;
[0054] in and For convolution kernel parameters, For convolution operations, ReLU is the activation function.
[0055] Perform adaptive max pooling on the output of each path:
[0056] ;
[0057] Where t is the wavelength dimension index of the feature map, and the max operation selects the maximum value along this dimension. To obtain the feature scalar after pooling, the pooling results from the two paths are concatenated:
[0058] ;
[0059] in For vector concatenation operation, P is a local feature vector that integrates information from two paths and multiple scales.
[0060] Local feature representations are generated through fully connected layers:
[0061] ;
[0062] Where V and c are the weights and biases of the fully connected layer, and GELU is the activation function. It is the generated 128-dimensional local feature representation, which is used as the output of the CNN branch.
[0063] like Figure 4 As shown, the MLP branch models the nonlinear interactions between global spectral bands in the spectrum by stacking multiple nonlinear transformation structures. The MLP branch structure contains three fully connected modules with channel dimensions of 512, 256, and 128 respectively. Each module consists of linear transformation, batch normalization, GELU activation function, Dropout regularization, and residual connections, ultimately outputting the global feature representation f. mlp The global feature extraction path is as follows:
[0064] Input features After linear transformation:
[0065] ;
[0066] in and These are the weight matrix and bias vector for this layer, respectively. The transformation results are then batch normalized.
[0067] ;
[0068] BN represents batch normalization. The normalized features are activated by GELU and then Dropout is applied.
[0069] ;
[0070] Residual connections generate the input for the next layer:
[0071] ;
[0072] enter As initial features The global feature representation is output after three layers of mapping. .
[0073] The MLP branch possesses stable gradient propagation capabilities and efficient nonlinear expression capabilities, enhancing model generalization performance while maintaining feature integrity and providing global feature support for the WMA-MLP model.
[0074] One embodiment involves a LIBS element-wise quantitative analysis method based on dual-branch feature fusion. To fuse local features extracted by CNN and global features extracted by MLP branches, a gated fusion module is introduced to achieve adaptive weighted fusion control, thereby obtaining fused features. Its fusion control path is as follows:
[0075] Gating factor Generated by a small, fully connected network:
[0076] ;
[0077] in For the sigmoid function, W1, b1, W2, and b2 are learnable parameters. Controlling the contribution of local features in the fusion.
[0078] The final fusion feature is expressed as:
[0079] ;
[0080] in This indicates a vector concatenation operation. It is the fused feature vector with a dimension of 256. This gating mechanism can suppress redundant information based on feature importance, thereby improving the discriminative ability and modeling effect of the fused features.
[0081] One embodiment involves a LIBS elemental quantitative analysis method based on dual-branch feature fusion, comprising a dual-branch feature extraction structure of a convolutional neural network and a multilayer perceptron (MLP) configured in parallel. Both branches encode features at two levels: spatial pattern recognition of local spectral peaks and global nonlinear interactions between spectral bands, respectively, to improve the model's expressive power and generalization performance for complex spectral signals. Specifically, the CNN branch extracts local features, while the MLP branch extracts global features. An adaptive weighted fusion of local and global features is achieved through a gating mechanism in the gating fusion module, resulting in a 256-dimensional fused feature vector. As an intermediate representation input to the WMA-MLP model, it progressively completes in-depth feature extraction and information compression through three cascaded "fully connected layer-residual module" processing units, ultimately performing the element content regression prediction task. The dimension of the fully connected layer and the type of activation function in each processing unit are hyperparameters that the WMA algorithm focuses on optimizing. Given the high-dimensional nonlinear characteristics of spectral data and the risk of gradient degradation in deep network training, the WMA-MLP model is based on a multilayer perceptron (MLP) and integrates a residual module and a multi-head self-attention mechanism to improve feature extraction efficiency and key spectral band response capabilities.
[0082] Introducing residual connections not only effectively alleviates the gradient vanishing problem in deep networks, but also significantly accelerates the model convergence process by allowing the construction of simpler and more efficient data paths, thus achieving a simultaneous improvement in network lightweighting and training efficiency at the structural level.
[0083] In one example, the forward propagation process of the i-th processing unit is as follows:
[0084] First, the features undergo a non-linear transformation through a fully connected layer:
[0085] ;
[0086] in, W is the fully connected layer output of the i-th processing unit. i With b i These are the weights and bias parameters of the layer, respectively. For activation function, This is the output feature of the previous unit.
[0087] Subsequently, the features are further mapped into the residual module:
[0088] ;
[0089] in, This is the final output of the residual module. and The weights and biases within the residual module are defined by BN, which represents batch normalization, and Dropout is the random dropout regularization.
[0090] After the output of the third residual module, the network introduces an 8-head self-attention mechanism to dynamically model the global dependencies between features. This mechanism first processes the input features... Linear transformation into a query, key, and value vector:
[0091] ;
[0092] Where Q, k, v are the query, key, and value matrices, respectively, and W... Q W K W V This is the corresponding learnable projection matrix.
[0093] The attention weight matrix is calculated using scaled dot products to enhance the model's ability to perceive key spectral regions.
[0094] ;
[0095] Where A is the attention weight matrix, Let be the dimension of the key vector. This is the scaling factor.
[0096] After concatenation and linear mapping of the outputs from each head, the refined feature representation is obtained as follows: Finally, the element content prediction results Output through a linear regression layer:
[0097] ;
[0098] Where w and b are the weight vector and bias term of the regression layer, respectively, the Huber loss function is used during model training, and its definition is as follows:
[0099] ;
[0100] in The threshold parameter is used. This loss combines the smoothness of mean square error with the robustness of absolute error, making it suitable for noisy spectral data.
[0101] The model employs multi-layer nonlinear mapping to compress dimensionality and extract deep features from the fused features. Each layer includes linear transformations, batch normalization, and residual connections, aiming to enhance the model's expressive power and alleviate the gradient vanishing problem. The activation function can be ReLU, GELU, Tanh, or other nonlinear functions; this invention does not limit this. The specific activation function type is automatically selected and optimized from a pre-defined candidate set by the whale migration optimization algorithm during subsequent training to adapt to different spectral features and model structures.
[0102] Multiple strategies are employed during training to enhance model stability and generalization ability. Regularization is primarily achieved through L2 weight decay to suppress overfitting. An EarlyStopping mechanism dynamically determines whether to terminate training early based on validation set metrics, avoiding ineffective iterations. The learning rate scheduler automatically adjusts the learning rate based on validation performance, balancing training speed and convergence quality. The training process supports the selection of various optimizers such as Adam, SGD, and RMSprop, and activation functions such as ReLU, GELU, and Tanh as hyperparameters to adapt to different features and model structures. Key training hyperparameters and strategy configurations are treated as variables to be optimized and jointly searched using the Whale Migration (WMA) algorithm to achieve the optimal balance between performance and efficiency.
[0103] In one embodiment, a LIBS element-wise quantitative analysis method based on bi-branch feature fusion is involved, which uses the Whale Migration Algorithm (WMA) to automatically and globally optimize key hyperparameters of the WMA-MLP model. This algorithm possesses good global search capabilities and adaptability to complex parameter spaces, effectively improving model performance and parameter tuning efficiency. WMA jointly optimizes eight categories of key hyperparameters, covering network structure, regularization, optimization strategies, and training configuration. The optimization names and search ranges of each parameter are shown in Table 1, which outlines the hyperparameter optimization space and value ranges.
[0104] Table 1. Hyperparameter optimization space and value range
[0105]
[0106] WMA simulates the collaborative optimization behavior of humpback whale groups during migration, achieving an effective balance between exploration and exploitation by distinguishing between leader and subordinate individuals. Within a defined search space, a randomized size of [size missing] is generated. The population. During the fitness evaluation phase, the prediction error of the model on the validation set is used as the objective function. A smaller value indicates a better solution quality. Subordinate individuals learn the average position of the group. Compared with the best historical individuals The difference in position is used to update its own position, and its typical update model can be expressed as:
[0107] ;
[0108] in, Indicates that the i-th individual is in The position of the generation, For Hadamard product, Let be a D-dimensional random perturbation vector. This mechanism enables the algorithm to possess excellent global optimization capabilities and convergence stability in high-dimensional mixed parameter spaces, thereby providing an optimal combination for model structure configuration and training strategies, and effectively improving the model's adaptability under different data distributions.
[0109] To verify the effectiveness of the LIBS elemental quantitative analysis method based on dual-branch feature fusion provided in this invention, an example was conducted to predict the carbon content in coal samples using LIBS spectra as the input spectral signal. This example employed five-fold cross-validation for performance evaluation on an experimental dataset. Evaluation metrics included the coefficient of determination (R²), root mean square error (RMSE), mean square error (MSE), and mean absolute error (MAE). The experimental results are shown in Table 2, representing the five-fold cross-validation results.
[0110] Table 2 Results of Five-Fold Cross-Validation
[0111]
[0112] The results of the examples show that the R² values for all folds are above 0.99, indicating that the model can stably capture the nonlinear relationship between the spectrum and carbon content, and the predicted results are highly consistent with the true values, exhibiting high fitting accuracy. The error level is low: the RMSE is consistently less than 0.15, and the MAE is less than 0.12, indicating that the model's prediction error is small and it is feasible for application. The model exhibits strong stability: the R² differences in the five-fold cross-validation results are small, with the maximum difference between R² values less than 0.006, indicating that the model maintains excellent performance under different data partitions and has good generalization ability. In the fourth fold, the RMSE reaches 0.1494, and the coefficient of determination R² remains at 0.9915, demonstrating the model's stability in the face of data noise and sample differences, and its excellent robustness.
[0113] One embodiment relates to an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the LIBS elemental quantitative analysis method based on dual-branch feature fusion as described above.
[0114] The LIBS elemental quantitative analysis method based on dual-branch feature fusion proposed in this embodiment of the invention realizes collaborative and multi-perspective modeling of LIBS spectral information. Compared to LIBS elemental quantitative analysis methods that employ single network structures such as simple CNNs or MLPs, the WMA-MLP model utilizes a parallel processing dual-branch feature fusion structure. The CNN branch focuses on capturing local features such as the morphology, width, and intensity of spectral peaks, while the MLP branch is responsible for modeling long-range dependencies between spectral segments and global trends. This structural design better suits the physical characteristics of LIBS spectral data, where local and global information coexist. Feature fusion yields a more comprehensive and discriminative spectral representation than a single perspective, improving the accuracy and robustness of the spectral analysis model. To address the high-dimensional redundancy of spectral data and the challenges of unstable deep network training, the WMA-MLP model integrates a multi-head attention mechanism and a residual module for deep feature modeling in LIBS quantitative analysis. The multi-head attention mechanism adaptively focuses on key spectral segments, effectively mitigating redundant feature interference and improving model interpretability. The introduction of the residual module ensures stable training of the deep network, enabling the model to learn complex nonlinear mapping relationships more efficiently, effectively solving the gradient decay and performance degradation problems of deep MLPs during training. In particular, to overcome the drawbacks of inefficient and subjective manual parameter tuning in traditional methods, the Whale Migration Optimization (WMA) algorithm is used to achieve automated global optimization of model hyperparameters, reducing reliance on manual intervention. Furthermore, through a global intelligent search strategy, it effectively avoids getting trapped in local optima, thereby enabling the systematic and repeatable acquisition of high-performance and robust quantitative analysis models, improving modeling efficiency and enhancing model performance stability.
[0115] Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications and improvements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be defined by the claims.
Claims
1. A LIBS elemental quantitative analysis method based on dual-branch feature fusion, characterized in that, Includes the following steps: S1: Preprocess the acquired LIBS spectral signal, including baseline correction and spectral resampling; S2: Input the preprocessed spectral signal data into a dual-branch feature extraction network, extract local features through the CNN branch, and extract global features in parallel through the MLP branch; S3: The local features and the global features are adaptively weighted and fused using a gated fusion module to obtain fused features; S4: Input the fused features into the WMA-MLP model. The WMA-MLP model is based on MLP and integrates a multi-head self-attention mechanism and a residual module to model the global dependencies between features and output the final elemental quantitative analysis results.
2. The LIBS elemental quantitative analysis method based on dual-branch feature fusion according to claim 1, characterized in that, The baseline correction in step S1 employs an adaptive iterative reweighted penalized least squares method, with the objective function being: ; Where y is the original spectral signal, z is the baseline function, D is the difference operator, λ is the smoothing factor, and W is the adaptive weight matrix.
3. The LIBS elemental quantitative analysis method based on dual-branch feature fusion according to claim 1, characterized in that, The spectral resampling in step S1 employs cubic spline interpolation, and its interpolation function is: ; Among them, S Let x be the fitting function, a, b, c, and d be the fitting coefficients, and x be the coordinate variable.
4. The LIBS elemental quantitative analysis method based on dual-branch feature fusion according to claim 1, characterized in that, The CNN branch in step S2 processes the input spectrum through two parallel convolution paths with kernel sizes of k=5 and k=11, respectively. Each path sequentially performs convolution, ReLU activation, and adaptive max-pooling operations, and the pooled results of the two paths are concatenated and passed through a fully connected layer to generate a local feature representation f cnn .
5. The LIBS elemental quantitative analysis method based on dual-branch feature fusion according to claim 4, characterized in that, The MLP branch in step S2 contains three fully connected layers with channel dimensions of 512, 256, and 128 respectively. Each layer sequentially performs linear transformation, batch normalization, GELU activation function, Dropout regularization, and residual connection, ultimately outputting the global feature representation f. mlp .
6. The LIBS elemental quantitative analysis method based on dual-branch feature fusion according to claim 5, characterized in that, The gated fusion module in step S3 is implemented as follows: the gate factor α is generated by a small fully connected network, and the calculation formula is: ; in, For the Sigmoid function, , , and These are learnable parameters; Fusion features Calculated using the following formula: ,in This indicates the feature vector concatenation operation.
7. The LIBS elemental quantitative analysis method based on dual-branch feature fusion according to claim 1, characterized in that, The WMA-MLP model uses three cascaded fully connected layers and residual module processing units. Features undergo nonlinear transformation through the fully connected layers, and then the features are further mapped in the residual module. After the output of the third residual module, an eight-head self-attention mechanism is introduced to dynamically model the global dependencies between features, and to perform in-depth feature extraction and information compression.
8. The LIBS elemental quantitative analysis method based on dual-branch feature fusion according to claim 7, characterized in that, After concatenation and linear mapping of the outputs from each head, the refined feature representation is obtained as follows: Elemental quantitative analysis results Output through a linear regression layer: ; in, and These are the weight vector and bias term of the regression layer, respectively; The model employs the Huber loss function during the training phase, combined with EarlyStopping, learning rate scheduling, and weight decay strategies. The Huber loss function is defined as follows: ; in, This is the threshold parameter.
9. The LIBS elemental quantitative analysis method based on dual-branch feature fusion according to claim 8, characterized in that, The key hyperparameters for training the WMA-MLP model are automatically searched globally using the whale migration algorithm. These hyperparameters include: number of hidden layer neurons, Dropout rate, initial learning rate, optimizer type, L2 regularization coefficient, learning rate decay coefficient, batch size, and activation function type.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the LIBS element quantitative analysis method based on dual-branch feature fusion as described in any one of claims 1 to 9.