Laboratory-induced breakdown spectroscopy (LIBS) online detection method for trace elements of radix paeoniae alba based on 1DCNN-DF network architecture
By employing a 1DCNN-DF network architecture and transfer learning methods, the problem of poor repeatability of spectral signals in the detection of Chinese medicinal materials using LIBS technology was solved, achieving high-precision online detection of trace elements. This approach adapts to feature space alignment across different data domains, improving detection accuracy and model generalization ability.
Patent Information
- Application Number
- CN202511006076.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-22
- Publication Date
- 2025-11-07
AI Technical Summary
LIBS technology has limitations in the detection of Chinese medicinal materials samples, including poor repeatability of spectral signals, high detection limit, susceptibility to matrix effects, and difficulty in meeting the requirements for high-precision detection. In particular, it cannot effectively collect sample surface data due to the limitations of online detection equipment.
An online detection method for trace elements in peony using LIBS based on a 1DCNN-DF network architecture is adopted. By combining K-means clustering, ICP-OES detection, spatial attention mechanism and transfer learning with domain adversarial neural network, the model is optimized to improve detection accuracy.
It effectively extracts spectral data features, reduces the influence of matrix effects, improves the accuracy and generalization ability of LIBS detection, adapts to feature space alignment of different data domains, and achieves high-precision prediction of chemical element concentrations.
Smart Images

