Raman spectroscopy oil detection method, device, equipment and storage medium

By preprocessing Raman spectral signals and extracting multi-channel features, combined with static and dynamic modal image transformation and dual-stream convolutional neural networks, the problems of accuracy and efficiency in diesel adulteration detection are solved, and high-precision oil detection is achieved.

CN122282746BActive Publication Date: 2026-07-31CHINESE PEOPLES ARMED POLICE FORCE NON-COMMISSIONED OFFICER SCHOOL
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINESE PEOPLES ARMED POLICE FORCE NON-COMMISSIONED OFFICER SCHOOL
Filing Date
2026-05-26
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing technologies for detecting adulterated diesel fuel suffer from problems such as low detection accuracy, complex sample pretreatment, expensive instruments, and long detection time, making it difficult to meet the needs of rapid on-site detection. Furthermore, the Raman spectral characteristic peaks overlap and fluorescence background interference are severe.

Method used

By preprocessing the Raman spectral signal, extracting multiple derivatives and generating multi-channel features, static and dynamic modal images are generated using Gram angle field and Markov transfer field transformation algorithms. Feature fusion is then performed using a two-stream convolutional neural network to achieve high-precision identification of diesel components and dopants.

Benefits of technology

It significantly improves the identification accuracy and efficiency of diesel adulteration detection, effectively distinguishing overlapping peaks and suppressing fluorescence background interference, thus achieving rapid and accurate oil detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122282746B_ABST
    Figure CN122282746B_ABST
Patent Text Reader

Abstract

This application relates to the field of oil product testing technology, and discloses a Raman spectroscopy method, apparatus, equipment, and storage medium for oil product testing. The method includes: acquiring the target Raman spectral signal of the oil product to be tested; determining the multiple derivatives of the target Raman spectral signal, and extracting multi-channel features from the target Raman spectral signal based on the multiple derivatives; generating a first modal image based on the static correlation characteristics between the feature values ​​in the multi-channel features, and generating a second modal image based on the dynamic change characteristics between the feature values ​​in the multi-channel features; extracting a first feature based on the first modal image, extracting a second feature based on the second modal image, fusing the first and second features to obtain a fused feature vector, and determining the detection result of the oil product to be tested based on the fused feature vector. This application can overcome Raman spectral peak overlap and fluorescence background interference, improving the identification accuracy and efficiency of oil product adulteration detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of oil testing technology, and in particular to a Raman spectroscopy method, apparatus, equipment and storage medium for oil testing. Background Technology

[0002] Diesel fuel is an important fuel widely used in transportation and industrial production. Fuel quality directly affects engine performance and the safety of industrial equipment. However, in order to reduce costs or increase profits, some operators adulterate diesel fuel with alcohols. This adulteration leads to a decline in fuel quality, not only altering combustion performance but also potentially damaging engine components and increasing pollution emissions.

[0003] Some related technologies rely primarily on gas chromatography, liquid chromatography, or mass spectrometry for diesel adulteration detection. While these methods offer high accuracy, they suffer from complex sample pretreatment, expensive equipment, and long detection times, making them unsuitable for rapid on-site testing applications. Other related technologies employ spectroscopic analysis for oil product detection, but the characteristic peaks of the Raman spectra of diesel adulterants highly overlap, and the spectral acquisition process is often accompanied by broadband fluorescence background interference, resulting in low detection accuracy. Summary of the Invention

[0004] This application provides a Raman spectroscopy method, apparatus, equipment, and storage medium for oil detection, which solves the current technical problem of difficulty in achieving both high precision and detection efficiency in oil detection. It can overcome the overlap of Raman spectral peaks and interference from fluorescence background, thereby improving the identification accuracy and efficiency of oil adulteration detection.

[0005] To achieve the above objectives, the main technical solutions adopted in this application include: In a first aspect, this application provides a Raman spectroscopy method for detecting oil products, the method comprising: The target Raman spectral signal of the oil to be tested is obtained, wherein the target Raman spectral signal is obtained by preprocessing the initial Raman spectral signal of the oil to be tested; The multiple derivatives of the target Raman spectral signal are determined, and multi-channel features are extracted from the target Raman spectral signal based on the multiple derivatives, wherein the multi-channel features correspond to the multiple derivatives; A first modal image is generated based on the static correlation characteristics between the feature values ​​in the multi-channel features, and a second modal image is generated based on the dynamic change characteristics between the feature values ​​in the multi-channel features. A first feature is extracted based on the first modal image, a second feature is extracted based on the second modal image, the first feature and the second feature are fused to obtain a fused feature vector, and the detection result of the oil to be tested is determined based on the fused feature vector.

[0006] The Raman spectroscopy method for oil detection proposed in this application extracts multi-channel features using the multi-order derivatives of the preprocessed target Raman spectral signal. Different derivatives can respectively reflect the overall intensity distribution, variation trend, and curvature information of the target Raman spectral signal, enabling the multi-channel features to effectively characterize the boundary discrimination and subtle structural differences between overlapping spectral peaks. This makes diesel components and adulterant components, which were originally difficult to distinguish, more distinguishable in the feature space expressed by the multi-channel features, significantly enhancing the weak peak features of similar components such as naphtha and solvent oil. Based on this, the static correlation characteristics of the multi-channel features are used to generate a first modality map to capture the static spatial correlation of the Raman spectrum, and the dynamic change characteristics of the multi-channel features are used to generate a second modality image to capture the dynamic state transition law of the Raman spectrum. This overcomes the defect of information loss in single image-based methods, thereby fusing the features of the two modality maps for detection, which can significantly improve the accuracy of oil detection while ensuring detection efficiency.

[0007] Optionally, the target Raman spectral signal is obtained in the following manner: The initial Raman spectrum signal is subjected to median filtering for denoising to obtain a denoised initial Raman spectrum signal; The target Raman spectrum signal is obtained by smoothing the denoised initial Raman spectrum signal.

