An oil quality detection method and system based on artificial intelligence and spectral detection

By using artificial intelligence and spectral detection methods, feature vectors were extracted from near-infrared and Raman spectral datasets, solving the detection accuracy problem caused by differences in base oil when diesel is adulterated, and achieving a more accurate determination of the adulteration ratio of mixed oils.

CN122259506APending Publication Date: 2026-06-23CHINESE PEOPLES ARMED POLICE FORCE NON-COMMISSIONED OFFICER SCHOOL
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The differences in spectral characteristics of pure diesel fuel from different manufacturers, batches, origins, and refining processes lead to reduced accuracy in quantitative detection of adulterated diesel fuel.

Method used

By employing artificial intelligence and spectral detection methods, near-infrared and Raman spectral datasets of the oil samples to be tested are acquired, specific spectral feature vectors are extracted, and a target quantitative detection model is used to determine the doping ratio of impurity oils, thereby reducing the influence of base oil differences.

Benefits of technology

This improves the accuracy of quantitative detection results for diesel adulteration, reduces the influence of impurity oil characteristics on the detection results, and ensures the accuracy of the detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122259506A_ABST
    Figure CN122259506A_ABST
Patent Text Reader

Abstract

This application provides a method and system for detecting the quality of oil substances based on artificial intelligence and spectral detection. The method includes: acquiring near-infrared spectral datasets and Raman spectral datasets of an oil sample to be tested; the oil sample to be tested is a mixture of diesel and mixed oil, and the proportion of diesel in the oil sample is greater than that of the mixed oil; processing the near-infrared spectral dataset and Raman spectral dataset according to several preset wavelength acquisition points to obtain specific spectral feature vectors; determining a target quantitative detection model from several candidate quantitative detection models based on the specific spectral feature vectors; and obtaining the doping ratio of the mixed oil in the oil sample to be tested based on the near-infrared spectral dataset, the Raman spectral dataset, and the target quantitative detection model. This application can reduce the decrease in the accuracy of quantitative detection results caused by differences in base oils.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular to a method and system for detecting the quality of oily substances based on artificial intelligence and spectral detection. Background Technology

[0002] Among the many methods of adulteration in diesel fuel, alcohol adulteration is a relatively common one. When identifying adulteration, it is not only necessary to determine whether adulteration has occurred and what type it is, but also the amount of adulteration. However, because the spectral characteristics (such as near-infrared and Raman spectral characteristics) of pure diesel fuel from different manufacturers, batches, origins, and refining processes vary, these inherent differences in diesel fuel can reduce the accuracy of quantitative detection results. Summary of the Invention

[0003] To address the aforementioned technical problem, the technical solution adopted in this application is as follows: In one aspect of this application, a method for detecting the quality of oily substances based on artificial intelligence and spectral detection is provided, the method comprising the following steps: S100, acquire the near-infrared spectral dataset and Raman spectral dataset of the oil sample to be tested; the oil sample to be tested is a mixture of diesel and mixed oil, and the proportion of diesel in the oil sample to be tested is greater than that of the mixed oil; the type of mixed oil is methanol or ethanol, and the type of mixed oil in the oil sample to be tested is known.

[0004] S200, the near-infrared spectral dataset and the Raman spectral dataset are processed according to a number of preset wavelength acquisition points to obtain a specific spectral feature vector; the specific spectral feature vector is obtained according to the data corresponding to each preset wavelength acquisition point in the near-infrared spectral dataset and the Raman spectral dataset; each preset wavelength acquisition point corresponds to the near-infrared spectral dataset or the Raman spectral dataset.

[0005] S300, based on the specific spectral feature vector, a target quantitative detection model is determined from several candidate quantitative detection models; each candidate quantitative detection model corresponds to a type of pure diesel; the difference in substance content between pure diesel corresponding to different types of pure diesel is greater than a preset threshold.

[0006] S400, based on the near-infrared spectroscopy dataset, the Raman spectroscopy dataset, and the target quantitative detection model, the doping ratio of the impurity oil in the oil sample to be tested is obtained.

[0007] In another aspect of this application, an oil substance quality detection system based on artificial intelligence and spectral detection is also provided. The system includes a near-infrared-Laman combined spectrometer and a processor. The near-infrared-Laman combined spectrometer and the processor are connected. The processor stores executable code, which, when executed, is used to implement the above-described method.

[0008] This application has at least the following beneficial effects: This application provides a method for detecting the quality of oil substances based on artificial intelligence and spectral detection. The method determines the type of base oil (i.e., diesel oil before it is adulterated) of the current oil sample by using a specific spectral feature vector, and uses the target quantitative detection model corresponding to the current diesel oil type to determine the adulteration ratio of the adulterated oil in the oil sample. This method can reduce the decrease in the accuracy of quantitative detection results caused by differences in base oil.

[0009] Furthermore, in this embodiment of the application, feature extraction is performed on the data corresponding to each preset wavelength acquisition point in the near-infrared spectral dataset and the Raman spectral dataset to reduce the influence of impurity oil on the extracted features, so that the specific spectral feature vector contains as few features as possible of impurity oil, thereby reducing the impact of inaccurate classification results caused by the influence of substances in impurity oil. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 A flowchart of a method for detecting the quality of oily substances based on artificial intelligence and spectral detection is provided for embodiments of this application; Figure 2 Near-infrared spectra of pure diesel and blended oil samples provided in the embodiments of this application; Figure 3 Raman spectra of pure diesel and adulterated oil samples provided in the embodiments of this application. Detailed Implementation

