A method for detecting material composition based on Raman spectroscopy

By using Raman spectroscopy-based detection methods in substance composition detection, combined with technical means such as baseline correction, classification network and multi-head attention mechanism module, the problem of difficult distinction between structurally similar substances and impaired signal integrity is solved, and high-precision material composition recognition is achieved.

CN118980673BActive Publication Date: 2025-03-14ZHEJIANG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411232274.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2025-03-14
Estimated Expiration
2044-09-04

AI Technical Summary

Technical Problem

The prior art is difficult to effectively distinguish substances with similar structures in the detection of substance composition, and traditional classification algorithms are prone to destroy signal integrity, ignore key information of the relative position of the spectrum, and environmental noise and baseline changes increase the difficulty of identification.

Method used

A substance component detection method based on Raman spectrum is proposed. By obtaining the Raman spectral signal of the substance to be detected, the substance categories are classified using a classification network, and the signal is divided according to the peak band of the category characteristics is divided, and the multi-head attention mechanism module, multi-particle size feature extraction module, layered Transformer module and multi-layer perceptron are used for feature extraction and component recognition in the substance component detection model.

Benefits of technology

By maintaining signal integrity, the classification accuracy of material components is improved, the model design is simplified, the training convergence speed is accelerated, different patterns and dependencies in the spectrum can be effectively captured, and the recognition accuracy is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118980673B_ABST
    Figure CN118980673B_ABST
Patent Text Reader

Abstract

The present invention discloses a material component detection method based on Raman spectroscopy, comprising the steps of obtaining Raman spectroscopy signals of a material to be detected, and performing baseline correction to obtain a corrected Raman spectroscopy signal; using a classification network to classify the corrected Raman spectroscopy signals to obtain the category of the material to be detected; finding the characteristic peak band of the corresponding functional group according to the category to which the material to be detected belongs, and segmenting the characteristic peak band from the Raman spectroscopy signal, and then segmenting the remaining Raman spectroscopy signal according to a preset length to obtain corresponding small bands; the material component detection method based on Raman spectroscopy classifies the category of the material to be detected, and then identifies the components of the material to be detected according to the characteristic peak band of the functional group corresponding to the category, and segments the Raman spectroscopy signal according to the complete functional group information, thereby maintaining the integrity of the signal and improving the classification accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of material component detection, and in particular relates to a material component detection method based on Raman spectroscopy. Background Art

[0002] Raman spectroscopy, also known as Raman spectroscopy, is an analytical tool used to study vibrational, rotational and other low-frequency modes in a system. It is based on the inelastic scattering of monochromatic light, usually from a laser source. When light interacts with molecules, most photons are scattered elastically (Rayleigh scattering), but a small fraction is scattered inelastically, resulting in energy transfer, which is called Raman scattering. The Raman shift of its Raman scattering is unique for each substance and provides information about the vibrational modes of the molecule.

[0003] Although the spectrum acquisition process is simple, the detection and matching of material spectra has always been a difficult problem. For substances with similar structures, their Raman spectra may be very similar, making it difficult to distinguish them correctly. At the same time, traditional classification algorithms such as CNNs mostly perform uniform segmentation and convolution on the original spectral signals, which easily destroys the integrity of the signal and ignores key information, and also ignores the key information of the relative position of the spectrum. Environmental noise and baseline changes make identification even more difficult. Summary of the invention

[0004] The purpose of the present invention is to solve the problems raised in the background technology and to propose a material composition detection method based on Raman spectroscopy.

[0005] To achieve the above object, the technical solution adopted by the present invention is:

[0006] The present invention proposes a method for detecting material components based on Raman spectroscopy, comprising:

[0007] Acquiring the Raman spectrum signal of the substance to be detected, and performing baseline correction to obtain the corrected Raman spectrum signal;

[0008] A classification network is used to classify the corrected Raman spectral signal to obtain the category of the substance to be detected;

[0009] According to the category of the substance to be detected, the characteristic peak band of the corresponding functional group is found, and the characteristic peak band is segmented from the Raman spectrum signal, and then the remaining Raman spectrum signal is segmented according to the preset length to obtain the corresponding small band;