[0008] This application uses median filtering to denoise, which can effectively eliminate impulse noise in the initial Raman spectrum signal. At the same time, the denoised signal is smoothed, which can suppress broadband fluorescence background interference introduced when acquiring the initial Raman spectrum signal while maintaining the overall peak shape of the spectrum. This results in a target Raman spectrum signal with a higher signal-to-noise ratio and a more stable baseline, providing a reliable data foundation for subsequent processing.

[0009] Optionally, the multi-order derivatives include at least the zeroth derivative, the first derivative, and the second derivative, and the multi-channel features include at least the first channel feature, the second channel feature, and the third channel feature; Wherein, the first channel feature corresponds to the zeroth derivative, the second channel feature corresponds to the first derivative, and the third channel feature corresponds to the second derivative.

[0010] This application utilizes different channel characteristics to characterize the zeroth, first, and second derivatives of the target Raman spectral signal. This not only preserves the original information of the target Raman spectral signal using the zeroth derivative, but also enhances the trend characteristics of spectral variation using the first derivative, and captures the curvature changes of the spectrum using the second derivative. This can significantly amplify subtle differences between overlapping peaks, thereby improving the identification of similar components such as naphtha and solvent oil.

[0011] Optionally, generating the first modality image based on the static correlation characteristics between the feature values ​​in the multi-channel features includes: Based on the first preset interval, each channel feature in the multi-channel features is normalized to obtain the first normalized feature corresponding to each channel feature. The first normalized feature is mapped to the angular space to obtain the angular feature sequence corresponding to each of the channel features; The sum of angle cosines of every two angle feature values ​​in the angular feature sequence is determined based on the Gramian Angular Summation Field (GASF) transform algorithm, and the Gramian Angular Summation Field matrix corresponding to each channel feature is generated based on the sum of angle cosines, so as to characterize the static correlation characteristics through the Gramian Angular Summation Field matrix; The Gram angular field matrices corresponding to each of the channel features are stacked along the channel dimension to generate the first modal image based on the stacked Gram angular field matrices.

[0012] This application eliminates the influence of differences in dimensions and amplitudes between different channels by normalizing the features of each channel to a first preset interval and mapping them to angular space. At the same time, the Gram angular field transformation algorithm is used to transform the first normalized features corresponding to each channel feature into a Gram angular field matrix. The Gram angular field matrix is ​​used to encode the static amplitude correlation of the spectrum into a first modal image, so that the first modal image not only retains the global morphological features of the spectrum, but also highlights the spatial correlation features between spectral fingerprint peaks.

[0013] Optionally, generating the second modality image based on the dynamic change characteristics between the feature values ​​in the multi-channel features includes: Based on the second preset interval, each channel feature in the multi-channel features is normalized to obtain the second normalized feature corresponding to each channel feature; The second normalized feature is discretized into multiple state feature values ​​according to a preset quantile, so as to form a discrete state sequence corresponding to each channel feature based on the multiple state feature values. The state transition probability of the state feature values ​​at adjacent positions in the discrete state sequence is determined based on the Markov Transition Field (MTF) transformation algorithm, and the Markov transition matrix corresponding to each channel feature is generated according to the state transition probability, so as to characterize the dynamic change characteristics through the Markov transition matrix. The Markov transition matrices corresponding to each of the channel features are stacked along the channel dimension to generate the second modality image based on the stacked Markov transition matrices.

[0014] This application eliminates the influence of differences in dimensions and amplitudes between different channels by normalizing the features of each channel to a second preset interval. At the same time, the dynamic change characteristics in the discretized state sequence corresponding to each channel feature are converted into Markov transition matrices through the Markov transfer field transformation algorithm. The dynamic change characteristics of the spectrum along the wavenumber direction are encoded into a second modal image using the Markov transfer matrix, so that the second modal image can reflect the change law of the spectral intensity sequence, which is beneficial to subsequent feature extraction and fusion recognition.

[0015] Optionally, the step of extracting a first feature based on the first modality image, extracting a second feature based on the second modality image, and fusing the first feature and the second feature to obtain a fused feature vector includes: A two-stream convolutional neural network is constructed, wherein the two-stream convolutional neural network includes a first feature extraction subnetwork and a second feature extraction subnetwork; The first modality image is input into the first feature extraction sub-network, and the first feature vector output by the first feature extraction sub-network is obtained; The second modality image is input into the second feature extraction sub-network, and the second feature vector output by the second feature extraction sub-network is obtained; The first feature vector and the second feature vector are concatenated along the feature dimension to obtain the fused feature vector.

[0016] This application constructs a two-stream convolutional neural network, inputting the first modality image and the second modality image into two independent first feature extraction subnetworks and second feature extraction subnetworks, respectively. This allows the complementary information of the two modalities to be extracted in parallel and efficiently in their respective networks. At the same time, the extracted first feature vector and second feature vector are concatenated along the feature dimension to obtain a fused feature vector. This fused feature vector contains both spectral static spatial correlation features and dynamic state transition probability features. Subsequently, these two types of complementary features are used for collaborative inspection, effectively compensating for the information loss of a single encoding method, thereby significantly improving the identification accuracy of diesel alcohol doping.

[0017] Optionally, the first feature extraction subnetwork and the second feature extraction subnetwork are respectively constructed based on the EfficientNet-B4 network, and the EfficientNet-B4 network includes a moving inverted residual structure. The EfficientNet-B4 network uses the moving inverted residual structure to perform a convolution operation on the first modality image or the second modality image, and obtains the first feature vector or the second feature vector based on the result of the convolution operation.

[0018] Secondly, this application provides a Raman spectroscopy oil detection device, the device comprising: The signal acquisition module is used to acquire the target Raman spectrum signal of the oil to be tested, wherein the target Raman spectrum signal is obtained by preprocessing the initial Raman spectrum signal of the oil to be tested; The feature extraction module is used to determine the multiple derivatives of the target Raman spectral signal and extract multi-channel features from the target Raman spectral signal based on the multiple derivatives, wherein the multi-channel features correspond to the multiple derivatives; The feature processing module is used to generate a first modal image based on the static correlation characteristics between the feature values ​​in the multi-channel features, and to generate a second modal image based on the dynamic change characteristics between the feature values ​​in the multi-channel features; The feature fusion module is used to extract a first feature based on the first modal image, extract a second feature based on the second modal image, fuse the first feature and the second feature to obtain a fused feature vector, and determine the detection result of the oil to be tested based on the fused feature vector.