[0012] The technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of this application, and 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.

[0013] It is worth noting that in the following description, specific details such as particular system structures and techniques are set forth for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application can also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of this application with unnecessary details.

[0014] It should be understood that in this application specification and the appended claims, the use of the terms "comprising," "including," "including but not limited to," "including but not limited to," "mainly composed of," or "mainly made of" indicates the presence of the described feature, integral, step, operation, element, and / or component, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof.

[0015] It should be understood that in this application specification and the appended claims, the use of the terms "consisting of" or "component of" indicates the presence of the described feature, integral, step, operation, element and / or component, but excludes the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0016] It should be understood that, in this specification and the appended claims, the term "and" indicates a combination in which multiple of the associated listed items exist simultaneously. For example, "A, B, C, and D" means a combination in which "A and B and C and D exist simultaneously".

[0017] It should be understood that in this application specification and the appended claims, the use of the term "or" indicates a combination in which one of the associated listed items exists alone. For example, "A, B, C or D" refers to the four combinations of "A alone", "B alone", "C alone", and "D alone".

[0018] It should be understood that, in this application specification and the appended claims, the term "and / or" indicates any combination of one or more of the associated listed items, as well as all possible combinations, and includes such combinations. For example, "A and / or B" refers to the three combinations of "A alone," "B alone," or "A and B simultaneously." For example, "A, B, and / or C" refers to the seven combinations of "A alone," "B alone," "C alone," "A and B simultaneously," "A and C simultaneously," "B and C simultaneously," and "A, B, and C simultaneously."

[0019] It should be understood that, in this specification and the appended claims, the term "if" is used to indicate, depending on the context, "in the case of," "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [the described condition or event] is detected" can be interpreted, depending on the context, as "once determined," "in response to determination," "once [the described condition or event] is detected," or "in response to detection of [the described condition or event]."

[0020] It should be understood that in this application specification and the appended claims, the terms "greater than", "less than", "exceeding", etc. are understood to exclude the number itself; and the terms "above", "below", "within", etc. are understood to include the number itself.

[0021] It should be understood that in this application specification and the appended claims, the terms "the," "the," "the," "the," "the," "the described," "the mentioned," etc., may be understood, depending on the context, to refer to the content mentioned above.

[0022] It should be understood that in this application specification and the appended claims, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance, nor are they used to describe a specific order or sequence.

[0023] It should be understood that in this application specification and appended claims, the designations such as "S100," "S200," and "S300" are used only for distinguishing descriptions and should not be construed as indicating or implying a specific order or sequence of execution of steps or processes. For example, "S100, acquire data A; S200, acquire data B; S300, acquire C based on A and B;" is merely an example providing a feasible execution order, not a necessary one. Those skilled in the art can determine the actual and feasible execution order based on the function and internal logic of each step. For example, "step S100 is executed before step S200, then step S300 is executed," "step S200 is executed before step S100, then step S300 is executed," or "steps S100 and S200 are executed in parallel, then step S300 is executed."

[0024] It should be understood that in this application specification and appended claims, if numbering or quantity in the form of “f(i); i=1, 2, ..., n;” is used, the specific value corresponding to the term “f(i)” should be understood as a value that changes with the value of i, and not as a fixed value. For example, in different practical scenarios, “f(1)” and “f(2)”, “f(1)” may be equal to “f(2)” or may not be equal to “f(2)”, and unless otherwise specified, there is no necessary size relationship between “f(1)” and “f(2)”.

[0025] It should be understood that in this application specification and appended claims, if numbers or symbols in the form of superscript are used, and the context or other corresponding locations provide a specific interpretation of them, they should be understood according to their corresponding explanatory description, and cannot be directly and simply understood as concepts such as "exponent" in mathematics or "atomic number" in chemistry. Similarly, if numbers or symbols in the form of subscript are used, they should be understood in the same way, without further explanation.

[0026] It should be understood that in the description of this application and the appended claims, if terms such as "A=(...)" are used, unless otherwise specifically interpreted, they should be understood as "A includes...", and not as "A is composed of...". Furthermore, unless otherwise specifically interpreted, the parentheses "(" and ")" are only used in conjunction with "=" to indicate what items or data A includes, and do not refer to any specific data structure, nor do they limit the type of its elements, whether the number of elements is fixed, whether the elements are ordered, whether the elements are repeatable, what query method is required to query its elements, or what access order is required to access its elements.

[0027] It should be understood that in the description of this application and the appended claims, if common processing functions such as "max(...)", "min(...)", and "avg(...)" are used, the context or other corresponding locations should provide a specific interpretation of these terms. If no specific interpretation exists, those skilled in the art should use relevant technical terms from computer science and technology for connection. For example, "max(...)" refers to a function for determining the maximum value, "min(...)" refers to a function for determining the minimum value, and "avg(...)" refers to a function for determining the average value.

[0028] Please refer to Figure 1 As shown in an exemplary embodiment of this application, a method for detecting the quality of oily substances based on artificial intelligence and spectral detection is provided. The method includes the following steps: S100, acquire the near-infrared spectral dataset and Raman spectral dataset of the oil sample to be tested; the oil sample to be tested is a mixture of diesel and mixed oil, and the proportion of diesel in the oil sample to be tested is greater than that of the mixed oil; the type of mixed oil is methanol or ethanol, and the type of mixed oil in the oil sample to be tested is known.