[0010] The characteristic peak bands and small bands that are inconsistent with the preset length are standardized to obtain features consistent with the preset length;

[0011] Input each feature with the same length into the material composition detection model. In the material composition detection model, firstly, position code each feature to obtain corresponding coding information, and then add each coding information to the corresponding feature to obtain the coding feature.

[0012] Each encoded feature is sequentially passed through a multi-head attention mechanism module, a multi-granularity feature extraction module, a hierarchical Transformer module and a multi-layer perceptron to obtain the composition of the substance to be detected.

[0013] Preferably, the airPLS algorithm is used to perform baseline correction on the Raman spectrum signal of the substance to be detected.

[0014] Preferably, the classification network adopts a convolutional neural network, and the convolutional neural network includes a preset number of convolutional pooling modules and fully connected layers connected in sequence from data input to output, and the convolutional pooling module includes convolutional layers and pooling layers connected in sequence.

[0015] Preferably, the step of normalizing the characteristic peak bands and the small bands inconsistent with the preset length to obtain the characteristics consistent with the preset length includes:

[0016] The characteristic peak bands and small bands that are inconsistent with the preset length are passed through a preset number of parallel pooling layers, and then the outputs of each pooling layer are spliced ​​in sequence. Finally, the spliced ​​features are passed through two fully connected layers to obtain features consistent with the preset length.

[0017] Preferably, the inputting of each feature with the same length into the material composition detection model, in which each feature is first position-encoded to obtain corresponding coding information, and each coding information is added to the corresponding feature to obtain the coding feature, including:

[0018] In the material composition detection model, each feature is first position-encoded to obtain the corresponding coding information, and each feature is passed through a fully connected layer to obtain the corresponding first feature, and then each coding information is added to the corresponding first feature to form its own coding feature.

[0019] Preferably, the multi-head attention mechanism module includes parallel linear layers Q, K and V, and in the multi-head attention mechanism module, each coded feature is first evenly divided into a preset number of first small-block features, and then each first small-block feature is passed through the linear layer Q, K and V in parallel to obtain a q vector, a k vector and a v vector in turn, and the q vectors obtained by passing the linear layer Q of the i-th first small-block feature in all the coded features are concatenated to obtain a Q matrix, the k vectors obtained by passing the linear layer K are concatenated to obtain a K matrix, and the v vectors obtained by passing the linear layer V are concatenated to obtain a V matrix, and then the three concatenated matrices are multiplied in turn to obtain a second feature, and all the second features are concatenated to obtain a third feature, and finally the third feature is multiplied by a preset weight to obtain the output of the multi-head attention mechanism module, wherein the preset weight is a vector composed of the weights of all first small-block features.

[0020] Preferably, in the multi-granularity feature extraction module, the input of the multi-granularity feature extraction module passes through a preset number of convolutional layers in parallel to obtain the corresponding fourth feature, each of the fourth features passes through a pooling layer to obtain the fifth feature, and then all the fifth features are spliced ​​to obtain the output of the multi-granularity feature extraction module.

[0021] Preferably, in the hierarchical Transformer module, the input of the hierarchical Transformer module is first divided into a preset number of second small block features, and then each second small block feature is input into the first submodule to obtain the corresponding sixth feature, and then all the sixth features are spliced ​​to obtain the seventh feature, and then the seventh feature is input into the second submodule to obtain the output of the hierarchical Transformer module;

[0022] In each submodule, the input of the submodule first passes through the multi-head attention mechanism module to obtain the eighth feature, and then passes through the first normalization layer and the forward propagation module in sequence after the eighth feature is fused with the input of the submodule. The output of the first normalization layer is fused with the output of the forward propagation module and then input into the second normalization layer to obtain the output of the submodule.

[0023] The forward propagation module includes a first fully connected layer, an activation layer, and a second fully connected layer which are sequentially connected from data input to output.

[0024] Preferably, the multilayer perceptron includes two fully connected layers connected in sequence.