[0019] Thirdly, this application provides a computer device, comprising: The system includes a memory and a processor, which are interconnected. The memory stores computer instructions, and the processor executes these computer instructions to perform the Raman spectroscopy oil detection method described above.

[0020] Fourthly, this application provides a computer-readable storage medium storing computer instructions, which are used to cause a computer to execute the above-described Raman spectroscopy oil detection method. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0022] Figure 1 One of the flowcharts for a Raman spectroscopy method for oil detection provided in this application embodiment; Figure 2 A second schematic flowchart of a Raman spectroscopy method for oil detection provided in this application embodiment; Figure 3 A third schematic flowchart of a Raman spectroscopy method for oil detection provided in this application embodiment; Figure 4The fourth schematic flowchart of a Raman spectroscopy method for oil detection provided in this application embodiment; Figure 5 This is a schematic diagram of a two-stream convolutional neural network architecture provided in an embodiment of this application; Figure 6 A matrix diagram of test results provided for embodiments of this application; Figure 7 This is a schematic diagram of the structure of a Raman spectroscopy oil detection device provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0024] Diesel adulteration detection mainly relies on gas chromatography, liquid chromatography, or mass spectrometry. Although these methods have high detection accuracy, they have problems such as complex sample pretreatment, expensive instruments, and long detection time, making it difficult to meet the needs of rapid on-site detection.

[0025] Spectroscopic analysis techniques offer advantages such as speed and non-destructiveness in oil product testing. For example, infrared spectroscopy can reflect molecular vibrational characteristics, while Raman spectroscopy provides information on molecular structure, thus enabling oil product detection based on the information provided by the spectra. Analysis of spectral data typically employs methods such as principal component analysis, partial least squares regression, or support vector machines. However, the Raman characteristic peaks of diesel oil and its adulterants (such as methanol, ethanol, methyl acetal, solvent oil, and naphtha) highly overlap, and broadband fluorescence background interference is often present during acquisition, posing challenges to spectral data analysis. Furthermore, the fingerprint information of spectral sequences, such as Raman spectra, is mainly reflected in subtle changes in peak shape; related techniques struggle to fully extract these detailed features directly from the raw spectra. All of these factors limit the ability of commonly used data analysis methods to distinguish similar adulterants.

[0026] Therefore, there is an urgent need for a method to detect oil adulteration that can quickly and accurately identify adulteration.

[0027] The Raman spectroscopy method for oil detection provided in this manual can be applied to oil detection instruments and equipment such as portable or benchtop Raman spectrometers. It is suitable for oil detection scenarios such as oil warehousing quality inspection, on-site sampling inspection at gas stations, and production process control in refining and chemical enterprises.

[0028] According to an embodiment of this application, a Raman spectroscopy method for detecting oil products is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0029] This embodiment provides a Raman spectroscopy method for oil detection. Figure 1 This is a flowchart of the Raman spectroscopy oil detection method according to an embodiment of this application, such as... Figure 1 As shown, the process includes the following steps: Step S1: Obtain the target Raman spectrum signal of the oil to be tested. The target Raman spectrum signal is obtained by preprocessing the initial Raman spectrum signal of the oil to be tested.

[0030] Specifically, the spectral data of the oil sample to be tested is first acquired using a Raman spectrometer to form an initial Raman spectral signal. This initial Raman spectral signal reflects the distribution of Raman scattering intensity corresponding to the vibrations of each molecule in the diesel sample as a function of wavenumber; that is, the initial Raman spectral signal is a one-dimensional intensity sequence distributed along the wavenumber direction, with the horizontal axis representing the wavenumber (Raman shift) and the vertical axis representing the spectral intensity value. Since impulse noise and broadband fluorescence background interference are inevitably introduced during spectral acquisition, this embodiment preprocesses the initial Raman spectral signal to suppress these interferences, thereby obtaining a target Raman spectral signal that truly reflects the vibrational characteristics of the oil molecules. After preprocessing, the signal-to-noise ratio and baseline stability of the target Raman spectral signal are improved, while still maintaining its one-dimensional sequence form, providing a reliable data foundation for subsequent processing.

[0031] Step S3: Determine the multiple derivatives of the target Raman spectral signal, and extract multi-channel features from the target Raman spectral signal based on the multiple derivatives, wherein the multi-channel features correspond to the multiple derivatives.

[0032] Specifically, multiple derivatives refer to the differential results of the target Raman spectral signal at different orders. Determining the multiple derivatives of the target Raman spectral signal involves calculating the zeroth, first, and higher-order derivatives of the one-dimensional sequence. Optionally, in some embodiments of this application, the multiple derivatives include at least the zeroth derivative, the first derivative, and the second derivative.

[0033] The zeroth derivative is the target Raman spectral signal itself, preserving the overall intensity distribution of the spectrum. The first derivative reflects the rate of change of spectral intensity with wavenumber, highlighting the rising and falling edges of the signal, eliminating baseline shift, and enhancing the trend characteristics of the spectrum. It can be determined by the following formula (1): The second derivative reflects the curvature change of spectral intensity, which can significantly amplify the subtle differences between overlapping peaks and improve the identification of similar components such as naphtha and solvent oil. It can be determined by the following formula (2): In the above formulas (1) and (2), The first derivative of the target Raman spectral signal is represented by... The second derivative of the target Raman spectral signal is represented. This represents the spectral intensity value corresponding to the (i+1)th wavenumber. This represents the spectral intensity value corresponding to the i-th wavenumber. This represents the spectral intensity value corresponding to the (i-1)th wavenumber. This indicates the preset calculation step size.

[0034] Multi-channel features are extracted based on the aforementioned multi-order derivatives, that is, derivative sequences of different orders are treated as independent channel features. Optionally, in some embodiments of this application, the multi-channel features include at least a first channel feature, a second channel feature, and a third channel feature, where the first channel feature corresponds to the zeroth derivative, the second channel feature corresponds to the first derivative, and the third channel feature corresponds to the second derivative.