[0029] The near-infrared spectral dataset includes near-infrared spectral intensities corresponding to several wavelength acquisition points; the Raman spectral dataset includes Raman spectral intensities corresponding to several wavelength acquisition points.

[0030] Specifically, the near-infrared spectral dataset RI=(RI1,RI2,…,RIi,…,RIn) and the Raman spectral dataset RS=(RS1,RS2,…,RSi,…,RSn) are used; where RIi is the near-infrared spectral intensity of the i-th wavelength acquisition point, RSi is the Raman spectral intensity of the i-th wavelength acquisition point, i ranges from 1 to n, and n is the number of wavelength acquisition points; diesel oil accounts for the largest proportion of the oil sample to be tested. Specifically, the near-infrared and Raman spectra correspond to different wavelength bands. In this implementation, the number of wavelength acquisition points is the same for each spectrum, but the actual wavelengths corresponding to different wavelength acquisition points can be different. For example, the wavelengths corresponding to the acquisition points of RI1 and RS1 are different. Of course, since there is overlap in the wavelength bands, some acquisition points can also be the same, but the order in the dataset can be different. The goal is to ensure that the corresponding wavelengths in the same dataset are ordered in ascending order.

[0031] The preset wavelength acquisition points include a number of first wavelength acquisition points and a number of second wavelength acquisition points. The first wavelength acquisition points correspond to the near-infrared spectral dataset, and the second wavelength acquisition points correspond to the Raman spectral dataset.

[0032] In this embodiment, the type of impurity oil in the oil sample to be tested can be determined by any existing method, and this embodiment does not impose any limitation.

[0033] S200, the near-infrared spectral dataset and the Raman spectral dataset are processed according to several preset wavelength acquisition points to obtain a specific spectral feature vector; the specific spectral feature vector is obtained from the data corresponding to each preset wavelength acquisition point in the near-infrared spectral dataset and the Raman spectral dataset; each preset wavelength acquisition point corresponds to the near-infrared spectral dataset or the Raman spectral dataset; in the near-infrared spectral dataset and the Raman spectral dataset, the data corresponding to the preset wavelength acquisition point is less affected by impurities than other wavelength acquisition points.

[0034] Specifically, step S200 includes the following steps: S210, the near-infrared spectral intensity corresponding to each first wavelength acquisition point in the near-infrared spectral data is determined as the target near-infrared spectral intensity.

[0035] S220, the Raman spectral intensity corresponding to each second wavelength acquisition point in the Raman spectral data set is determined as the target Raman spectral intensity.

[0036] S230 obtains specific spectral feature vectors based on the near-infrared spectral intensities of several targets and the Raman spectral intensities of several targets.

[0037] Specifically, step S230 includes the following steps: S231, input the near-infrared spectral intensities of several targets into the first specific feature extraction module to obtain the first sub-specific spectral feature vector.

[0038] S232, input the Raman spectral intensities of several targets into the second specific feature extraction module to obtain the second sub-specific spectral feature vector.

[0039] S233, the first sub-specific spectral feature vector and the second sub-specific spectral feature vector are concatenated to obtain the specific spectral feature vector.

[0040] Methanol and ethanol each correspond to several preset wavelength acquisition points, but the preset wavelength acquisition points for methanol and ethanol are not exactly the same.

[0041] Please refer to Figure 2 and Figure 3 As shown, since the near-infrared and Raman spectra of pure diesel fuel mixed with methanol and ethanol exhibit highly similar light intensity data at certain wavelengths compared to pure diesel fuel, this embodiment can, through statistical analysis of the collected spectral data, determine the wavelength acquisition points corresponding to the similar data as the first and second wavelength acquisition points, respectively. This ensures that the data corresponding to the preset wavelength acquisition points in the near-infrared and Raman spectra is less affected by the mixed oil than other wavelength acquisition points, thereby minimizing the influence of the mixed oil on specific spectral feature vectors.

[0042] S300, based on the specific spectral feature vector, a target quantitative detection model is determined from several candidate quantitative detection models; each candidate quantitative detection model corresponds to a type of pure diesel; the difference in substance content between pure diesel corresponding to different types of pure diesel is greater than a preset threshold.

[0043] Several candidate quantitative detection models are provided for methanol and ethanol, and the candidate quantitative detection models for methanol and ethanol are different.

[0044] Step S300 includes the following steps: S310, Based on the specific spectral feature vector, determine the target quantitative detection model from several candidate quantitative detection models corresponding to the type of impurity oil in the oil sample to be tested.

[0045] Step S310 includes the following steps: S311, the specific spectral feature vector is input into the classification model corresponding to the type of impurity oil in the oil sample to be tested, so as to obtain the classification result corresponding to the oil sample to be tested; the classification result is used to indicate the target quantitative detection model among several candidate quantitative detection models corresponding to the type of impurity oil in the oil sample to be tested.

[0046] Specifically, in this embodiment, the first specific feature extraction module and the second specific feature extraction module can adopt a one-dimensional convolutional neural network, such as a single-stream 1D-CNN.

[0047] The classification model can be an XGBoost ensemble model, whose input is a specific spectral feature vector. The output is a pre-defined identifier corresponding to one of several candidate quantitative detection models. Specifically, each candidate quantitative detection model has a unique pre-defined identifier.