[0025] Compared with the prior art, the present invention has the following beneficial effects:

[0026] 1. This material composition detection method based on Raman spectroscopy classifies the types of substances to be detected, and then identifies the components of the substances to be detected according to the characteristic peak bands of the functional groups corresponding to the categories. At the same time, the Raman spectral signal is segmented according to the complete functional group information, which maintains the integrity of the signal and improves the accuracy of classification;

[0027] 2. Before inputting the features into the material composition detection model, the material composition detection method based on Raman spectroscopy standardizes the length of each feature to obtain features of uniform length, simplifies the design of subsequent models, and accelerates the convergence speed of model training;

[0028] 3. In the material composition detection model, by encoding the position of each feature and adding the encoded information to the corresponding original feature, a multi-head attention mechanism module is used to learn different attention weights for each part of the spectrum. Each attention head can focus on different aspects of the input features, so that the model can capture different patterns and dependencies; convolution filters of different sizes are used to capture the fine and coarse features of the features, which enables the model to detect patterns and details at multiple resolutions; the features are calculated through each first sub-module to obtain local features, and then the global features are calculated through the second sub-module to obtain more complete features. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a schematic diagram of the process of the material composition detection method based on Raman spectroscopy of the present invention;

[0030] Figure 2 It is a schematic diagram of the process of the standardized processing of the present invention;

[0031] Figure 3 A schematic diagram of a process for obtaining coding features according to the present invention;

[0032] Figure 4 It is a schematic diagram of the structure of the multi-head attention mechanism module of the present invention;

[0033] Figure 5 It is a structural schematic diagram of the multi-granularity feature extraction module of the present invention;

[0034] Figure 6 Schematic diagram of the structure of the hierarchical Transformer module of the present invention. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0036] In one embodiment, Figure 1-Figure 6 As shown, a method for detecting material composition based on Raman spectroscopy is provided, comprising:

[0037] S1, obtaining the Raman spectrum signal of the substance to be detected, and performing baseline correction to obtain the corrected Raman spectrum signal;

[0038] The airPLS algorithm is used to perform baseline correction on the Raman spectrum signal of the substance to be detected, which specifically includes (the entire baseline correction process belongs to the existing technology):

[0039] Let the Raman spectrum signal of the substance to be detected be vector , and fit a vector ,vector and the fitting vector The length of , , ;

[0040] Fitting vector Pair Vector Fidelity Expressed in terms of variance:

[0041] (1);

[0042] Fitting vector The second-order difference method is used to measure smoothness, and the smoothness The calculation formula is as follows:

[0043] (2);

[0044] Fidelity and smoothness The balance between The expression is as follows:

[0045] (3);

[0046] in, represents the adjustment parameter, and The user adjusts the input, The larger the value, the smoother the fitting vector. Users can adjust this parameter to achieve a smoothness between signal fidelity and smoothness. represents the unit second-order difference matrix;

[0047] For the vector in formula (3) Taking the partial derivative and making it equal to get an easily solved linear equation system, we can get:

[0048] (4);

[0049] in, represents the identity matrix, express The derivative of

[0050] In formula (4), a fidelity weight vector is introduced to achieve baseline calibration: , in the feature The position of , but at the baseline The position weight , formula (1) is rewritten as follows:

[0051] (5);

[0052] in is a unit diagonal matrix, each weight On its diagonal, formula (5) transforms into:

[0053] (6);

[0054] Then the fitting vector It can be obtained by the following formula:

[0055] (7);

[0056] In the adaptive iteration process, automatic updates To obtain a reasonable baseline, the optimized t The balance degree of the iteration can be expressed as follows:

[0057] (8);

[0058] Weight vector It is obtained adaptively through iterative method. In the beginning, the initial weight is set to 1. After initialization, if the The value of a point Greater than or equal to the fitted baseline , the value of this point can be regarded as part of the characteristic peak, so let its weight is equal to 0; if The value of a point Less than the fitted baseline , then let the weight equal ;

[0059] The iteration will stop when the maximum number of iterations is reached or the final standard is reached. The termination standard is defined as follows:

[0060] ;

[0061] Among them, the vector Contains vector The fitting vector in the iterative process All negative differences between

[0062] After the calculation is terminated, the fitting vector is obtained , and finally subtract the fitting vector from the original spectral data The baseline-corrected Raman spectrum signal can be obtained.

[0063] S2, using a classification network to classify the corrected Raman spectrum signal to obtain the category of the substance to be detected;

[0064] The classification network adopts a convolutional neural network, and the convolutional neural network includes a preset number of convolutional pooling modules and fully connected layers connected in sequence from data input to output, and the convolutional pooling module includes convolutional layers and pooling layers connected in sequence; the corrected Raman spectral signal is input into the convolutional neural network to obtain the category of the substance to be detected, such as the substance to be detected is benzene, alcohols, phenols and acids, etc.;

[0065] In this embodiment, the convolutional neural network uses two sequentially connected convolutional pooling modules and a fully connected layer. The convolutional pooling module includes a convolutional layer and a pooling layer sequentially connected from data input to output. The number of convolutional kernels in the middle convolutional layer of the first convolutional pooling module is 20, and the number of convolutional kernels in the middle convolutional layer of the second convolutional pooling module is 40, and the size of the convolutional kernel is 3; the pooling layer uses a maximum pooling layer, and its pooling size is set to 2. Ten-fold cross validation is used for training during the training process.

[0066] S3. Find the characteristic peak band of the corresponding functional group according to the category of the substance to be detected, and segment the characteristic peak band from the Raman spectrum signal, and then segment the remaining Raman spectrum signal according to the preset length to obtain the corresponding small band, specifically:

[0067] According to the category of the substance to be detected, find out the characteristic peak band of the functional group corresponding to this type of substance from the existing knowledge (for example, the characteristic peak of the benzene ring of the functional group of benzene substances is at 1580-1610cm -1 ), the characteristic peak band is expanded to a preset range (the specific expansion range is not limited and is set according to the type of substance. For example, taking benzene ring as an example, it is expanded to 1500-1700 cm -1 band), and then the enlarged characteristic peak band is segmented from the Raman spectrum signal as a whole;

[0068] Then the remaining Raman spectrum signal is divided into corresponding small bands according to the preset length (because after the expanded characteristic peak band is divided from the Raman spectrum signal as a whole, the remaining Raman spectrum signal is divided into two segments or one segment, and the remaining Raman spectrum signal is divided into two segments or one segment according to the preset length, such as dividing it into 100 wave numbers as a unit (that is, the preset length is 100 bands at this time), and there may be small bands with less than 100 wave numbers at the end, which are subsequently standardized).

[0069] S4, standardize the characteristic peak bands and the small bands that are inconsistent with the preset length to obtain features consistent with the preset length, specifically:

[0070] The characteristic peak bands and the small bands that are inconsistent with the preset length are respectively passed through a preset number of parallel pooling layers (in this embodiment, such as Figure 2 As shown, four parallel pooling layers are used, and the window sizes of the four pooling layers are different, such as 1×1, 2×2, 3×3, and 4×4, and each feature after standardization passes through the four pooling layers in parallel). Then, the outputs of each pooling layer are spliced ​​in sequence, and finally, the spliced ​​features are passed through two layers of fully connected layers to obtain features consistent with the preset length, thereby making all features (feature peak bands, and small bands inconsistent with the preset length) become features consistent with the preset length. In order to fully extract information and reduce the complexity of the model, this embodiment uses a relatively simple fully connected layer to extract features from the results processed by the pooling layer to obtain a fixed-length feature expression.

[0071] S5. Input each feature with the same length into the material composition detection model. In the material composition detection model, firstly, position code each feature to obtain corresponding coding information, and then add each coding information to the corresponding feature to obtain the coding feature, including:

[0072] In the material composition detection model, each feature is first position-encoded to obtain the corresponding encoding information, and each feature is passed through a fully connected layer to obtain the corresponding first feature, and then each encoding information is added to the corresponding first feature to form its own encoding feature (each encoding information is added to the corresponding first feature to obtain its own encoding feature). Figure 3 As shown, taking the case where the number of features with the same length is nine as an example ( Figure 3 Each feature with a data number of 1-9 represents the position encoding of nine features to obtain the corresponding encoding information, and "C" means splicing, the same below).

[0073] S6. Each coded feature is sequentially passed through a multi-head attention mechanism module, a multi-granularity feature extraction module, a hierarchical Transformer module and a multi-layer perceptron to obtain the composition of the substance to be detected.

[0074] S6.1. The multi-head attention mechanism module includes a parallel linear layer Q, a linear layer K, and a linear layer V. In the multi-head attention mechanism module, each coded feature is first evenly divided into a preset number of first small-block features, and then each first small-block feature is passed through the linear layer Q, the linear layer K, and the linear layer V in parallel to obtain a q vector, a k vector, and a v vector in turn. The i-th first small-block feature (expressed as ) The q vectors obtained by the linear layer Q are concatenated to obtain the Q matrix, the k vectors obtained by the linear layer K are concatenated to obtain the K matrix, and the v vectors obtained by the linear layer V are concatenated to obtain the V matrix, and then the three concatenated matrices are multiplied in sequence to obtain the second feature, and all the second features are concatenated to obtain the third feature, and finally the third feature is multiplied by the preset weight to obtain the output of the multi-head attention mechanism module, where the preset weight is a vector composed of the weights of all the first small block features. In the training stage, weight parameters are randomly added to each first small block feature. During the training process, the weight parameters are continuously updated, and the weight parameters in the inference stage are the weight parameters obtained after the training is completed (that is, the preset weights);