Figure CN120908166A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of quantitative analysis of mineral elements, and particularly relates to a white peony root trace element LIBS online detection method based on a 1DCNN-DF network architecture. BACKGROUND
[0002] Laser-induced breakdown spectroscopy (LIBS) technology forms plasma on the surface of a sample by focusing an ultrashort pulse laser on the sample surface, and then analyzes the plasma emission spectrum to determine the material composition and content of the sample, and is mainly used for qualitative and quantitative analysis of chemical elements. The basic principle is that a high-energy laser pulse is focused on the sample surface to produce high-temperature plasma, then the laser pulse stops, the ions and atoms in the high-energy state in the plasma transition to a low-energy state and emit radiation with a certain energy. This radiation has obvious element characteristics, and then the light with a specific wavelength is collected and sent to the spectrum for analysis. Since the wavelengths of ion and atomic spectra correspond to specific elements and have a certain quantitative relationship, the composition and content of elements in the sample can be determined according to the wavelength and intensity of the emission line.
[0003] LIBS technology has problems such as poor repeatability of spectral signals, high detection limit, and easy interference from matrix effects in actual application. These problems are mainly caused by the physical characteristics of LIBS technology itself, such as the instability of the plasma generated during the interaction of laser and matter, and the great influence of spectral signals on environmental factors (such as temperature, humidity) and the state of the sample surface. In addition, traditional Chinese medicinal material samples themselves have significant heterogeneity, and there are significant differences in composition in different parts of the sample. Due to the limitations of online detection equipment, the laser ablation area is limited, and the number of hitting points is limited, so it is impossible to collect data from the concentrated area on the sample surface. These factors together cause the performance of the quantitative analysis model based on traditional methods to be not ideal, and it is difficult to meet the demand for high-precision detection. SUMMARY
[0004] The application aims to provide a white peony root trace element LIBS online detection method based on a 1DCNN-DF network architecture to solve the above technical problems.
[0005] To solve the above technical problems, the specific technical scheme of the white peony root trace element LIBS online detection method based on a 1DCNN-DF network architecture of the application is as follows:
[0006] A white peony root trace element LIBS online detection method based on a 1DCNN-DF network architecture, comprising the following steps:
[0007] Step 1: Obtain spectral data on different samples, divided into Online dataset and LAB dataset, i.e. online detection data and laboratory data, as training data and prediction data;
[0008] Step 2: Use K-means clustering algorithm to unsupervised grouping of samples, and then divide training data and test data inside each cluster;
[0009] Step 3: ICP-OES detection of samples to obtain the label of training data;
[0010] Step 4: Standardize the original one-dimensional spectral data for preprocessing, build a 1DCNN-DF regression network containing a spatial attention mechanism, train the model to minimize the mean square error MSE loss function between the predicted value and the true label, and iteratively optimize to obtain the best parameters;
[0011] Step 5: Evaluate the model performance on the test set, output the prediction accuracy of the best model on the test set, and realize high-precision chemical element concentration prediction;
[0012] Step 6: Transfer the feature representation and model parameters learned from laboratory data to the online detection task through transfer learning.
[0013] Further, the step 1 obtains multiple spectral data on the same sample and performs average processing.
[0014] Further, the step 2 divides the data in each cluster according to the ratio of 80% training and 20% testing.
[0015] Further, in the step 4, the specific framework of the 1DCNN-DF regression network containing a spatial attention mechanism is as follows:
[0016] First, the input data is processed by the first convolutional layer, which aims to extract local features in the input data; then, a pooling layer is added to the structure to downsample the feature map obtained from the convolutional layer; in addition, the spatial attention mechanism Spatial Attention learns and utilizes the information of the target object region, and aggregates features from it, and the spatial attention mechanism calculation formula is as follows:
[0017]
[0018] Where σ represents the sigmoid function, f 7×7 represents a convolution operation with a 7x7 convolution kernel, and AvgPool(F) represents an average pooling operation on the input features.
[0019] Further, the step 4 is based on a spatial attention mechanism, and a differential attention module DF is designed. The differential attention module generates spatial feature descriptions through dot product, and then divides the features into two groups to calculate the respective convolution features and sigmoid attention scores. The attention scores of the latter group are multiplied by a learnable weight factor to ensure synchronous dynamic learning. Finally, the difference between the two attention scores is used as the attention weight. In this way, common mode noise is effectively eliminated. The calculation formula is as follows:
[0020] M dif (F)=σ(f 7×7 ([AvgPool(F)]))-λ*σ(f 7×7 ([AvgPool(F)]))
[0021] Where M dif (F) represents the output feature obtained after the differential attention mechanism is calculated, and λ represents a scientific weight factor.
[0022] After two convolution layers are used to extract deep features, a dropout layer is introduced. Finally, the model uses a multilayer perceptron MLP containing a single hidden layer to map the extracted features to the prediction results. The model only applies a ReLU activation function between the last multilayer perceptron, and does not use an activation function in the early feature extraction process.
[0023] Further, in the step 4, the correlation coefficient R and the root mean square error RMSE are used as the main evaluation index.
[0025] R is a statistical quantity used to measure the degree of linear correlation between two variables, and its value ranges from -1 to 1. When R is closer to 1, it indicates that the positive linear correlation between the two variables is stronger. The formula is as follows:
[0026]
[0027] Where x i and y i are the observation values of the two variables, and are the average values of the two variables.
[0028] RMSE is a statistical quantity that measures the difference between the predicted value and the true value. It calculates the average of the squared difference between the predicted value and the true value, and takes the square root. The smaller the RMSE, the better the prediction performance of the model. The calculation is as follows:
[0029]
[0030]
[0031] wherein n is the number of samples, y i is the true value, is the corresponding predicted value.
[0032] Further, the migration learning in the step 6 adopts a domain adversarial neural network DANN, and specifically includes the following steps:
[0033] The laboratory LIBS data is labeled as a source domain, and the online detection data is labeled as a target domain;
[0034] A 1DCNN-DF model is used as a feature extractor, and a full connection layer with an output dimension of 128 is outputted;
[0035] A field classifier and a task classifier are introduced, and an adversarial training is realized through a gradient reversal layer GRL to align the feature distribution of the source domain and the target domain.
[0036] The white peony root trace element LIBS online detection method based on the 1DCNN-DF network architecture has the following advantages:
[0037] The 1DCNN-DF method proposed in the application can effectively extract important features, enhance the data interaction between spectral data features, and effectively reduce the influence of the matrix effect. The 1DCNN-DF model introduces a differential attention on the basis of the 1DCNN model, which not only retains the original advantages of CNN, but also enhances the feature extraction capability, fully utilizes the local feature extraction capability and hierarchical learning characteristics of CNN, and improves the detection accuracy of LIBS data. In the model, the gradient reversal layer reverses the reverse gradient direction of the field discriminator in the training process, so as to force the feature extractor to learn the "field-independent" features suitable for laboratory and online data, realize the feature space alignment, and improve the generalization ability of the model on different data domains. BRIEF DESCRIPTION OF DRAWINGS
[0038] Figure 1 It is a 1DCNN-DF model framework diagram.
[0039] Figure 2 It is a DANN model framework structure schematic diagram. DETAILED DESCRIPTION
[0040] In order to better understand the purpose, structure and function of the application, the application of a white peony root trace element LIBS online detection method based on 1DCNN-DF network architecture is further described in detail below in combination with the drawings.
[0041] The white peony root trace element LIBS online detection method based on the 1DCNN-DF network architecture of the application includes the following steps:
[0042] Step 1: Obtain spectral data on different samples, divided into Online dataset and LAB dataset, i.e. online detection data and laboratory data, as training data and prediction data;
[0043] Obtain spectral data on different samples, aiming to provide sufficient learning samples for the model; considering that there are fluctuations between points in the sample, a single spectral data cannot accurately represent the chemical element reference value information of the sample, therefore multiple spectral data on the same sample need to be obtained and processed by averaging.
[0044] Step 2: Use K-means clustering algorithm to unsupervised group the samples, and then divide the data in each cluster according to the ratio of 80% training and 20% testing;
[0045] Step 3: Perform ICP-OES detection on the samples to obtain the labels of the training data;
[0046] Step 4: Standardize the original one-dimensional spectral data for preprocessing, build a 1DCNN-DF regression network containing spatial attention mechanism, train the model to minimize the mean square error (MSE) loss function between the predicted value and the true label, and iteratively optimize to obtain the best parameters;
[0047] In step 4, the specific framework of the 1DCNN-DF regression network containing spatial attention mechanism is as follows:
[0048] First, the input data is processed by the first convolutional layer, which aims to extract local features from the input data.
[0049] Then, a pooling layer is added to the structure to downsample the feature maps obtained from the convolutional layer, thereby reducing the spatial dimension and parameter number of the data while preserving key feature information.
[0050] In addition, the spatial attention mechanism learns and utilizes the information of the target object region and aggregates features from it, thereby improving the performance of the model. The spatial attention mechanism calculation formula is as follows:
[0051]
[0052] Where σ represents the sigmoid function, f 7×7 represents a convolution operation with a 7x7 kernel size, and AvgPool(F) represents an average pooling operation on the input features.
[0053] Based on the spatial attention mechanism, a difference attention module (DF) is designed to enhance the network's ability to identify important features. The structural framework of the module is shown in Figure 1 The goal of this module is to adaptively assign weights to each pixel, highlighting important features, and suppressing the impact of noise on model performance by introducing a difference denoising mechanism. Specifically, the difference attention module first generates spatial feature descriptions through dot product, then divides these features into two groups, and calculates the convolutional features and sigmoid attention scores for each group respectively. The attention scores of the latter group are multiplied by a learnable weight factor to ensure synchronous dynamic learning. Finally, the difference between the two attention scores is used as the attention weight. In this way, common mode noise can be effectively eliminated. The calculation formula is as follows:
[0054] M dif (F)=σ(f 7×7 ([AvgPool(F)]))-λ*σ(f 7×7 ([AvgPool(F)]))
[0055] Where M dif (F) represents the output feature obtained after the result difference attention mechanism is calculated, and λ represents a scientific weight factor.
[0056] This method models features with different receptive field convolutions, strengthening local change features. By calculating the difference between two different convolution receptive fields and adjusting the contribution of attention2 through a learnable parameter a, attention is more focused on areas with significant feature changes, suppressing the influence of smooth areas.
[0057] Through the combination of two groups of convolutional layers and pooling layers, the model can effectively extract deep features from one-dimensional spectral data. After two convolutional layers are used to extract deep features, a dropout layer is introduced to improve the model's generalization ability and prevent overfitting. Finally, the model uses a multilayer perceptron (MLP) containing a single hidden layer to map the extracted features to the prediction results. It is worth noting that unlike traditional models, this model only applies the ReLU activation function between the final multilayer perceptron, the purpose of which is to introduce a nonlinear transformation, allowing the neural network to learn complex nonlinear relationships. During the early feature extraction process, no activation function is used, because existing research has shown that LIBS signals have strong linear relationships, and introducing a nonlinear activation function too early may destroy this linear relationship and thus reduce the overall performance of the model.
[0058] In step 4, to evaluate the generalization performance of the established model, the correlation coefficient (R) and the root mean squared error (RMSE) are used as the main evaluation indicators.
[0059] R is a statistical measure used to measure the degree of linear correlation between two variables, with a value range of -1 to 1. When R is closer to 1, it indicates a stronger positive linear correlation between the two variables. The formula is as follows:
[0060]
[0061] where x i and y i are the observed values of the two variables, and are the average values of the two variables.
[0062] RMSE is a statistical measure that measures the difference between predicted and true values. It calculates the average of the squared differences between predicted and true values, and takes the square root. The smaller the RMSE, the better the prediction performance of the model. The calculation is shown in the following formula:
[0063]
[0064] where n is the sample size, y i is the true value, is the corresponding predicted value.
[0065] Step 5: Evaluate the model performance on the test set, output the prediction accuracy of the best model on the test set, and realize high-precision chemical element concentration prediction.
[0066] Step 6: Transfer the feature representation and model parameters learned from laboratory data to the online detection task through transfer learning.
[0067] Embodiment:
[0068] In the embodiment of the present application, white peony root is taken as the experimental object, and manganese, magnesium, calcium and potassium elements are taken as the target detection elements. 4*4 16 points are collected in the same white peony root sample, each point is repeatedly hit 10 times, a total of 160 spectral data are collected and averaged. A total of 150 spectral data of white peony root samples are obtained, and the purchased samples are not subjected to any pretreatment, and the corresponding chemical reference value of the sample is obtained by ICP-OES technology. The spectral data collected are first subjected to normalization processing to eliminate systematic errors caused by instrument or environmental differences. Subsequently, the K-means clustering algorithm is used to unsupervised grouping of the samples, and then the data is divided in each cluster according to the proportion of 80% training and 20% testing, so that the training set and the test set are evenly distributed in the feature space. In addition, in order to further verify the stability and reliability of the model, the five-fold cross-validation method is adopted: the training set is divided into 5 subsets, one of which is selected as the validation set, and the remaining four subsets are used as the training set, and the training and verification process is repeated five times.
[0069] In the example of the present application, each spectral data contains 4096 features, and the spectral range is 203-428 nm. The 1DCNN-DF model is used as the conversion method, and finally a data matrix with a size of 128*1 is generated.
[0070] In the example of the present application, the network structure of the 1DCNN-DF model includes a convolution layer, a pooling layer, a dropout, a fully connected layer and a nonlinear activation.
[0071] The first layer convolution + pooling: the input data is first passed through a one-dimensional convolution layer (the input channel number is 1, the output channel number is 16, and the convolution kernel size is 5), and then maximum pooling is performed, and the feature map size becomes (16, 2048);
[0072] The first convolution layer is applied to the pooled feature map, and a Sigmoid activation function is used to generate the first attention score. This is to learn the importance of the features through convolution operation.
[0073] The second convolution layer is applied to the pooled feature map, and a Sigmoid activation function is also used to generate the second attention score. The second attention score is different from the first one in that it is multiplied by a trainable parameter a to control its influence in the final attention score.
[0074] After obtaining the two attention scores, the difference attention module will calculate the difference between the two attention scores and take it as the final attention weight. The specific difference operation is: attention = attention1-attention2
[0075] Finally, the model can weight the input feature maps by the obtained differential attention. Specifically, the input feature maps are multiplied by the calculated attention weights to generate weighted feature maps:
[0076] Second convolution + pooling: the enhanced feature maps are input into a second one-dimensional convolution layer (the number of channels increases from 16 to 32), followed by maximum pooling, to obtain an output dimension of (32, 1024);
[0077] Flatten operation: the convolution output is flattened into a long vector with a dimension of (32, 1024);
[0078] Fully connected layer: the flattened vector is input into a fully connected layer with an output dimension of 128, and is subjected to a ReLU activation function and Dropout;
[0079] Output layer: the last fully connected layer maps the 128-dimensional features to a single output for the regression task, with an output dimension of 1.
[0080] To test the prediction performance of the data rolling method combined with the model, the classic machine learning method PLSR and the 1DCNN-DF model proposed in the present application were used. Table 1 compares the prediction performance of the laboratory data under different modeling methods PLSR and 1DCNN-DF, and shows the ablation experiment results of the CNN model on the test set. 1DCNN represents a convolutional neural network model with the DF-Attention module removed. The quantitative results of the four mineral elements Mn, Mg, Ca, and K were analyzed. The experiments show that the prediction performance of the 1DCNN-DF model is better than that of the 1DCNN and PLSR models, especially in the prediction of Mn, Ca, and K, indicating that 1DCNN-DF can better extract deep features from spectral data than 1DCNN, thereby capturing complex nonlinear relationships that traditional linear models cannot discover. In contrast, although the PLSR model can reduce the data dimension and extract main features, its linear assumption has certain limitations in processing complex spectral data, especially when facing nonlinear relationships and high-dimensional data, its prediction performance is often not as good as that of deep learning models.
[0081] Table 1 Modeling results of white peony root mineral elements based on LIBS data
[0082]
[0083] Note: LAB-PLSR is the best modeling result of PLSR based on laboratory data, LAB-1DCNN is the modeling result of 1DCNN based on laboratory data, and LAB-1DCNN-DF is the modeling result of 1DCNN-DF based on laboratory data
[0084] In view of the performance difference between online detection data and laboratory data, the present application intends to use methods such as transfer learning to enhance the performance of online detection quantitative models by using high-quality laboratory data to make up for the shortcomings in the online detection environment. The core idea of transfer learning is to improve the learning effect of the target field (online detection data) by sharing the knowledge of the source field (laboratory data). This method is particularly suitable for online detection tasks because online detection data is often difficult to obtain in large quantities and of low quality. Through transfer learning, the feature representation and model parameters learned in the laboratory data can be transferred to the online detection task, thereby improving the generalization ability and prediction accuracy of the model. In addition, domain adaptation techniques can also be combined to adjust the model parameters or feature representation to reduce the distribution difference between laboratory data and online monitoring data, thereby further improving the performance of the model. These methods are expected to provide more reliable technical support for the quantitative analysis of mineral elements in online detection environments, and also provide new research ideas for spectral analysis tasks in other complex environments.
[0085] Domain-Adversarial Neural Network (DANN) is a deep learning model based on adversarial training mechanism, designed specifically for solving domain adaptation problems. The structure of DANN contains three core modules: feature extractor, domain classifier and task classifier. The feature extractor extracts high-order semantic features from the input data through convolution or fully connected layers; the domain classifier tries to distinguish whether the features come from the source domain or the target domain, in order to drive the feature extractor to generate "domain-invariant" features; while the task classifier is responsible for task-related prediction of features, in this application, the task classifier is a regression task, predicting the value of element content. The key innovation of this framework lies in the introduction of the Gradient Reversal Layer (GRL): during backpropagation, the gradient sign of the domain classifier is reversed, forcing the feature extractor to gradually confuse the judgment ability of the domain classifier during optimization. This adversarial game mechanism enables the model to implicitly reduce the distribution difference between domains while retaining task-related discriminative information.
[0086] The advantages of DANN are reflected in its end-to-end training capability and automatic feature alignment mechanism. Traditional methods usually rely on manually designed feature alignment criteria or complex distribution distance calculations, while DANN directly embeds the domain alignment target into the neural network optimization process through adversarial training, without the need to explicitly define the inter-domain similarity measure. In addition, the hierarchical feature extraction capability of DANN enables it to adapt to high-dimensional, nonlinear data distribution shifts, such as in cross-device spectral analysis. Even if there are baseline drifts or noise pattern differences between the spectrometers of the source domain and the target domain, DANN can still effectively extract device-insensitive local spectral features (such as peak position, absorption band shape, etc.), significantly improving the robustness of cross-domain models. In the present application, the feature extractor uses the 1DCNN-DF model proposed in the above-mentioned research, wherein the MLP of the last layer needs to be modified to a fully connected layer with an output dimension of 128, so that it can extract features from the data. The label predictor and the domain discriminator are both a perceptron model with one fully connected layer, and the model schematic diagram is as shown in Figure 2 The present application uses laboratory LIBS data and online LIBS data as the model input of DANN, and labels the laboratory LIBS data as the source domain and the online detection data as the target domain, aiming to improve the detection performance of the online detection model through transfer learning.
[0087] Table 2 shows the prediction results of the elements of the online data set after DANN migration. From the data results, there are significant differences in the performance of different elements in the Online data set and after the migration of the DANN model. Overall, the DANN model performs better than the PLSR prediction results of the online data set on Mn, Mg, Ca, and K elements, with R p improvement and RMSE p reduction, which may be attributed to the fact that the DANN model reduces the distribution difference between the source domain and the target domain through domain adaptation technology, enabling the model to better adapt to the spectral data features in the online detection environment, thereby improving the prediction performance.
[0088] Table 2 shows the prediction results of the elements of the online data set after DANN migration. From the data results, there are significant differences in the performance of different elements in the Online data set and after the migration of the DANN model. Overall, the DANN model performs better than the PLSR prediction results of the online data set on Mn, Mg, Ca, and K elements, with R
[0089]
[0090] Note: Online-PLSR is the best prediction result based on the online detection data, and DANN is the best modeling result based on the transfer learning method.
[0091] It is to be understood that the present application is described by way of example only, and that modifications or alterations can be made to the features and embodiments described without departing from the spirit and scope of the application. In addition, modifications can be made to the features and embodiments described to accommodate specific situations and materials without departing from the spirit and scope of the application. Accordingly, the application is not limited to the specific embodiments disclosed herein, but rather, the scope of the application includes all embodiments falling within the scope of the claims.
Claims
1. A white peony root microelement LIBS online detection method based on a 1D CNN-DF network architecture, characterized by, The method comprises the following steps: Step 1: Obtain spectral data on different samples, divided into Online data set and LAB data set, namely online detection data and laboratory data, as training data and prediction data; Step 2: Use K-means clustering algorithm to unsupervisedly group the samples, and then divide the training data and test data within each cluster; Step 3: Perform ICP-OES detection on the samples to obtain the labels of the training data; Step 4: Standardize the original one-dimensional spectral data, construct a 1DCNN-DF regression network containing a spatial attention mechanism, train the model to minimize the mean square error (MSE) loss function between the predicted value and the true label, and iteratively optimize to obtain the best parameters; Step 5: Evaluate the model performance on the test set, output the prediction accuracy of the best model on the test set, and realize high-precision chemical element concentration prediction; Step 6: Migrate the feature representation and model parameters learned from the laboratory data to the online detection task through transfer learning. The step 1 obtains multiple spectral data on the same sample and performs average processing.
2. The Radix Paeonia trace element LIBS online detection method based on the 1D CNN-DF network architecture according to claim 1, characterized in that, The step 2 divides the data in each cluster according to the proportion of 80% training and 20% testing.
3. The Radix Paeoniae Alba Microelement LIBS online detection method based on the 1D CNN-DF network architecture according to claim 1, characterized in that, In the step 4, the specific framework of the 1DCNN-DF regression network containing a spatial attention mechanism is as follows:
4. The Radix Paeoniae Alba Microelement LIBS online detection method based on the 1D CNN-DF network architecture according to claim 1, characterized in that, First, the input data is processed by the first convolutional layer, which aims to extract local features in the input data; Then, a pooling layer is added to the structure to downsample the feature maps obtained from the convolutional layer; In addition, the spatial attention mechanism learns and utilizes the information of the target object region and aggregates features therefrom, and the calculation formula of the spatial attention mechanism is as follows: Based on the spatial attention mechanism, a differential attention module (DF) is designed in the step 4. The differential attention module first generates spatial feature descriptions through dot product, then divides these features into two groups, calculates the convolutional features and sigmoid attention scores of each group respectively, and multiplies the attention scores of the latter group by a learnable weight factor to ensure synchronous dynamic learning. Finally, the difference between the two attention scores is used as the attention weight. In this way, common mode noise is effectively eliminated, and the calculation formula is as follows: wherein σ represents a sigmoid function, f 7×7 represents a convolution operation with a 7x7 kernel size, and AvgPool(F) represents an average pooling operation on the input feature.
5. The Radix Paeonia trace element LIBS online detection method based on the 1D CNN-DF network architecture according to claim 1, characterized in that, After two convolutional layers are used to extract deep-level features, a dropout layer is introduced, and finally, the model uses a multi-layer perceptron (MLP) containing a single hidden layer to map the extracted features to the prediction results. The model only applies the ReLU activation function between the last multi-layer perceptron, and does not use the activation function in the early feature extraction process. M dif (F) = σ(f 7×7 ([AvgPool(F)]))-λ*σ(f 7×7 ([AvgPool(F)])) where M dif (F) represents the output feature obtained after the result differential attention mechanism is calculated, and λ represents a scientific system weight factor; In the step 4, the correlation coefficient R and the root mean square error (RMSE) are used as the main evaluation index; 6. The Radix Paeonia trace element LIBS online detection method based on the 1D CNN-DF network architecture according to claim 1, characterized in that, R is a statistical quantity used to measure the degree of linear correlation between two variables, and its value ranges from -1 to 1. When R is closer to 1, it indicates that the positive linear correlation between the two variables is stronger, as shown in the formula where x i and y i are the observed values of the two variables, and are the means of the two variables; RMSE is a kind of statistical quantity for measuring the difference between predicted value and true value, which calculates the average of the square difference between predicted value and true value, and takes square root, the smaller the RMSE is, the better the prediction performance of the model is, and its calculation is shown in the following formula: where n is the number of samples, y i is the true value, is the corresponding predicted value.
7. The Radix Paeoniae Alba Microelement LIBS online detection method based on the 1D CNN-DF network architecture according to claim 1, characterized in that, The transfer learning in step 6 adopts a domain adversarial neural network DANN, and specifically includes the following steps: The laboratory LIBS data is labeled as the source domain, and the online detection data is labeled as the target domain; A 1DCNN-DF model is used as a feature extractor, and a full connection layer with an output dimension of 128 is outputted; A field classifier and a task classifier are introduced, and gradient reversal layer GRL is used for adversarial training to align the feature distribution of the source domain and the target domain.