[0048] Furthermore, in this embodiment, there are two classification models, corresponding to methanol and ethanol respectively. There are two sets of candidate quantitative detection models, corresponding to methanol and ethanol respectively.

[0049] It is understandable that when the mixed oil is methanol, the classification model in step S311 is the classification model corresponding to methanol, and the several candidate quantitative detection models are the set of candidate quantitative detection models corresponding to methanol. The same applies when the mixed oil is methanol, and will not be elaborated further.

[0050] Furthermore, there are two specific feature extraction modules for the first feature extraction and two specific feature extraction modules, and the principle is as described above, so it will not be repeated here.

[0051] Specifically, in this embodiment, the first specific feature extraction module, the second specific feature extraction module, and the XGBoost ensemble model can be trained as a whole. During training, training samples can be different types of pure diesel (different types are distinguished by different manufacturers, batches, origins, and refining processes), and each sample is further divided into multiple portions and then mixed with different concentrations of methanol or ethanol. Spectral data are then acquired to form training samples. For sample labels, near-infrared and Raman spectral data can be extracted for different types of pure diesel. Then, the near-infrared and Raman spectral data corresponding to each type of pure diesel are treated as independent data. The DBSCAN algorithm is used to classify each independent data to obtain crude oil classification results, and a unique classification label is assigned to each category. For each training sample, the classification label corresponding to the base oil of its corresponding oil sample is used as the sample label. Then, supervised training is performed based on the training samples and sample labels. It should be noted that the first specific feature extraction module, the second specific feature extraction module, and the XGBoost ensemble model for methanol and ethanol need to be trained independently. The sample acquisition method and training method can be the same, only the training samples used are different.

[0052] S400, based on the near-infrared spectroscopy dataset, the Raman spectroscopy dataset, and the target quantitative detection model, the doping ratio of the impurity oil in the oil sample to be tested is obtained.

[0053] The target quantitative detection model includes a first quantitative feature extraction module, a second quantitative feature extraction module, and a decoding module.

[0054] In this embodiment, the candidate quantitative detection model can be any existing model capable of detecting the concentration of adulterants in diesel fuel, and this embodiment does not impose any limitations.

[0055] Furthermore, in one exemplary embodiment of this application, step S400 includes the following steps: S410, input the near-infrared spectral dataset into the first quantitative feature extraction module to obtain the first sub-quantitative spectral feature vector.

[0056] S420, input the Raman spectroscopy dataset into the second quantitative feature extraction module to obtain the second sub-quantitative spectral feature vector.

[0057] S430, the first sub-quantitative spectral feature vector and the second sub-quantitative spectral feature vector are concatenated and input into the decoding module to obtain the doping ratio of the impurity oil in the oil sample to be tested output by the decoding module.

[0058] Specifically, the first quantitative feature extraction module and the second quantitative feature extraction module can be Transformer models, where the first and second quantitative feature extraction modules can be encoders in a classic Transformer model, and the decoding module can be a decoder in a classic Transformer model. Those skilled in the art can set the specific structures of the first quantitative feature extraction module, the second quantitative feature extraction module, and the decoding module according to the above technical ideas, and set corresponding training methods; this application does not impose any limitations.

[0059] This application provides a method for detecting the quality of oil substances based on artificial intelligence and spectral detection. The method determines the type of base oil (i.e., diesel oil before it is adulterated) of the current oil sample by using a specific spectral feature vector, and uses the target quantitative detection model corresponding to the current diesel oil type to determine the adulteration ratio of the adulterated oil in the oil sample. This method can reduce the decrease in the accuracy of quantitative detection results caused by differences in base oil.

[0060] Furthermore, in this embodiment of the application, feature extraction is performed on the data corresponding to each preset wavelength acquisition point in the near-infrared spectral dataset and the Raman spectral dataset to reduce the influence of impurity oil on the extracted features, so that the specific spectral feature vector contains as few features as possible of impurity oil, thereby reducing the impact of inaccurate classification results caused by the influence of substances in impurity oil.

[0061] Furthermore, in one exemplary embodiment of this application, a method for determining the type of miscellaneous oil is also provided, as follows: S2100, Based on the oil sample to be tested, obtain the near-infrared spectral dataset RI=(RI1,RI2,…,RIi,…,RIn) and the Raman spectral dataset RS=(RS1,RS2,…,RSi,…,RSn); where RIi is the near-infrared spectral intensity of the i-th wavelength acquisition point, RSi is the Raman spectral intensity of the i-th wavelength acquisition point, i takes values ​​from 1 to n, and n is the number of wavelength acquisition points; diesel oil accounts for the largest proportion of the oil sample to be tested. Specifically, the near-infrared spectrum and the Raman spectrum correspond to different bands. In this implementation, the number of wavelength acquisition points set in each spectrum is the same, but the actual wavelengths corresponding to different wavelength acquisition points can be different. For example, the wavelengths corresponding to the acquisition points of RI1 and RS1 are different. Of course, since there is overlap in the bands, some acquisition points can also be the same, but the order in the dataset can be different. It is sufficient to ensure that the corresponding wavelengths in the same dataset are in ascending order.

[0062] S2200, obtain the first derivative near-infrared spectrum dataset RI' and the second derivative near-infrared spectrum dataset RI" of RI based on RI, and obtain the first derivative Raman spectrum dataset RS' and the second derivative Raman spectrum dataset RS" of RS based on RS.

