Material component detection method based on Raman spectrum
By using baseline correction, classification network and multi-head attention mechanism in material component detection, the problem of detection of structurally similar substances and signal integrity is solved, the detection accuracy and model training efficiency are improved, and more accurate material component recognition is achieved .
Patent Information
- Application Number
- CN202411232274.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-09-04
AI Technical Summary
In the detection of substance composition, Raman spectra of substances with similar structures are difficult to distinguish. Traditional classification algorithms destroy signal integrity, ignore relative position information, and environmental noise and baseline changes increase the difficulty of identification.
Using Raman spectroscopy-based substance component detection method, through baseline correction, classification network, feature peak band segmentation, standardized processing, position encoding, multi-head attention mechanism, multi-particle size feature extraction and layered Transformer module, combined with multi-layer perception machine, Perform substance testing.
It improves the accuracy of substance component detection, maintains signal integrity, simplifies model design, speeds up training convergence speed, can capture different resolutions and patterns, and improves recognition capabilities.
Smart Images

Figure CN118980673A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of material composition detection, and particularly relates to a material composition 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, typically 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 an energy transfer known as Raman scattering. The Raman shift of this Raman scattering is unique for each substance and provides information about the molecular vibrational modes.
[0003] While spectral acquisition is simple, matching material spectra has always been a challenge. Structurally similar substances can have very similar Raman spectra, making accurate differentiation difficult. Furthermore, traditional classification algorithms, such as CNNs, typically perform uniform segmentation and convolution on the raw spectral signal, which can damage signal integrity and overlook key information, including the relative positions of spectra. Environmental noise and baseline variations further complicate identification. 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 method for detecting material components based on Raman spectroscopy.
[0005] To achieve the above object, the technical solution adopted by the present invention is: The present invention proposes a method for detecting material composition based on Raman spectroscopy, comprising: Acquire the Raman spectrum signal of the substance to be detected, and perform baseline correction to obtain the corrected Raman spectrum signal; The 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. 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 normalized 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 encoding is performed on each feature to obtain corresponding encoding information, and then each encoding information is added to the corresponding feature to obtain the encoding feature; Each encoded feature is sequentially passed through the multi-head attention mechanism module, the multi-granularity feature extraction module, the hierarchical Transformer module and the multi-layer perceptron to obtain the composition of the substance to be detected.
[0006] Preferably, the airPLS algorithm is used to perform baseline correction on the Raman spectrum signal of the substance to be detected.
[0007] 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.
[0008] Preferably, the step of normalizing the characteristic peak bands and the small bands that are inconsistent with the preset length to obtain features consistent with the preset length includes: 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 layers of fully connected layers to obtain features consistent with the preset length.
[0009] Preferably, the inputting of the features of the same length into the material composition detection model, firstly position-encoding the features to obtain corresponding encoding information in the material composition detection model, and then adding the encoding information to the corresponding features to obtain the encoding features, comprises: In the material composition detection model, each feature is first position-encoded to obtain the corresponding coding information. At the same time, each feature is passed through a fully connected layer to obtain the corresponding first feature. Then, each coding information is added to the corresponding first feature to form its own coding feature.
[0010] Preferably, 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 coding 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 sequence, and the q vectors obtained by the i-th first small block feature in all coding features after passing through the linear layer Q are spliced to obtain a Q matrix, the k vectors obtained by passing through the linear layer K are spliced to obtain a K matrix, and the v vectors obtained by passing through the linear layer V are spliced to obtain a V matrix, and then the three spliced matrices are multiplied in sequence to obtain the second feature, and all the second features are spliced 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, wherein the preset weight is a vector composed of the weights of all first small block features.
[0011] Preferably, in the multi-granularity feature extraction module, the input of the multi-granularity feature extraction module passes through a preset number of convolution 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.
[0012] 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; In each submodule, the input of the submodule first passes through the multi-head attention mechanism module to obtain the eighth feature. The eighth feature is fused with the input of the submodule 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 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 that are sequentially connected from data input to output.
[0013] Preferably, the multilayer perceptron includes two fully connected layers connected in sequence.
[0014] Compared with the prior art, the present invention has the following beneficial effects: 1. This Raman spectroscopy-based material composition detection method classifies the substances to be detected, and then identifies the components of the substances to be detected based on 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, maintaining the integrity of the signal and improving the classification accuracy. 2. This Raman spectroscopy-based material composition detection method standardizes the length of each feature before inputting it into the material composition detection model to obtain features of uniform length, simplifying the design of subsequent models and accelerating the convergence of model training; 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 operated on by each first submodule to obtain local features, and then the global features are obtained by the second submodule, so that more complete features can be obtained. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 Schematic diagram of the process of the material composition detection method based on Raman spectroscopy of the present invention; Figure 2 It is a schematic diagram of the process of the standardization process of the present invention; Figure 3 A schematic diagram of the process of obtaining coding features according to the present invention; Figure 4 This is a schematic diagram of the structure of the multi-head attention mechanism module of the present invention; Figure 5 Schematic diagram of the structure of the multi-granularity feature extraction module of the present invention; Figure 6 This is a schematic diagram of the structure of the hierarchical Transformer module of the present invention. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0017] In one embodiment, Figures 1-6 As shown, a method for detecting material composition based on Raman spectroscopy is provided, comprising: S1. Obtaining the Raman spectrum signal of the substance to be detected and performing baseline correction to obtain the corrected Raman spectrum signal; The airPLS algorithm is used to perform baseline correction on the Raman spectrum signal of the substance to be detected, specifically including (the entire baseline correction process belongs to the existing technology): 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 , , ; Fitting vector Pair Vector Fidelity Expressed in terms of variance: (1); Fitting vector The second-order difference method is used to measure smoothness, and the smoothness The calculation formula is as follows: (2); Fidelity and smoothness The balance between The expression is as follows: (3); in, represents the adjustment parameter, and The user modulates 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; For the vector in formula (3) Taking the partial derivative and making it equal to get a linear equation system that is easy to solve, we can get: (4); in, represents the identity matrix, express The derivative of In formula (4), a fidelity weight vector is introduced to achieve baseline calibration. , in the feature The position of the weight , but at the baseline Position weight , formula (1) is rewritten as follows: (5); in is a unit diagonal matrix, each weight On its diagonal, formula (5) transforms into: (6); Then the fitting vector It can be obtained by the following formula: (7); In the adaptive iterative process, automatic updates To obtain a reasonable baseline, after optimization t The balance degree of the iteration can be expressed as follows: (8); Weight vector It is obtained adaptively through iterative method. At 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 its weight Equal to 0; if The value of a point Less than the fitted baseline , then let the weight equal ; The iteration will stop when the maximum number of iterations is reached or the final criterion is reached. The termination criterion is defined as follows: ; Among them, the vector Contains vector Fitting vector in the iterative process All negative differences between 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.
[0018] S2. Using a classification network to classify the corrected Raman spectral signal to obtain the category of the substance to be detected; The classification network uses 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 benzene, alcohols, phenols, and acids. In this embodiment, the convolutional neural network uses two sequentially connected convolutional pooling modules and a fully connected layer. The convolutional pooling modules include convolutional layers and pooling layers sequentially connected from data input to output. The number of convolution kernels in the middle convolutional layer of the first convolutional pooling module is 20, and the number of convolution kernels in the middle convolutional layer of the second convolutional pooling module is 40, and the convolution kernel size is 3. The pooling layer uses a maximum pooling layer with a pooling size of 2. Ten-fold cross-validation is used for training.
[0019] 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. Then, segment the remaining Raman spectrum signal according to the preset length to obtain the corresponding small bands, specifically: According to the category of the substance to be detected, find the characteristic peak band of the functional group corresponding to the 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 expanded characteristic peak band is segmented from the Raman spectrum signal as a whole; The remaining Raman spectrum signal is then divided into corresponding small bands according to a preset length (since 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. The remaining Raman spectrum signal is divided into two segments or one segment according to a preset length, such as 100 wavenumbers as a unit (that is, the preset length is 100 bands at this time). For the small bands at the end that may be less than 100 wavenumbers, they are subsequently standardized).
[0020] 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: 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, respectively. Each standardized feature passes through the four pooling layers in parallel. The outputs of each pooling layer are then concatenated in sequence. Finally, the concatenated features are passed through two fully connected layers to obtain features consistent with the preset length. This allows all features (characteristic peak bands and small bands inconsistent with the preset length) to become features consistent with the preset length. In order to fully extract information while reducing model complexity, this embodiment uses a relatively simple fully connected layer to extract features from the results of pooling layer processing to obtain a fixed-length feature expression.
[0021] S5. Input each feature with the same length into the material composition detection model. In the material composition detection model, first, position code each feature to obtain corresponding coding information. Each coding information is added to the corresponding feature to obtain a coding feature, including: In the material composition detection model, each feature is first position-encoded to obtain the corresponding encoding information, and each feature is passed through the fully connected layer to obtain the corresponding first feature. 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 corresponding coding information obtained by position encoding of nine features, and "C" means splicing, the same below).
[0022] S6. 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.
[0023] 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 encoded 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 the q vector, the k vector, and the v vector in sequence. 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. 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. 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 phase, weight parameters are randomly added to each first small block feature. During the training process, the weight parameters are continuously updated. The weight parameters in the inference phase are the weight parameters obtained after the training is completed (that is, the preset weights); 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 pass through the linear layer Q, linear layer K and linear layer V in parallel, and obtain the q vector, k vector and v vector in turn, and the first small block feature of all the encoded features is 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 is obtained. 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 obtain the V matrix, and then the first small block feature is The three concatenated matrices are multiplied in turn to obtain the second feature (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. The third feature is then multiplied by the vector consisting 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 different parts of the spectrum. Each attention head can focus on different aspects of the input spectrum, allowing the model to capture different patterns and dependencies. Figure 4 The displayed features are the encoding features ( Figure 4The processing process of the first small block feature in the multi-head attention mechanism module (data 1-9 represent each encoded feature), and "X" represents the multiplication operation.
[0024] S6.2. In the multi-granularity feature extraction module, the input of the multi-granularity feature extraction module is parallelized through a preset number of convolutional layers to obtain a corresponding fourth feature, each fourth feature is respectively subjected to a pooling layer to obtain a fifth feature, and then all the fifth features are concatenated to obtain the output of the multi-granularity feature extraction module; It should be noted that if Figure 5 As shown, in this embodiment, the multi-granularity feature extraction module includes three parallel convolutional layers (the convolution kernels of each convolutional layer are of different sizes). The input of the multi-granularity feature extraction module passes through the three convolutional layers in parallel to obtain the corresponding fourth feature. Each fourth feature then passes through a pooling layer (the number of pooling layers corresponds to the number of convolutional layers, both three) to obtain the corresponding fifth feature. The three fifth features are then concatenated to obtain the output of the multi-granularity feature extraction module. Using convolutional filters of different sizes to capture the fine and coarse features of the spectral data enables the model to detect patterns and details at multiple resolutions.
[0025] S6.3, such as 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 sub-module 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 sub-module 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. 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; The forward propagation module includes a first fully connected layer, an activation layer, and a second fully connected layer connected in sequence from data input to output; It should be noted that in this embodiment, the input of the layered Transformer module is evenly divided into five second-block features. The specific number is not limited and can be set according to actual conditions. The number of first submodules corresponds to the number of second-block 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 repeated. The features are calculated by each first submodule to obtain local features, and then the global features are obtained by calculating by the second submodule, so that more complete features are obtained.
[0026] S6.4. A multilayer perceptron consists of two fully connected layers connected in sequence.
[0027] 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.
[0028] In another embodiment, a method for detecting material composition based on Raman spectroscopy is described by way of example: 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 signals (i.e., the number of wave points is 2048) as an example, and taking the category of the substance to be detected as benzene as an example; 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 Range, expand the range, such as expanding it to 1500-1700 cm -1 The expanded wavenumber range is separated from the Raman spectrum signal as a whole, and the wavenumber range of the remaining Raman spectrum signal is 0-1500 cm -1 (called the first wavenumber interval) and 1700-2048 cm -1 (called the second wave number interval), the two wave number intervals are divided into 100 wave number units. The first wave number interval can be divided into 15 small band blocks of 100 wave number units, and the second wave number interval can be divided into 5 small band blocks of 100 wave number units, and 2000-2048 cm is left. -1 The small band block (called the end small band block) is less than 100 wave numbers; The expanded wavenumber range (1500-1700 cm -1 ) and the end of the small band block 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; Then, all features with the same length are sequentially processed through S5 and S6 to obtain the composition of the substance to be tested.
[0029] 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. In addition, Figure 1At 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.
[0030] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended 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; 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 step of normalizing the characteristic peak bands and the small bands that are inconsistent with the preset length to obtain the characteristics that are consistent with the preset length includes: 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.
5. 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.
6. 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, 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 layers Q, K and 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 spliced to obtain a Q matrix, the k vectors obtained by passing the linear layer K are spliced to obtain a K matrix, and the v vectors obtained by passing the linear layer V are spliced to obtain a V matrix, and then the three spliced matrices are multiplied in turn to obtain a second feature, and all the second features are spliced 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.
7. 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.
8. 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.
9. 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
Raman spectrum data analysis method and device based on deep learning
CN113095188A
Raman spectrum detection and identification method and system for trace substances
CN114878543A
Raman spectrum classification method, species blood semen and species classification method
CN117349741A
Cited By
Raman spectrum identification method, device and system for drug residues in water body based on neural network algorithm
CN119845924A
Serum data classification method and system based on Raman spectrum
CN120145236A
Dangerous chemical data acquisition and detection method based on Raman spectrum
CN121167327A
