Raman spectroscopy data classification method based on DenseNet-biAttention deep learning
Through the deep learning method based on DenseNet-biAttention, the problems of low accuracy and loss of feature information in traditional algorithms in Raman spectrum data classification are solved, and higher classification accuracy and efficiency are achieved.
Patent Information
- Application Number
- CN202111652448.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2041-12-30
AI Technical Summary
It is difficult for traditional machine learning algorithms to improve the classification accuracy of Raman spectrum data, especially when there are many categories. The increase in the number of layers of deep CNN models leads to loss of feature information and reduced classification accuracy.
Using the deep learning method based on DenseNet-biAttention, by building a classification model composed of DenseNet, biAttention and fully connected layers, using the Adam optimizer and cross-entropy loss function for training, combined with L2 regularization to alleviate overfitting, extraction and analysis Characteristic information of Raman spectrum data.
It significantly improves the multi-classification accuracy of Raman spectrum data, reduces the focus on useless information, avoids the loss of feature information, and achieves more efficient classification performance.
Smart Images

Figure CN114528905B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Raman spectroscopy data classification, and in particular to a Raman spectroscopy data classification method based on DenseNet-biAttention deep learning. Background Art
[0002] Raman spectroscopy is generated by the inelastic scattering of incident light by molecules of a substance, so it can reflect the molecular information of a substance. It is often used to determine the composition and quickly classify substances, and provides an important qualitative and quantitative analysis method for chemical analysis. Raman spectroscopy detection methods are widely used in petrochemical, gem identification, geology, food safety, medicine and other technical fields due to their advantages such as simple operation, no damage to samples, fast analysis speed and high sensitivity.
[0003] Raman spectroscopy detection methods rely on effective quantitative and qualitative models, and model algorithms are the core of Raman spectroscopy qualitative and quantitative analysis methods. The quality of the algorithm will directly affect the accuracy and efficiency of material classification. With the development of machine learning, many traditional machine learning algorithms have been applied to Raman spectroscopy analysis methods. Commonly used algorithms include support vector machine (SVM), random forest (RF), and k-nearest neighbor (KNN) algorithms. The classification accuracy of these algorithms is difficult to improve, and for the numerous categories of Raman spectra, they are difficult to distinguish complex Raman spectra.
[0004] Traditional machine learning algorithms have been unable to meet the high-precision requirements of Raman spectroscopy analysis. Convolutional Neural Networks (CNN), as an outstanding algorithm in deep learning algorithms, have achieved good results in Raman spectroscopy classification. As the first typical CNN network structure, LeNet-5 can well identify Raman spectra. After that, more network models with excellent performance were proposed, such as VGG, GoogleNet and ResNet, which are deep CNN models composed of repeated superposition of small one-dimensional convolution kernels and pooling layers. Due to the large number of layers in these deep CNN models, the efficiency of model classification will decrease, and as the number of layers is superimposed, part of the feature information extracted by the convolution operation will be lost, which will lead to a decrease in classification accuracy. Summary of the invention
[0005] The purpose of the present invention is that in most cases, in the actual application process, the number of categories of Raman spectral data is large and the number of samples is small. Simple models cannot be effectively classified, and the efficiency of complex models decreases with the increase of complexity. In order to more accurately extract the characteristic information of Raman spectral data to solve the problem of low multi-classification accuracy, the present invention proposes a Raman spectral data classification method based on DenseNet-biAttention deep learning.
[0006] The technical solution of the present invention is:
[0007] A Raman spectroscopy data classification method based on DenseNet-biAttention deep learning includes the following steps:
[0008] Step 1, obtaining Raman spectral data, normalizing the Raman spectral data, and dividing the processed Raman spectral data into a training set, a validation set, and a test set;
[0009] Step 2: Build a classification model based on DenseNet-biAttention deep learning;
[0010] Step 3: Use the training set to train the classification model based on DenseNet-biAttention deep learning, and use the validation set to evaluate and adjust the classification model based on DenseNet-biAttention deep learning;
[0011] Step 4: Use the test set to test the performance of the classification model based on DenseNet-biAttention deep learning.
[0012] In step 1, the processed Raman spectral data are divided into a training set, a validation set and a test set, specifically including: 70% to 90% of the Raman spectral data are divided into training data, and the remaining 10% to 30% of the Raman spectral data are divided into a test set; when dividing the validation set, a 5-15 fold cross-validation method is adopted, that is, the training data is divided into 5-15 equal parts, and one part is taken as the validation set each time, and the rest are used as the training set for training.
[0013] Acquire Raman spectral data, perform normalization on the Raman spectral data, and divide the processed Raman spectral data into a training set, a validation set, and a test set, specifically including:
[0014] Since the Raman spectrum data are in different orders of magnitude, it will affect the extraction of feature information during model training. Therefore, the Raman spectrum data is normalized according to formula (1) so that each Raman spectrum data is distributed between 0 and 1:
[0015]
[0016] Among them, X norm is the normalized Raman spectrum data; X is the original Raman spectrum data; X min is the minimum value of the original Raman spectrum data; X max is the maximum value of the original Raman spectrum data;
[0017] 80% of the Raman spectral data were divided into training data, and the remaining 20% of the Raman spectral data were divided into test sets. When dividing the validation set, the 10-fold cross-validation method was adopted, that is, the training data was divided into 10 equal parts, and one part was taken as the validation set each time, and the rest were used as the training set for training.
[0018] In step 2, a classification model based on DenseNet-biAttention deep learning is constructed, which includes:
[0019] The constructed classification model based on DenseNet-biAttention deep learning consists of three parts. The first two parts are used to extract Raman spectrum feature information, and the third part is used to analyze the extracted feature information and classify it. The DenseNet that constitutes the first part consists of two Dense blocks, which are connected by an average pooling layer. A Dense block has four convolutional layers, and the activation function layer uses the ReLU activation function. A batch normalization layer is inserted between each convolutional layer and the activation function layer. Each convolutional layer will receive the feature maps of all previous convolutional layers as input.
[0020] The second part, biAttention, is a dual attention mechanism module composed of a compression excitation module and a spatial attention module in parallel. A one-dimensional vector is obtained as the weight of the channel through the compression excitation module, and then the weight is applied to the corresponding channels respectively. The spatial attention module strengthens the information of the location of the Raman spectrum peak. The third part consists of a flat layer, a fully connected layer and an output layer. The flat layer and the fully connected layer connect the extracted Raman spectrum feature information for analysis, and finally the final classification result is obtained through the output layer Softmax classifier.
[0021] In step 3, the training set is used to train the classification model based on DenseNet-biAttention deep learning, and the validation set is used to evaluate and adjust the classification model based on DenseNet-biAttention deep learning, including:
[0022] The Adam optimizer is used to train the classification model based on DenseNet-biAttention deep learning built in step 2. The initial learning rate of the Adam optimizer is set to 0.01, the learning rate decay rate is set to 0.1, and other parameters use the default parameters; the loss function uses the cross entropy loss function, and L2 regularization is used to alleviate overfitting. The loss function expression is:
[0023]
[0024] Where W is the model weight; N is the number of Raman spectra; n is the Raman spectrum index; y n is the true value of the Raman spectrum label; is the predicted value of the Raman spectrum label; λ is the L2 regularization factor;
[0025] Use the validation set to evaluate the error and classification accuracy of the trained DenseNet-biAttention deep learning-based classification model, so as to adjust the model parameters and save the optimal DenseNet-biAttention deep learning-based classification model.
[0026] In step 4, the test set is used to test the performance of the classification model based on DenseNet-biAttention deep learning, including:
[0027] Use the test set to test the performance of the classification model based on DenseNet-biAttention deep learning saved in step 3, and use accuracy, recall, F1 score and AUC as evaluation indicators of the classification model based on DenseNet-biAttention deep learning.
[0028] Compared with the prior art, the present invention has the following advantages:
[0029] Compared with the prior art, the Raman spectroscopy data classification method based on DenseNet-biAttention deep learning proposed in the present invention improves the accuracy of multi-classification of Raman spectroscopy data. The classification model based on DenseNet-biAttention deep learning in the present invention solves the problem that the characteristic information of Raman spectroscopy is lost as the number of layers is superimposed, and at the same time, it pays more attention to the extracted important information and reduces the attention to useless information. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0031] Figure 1This is a classification model diagram based on DenseNet-biAttention deep learning.
[0032] Figure 2 It is a Dense block structure diagram.
[0033] Figure 3 This is the structural diagram of the compression excitation module.
[0034] Figure 4 This is the structure diagram of the spatial attention module. DETAILED DESCRIPTION
[0035] The following will describe the implementation modes of the present invention in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present invention applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly.
[0036] like Figures 1 to 4 As shown, a Raman spectroscopy data classification method based on DenseNet-biAttention deep learning includes the following steps:
[0037] Step 1: obtain Raman spectral data, normalize the Raman spectral data, and divide the processed Raman spectral data into a training set, a validation set, and a test set.
[0038] Since the Raman spectrum data are in different orders of magnitude, it will affect the extraction of feature information during model training. Therefore, the Raman spectrum data is normalized according to formula (1) so that each Raman spectrum data is distributed between 0 and 1:
[0039]
[0040] Among them, X norm is the normalized Raman spectrum data; X is the original Raman spectrum data; X min is the minimum value of the original Raman spectrum data; X max is the maximum value of the original Raman spectrum data.
[0041] 80% of the Raman spectral data are divided into training data, and the remaining 20% of the Raman spectral data are divided into test sets. When dividing the validation set, the 10-fold cross-validation method is used, that is, the training data is divided into 10 equal parts, and one part is taken as the validation set each time, and the rest is used as the training set for training.
[0042] Step 2: Build a classification model based on DenseNet-biAttention deep learning.
[0043] The classification model based on DenseNet-biAttention deep learning is composed of three parts. The first two parts are used to extract Raman spectral feature information, and the third part is used to analyze the extracted feature information and classify it. The DenseNet that constitutes the first part is composed of two Dense blocks, which are connected by an average pooling layer. A Dense block has four convolutional layers, and the activation function layer uses the ReLU activation function. A batch normalization layer is inserted between each convolutional layer and the activation function layer. Each convolutional layer will receive the feature maps of all previous convolutional layers as input.
[0044] The second part, biAttention, is a dual attention mechanism module composed of a compression excitation module and a spatial attention module in parallel. A one-dimensional vector is obtained as the weight of the channel through the compression excitation module, and then the weight is applied to the corresponding channel respectively. The spatial attention module strengthens the information of the location of the Raman spectrum peak. The third part consists of a flat layer, a fully connected layer, and an output layer. The flat layer and the fully connected layer connect the extracted Raman spectrum feature information for analysis, and finally the final classification result is obtained through the output layer Softmax classifier.
[0045] Step 3: Use the training set to train the classification model based on DenseNet-biAttention deep learning, and use the validation set to evaluate and adjust the classification model based on DenseNet-biAttention deep learning.
[0046] The Adam optimizer is used to train the classification model based on DenseNet-biAttention deep learning built in step 2. The initial learning rate of the Adam optimizer is set to 0.01, the learning rate decay rate is set to 0.1, and other parameters are set to default parameters. The loss function uses the cross entropy loss function, and L2 regularization is used to alleviate overfitting. The loss function expression is:
[0047]
[0048] Where W is the model weight; N is the number of Raman spectra; n is the Raman spectrum index; y n is the true value of the Raman spectrum label; is the predicted value of the Raman spectrum label; λ is the L2 regularization factor.
[0049] Use the validation set to evaluate the error and classification accuracy of the trained DenseNet-biAttention deep learning-based classification model, so as to adjust the model parameters and save the optimal DenseNet-biAttention deep learning-based classification model.
[0050] Step 4: Use the test set to test the performance of the classification model based on DenseNet-biAttention deep learning.
[0051] Use the test set to test the performance of the classification model based on DenseNet-biAttention deep learning saved in step 3, and use accuracy, recall, F1 score and AUC as evaluation indicators of the classification model based on DenseNet-biAttention deep learning.
[0052] Minerals with Raman spectrum numbers greater than 6 and less than 21 were selected from the excellent_unoriented data set of the RRUFF database as Raman spectrum data. Finally, 1436 Raman spectrum data were selected, totaling 127 minerals.
[0053] The classification accuracy of the method of the present invention is compared with that of traditional Raman spectroscopy data classification methods, including support vector machine (SVM), random forest (RF), and k-nearest neighbor (KNN) algorithm. The classification accuracy of the three traditional methods is 93.67%, 68.67%, and 92.91% respectively, while the classification accuracy of the method of the present invention can reach 96.38%, far exceeding the traditional methods.
[0054] The performance of the method of the present invention is compared with that of other deep learning classification methods, including LeNet-5, DeepSpectra, and ResidualSpectra. The evaluation results of the four classification methods are shown in Table 1.
[0055] Table 1 Evaluation results of the method of the present invention and other deep learning classification methods
[0056]
Claims
1. A Raman spectroscopy data classification method based on DenseNet-biAttention deep learning, The following steps are involved: Step 1, obtaining Raman spectral data, normalizing the Raman spectral data, and dividing the processed Raman spectral data into a training set, a validation set, and a test set; Step 2: Build a classification model based on DenseNet-biAttention deep learning, including: The constructed classification model based on DenseNet-biAttention deep learning consists of three parts. The first two parts are used to extract Raman spectral feature information, and the third part is used to analyze the extracted feature information and perform classification. The DenseNet in the first part consists of two Dense blocks, which are connected by an average pooling layer. A Dense block has four convolutional layers, and the activation function layer uses the ReLU activation function. A batch normalization layer is inserted between each convolutional layer and the activation function layer. Each convolutional layer will receive the feature maps of all previous convolutional layers as input. The second part, biAttention, is a dual attention mechanism module consisting of a compression excitation module and a spatial attention module in parallel. The compression excitation module obtains a one-dimensional vector as the weight of the channel, and then applies the weight to the corresponding channel respectively. The spatial attention module strengthens the information of the location of the Raman spectral peak. The third part consists of a flat layer, a fully connected layer, and an output layer. The flat layer and the fully connected layer connect the extracted Raman spectrum feature information for analysis, and finally the final classification result is obtained through the output layer Softmax classifier. Step 3: Use the training set to train the classification model based on DenseNet-biAttention deep learning, and use the validation set to evaluate and adjust the classification model based on DenseNet-biAttention deep learning; Step 4: Use the test set to test the performance of the classification model based on DenseNet-biAttention deep learning.
2. According to claim 1, the Raman spectroscopy data classification method based on DenseNet-biAttention deep learning, It is characterized in that In step 1, the Raman spectrum data is normalized using formula (1) so that each Raman spectrum data is distributed between 0 and 1: Among them, X norm is the normalized Raman spectrum data; X is the original Raman spectrum data; X min is the minimum value of the original Raman spectrum data; X max is the maximum value of the original Raman spectrum data.
3. The Raman spectroscopy data classification method based on DenseNet-biAttention deep learning according to claim 1, It is characterized in that In step 1, the processed Raman spectroscopy data is divided into a training set, a validation set, and a test set, specifically including: 70% to 90% of the Raman spectral data are divided into training data, and the remaining 10% to 30% of the Raman spectral data are divided into a test set; when dividing the validation set, a 5-15-fold cross-validation method is adopted, that is, the training data is divided into 5-15 equal parts, and one part is taken as the validation set each time, and the rest are used as the training set for training.
4. The Raman spectroscopy data classification method based on DenseNet-biAttention deep learning according to claim 1, It is characterized in that In step 3, the training set is used to train the classification model based on DenseNet-biAttention deep learning, and the validation set is used to evaluate and adjust the classification model based on DenseNet-biAttention deep learning, including: The Adam optimizer is used to train the classification model based on DenseNet-biAttention deep learning built in step 2. The loss function uses the cross entropy loss function, and L2 regularization is used to alleviate overfitting. The cross entropy loss function expression (2) is: Where W is the model weight; N is the number of Raman spectra; n is the Raman spectrum index; y n is the true value of the Raman spectrum label; is the predicted value of the Raman spectrum label; λ is the L2 regularization factor; Use the validation set to evaluate the error and classification accuracy of the trained DenseNet-biAttention deep learning-based classification model, so as to adjust the model parameters and save the optimal DenseNet-biAttention deep learning-based classification model.
5. The Raman spectroscopy data classification method based on DenseNet-biAttention deep learning according to claim 1, It is characterized in that In step 4, the test set is used to test the performance of the classification model based on DenseNet-biAttention deep learning, including: Use the test set to test the performance of the classification model based on DenseNet-biAttention deep learning saved in step 3, and use accuracy, recall, F1 score and AUC as evaluation indicators of the classification model based on DenseNet-biAttention deep learning.