[0063] Among them, RI, RI', RI", RI, RI', and RI" are all data that have undergone preprocessing steps such as filtering, standardization, and normalization on the original data. Specifically, the preprocessing steps include median filtering, Savitzky-Golay filtering, spectral derivative calculation, and robust normalization.

[0064] It is understandable that median filtering and Savitzky-Golay filtering are performed before step S2100, and spectral derivative calculation and robust normalization can be understood as the specific implementation of step S2200.

[0065] Specifically, robust normalization uses a percentile-based normalization method, specifically the 2% and 98% percentiles.

[0066] S2300, based on RI, RI', and RI", obtain the Markov transfer field image MRI corresponding to RI, the Markov transfer field image MRI' corresponding to RI', and the Markov transfer field image MRI" corresponding to RI"; based on RS, RS', and RS", obtain the Markov transfer field image MRS corresponding to RS, the Markov transfer field image MRS' corresponding to RS', and the Markov transfer field image MRS" corresponding to RS"; MRI, MRI', and MRI" have the same size, and MRS, MRS', and MRS" have the same size.

[0067] Specifically, RI' = (RI1', RI2', ..., RIi', ..., RIn'); where RIi' is the first derivative of RIi; RI"=(RI1",RI2",…,RIi",…,RIn";where RIi" is the second derivative of RIi; RS'=(RS1',RS2',…,RSi',…,RSn'); where RSi' is the first derivative of RSi; RS"=(RS1",RS2",…,RSi",…,RSn"); where RSi" is the second derivative of RSi.

[0068] Both the near-infrared spectral intensity and the Raman spectral intensity are normalized values, and their values ​​range from 0 to 1. MRI, MRI', MRI", MRS, MRS', and MRS" are obtained through the following methods: S2001, obtain the target dataset Y=(Y1,Y2,…,Yi,…,Yn); where Yi is the i-th target data in Y, and Yi is RIi, RIi', RIi", RSi, RSi' or RIi". S2002, based on Y, perform quantile binning to obtain q numerical intervals; each numerical interval has its unique corresponding state identifier. S2003, determine the state identifier corresponding to the numerical interval where Yi is located as the target state identifier Zi corresponding to Yi, so as to obtain the target state identifier Z=(Z1,Z2,…,Zi,…,Zn); S2003, Based on Z, determine the target state transition matrix MZ, where MZ is a q-row, q-column matrix, and the value in the p1-th row and p2-th column of MZ represents the transition probability from the state corresponding to the p1-th state identifier to the state corresponding to the p2-th state identifier; S2004, Generate Markov transfer field image MZP based on MZ; MZP is MRI, MRI', MRI", MRS, MRS', or MRS".

[0069] It is understandable that MRI, MRI', MRI", MRS, MRS', and MRS" are obtained in the same way, the difference lies in the input data, hence the above examples are used for illustration.

[0070] S2400 acquires near-infrared three-channel images PRI based on MRI, MRI', and MRI"; and acquires Raman three-channel images PRS based on MRS, MRS', and MRS".

[0071] Specifically, the values ​​corresponding to pixels at the same position in MRI, MRI', and MRI" are concatenated to obtain PRI; the values ​​corresponding to pixels at the same position in MRS, MRS', and MRS" are concatenated to obtain PRS. From the above, it can be seen that the values ​​corresponding to pixels at the same position in MRI, MRI', and MRI" can be understood as using the values ​​of the three images as R / G / B values ​​to generate a three-channel image.

[0072] S2500, input PRI and PRS into the target recognition model to obtain the recognition result output by the target recognition model; the recognition result is used to indicate the type of alcohol doped in the oil sample to be tested.

[0073] Specifically, the target recognition model includes a first feature extraction network, a second feature extraction network, a concatenation layer, and a classification layer; The first feature extraction network is used to receive PRI and output the near-infrared feature vector TRI corresponding to PRI; The second feature extraction network is used to receive the PRS and output the Raman feature vector TRS corresponding to the PRS; The splicing layer is used to splice TRI and TRS to obtain a joint spectral feature vector TL; The classification layer is used to receive the classification result (TL) and output the classification result corresponding to the TL.

[0074] Both the first feature extraction network and the second feature extraction network are residual convolutional neural networks. Specifically, in this embodiment, a ResNet convolutional neural network is used.

[0075] The splicing layer can be spliced ​​directly or by weighted splicing, and this embodiment does not impose any restrictions.

[0076] The classification layer can be based on linear regression.

[0077] It can be understood that the relevant parameters involved in the original first feature extraction network, second feature extraction network, splicing layer, and classification layer in the embodiments of this application can all be initialized with random values ​​and trained using pre-labeled training samples through training methods such as backpropagation or gradient descent. The training samples can be obtained by adding different impurity oils to different batches of pure diesel oil, performing spectral analysis to obtain relevant spectral data, and obtaining corresponding three-channel images using the above method. The labels corresponding to the impurity oils are then used as sample labels to form training samples. It should be noted that the training samples should include three-channel images obtained from the spectral data of different batches of pure diesel oil, and correspondingly, the sample labels should also include the label "no impurity". Therefore, the final classification result should also include the result "no impurity". Other sample labels and classification results can be "methanol impurity", "ethanol impurity", etc.