[0035] The first channel feature characterizes the overall peak shape and absolute intensity distribution of the target Raman spectral signal, reflecting the basic fingerprint characteristics of each dopant component. The second channel feature highlights the trend of spectral intensity variation, enhances the boundary features of overlapping peaks, and effectively distinguishes peak shoulders from the main peak. The third channel feature captures the curvature variation of the spectrum and is most sensitive to the fine structure of overlapping peaks, significantly amplifying subtle peak shape differences between similar components such as naphtha and solvent oil.

[0036] This demonstrates that each channel feature corresponds to spectral feature information at different scales. This fully utilizes the enhanced analytical capability of derivative spectroscopy for overlapping peaks, effectively resolving the problem of overlapping features in oil Raman spectra. This allows subsequent encoding of static correlation characteristics and dynamic variation characteristics to be performed in a more discriminative feature space, rather than directly acting on the difficult-to-distinguish original spectrum.

[0037] Step S5: Generate a first modal image based on the static correlation characteristics between the feature values ​​in the multi-channel features, and generate a second modal image based on the dynamic change characteristics between the feature values ​​in the multi-channel features.

[0038] Specifically, this application employs two complementary image coding methods to represent multi-channel features in a two-dimensional image from both static and dynamic perspectives. Specifically, regarding the static correlation characteristics of the multi-channel features, the correlation between feature values ​​at any two positions in the one-dimensional sequence of each channel feature is determined, and this correlation is mapped to the corresponding pixel value in the two-dimensional first modality image. It is understood that the static correlation characteristics do not depend on the order of wavenumbers, but rather reflect the synchronous change trend of spectral intensity between different wavenumber points.

[0039] To address the dynamic changes in multi-channel features, the feature values ​​in each channel's feature sequence are discretized into a finite number of states. Then, the frequency of state transitions between positions along the wavenumber direction is statistically analyzed, and this transition probability is mapped to the corresponding pixel value in a two-dimensional second-modal image. It can be understood that the dynamic changes reflect the variation of spectral intensity along the wavenumber direction.

[0040] It can be seen that the first modality image and the second modality image encode the same set of multi-channel features from the perspectives of static correlation and dynamic change, respectively, forming complementary image representations.

[0041] Step S7: Extract the first feature based on the first modality image, extract the second feature based on the second modality image, fuse the first feature and the second feature to obtain a fused feature vector, and determine the detection result of the oil to be tested based on the fused feature vector.

[0042] Specifically, this embodiment employs two parallel convolutional neural networks to extract features from the first modality image and the second modality image, respectively. Each network can automatically learn and extract high-dimensional feature representations from its respective input image. After feature extraction, the feature vectors output by the two networks are fused to obtain a fused feature vector. The fused feature vector contains the static spatial correlation features of spectral intensity along the wavenumber direction and the dynamic state transition probability features, realizing cross-domain collaborative perception of two types of complementary information. The obtained fused feature vector is then input into a fully connected classifier to achieve accurate identification of diesel alcohol doping types, such as outputting the probability distribution of the tested oil product belonging to various known doping types, or outputting a judgment conclusion on the presence or absence of a specific doping substance.

[0043] The Raman spectroscopy oil detection method provided in this application extracts multi-channel features using the multi-order derivatives of the preprocessed target Raman spectral signal. Different derivatives can respectively reflect the overall intensity distribution, variation trend, and curvature information of the target Raman spectral signal, enabling the multi-channel features to effectively characterize the boundary discrimination and subtle structural differences between overlapping spectral peaks. This makes diesel components and adulterant components, which were originally difficult to distinguish, more distinguishable in the feature space expressed by the multi-channel features, significantly enhancing the weak peak features of similar components such as naphtha and solvent oil. Based on this, the static correlation characteristics of the multi-channel features are used to generate a first modality map to capture the static spatial correlation of the Raman spectrum, and the dynamic change characteristics of the multi-channel features are used to generate a second modality image to capture the dynamic state transition law of the Raman spectrum. This overcomes the defect of information loss in single image-based methods, thereby fusing the features of the two modality maps for detection, which can significantly improve the accuracy of oil detection while ensuring detection efficiency.

[0044] Optionally, in some embodiments of this application, the target Raman spectral signal is obtained in the following manner: The initial Raman spectrum signal is denoised by median filtering to obtain the denoised initial Raman spectrum signal. The denoised initial Raman spectrum signal is then smoothed to obtain the target Raman spectrum signal.

[0045] Specifically, the spectral data of the oil sample collected by the Raman spectrometer can be expressed as follows: ,in, Indicates the spectral wavenumber position. Let represent the spectral intensity value at the corresponding wavenumber position, and n represent the number of spectral sampling points. Therefore, the initial Raman spectral signal can be represented as a one-dimensional sequence. .

[0046] In some embodiments of this application, the initial Raman spectral signal is first denoised using a median filtering method, wherein, for each spectral point Take its neighboring window k is the first preset window parameter, which takes the value of a positive integer. This can be understood as the neighborhood window. The window size is 2k+1. This is achieved by determining the neighboring windows. The median of the inner values ​​yields new spectral values, which are then used to construct the initial Raman spectral signal after denoising. .

[0047] To further smooth non-stationary noise and suppress background fluorescence interference, this application employs the Savitzky-Golay convolution smoothing algorithm to smooth the initial Raman spectrum signal after denoising. This algorithm, by performing local polynomial least squares fitting within a sliding window, can maintain the peak position and full width at half maximum (FWHM) of the spectrum while reducing noise.

[0048] Specifically, for the initial Raman spectrum signal after denoising Set up a sliding window with a width of 2m+1, where m is a second preset window parameter, and the polynomial order is p. After each window slide, process all data points within the sliding window. A polynomial of degree p is fitted, as shown in the following formula (3): In the formula, This represents the fitted spectral intensity value at a relative position t within the window. , , ... represents the fitting coefficients of the polynomial, and t represents the relative position index within the window, which is usually based on the center point of the window as the origin. t can take the value of an integer between [-m, m].