[0075] It should be noted that, in this embodiment, each coding feature is evenly divided into three first small block features, which are represented as follows: , and All the first small block features are passed through the linear layer Q, linear layer K and linear layer V in parallel to obtain the q vector, k vector and v vector in turn. The first small block feature of all the encoded features The Q matrix is ​​obtained by concatenating the q vectors obtained by the linear layer Q, and the first small block feature of all the encoded features The K matrix is ​​obtained by concatenating the k vectors obtained by the linear layer K. The first small block feature of all the encoded features The v vectors obtained by the linear layer V are concatenated to get the V matrix, and then the first small block feature The three concatenated matrices are multiplied in turn to obtain the second feature (similarly the second first small block feature And the third first small feature The same operation is performed to obtain the second feature), and then all the second features are concatenated in sequence to obtain the third feature, and then the third feature is multiplied by the vector composed of the weights of all the first small features to obtain the output of the multi-head attention mechanism module. The multi-head attention mechanism module is used to learn different attention weights for each part of the spectrum. Each attention head can focus on different aspects of the input spectrum, so that the model can capture different patterns and dependencies. Figure 4The displayed features are the encoding features ( Figure 4 The data 1-9 in the figure represent the processing process of the first small block feature in each encoded feature in the multi-head attention mechanism module, and "X" represents the multiplication operation.

[0076] S6.2, in the multi-granularity feature extraction module, the input of the multi-granularity feature extraction module is parallelly passed through a preset number of convolutional layers to obtain a corresponding fourth feature, each fourth feature is respectively passed through a pooling layer to obtain a fifth feature, and then all the fifth features are spliced ​​to obtain the output of the multi-granularity feature extraction module;

[0077] It should be noted that if Figure 5 As shown, in this embodiment, the multi-granularity feature extraction module includes three parallel convolution layers (the size of the convolution kernel of each convolution layer is inconsistent), and the input of the multi-granularity feature extraction module passes through the three convolution layers in parallel to obtain the corresponding fourth feature, and then each fourth feature passes through the pooling layer (the number of pooling layers corresponds to the number of convolution layers, both are three) to obtain the corresponding fifth feature, and then the three fifth features are spliced ​​to obtain the output of the multi-granularity feature extraction module. Convolution filters of different sizes are used to capture the fine and coarse features of spectral data, which enables the model to detect patterns and details at multiple resolutions.

[0078] S6.3, if Figure 6 As shown, in the hierarchical Transformer module, the input of the hierarchical Transformer module is first divided into a preset number of second small block features, and then each second small block feature is input into the first submodule to obtain the corresponding sixth feature, and then all the sixth features are spliced ​​to obtain the seventh feature, and then the seventh feature is input into the second submodule to obtain the output of the hierarchical Transformer module;

[0079] In each submodule, the input of the submodule first passes through the multi-head attention mechanism module to obtain the eighth feature, and the eighth feature is fused with the input of the submodule (the fusion is an addition operation) and then passes through the first normalization layer and the forward propagation module in sequence. The output of the first normalization layer is fused with the output of the forward propagation module (the fusion is an addition operation), and then input into the second normalization layer to obtain the output of the submodule;

[0080] The forward propagation module includes a first fully connected layer, an activation layer, and a second fully connected layer sequentially connected from data input to output;

[0081] It should be noted that, in this embodiment, the input of the hierarchical Transformer module is evenly divided into five second small blocks of features. The specific number is not limited and can be set according to the actual situation. The number of first submodules corresponds to the number of second small blocks of features, which is five. In each submodule, the structure and operation process of the multi-head attention mechanism module are the same as those in S6.1 and will not be described again. The features are calculated by each first submodule to obtain local features, and then the global features are calculated by the second submodule to obtain more complete features.

[0082] S6.4. A multilayer perceptron consists of two fully connected layers connected in sequence.

[0083] Each coding feature is sequentially passed through S6.1, S6.2, S6.3 and S6.4 to obtain whether the substance to be detected is a certain substance.

[0084] In another embodiment, a method for detecting material composition based on Raman spectroscopy is exemplified:

[0085] According to S1 and S2, the categories of the substances to be detected are obtained, such as benzene, alcohols, phenols, and acids, etc., taking the Raman spectrum signal of the substance to be detected as 1×2048 as an example (that is, the number of wave points is 2048), and taking the category of the substance to be detected as benzene as an example;

[0086] The functional group of the substance to be detected (benzene) is the benzene ring. Combined with the prior knowledge of chemical neighborhood, the characteristic peak of the benzene ring is at 1580-1610cm -1 The interval is expanded, such as expanding to 1500-1700 cm -1 The expanded wavenumber interval is separated from the Raman spectrum signal as a whole, and the wavenumber interval of the remaining Raman spectrum signal is 0-1500 cm -1 (called the first wavenumber interval) and 1700-2048 cm -1 The first wave number interval can be divided into 15 small band blocks with 100 wave numbers as a unit, and the second wave number interval can be divided into 5 small band blocks with 100 wave numbers as a unit, and there is still 2000-2048 cm -1 The small band block (called the end small band block) is less than 100 wave numbers;

[0087] The expanded wavenumber range (1500-1700 cm -1 ) and the small band block at the end are standardized, and the two wave number intervals are uniformly expressed as a block of length 100 (i.e. 100 wave numbers), which is consistent with the length of the remaining small bands;

[0088] Then, all the features with the same length are sequentially passed through S5 and S6 to obtain the composition of the substance to be tested.

[0089] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0090] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for detecting material composition based on Raman spectroscopy, characterized in that: The material composition detection method based on Raman spectroscopy includes: Acquiring the Raman spectrum signal of the substance to be detected, and performing baseline correction to obtain the corrected Raman spectrum signal; A classification network is used to classify the corrected Raman spectral signal to obtain the category of the substance to be detected; According to the category of the substance to be detected, the characteristic peak band of the corresponding functional group is found, and the characteristic peak band is segmented from the Raman spectrum signal, and then the remaining Raman spectrum signal is segmented according to the preset length to obtain the corresponding small band; The characteristic peak bands and small bands that are inconsistent with the preset length are standardized to obtain features consistent with the preset length, including: The characteristic peak bands and small bands that are inconsistent with the preset length are passed through a preset number of parallel pooling layers, and then the outputs of each pooling layer are spliced ​​in sequence. Finally, the spliced ​​features are passed through two fully connected layers to obtain features consistent with the preset length; Input each feature with the same length into the material composition detection model. In the material composition detection model, firstly, position code each feature to obtain corresponding coding information, and then add each coding information to the corresponding feature to obtain the coding feature. Each encoded feature is sequentially passed through a multi-head attention mechanism module, a multi-granularity feature extraction module, a hierarchical Transformer module and a multi-layer perceptron to obtain the composition of the substance to be detected.