[0078] Please refer to Figure 2 and Figure 3 As shown, due to the doping of alcohols (all at a concentration of 10%), their curves are highly similar to those of blast furnace diesel, and their values ​​at specific peaks and troughs almost overlap. Therefore, processing only one-dimensional data results in low accuracy. In this embodiment, the characteristics of spectral variation trends are enhanced by calculating the second derivative of the original data, and the characteristics of spectral peaks are enhanced by calculating the second derivative of the original data. At the same time, by converting the three types of one-dimensional spectral data into two-dimensional image data and then stitching them together into three-channel two-dimensional image data, a deeper feature extraction of the original one-dimensional data is achieved, thereby improving the accuracy of the final output results.

[0079] In another exemplary embodiment of this application, the target recognition model further includes a weight determination module; The weight determination module is used to receive the original joint dataset RI-RS=(RI1,RI2,…,RIi,…,RIn,RS1,RS2,…,RSi,…,RSn) and output the weight set W=(W1,W2) corresponding to RI-RS; where W1 is the weight corresponding to TRI and W2 is the weight corresponding to TRS. The joint spectral feature vector TL = (W1×TRI1,W1×TRI2,…,W1×TRIj,…,W1×TRIm,W2×TRS1,W2×TRS2,…,W2×TRSj,…,W2×TRSm); where TRIj is the j-th feature value in TRI, TRSj is the j-th feature value in TRS, j takes values ​​from 1 to m, and m is the number of feature values ​​in TRI and TRS.

[0080] The weight determination module is constructed using a linear regression model.

[0081] Because the spectral data exhibits different characteristics in near-infrared and Raman spectra under different doping types and ratios, the difference between near-infrared and pure diesel fuel is sometimes greater than that in Raman spectra. Therefore, in this embodiment, the features of the original data are extracted based on the weight determination module, forming two weights, W1 and W2. By allocating these weights, the final classification layer can focus on different feature vectors obtained from different spectral data under different conditions, thereby improving the accuracy of the final classification result.

[0082] It is worth noting that if a weight determination module is used, the weight determination module can be trained together with other layers and neural networks as a complete model, only the processing method of the input data needs to be distinguished.

[0083] In one exemplary embodiment of this application, a diesel alcohol doping identification system based on a neural network is also provided. The system includes a near-infrared-Laman combined spectrometer and a processor. The near-infrared-Laman combined spectrometer and the processor are connected. The processor stores executable code, which, when executed, is used to implement the above-described method.

[0084] In this application embodiment, a non-transitory computer-readable storage medium is also provided. This non-transitory computer-readable storage medium can be disposed in an electronic device to store at least one instruction or at least one program related to implementing the method provided in any embodiment of this application. The at least one instruction or the at least one program is loaded and executed by a processor to implement the method provided in any embodiment of this application, and can achieve the same technical effect. To avoid repetition, further details are omitted here.

[0085] Examples of non-transitory computer-readable storage media include: computer read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), compact disc read-only memory (CD-ROM), flash memory, magnetic disk, optical disk, portable computer disk, hard disk and / or solid-state drive, etc.

[0086] In this application embodiment, an electronic device is also provided, the electronic device including a processor and the non-transitory computer-readable storage medium. The processor loads and executes at least one instruction or at least one program stored in the non-transitory computer-readable storage medium related to implementing the method provided in any embodiment of this application, so as to implement the method provided in the embodiment of this application.

[0087] For example, the electronic device may be a mobile electronic device or a non-mobile electronic device that also includes other functions such as a personal digital assistant and / or music player. Further, the mobile electronic device may be any one of a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA); the non-mobile electronic device includes any one of a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine. No specific limitations are made in the embodiments of this application.

[0088] For example, the processor can be a processor in any electronic device.

[0089] Exemplary embodiments of this application also provide a feasible structure for an electronic device. For example, the electronic device may include a processor, an external memory interface, internal memory, a universal serial bus (USB) interface (hereinafter referred to as a USB interface), a charging management module, a power management module, a battery, a first antenna, a second antenna, a mobile communication module, a wireless communication module, an audio module, a speaker, a receiver, a microphone, a headphone jack, a sensor module, buttons, a motor, an indicator, a camera, a display screen, and a subscriber identification module (SIM) card interface (hereinafter referred to as a SIM card interface), etc. The sensor module may include pressure sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, accelerometers, distance sensors, proximity sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, and / or bone conduction sensors, etc.

[0090] It should be understood that the exemplary structures of the embodiments of this application do not constitute a specific limitation on the electronic device. In other embodiments of this application, the electronic device may include more or fewer components than the structure described herein, or combine some components, or split some components, or have different component arrangements. The components may be implemented in hardware, software, or a combination of software and hardware.

[0091] For example, the processor may include one or more processing units, wherein the processing units include: an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. The controller may generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.

[0092] For example, the processor may further include a memory for storing instructions and data. In some embodiments of this application, the memory in the processor is a cache memory. The memory can store instructions or data that the processor has just used or that are used repeatedly. If the processor needs to use the instructions or data again, it can directly retrieve them from the memory.

[0093] For example, the processor may also include one or more interfaces. These interfaces include: an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM card interface, and / or a USB interface, etc.

[0094] The integrated circuit interface is a bidirectional synchronous serial bus, which includes a serial data line (SDA) and a serial clock line (SCL).

[0095] Integrated circuits with built-in audio interfaces can be used for audio communication. In some embodiments of this application, the processor may include multiple sets of integrated circuit-based audio interfaces. The processor can couple with an audio module through the integrated circuit-based audio interface to achieve communication between the processor and the audio module.