[0049] During the fitting process, the least squares method can be used to determine the coefficients of the polynomial, minimizing the sum of squared residuals from each original data point within the window to the fitted curve. After fitting, the fitted value of the polynomial at the center point of the current window is taken as the spectral point. The smoothed output value. Then, the sliding window is moved one data point to the right, and the above fitting and value-taking operations are repeated until the entire denoised initial Raman spectrum signal has been traversed. The sequence values ​​are then used. Finally, the fitted values ​​at the center points of each sliding window constitute the smoothed target Raman spectral signal.

[0050] In one example of an embodiment of this application, the width of the sliding window is 21, that is, m is 10, and the polynomial order p is 3.

[0051] This application embodiment uses median filtering to denoise, which can effectively eliminate impulse noise in the initial Raman spectrum signal. At the same time, the denoised signal is smoothed, which can suppress broadband fluorescence background interference introduced when acquiring the initial Raman spectrum signal while maintaining the overall peak shape of the spectrum. This results in a target Raman spectrum signal with a higher signal-to-noise ratio and a more stable baseline, providing a reliable data foundation for subsequent processing.

[0052] It should be noted that in some embodiments of this application, a robust normalization method based on percentiles is also used to process the target Raman spectral signal. Specifically, the lower and higher percentiles of the smoothed sequence are calculated. In one example of this application, the lower percentile is the 2% percentile and the higher percentile is the 98% percentile. Then, the smoothed spectral signal is cropped and normalized based on the following formula (4): In the formula, This represents the spectral intensity value corresponding to the i-th wavenumber in the target Raman spectrum signal. Indicates the least significant quantile. Indicates the higher quantile. This represents the spectral intensity value corresponding to the i-th wavenumber in the target Raman spectrum signal after normalization. Indicates will Limited to [ , Within the range.

[0053] The robust normalization method described above can effectively reduce the impact of outliers on data distribution, making subsequent derivative calculations and image encoding more stable, and updating the target Raman spectrum signal using the robustly normalized spectral signal.

[0054] Figure 2 A flowchart of step S5 in an embodiment of this application is shown. Step S5 may include the following steps: Step S511: Normalize each channel feature in the multi-channel features based on the first preset interval to obtain the first normalized feature corresponding to each channel feature.

[0055] For each channel feature in the multi-channel feature set, its numerical range needs to be mapped to a first preset interval to meet the input requirements of the Gram angle field transform. In this embodiment, the first preset interval is set to [-1, 1]. Specifically, the feature values ​​of each channel feature are mapped to the [-1, 1] interval through maximum and minimum value normalization processing, thereby obtaining the first normalized feature sequence. .

[0056] Step S513: Map the first normalized feature to the angular space to obtain the angular feature sequence corresponding to each channel feature.

[0057] Specifically, for the first normalized feature sequence of each channel feature Each eigenvalue is mapped to the angular space using an inverse cosine function, resulting in the angular eigenvalues ​​as shown in formula (5) below: In the formula, where, This represents the i-th first normalized feature, derived from the angle feature value. The angular feature sequence that constitutes the channel feature.

[0058] Step S515: Based on the Gram angle field transformation algorithm, determine the sum of angle cosines of every two angle feature values ​​in the angle feature sequence, and generate the Gram angle field matrix corresponding to each channel feature according to the sum of angle cosines, so as to characterize the static correlation characteristics through the Gram angle field matrix.

[0059] For each channel feature corresponding to the angular feature sequence, the static correlation characteristics between every two spectral points are encoded using trigonometric functions and angular formulas, thereby obtaining the Gram angular field matrix. Specifically, the Gram angular field matrix is ​​shown in the following formula (6): In the formula, This represents the Gram angular field matrix corresponding to a certain channel feature.

[0060] From the above formula (5), we can obtain that , Therefore, the Gram angular field matrix a certain element in It can be shown in the following formula (7): In the formula, Represents the i-th first normalized feature. Let j represent the j-th first normalized feature.

[0061] Step S517: Stack the Gram angular field matrices corresponding to each channel feature along the channel dimension to generate the first modal image based on the stacked Gram angular field matrices.

[0062] Specifically, through the above step S515, the channel features corresponding to the zeroth derivative, first derivative, second derivative, etc., are respectively generated into a Gram angular field matrix. The size of each Gram angular field matrix is ​​n×n. These Gram angular field matrices are stacked according to the preset channel order, thereby generating a two-dimensional first modal image based on the stacked Gram angular field matrix.

[0063] This application embodiment eliminates the influence of differences in dimensions and amplitudes between different channels by normalizing the features of each channel to a first preset interval and mapping them to angular space. At the same time, the Gram angular field transformation algorithm transforms the first normalized features corresponding to each channel feature into a Gram angular field matrix. The Gram angular field matrix is ​​used to encode the static amplitude correlation of the spectrum into a first modal image, so that the first modal image not only retains the global morphological features of the spectrum, but also highlights the spatial correlation features between spectral fingerprint peaks.

[0064] Figure 3 Another flowchart of step S5 in an embodiment of this application is shown. Step S5 may further include the following steps: Step S521: Normalize each channel feature in the multi-channel features based on the second preset interval to obtain the second normalized features corresponding to each channel feature.

[0065] Similar to step S511 above, in this embodiment, for each channel feature in the multi-channel features, its numerical range needs to be mapped to a second preset interval to meet the input requirements of the Markov transfer field transform. It should be noted that, to ensure the physical correctness of the encoding, this embodiment sets different first and second preset intervals; in this embodiment, the second preset interval is set to [0,1]. Specifically, the feature values ​​of each channel feature are mapped to the [0,1] interval through maximum and minimum value normalization processing, thereby obtaining the second normalized feature sequence. .

[0066] Step S523: Discretize the second normalized feature into multiple state feature values ​​according to a preset quantile, so as to form a discrete state sequence corresponding to each channel feature based on the multiple state feature values.

[0067] Specifically, the numerical range [0,1] is first divided into Q intervals according to a preset quantile. Each interval corresponds to a set of states, and each set of states corresponds to a state feature value. In one example of this application embodiment, Q is set to 24. For the second normalized feature sequence of each channel feature... Determine each feature value The set of states to which they belong, thus making each feature value in the second normalized feature... The state is converted into the state feature value corresponding to the set of states, and these state feature values ​​form a discrete state sequence.

[0068] Step S525: Based on the Markov transition field transformation algorithm, determine the state transition probability of the state feature values ​​of adjacent positions in the discrete state sequence, and generate the Markov transition matrix corresponding to each channel feature according to the state transition probability, so as to characterize the dynamic change characteristics through the Markov transition matrix.

[0069] Specifically, the statistical analysis of the feature values ​​of two adjacent states in the above discrete state sequence is based on the state... Transferred to The state transition probabilities between states are used to analyze the dynamic changes between the corresponding eigenvalues ​​at each spectral point. Among these, the two state eigenvalues... and The state transition probability between them is expressed as It is understandable. Indicates the state characteristic value Transition to state eigenvalues The probability of.

[0070] Furthermore, the Markov transition matrix corresponding to each channel feature can be obtained as shown in the following formula (8): In the formula, This represents the Markov transition matrix corresponding to a certain channel feature.

[0071] Step S527: Stack the Markov transition matrices corresponding to each channel feature along the channel dimension to generate a second modality image based on the stacked Markov transition matrices.

[0072] Specifically, through the above step S525, the channel features corresponding to the zeroth derivative, first derivative, second derivative, etc., are respectively generated into a Markov transition matrix. The size of each Markov transition matrix is ​​Q×Q. These Markov transition matrices are stacked according to the preset channel order, thereby generating a two-dimensional second modality image based on the stacked Markov transition matrices.

[0073] This application embodiment normalizes the features of each channel to a second preset interval, eliminating the influence of differences in dimensions and amplitudes between different channels. At the same time, the dynamic change characteristics in the discretized state sequence corresponding to each channel feature are converted into a Markov transition matrix through the Markov transfer field transformation algorithm. The dynamic change characteristics of the spectrum along the wavenumber direction are encoded into a second modal image using the Markov transfer matrix, so that the second modal image can reflect the change law of the spectral intensity sequence, which is beneficial to subsequent feature extraction and fusion recognition.

[0074] Figure 4 A flowchart of step S7 in an embodiment of this application is shown. Step S7 may include the following steps: Step S71: Construct a two-stream convolutional neural network, which includes a first feature extraction subnetwork and a second feature extraction subnetwork. Step S73: Input the first modality image into the first feature extraction sub-network and obtain the first feature vector output by the first feature extraction sub-network; Step S75: Input the second modality image into the second feature extraction subnetwork and obtain the second feature vector output by the second feature extraction subnetwork; Step S77: Concatenate the first feature vector and the second feature vector along the feature dimension to obtain the fused feature vector.

[0075] Specifically, Figure 5The above-described two-stream convolutional neural network structure is illustrated in the diagram below. Figure 5 As shown, this dual-stream convolutional neural network includes two parallel branches. One branch is a first feature extraction sub-network (GAF-Stream), whose input is the first modality image, used to extract the global spatial morphological features of the spectrum. The other branch is a second feature extraction sub-network (MTF-Stream), whose input is the second modality image, used to extract the state transition probability features of the spectrum. Furthermore, both the first and second feature extraction sub-networks output a 1792-dimensional feature vector through a global average pooling layer. That is, the first feature extraction sub-network outputs a first feature vector as follows: The second feature extraction subnetwork outputs the second feature vector as follows: .

[0076] Optionally, in some embodiments of this application, the first feature extraction subnetwork and the second feature extraction subnetwork are respectively constructed based on the EfficientNet-B4 network, and the EfficientNet-B4 network includes a Mobile Inverted Bottleneck Convolution (MBConv) structure. The EfficientNet-B4 network uses the Mobile Inverted Bottleneck Convolution structure to perform convolution operations on the first modality image or the second modality image, and obtains the first feature vector or the second feature vector based on the result of the convolution operation.

[0077] Specifically, the EfficientNet-B4 network is a high-efficiency convolutional neural network. The core of the EfficientNet-B4 network includes a moving inverted residual structure, which first expands the number of channels by increasing the dimensionality through 1×1 convolution, then extracts spatial features through depthwise separable convolution, then dynamically adjusts the channel weights through a global average pooling layer using the Squeeze-and-Excitation (SE) mechanism, and finally reduces the number of channels by 1×1 convolution, thereby outputting the first feature vector and the second feature vector mentioned above.

[0078] Subsequently, the first and second feature vectors output from the two parallel branches are vertically concatenated to form a fused feature vector. This enables cross-domain perception of spatial and probabilistic features, which can be understood as fusing feature vectors. The dimension is 3584.

[0079] This application embodiment constructs a dual-stream convolutional neural network, inputting the first modality image and the second modality image into two independent first feature extraction subnetworks and second feature extraction subnetworks, respectively. This allows the complementary information of the two modalities to be extracted in parallel and efficiently in their respective networks. At the same time, the extracted first feature vector and second feature vector are concatenated along the feature dimension to obtain a fused feature vector. This fused feature vector contains both spectral static spatial correlation features and dynamic state transition probability features. Subsequently, these two types of complementary features are used for collaborative inspection, effectively compensating for the information loss of a single encoding method, thereby significantly improving the identification accuracy of diesel alcohol doping.

[0080] In some embodiments of this application, the above-described two-stream convolutional neural network further includes a fully connected classifier, i.e., a fully connected layer. For example... Figure 5 As shown, the feature vectors will be fused. The input is fed into a pre-trained fully connected classifier to obtain the classification output. The logic of the fully connected classifier can be expressed by the following formula (9): In the formula, This represents the probability distribution of the tested oil product belonging to various oil adulteration types. and These are the weight matrix and bias parameters of the fully connected layer, respectively. This application embodiment is based on... The category with the highest probability is taken as the final oil adulteration detection result.

[0081] Furthermore, in some embodiments of this application, the fully connected classifier also includes two random deactivation layers for randomly discarding some neuron outputs to prevent model overfitting, wherein the deactivation rate of the first random deactivation layer is set to 0.5 and the deactivation rate of the second random deactivation layer is set to 0.3.

[0082] It should be noted that, in this embodiment of the application, the training process of the above-mentioned two-stream convolutional neural network is as follows: First, Raman spectral data were collected from various diesel samples. A multi-channel feature dataset for training was constructed using steps S1 to S5. Then, a GAF image dataset and an MTF image dataset were constructed from the multi-channel feature dataset, and corresponding real-world diesel product labels were assigned to each dataset. It can be understood that the GAF image dataset corresponds to the first modality image, and the MTF image dataset corresponds to the second modality image.

[0083] During training, the multi-channel feature dataset, GAF image dataset, and MTF image dataset were divided into training, validation, and test sets. The dual-stream convolutional neural network model was trained using the training set, and its recognition performance was evaluated using the validation set. The network weights were updated iteratively using the cross-entropy loss function and the backpropagation algorithm, thereby gradually optimizing the dual-stream convolutional neural network. This enabled it to automatically extract feature information from spectral data and achieve high-precision identification of different alcohol adulterations in diesel fuel.

[0084] After training, test set samples were input into the trained model for classification and recognition experiments, and the classification results were statistically analyzed. In multiple training experiments, the overall recognition accuracy of the model was consistently maintained above 90%, indicating that the trained two-stream convolutional neural network has good recognition performance in the diesel alcohol adulteration identification task.

[0085] To further analyze the classification performance of the two-stream convolutional neural network model in the embodiments of this application, this application adopts the following... Figure 6 The confusion matrix shown evaluates the experimental results. The confusion matrix is ​​a commonly used tool for classification performance analysis; it visually reflects the model's recognition performance for different categories of samples by statistically analyzing the prediction results for each category.

[0086] In the process of oil testing, such as Figure 6 As shown, six categories were set up: ethanol-adulterated, solvent-adulterated, methyl acetal-adulterated, methanol-adulterated, naphtha-adulterated, and pure diesel oil, to identify different types of diesel oil adulterated with alcohols. The confusion matrix obtained from the experiment shows that most samples can be correctly classified. The main diagonal elements of the confusion matrix are significantly higher than the off-diagonal elements, indicating that the model has a high accuracy rate in identifying samples of each category.

[0087] Furthermore, analysis of the confusion matrix reveals that there may be some degree of misclassification among a few samples with similar spectral characteristics, but the overall recognition performance remains at a high level.

[0088] Experimental results show that the Raman spectroscopy oil detection method proposed in this application, based on multi-channel features composed of multi-order derivatives and the synergistic effect of GAF-MTF, can simultaneously capture the static spatial correlation and dynamic state transition law of the spectrum, effectively utilize the complementary information of different encoding methods, and automatically extract multi-order derivative features through deep neural networks, thereby significantly improving the accuracy of diesel alcohol adulteration identification.

[0089] To further verify the effectiveness of the dual-modal fusion strategy and network architecture selection in the embodiments of this application, ablation experiments and comparative experiments were designed. In the ablation experiments, a single-stream model using only GAF images (GAF-Stream) and a single-stream model using only MTF images (MTF-Stream) were constructed and compared with the dual-stream fusion model proposed in this application. Experimental results show that the GAF single-stream model has a test accuracy of 77.0%, the MTF single-stream model has a test accuracy of 83.0%, while the dual-stream fusion model of this application achieves a test accuracy of 91%, which is 14.0 and 8.0 percentage points higher than the GAF single-stream and MTF single-stream models, respectively. The above results demonstrate that the spectral static spatial correlation features captured by GAF encoding and the dynamic state transition probability features captured by MTF encoding are significantly complementary. The fusion of the two can effectively compensate for the information loss of a single encoding method, thereby significantly improving the identification accuracy of diesel alcohol doping. In the network architecture comparison experiment, the dual-stream EfficientNet-B4 used in this application was compared with dual-stream ResNet18, dual-stream SqueezeNet, dual-stream AlexNet, and dual-stream EfficientNet-B0. The test accuracies of dual-stream ResNet18, dual-stream SqueezeNet, dual-stream AlexNet, and dual-stream EfficientNet-B0 were 86.0%, 86.0%, 85.1%, and 77.0%, respectively, while EfficientNet-B4 outperformed all the comparison networks with a test accuracy of 91.0%, verifying the superiority of EfficientNet-B4 in the task of extracting features from oil Raman spectral images.

[0090] Accordingly, please refer to Figure 7 This application provides a Raman spectroscopy oil detection device, which includes: The signal acquisition module 100 is used to acquire the target Raman spectrum signal of the oil to be tested. The target Raman spectrum signal is obtained by preprocessing the initial Raman spectrum signal of the oil to be tested. For details, please refer to step S1. The feature extraction module 200 is used to determine the multi-order derivatives of the target Raman spectral signal and extract multi-channel features from the target Raman spectral signal based on the multi-order derivatives. The multi-channel features correspond to the multi-order derivatives. For details, please refer to step S3. The feature processing module 300 is used to generate a first modal image based on the static correlation characteristics between the feature values ​​in the multi-channel features, and to generate a second modal image based on the dynamic change characteristics between the feature values ​​in the multi-channel features. For details, please refer to step S5. The feature fusion module 400 is used to extract a first feature based on a first modal image, extract a second feature based on a second modal image, fuse the first feature and the second feature to obtain a fused feature vector, and determine the detection result of the oil to be tested based on the fused feature vector. For details, please refer to step S7.

[0091] The Raman spectroscopy oil detection device provided in this application extracts multi-channel features using the multi-order derivatives of the preprocessed target Raman spectral signal. Different derivatives can respectively reflect the overall intensity distribution, variation trend, and curvature information of the target Raman spectral signal. This allows the multi-channel features to effectively characterize the boundary discrimination and subtle structural differences between overlapping spectral peaks. This makes diesel components and adulterant components, which were originally difficult to distinguish, more distinguishable in the feature space expressed by the multi-channel features, significantly enhancing the weak peak features of similar components such as naphtha and solvent oil. Based on this, a first modality map is generated using the static correlation characteristics of the multi-channel features to capture the static spatial correlation of the Raman spectrum, and a second modality image is generated using the dynamic change characteristics of the multi-channel features to capture the dynamic state transition law of the Raman spectrum. This overcomes the information loss defect of single image-based methods, thus fusing the features of the two modality maps for detection. This significantly improves the accuracy of oil detection while ensuring detection efficiency. In some embodiments of this application, the device further includes a preprocessing module 500, which is used to: perform median filtering on the initial Raman spectral signal to obtain a denoised initial Raman spectral signal; and to smooth the denoised initial Raman spectral signal to obtain a target Raman spectral signal.

[0092] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0093] In this embodiment, the Raman spectroscopy oil detection device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0094] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application, such as... Figure 8As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 8 Take a processor 10 as an example.