2. The method for detecting material composition based on Raman spectroscopy according to claim 1, characterized in that: The airPLS algorithm is used to perform baseline correction on the Raman spectrum signal of the substance to be detected.

3. The method for detecting material composition based on Raman spectroscopy according to claim 1, characterized in that: The classification network adopts a convolutional neural network, and the convolutional neural network includes a preset number of convolutional pooling modules and fully connected layers connected in sequence from data input to output, and the convolutional pooling module includes convolutional layers and pooling layers connected in sequence.

4. The method for detecting material composition based on Raman spectroscopy according to claim 1, characterized in that: The features with the same length are input into the material composition detection model. In the material composition detection model, each feature is first position-coded to obtain corresponding coding information, and each coding information is added to the corresponding feature to obtain the coding feature, including: In the material composition detection model, each feature is first position-encoded to obtain the corresponding coding information, and each feature is passed through a fully connected layer to obtain the corresponding first feature, and then each coding information is added to the corresponding first feature to form its own coding feature.

5. The method for detecting material composition based on Raman spectroscopy according to claim 1, characterized in that: The multi-head attention mechanism module includes parallel linear layers Q, linear layers K and linear layers V, and in the multi-head attention mechanism module, each coded feature is first evenly divided into a preset number of first small-block features, and then each first small-block feature is passed through the linear layers Q, linear layers K and linear layers V in parallel to obtain q vectors, k vectors and v vectors in turn, and the q vectors obtained by passing the linear layer Q of the i-th first small-block feature in all coded features are concatenated to obtain a Q matrix, the k vectors obtained by passing the linear layer K are concatenated to obtain a K matrix, and the v vectors obtained by passing the linear layer V are concatenated to obtain a V matrix, and then the three concatenated matrices are multiplied in turn to obtain a second feature, and all the second features are concatenated to obtain a third feature, and finally the third feature is multiplied by a preset weight to obtain the output of the multi-head attention mechanism module, wherein the preset weight is a vector composed of the weights of all first small-block features.

6. The method for detecting material composition based on Raman spectroscopy according to claim 1, characterized in that: In the multi-granularity feature extraction module, the input of the multi-granularity feature extraction module passes through a preset number of convolutional layers in parallel to obtain the corresponding fourth feature, each of the fourth features passes through a pooling layer to obtain a fifth feature, and then all the fifth features are spliced ​​to obtain the output of the multi-granularity feature extraction module.

7. The method for detecting material composition based on Raman spectroscopy according to claim 1, characterized in that: In the hierarchical Transformer module, firstly, the input of the hierarchical Transformer module is divided into a preset number of second small block features, then each second small block feature is input into the first submodule to obtain the corresponding sixth feature, then all the sixth features are concatenated to obtain the seventh feature, and then the seventh feature is input into the second submodule to obtain the output of the hierarchical Transformer module; In each submodule, the input of the submodule first passes through the multi-head attention mechanism module to obtain the eighth feature, and then passes through the first normalization layer and the forward propagation module in sequence after the eighth feature is fused with the input of the submodule. The output of the first normalization layer is fused with the output of the forward propagation module and then input into the second normalization layer to obtain the output of the submodule. The forward propagation module includes a first fully connected layer, an activation layer, and a second fully connected layer which are sequentially connected from data input to output.

8. The method for detecting material composition based on Raman spectroscopy according to claim 1, characterized in that: The multi-layer perceptron includes two fully connected layers connected in sequence.

Citation Information

Patent Citations

  • A Raman spectroscopic analysis method based on a convolution neural network

    CN109543763A

  • Scale-adaptive microbial Raman spectrum detection method and system

    CN112986210A