[0096] The pulse code modulation interface can also be used for audio communication, specifically for sampling, quantizing, and encoding analog signals. In some embodiments of this application, the audio module and the wireless communication module can be coupled through the pulse code modulation interface.

[0097] A Universal Asynchronous Receiver / Transmitter (UART) is a universal serial data bus interface used for asynchronous communication. This bus can be a bidirectional communication bus interface. It converts the data to be transmitted between serial and parallel communication. In some embodiments of this application, the processor and the wireless communication module can be connected via the UART.

[0098] Mobile industry processor interfaces can be used to connect processors to peripheral devices such as displays and cameras.

[0099] General purpose input / output interfaces can be configured via software.

[0100] Furthermore, the general-purpose input / output interface can be configured as a control signal or a data signal. In some embodiments of this application, the general-purpose input / output interface can be used to connect the processor to a camera, display screen, wireless communication module, audio module, sensor module, etc.

[0101] A USB interface is an interface that conforms to the USB standard specification, specifically including Mini USB, Micro USB, and USB Type-C interfaces. USB interfaces can be used to connect chargers to charge electronic devices, and also for transferring data between electronic devices and peripheral devices.

[0102] It should be understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of this application, the electronic device may also employ different interface connection methods or a combination of multiple interface connection methods as described in the embodiments.

[0103] The charging management module receives charging input from a charger, which can be either a wireless or wired charger. In some wired charging embodiments, the charging management module receives charging input from the wired charger via a USB interface. In some wireless charging embodiments, the charging management module receives wireless charging input via the wireless charging coil of the electronic device. While charging the battery, the charging management module can also supply power to various parts of the electronic device via the power management module.

[0104] The power management module is used to connect the battery, the charging management module, and the processor.

[0105] Wireless communication functionality in electronic devices can be achieved through a first antenna, a second antenna, a mobile communication module, a wireless communication module, a modem processor, and a baseband processor.

[0106] Mobile communication modules can enable wireless communication solutions, including 2G / 3G / 4G / 5G, for use in electronic devices.

[0107] A modem processor may include a modulator and a demodulator. The modulator modulates a low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates a received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to a baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to an application processor. The application processor outputs sound signals through audio devices (not limited to speakers, receivers, etc.) or displays images or videos on a display screen. In some embodiments of this application, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor and housed within the same device as the mobile communication module or other functional modules.

[0108] Wireless communication modules can enable solutions for wireless communication applications in electronic devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies.

[0109] In some embodiments of this application, the first antenna of the electronic device is coupled to the mobile communication module, and the second antenna is coupled to the wireless communication module, enabling the electronic device to communicate with networks and other devices via wireless communication technology.

[0110] Electronic devices utilize GPUs, displays, and application processors to achieve their display functions. A GPU is a microprocessor for image processing, connecting the display and the application processor. GPUs perform mathematical and geometric calculations and are used for graphics rendering. A processor may include one or more GPUs, which execute program instructions to generate or modify display information.

[0111] The display screen is used to display images, videos, etc. The display screen includes a display panel. The display panel can be a liquid crystal display (LCD), or a display panel made of materials selected from organic light-emitting diodes (OLEDs), active-matrix organic light-emitting diodes (AMOLEDs), flexible light-emitting diodes (FLEDs), minimized, microLEDs, micro-OLEDs, or quantum dot light-emitting diodes (QLEDs). In some embodiments of this application, the electronic device may include one or more display screens. In some embodiments of this application, the display screen may also integrate touch functionality and may also be referred to as a touch screen.

[0112] Electronic devices can achieve shooting functions through ISPs, cameras, video codecs, GPUs, displays, and application processors.

[0113] External storage interfaces can be used to connect external memory cards, such as Micro SD cards, to expand the storage capacity of electronic devices.

[0114] Internal memory can be used to store executable program code for a computer, which includes instructions. The processor executes the instructions stored in internal memory to perform various functional applications and data processing of electronic devices.

[0115] Electronic devices can implement audio functions through audio modules, speakers, receivers, microphones, headphone jacks, and application processors. Examples include music playback and recording.

[0116] The audio module converts digital audio information into analog audio signals for output, and also converts analog audio input into digital audio signals. The speaker, also called a "horn," converts audio electrical signals into sound signals. The receiver, also called a "handset," converts audio electrical signals into sound signals. The microphone, also called a "microphone" or "voice transducer," converts sound signals into electrical signals. The headphone jack is used to connect wired headphones.

[0117] Pressure sensors are used to sense pressure signals and convert them into electrical signals. In some embodiments of this application, the pressure sensor can be located on the display screen. A gyroscope sensor can be used to determine the motion posture of the electronic device. A barometric pressure sensor is used to measure air pressure. In some embodiments of this application, the electronic device calculates altitude using the air pressure value measured by the barometric pressure sensor, assisting in positioning and navigation. An accelerometer can detect the magnitude of acceleration of the electronic device in various directions (generally three axes). A distance sensor is used to measure distance. A fingerprint sensor is used to collect fingerprints. A touch sensor, also known as a "touch panel," can be located on the display screen, forming a touchscreen, also known as a "touch screen." A bone conduction sensor can acquire vibration signals. In some embodiments of this application, a bone conduction sensor can acquire vibration signals from vibrating bone fragments in the human vocal cords. A bone conduction sensor can also contact the human pulse to receive blood pressure signals.

[0118] The buttons include a power button and volume buttons. A motor can generate vibration alerts. Indicators can be indicator lights, used to show charging status, battery level changes, messages, missed calls, notifications, etc. A SIM card slot is used to connect a SIM card.