[0095] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0096] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.

[0097] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0098] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0099] The computer device also includes a communication interface 30 for communicating with other devices or communication networks.

[0100] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the methods shown in the above embodiments are implemented.

[0101] This application provides a computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method of any embodiment of this application.

[0102] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.

[0103] The apparatus, module, or unit described in the above embodiments can be implemented by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0104] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0105] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0106] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0107] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0108] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0109] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0110] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0111] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

[0112] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method of Raman spectroscopy for oil detection, characterized in that, The method includes: The target Raman spectral signal of the oil to be tested is obtained, wherein the target Raman spectral signal is obtained by preprocessing the initial Raman spectral signal of the oil to be tested; The multiple derivatives of the target Raman spectral signal are determined, and multi-channel features are extracted from the target Raman spectral signal based on the multiple derivatives, wherein the multi-channel features correspond to the multiple derivatives; Normalize each channel feature in the multi-channel features based on a first preset interval to obtain a first normalized feature corresponding to each channel feature; map the first normalized feature to angular space to obtain an angular feature sequence corresponding to each channel feature; determine the sum cosine of every two angular feature values ​​in the angular feature sequence based on the Gram angular field transform algorithm, and generate a Gram angular field matrix corresponding to each channel feature based on the sum cosine, so as to characterize the static correlation characteristics through the Gram angular field matrix; stack the Gram angular field matrices corresponding to each channel feature along the channel dimension to generate a first modal image based on the stacked Gram angular field matrix; Normalization is performed on each channel feature in the multi-channel features based on a second preset interval to obtain a second normalized feature corresponding to each channel feature; the second normalized feature is discretized into multiple state feature values ​​according to a preset quantile to form a discrete state sequence corresponding to each channel feature based on the multiple state feature values; the state transition probability of the state feature values ​​at adjacent positions in the discrete state sequence is determined based on the Markov transition field transformation algorithm, and a Markov transition matrix corresponding to each channel feature is generated based on the state transition probability to characterize the dynamic change characteristics through the Markov transition matrix; the Markov transition matrices corresponding to each channel feature are stacked along the channel dimension to generate a second modality image based on the stacked Markov transition matrix. A two-stream convolutional neural network is constructed, comprising a first feature extraction subnetwork and a second feature extraction subnetwork. The first modality image is input into the first feature extraction subnetwork, and a first feature vector output by the first feature extraction subnetwork is obtained. The second modality image is input into the second feature extraction subnetwork, and a second feature vector output by the second feature extraction subnetwork is obtained. The first feature vector and the second feature vector are concatenated along the feature dimension to obtain a fused feature vector. The detection result of the oil to be tested is determined based on the fused feature vector.

2. The method of claim 1, wherein, The target Raman spectral signal is obtained in the following manner: The initial Raman spectrum signal is subjected to median filtering for denoising to obtain a denoised initial Raman spectrum signal; The target Raman spectrum signal is obtained by smoothing the denoised initial Raman spectrum signal.

3. The method of claim 1, wherein, The multi-order derivatives include at least the zeroth derivative, the first derivative, and the second derivative, and the multi-channel features include at least the first channel feature, the second channel feature, and the third channel feature; Wherein, the first channel feature corresponds to the zeroth derivative, the second channel feature corresponds to the first derivative, and the third channel feature corresponds to the second derivative.

4. The method of claim 1, wherein, The first feature extraction subnetwork and the second feature extraction subnetwork are respectively constructed based on the EfficientNet-B4 network, and the EfficientNet-B4 network includes a moving inverted residual structure. The EfficientNet-B4 network uses the moving inverted residual structure to perform a convolution operation on the first modality image or the second modality image, and obtains the first feature vector or the second feature vector based on the result of the convolution operation.

5. A Raman spectroscopy oil detection device, characterized in that, The apparatus is based on the Raman spectroscopy oil detection method as described in any one of claims 1 to 4; the apparatus comprises: The signal acquisition module is used to acquire the target Raman spectrum signal of the oil to be tested, wherein the target Raman spectrum signal is obtained by preprocessing the initial Raman spectrum signal of the oil to be tested; The feature extraction module is used to determine the multiple derivatives of the target Raman spectral signal and extract multi-channel features from the target Raman spectral signal based on the multiple derivatives, wherein the multi-channel features correspond to the multiple derivatives; The feature processing module is used to generate a first modal image based on the static correlation characteristics between the feature values ​​in the multi-channel features, and to generate a second modal image based on the dynamic change characteristics between the feature values ​​in the multi-channel features; The feature fusion module is used to extract a first feature based on the first modal image, extract a second feature based on the second modal image, fuse the first feature and the second feature to obtain a fused feature vector, and determine the detection result of the oil to be tested based on the fused feature vector.

6. A computer device, characterized in that, include: The system includes a memory and a processor, which are interconnected. The memory stores computer instructions, and the processor executes the computer instructions to perform the Raman spectroscopy oil detection method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the Raman spectroscopy oil detection method according to any one of claims 1 to 4.