[0119] Embodiments of this application also provide a computer program product including program code that, when the program product is run on an electronic device, causes the electronic device to perform the steps of the methods described in this specification according to various exemplary embodiments of this application.

[0120] This application also provides a chip, which includes a processor and a communication interface. The communication interface is used to receive signals and transmit the signals to the processor. The processor processes the signals so that the methods described in the various exemplary embodiments of this application are executed.

[0121] While specific embodiments of this application have been described in detail by way of examples, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of this application. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of this application. The scope of this application is defined by the appended claims.

Claims

1. A method for detecting the quality of oily substances based on artificial intelligence and spectral detection, characterized in that, The method includes the following steps: S100, acquire the near-infrared spectral dataset and Raman spectral dataset of the oil sample to be tested; the oil sample to be tested is a mixture of diesel and mixed oil, and the proportion of diesel in the oil sample to be tested is greater than that of the mixed oil; the type of mixed oil is methanol or ethanol, and the type of mixed oil in the oil sample to be tested is known; S200 processes near-infrared spectral datasets and Raman spectral datasets based on several preset wavelength acquisition points to obtain specific spectral feature vectors; The specific spectral feature vector is obtained based on the data corresponding to each preset wavelength acquisition point in the near-infrared spectral dataset and the Raman spectral dataset; Each preset wavelength acquisition point corresponds to a near-infrared spectral dataset or a Raman spectral dataset; in the near-infrared spectral dataset and the Raman spectral dataset, the data corresponding to the preset wavelength acquisition point is less affected by the impurity oil than other wavelength acquisition points. S300, based on the specific spectral feature vector, a target quantitative detection model is determined from several candidate quantitative detection models; each candidate quantitative detection model corresponds to a type of pure diesel; the difference in substance content between pure diesel corresponding to different types of pure diesel is greater than a preset threshold; S400, based on the near-infrared spectroscopy dataset, the Raman spectroscopy dataset, and the target quantitative detection model, the doping ratio of the impurity oil in the oil sample to be tested is obtained.

2. The method according to claim 1, characterized in that, The near-infrared spectral dataset includes near-infrared spectral intensities corresponding to several wavelength acquisition points; the Raman spectral dataset includes Raman spectral intensities corresponding to several wavelength acquisition points. The preset wavelength acquisition points include a number of first wavelength acquisition points and a number of second wavelength acquisition points. The first wavelength acquisition points correspond to the near-infrared spectral dataset, and the second wavelength acquisition points correspond to the Raman spectral dataset.

3. The method according to claim 2, characterized in that, Step S200 includes the following steps: S210, the near-infrared spectral intensity corresponding to each first wavelength acquisition point in the near-infrared spectral data is determined as the target near-infrared spectral intensity; S220, the Raman spectral intensity corresponding to each second wavelength acquisition point in the Raman spectral dataset is determined as the target Raman spectral intensity; S230 obtains specific spectral feature vectors based on the near-infrared spectral intensities of several targets and the Raman spectral intensities of several targets.

4. The method according to claim 3, characterized in that, Step S230 includes the following steps: S231, input the near-infrared spectral intensities of several targets into the first specific feature extraction module to obtain the first sub-specific spectral feature vector; S232, input the Raman spectral intensities of several targets into the second specific feature extraction module to obtain the second sub-specific spectral feature vector; S233, the first sub-specific spectral feature vector and the second sub-specific spectral feature vector are concatenated to obtain the specific spectral feature vector.

5. The method according to any one of claims 1-4, characterized in that, The target quantitative detection model includes a first quantitative feature extraction module, a second quantitative feature extraction module, and a decoding module; Step S400 includes the following steps: S410, input the near-infrared spectral dataset into the first quantitative feature extraction module to obtain the first sub-quantitative spectral feature vector; S420, input the Raman spectroscopy dataset into the second quantitative feature extraction module to obtain the second sub-quantitative spectral feature vector; S430, the first sub-quantitative spectral feature vector and the second sub-quantitative spectral feature vector are concatenated and input into the decoding module to obtain the doping ratio of the impurity oil in the oil sample to be tested output by the decoding module.

6. The method according to claim 1, characterized in that, Methanol and ethanol each correspond to several preset wavelength acquisition points, but the preset wavelength acquisition points for methanol and ethanol are not exactly the same.

7. The method according to claim 1, characterized in that, Several candidate quantitative detection models are provided for methanol and ethanol, and the candidate quantitative detection models for methanol and ethanol are different. Step S300 includes the following steps: S310, Based on the specific spectral feature vector, determine the target quantitative detection model from several candidate quantitative detection models corresponding to the type of impurity oil in the oil sample to be tested.

8. The method according to claim 7, characterized in that, Step S310 includes the following steps: S311, the specific spectral feature vector is input into the classification model corresponding to the type of impurity oil in the oil sample to be tested, so as to obtain the classification result corresponding to the oil sample to be tested; the classification result is used to indicate the target quantitative detection model among several candidate quantitative detection models corresponding to the type of impurity oil in the oil sample to be tested.

9. A quality detection system for oily substances based on artificial intelligence and spectral detection, characterized in that, The system includes a near-infrared-La Mann combined spectrometer and a processor, the near-infrared-La Mann combined spectrometer and the processor being connected, the processor storing executable code, which, when executed, is used to implement the method according to any one of claims 1-8.