Detection method and system based on fusion of various spectral data, and medium and apparatus
By using multiple spectral data fusion methods, a detection model was constructed, which solved the problem that single spectral technology could not obtain comprehensive chemical information, and achieved high accuracy and reliability in predicting oil product detection indicators.
Patent Information
- Application Number
- PCT/CN2025/076911
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-05-31
- Filing Date
- 2025-02-12
- Publication Date
- 2025-12-04
AI Technical Summary
Existing single-spectral techniques cannot obtain comprehensive, reliable, and rich chemical information in rapid oil detection, resulting in insufficient predictive performance.
Multiple spectral data fusion methods are employed. By collecting near-infrared and mid-infrared spectra, a detection model is constructed. Spectral preprocessing, variable screening, and data-level, feature-level, and decision-level fusion are performed to train the detection model for predicting oil product detection indicators.
It improves the accuracy and reliability of oil testing, and can more comprehensively predict test indicators such as flash point, pour point, density and kinematic viscosity.
Smart Images

Figure CN2025076911_04122025_PF_FP_ABST
Abstract
Description
Method, system, medium and device for detection based on fusion of multiple spectral data TECHNICAL FIELD
[0001] The present application relates to the technical field of gasoline and diesel detection, and particularly relates to a method, system, medium and device for detection based on fusion of multiple spectral data. BACKGROUND
[0002] There are two existing methods for rapid detection of oil products:
[0003] One is near-infrared spectroscopy combined with a chemometrics model, for example, using near-infrared spectroscopy to establish a chemometrics model to determine the ethanol content in ethanol gasoline;
[0004] The other is mid-infrared spectroscopy combined with a chemometrics model, for example, using mid-infrared spectroscopy combined with a chemometrics model to determine the cetane number of diesel oil;
[0005] Both of the above methods obtain chemical information of the component to be detected by a single spectroscopy (using near-infrared spectroscopy or mid-infrared spectroscopy), and have the disadvantage of being relatively one-sided in obtaining chemical information of the component to be detected, for example, the near-infrared spectroscopy of the first method for rapid detection of oil products can only obtain the frequency doubling and combination frequency information of hydrogen-containing groups; the mid-infrared spectroscopy of the second method for rapid detection of oil products can only obtain the fundamental frequency information of hydrogen-containing groups. Therefore, a single spectroscopy cannot obtain more comprehensive, reliable and rich chemical information. For this reason, there is still room for improvement in the prediction performance (for example, determination of the flash point of diesel oil) of a single spectroscopy model. SUMMARY
[0006] The present application provides a method for detection based on fusion of multiple spectral data, comprising:
[0007] Collecting spectra: collecting near-infrared spectroscopy and mid-infrared spectroscopy of the substance to be detected to obtain a near-infrared spectroscopy matrix and a mid-infrared spectroscopy matrix of the substance to be detected;
[0008] Constructing a detection model: constructing a detection model by the following formula, Y=XP T BQ
[0009] wherein X is an input matrix, Y is an output matrix, B is a coefficient matrix, and P and Q are load matrices of X and Y, respectively;
[0010] Training the detection model;
[0011] Predicting the detection index;
[0012] The step of training the detection model comprises:
[0013] Collecting training samples to construct a training set, the training set comprising near-infrared spectra and mid-infrared spectra of the plurality of training samples and index values of detection indexes of the plurality of training samples;
[0014] Dividing the training set into a calibration set and a validation set to obtain near-infrared spectrum matrices, mid-infrared spectrum matrices and index matrices of the calibration set and near-infrared spectrum matrices, mid-infrared spectrum matrices and index matrices of the validation set;
[0015] Respectively performing spectral pretreatment on the near-infrared spectra and the mid-infrared spectra of the calibration set and the validation set to obtain near-infrared spectral pretreatment matrices and mid-infrared spectral pretreatment matrices of the calibration set and near-infrared spectral pretreatment matrices and mid-infrared spectral pretreatment matrices of the validation set; the spectral pretreatment comprises derivative processing or / and vector normalization processing, and the derivative processing comprises first derivative processing or / and high-order derivative processing;
[0016] Respectively performing spectral variable screening processing on the near-infrared spectra, the mid-infrared spectra, the spectral pretreated near-infrared spectra and the spectral pretreated mid-infrared spectra of the calibration set and the validation set to obtain near-infrared spectral variable screening matrices, mid-infrared spectral variable screening matrices, pretreated near-infrared spectral variable screening matrices and pretreated mid-infrared spectral variable screening matrices of the calibration set and near-infrared spectral variable screening matrices, mid-infrared spectral variable screening matrices, pretreated near-infrared spectral variable screening matrices and pretreated mid-infrared spectral variable screening matrices of the validation set; the spectral variable screening processing comprises competitive adaptive reweighted sampling processing or / and variable importance projection processing;
[0017] Inputting the near-infrared spectrum matrix and the index matrix of the calibration set into a detection model to train the detection model to obtain a first coefficient matrix;
[0018] Inputting the mid-infrared spectrum matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a second coefficient matrix;
[0019] Inputting the near-infrared spectral pretreatment matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a third coefficient matrix;
[0020] Inputting the mid-infrared spectral pretreatment matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a fourth coefficient matrix;
[0021] Inputting the near-infrared spectrum matrix of the calibration set into the detection model corresponding to the first coefficient matrix to obtain a calibration set first index prediction matrix composed of predicted values of the detection indexes of the calibration set;
[0022] Inputting the mid-infrared spectrum matrix of the calibration set into the detection model corresponding to the second coefficient matrix to obtain a calibration set second index prediction matrix composed of predicted values of the detection indexes of the calibration set;
[0023] inputting the near-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the third coefficient matrix to obtain a calibration set third index prediction matrix composed of predicted values of the detection indexes of the calibration set;
[0024] inputting the mid-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix to obtain a calibration set fourth index prediction matrix composed of predicted values of the detection indexes of the calibration set;
[0025] inputting the near-infrared spectrum matrix of the verification set into the detection model corresponding to the first coefficient matrix to obtain a verification set first index prediction matrix composed of predicted values of the detection indexes of the verification set;
[0026] inputting the mid-infrared spectrum matrix of the verification set into the detection model corresponding to the second coefficient matrix to obtain a verification set second index prediction matrix composed of predicted values of the detection indexes of the verification set;
[0027] inputting the near-infrared spectrum pretreatment matrix of the verification set into the detection model corresponding to the third coefficient matrix to obtain a verification set third index prediction matrix composed of predicted values of the detection indexes of the verification set;
[0028] inputting the mid-infrared spectrum pretreatment matrix of the verification set into the detection model corresponding to the fourth coefficient matrix to obtain a verification set fourth index prediction matrix composed of predicted values of the detection indexes of the verification set;
[0029] obtaining a first verification value, a second verification value, a third verification value and a fourth verification value according to the verification indexes respectively through the verification set first index prediction matrix, the verification set second index prediction matrix, the verification set third index prediction matrix, the verification set fourth index prediction matrix and the index matrix, wherein the verification indexes are used to represent the prediction performance of the detection model;
[0030] taking the optimal values of the first verification value, the second verification value, the third verification value and the fourth verification value as the optimal verification values, taking the optimal verification values as the threshold values, and taking the range of the threshold values towards the direction in which the prediction performance of the detection model is improved as the threshold value range;
[0031] performing data level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the calibration set to obtain a calibration set first data level fusion matrix, and inputting the calibration set first data level fusion matrix and the index matrix of the calibration set into the detection model to train the detection model, so as to obtain a fifth coefficient matrix;
[0032] performing data level fusion on the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the calibration set to obtain a calibration set second data level fusion matrix, and inputting the calibration set second data level fusion matrix and the index matrix of the calibration set into the detection model to train the detection model, so as to obtain a sixth coefficient matrix;
[0033] The first data level fusion matrix of the calibration set is taken as an input matrix, the detection model corresponding to the fifth coefficient matrix is input, and a calibration set fifth index prediction matrix composed of predicted values of detection indexes of the calibration set is obtained.
[0034] The second data level fusion matrix of the calibration set is taken as an input matrix, the detection model corresponding to the sixth coefficient matrix is input, and a calibration set sixth index prediction matrix composed of predicted values of detection indexes of the calibration set is obtained.
[0035] The first data level fusion matrix of the calibration set is taken as an input matrix, the detection model corresponding to the fifth coefficient matrix is input, and a calibration set fifth index prediction matrix composed of predicted values of detection indexes of the calibration set is obtained.
[0036] The second data level fusion matrix of the calibration set is taken as an input matrix, the detection model corresponding to the sixth coefficient matrix is input, and a calibration set sixth index prediction matrix composed of predicted values of detection indexes of the calibration set is obtained.
[0037] The fifth verification value and the sixth verification value are obtained according to the verification indexes through the fifth index prediction matrix of the verification set, the sixth index prediction matrix of the verification set and the index matrix.
[0038] The first characteristic level fusion matrix of the calibration set is obtained by performing characteristic level fusion on the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set, and the index matrix of the calibration set is input into the detection model to train the detection model, and the seventh coefficient matrix is obtained.
[0039] The second characteristic level fusion matrix of the calibration set is obtained by performing characteristic level fusion on the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set, and the index matrix of the calibration set is input into the detection model to train the detection model, and the eighth coefficient matrix is obtained.
[0040] The first characteristic level fusion matrix of the calibration set is taken as an input matrix, the detection model corresponding to the seventh coefficient matrix is input, and a calibration set seventh index prediction matrix composed of predicted values of detection indexes of the calibration set is obtained.
[0041] The second characteristic level fusion matrix of the calibration set is taken as an input matrix, the detection model corresponding to the eighth coefficient matrix is input, and a calibration set eighth index prediction matrix composed of predicted values of detection indexes of the calibration set is obtained.
[0042] The first characteristic level fusion matrix of the verification set formed by the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the verification set is taken as an input matrix, and the detection model corresponding to the seventh coefficient matrix is inputted to obtain the seventh index prediction matrix of the verification set formed by the prediction values of the detection indexes of the verification set;
[0043] The second characteristic level fusion matrix of the verification set formed by the pretreated near-infrared spectrum variable screening matrix and the pretreated mid-infrared spectrum variable screening matrix of the verification set is taken as an input matrix, and the detection model corresponding to the eighth coefficient matrix is inputted to obtain the eighth index prediction matrix of the verification set formed by the prediction values of the detection indexes of the verification set;
[0044] The seventh verification value and the eighth verification value are obtained according to the verification indexes through the seventh index prediction matrix, the eighth index prediction matrix and the index matrix;
[0045] The first verification value to the eighth verification value are screened according to the threshold range, and a verification value group within the threshold range is screened out;
[0046] The index matrix of the calibration set corresponding to the verification value group is subjected to decision level fusion to obtain a calibration set decision level fusion matrix, the calibration set decision level fusion matrix and the index matrix of the calibration set are inputted into the detection model, the detection model is trained, and the ninth coefficient matrix is obtained, the ninth coefficient matrix being a coefficient matrix after training;
[0047] The step of predicting the detection index comprises:
[0048] The near-infrared spectrum matrix and the mid-infrared spectrum matrix of the to-be-detected substance are subjected to data level fusion to obtain a spectrum fusion matrix;
[0049] The spectrum fusion matrix of the to-be-detected substance is taken as an input matrix to input into the trained detection model to obtain a first index matrix as an output matrix; the first index matrix is taken as a detection result of the detection index of the to-be-detected substance;
[0050] The index matrix is a matrix formed by index values of the detection index measured by a standard method; the first index matrix is a matrix formed by index values of the detection index predicted by the detection model; the detection index comprises one or more of a flash point, a pour point, a density and a kinematic viscosity.
[0051] According to an aspect of the present application, the verification index comprises a determination coefficient or / and a prediction root mean square error.
[0052] According to an aspect of the present application, the optimal verification value is a minimum value of the prediction root mean square error or / and a maximum value of the determination coefficient; and the threshold range is not greater than the minimum value of the prediction root mean square error or / and not less than the maximum value of the determination coefficient.
[0053] According to an aspect of the present application, the step of predicting the detection index further comprises:
[0054] inputting the near-infrared spectrum matrix of the to-be-tested substance as an input matrix into the trained detection model to obtain a second index matrix as an output matrix;
[0055] inputting the mid-infrared spectrum matrix of the to-be-tested substance as an input matrix into the trained detection model to obtain a third index matrix as an output matrix;
[0056] performing decision-level fusion on the first index matrix, the second index matrix and the third index matrix to obtain a fourth index matrix;
[0057] inputting the fourth index matrix as an input matrix into the trained detection model to obtain a fifth index matrix as an output matrix; and taking the fifth index matrix as the detection result of the detection index of the to-be-tested substance;
[0058] The second index matrix, the third index matrix and the fifth index matrix are matrices composed of index values of the detection index predicted by the detection model.
[0059] According to an aspect of the present application, the step of predicting the detection index further comprises:
[0060] spectrum preprocessing: performing spectrum preprocessing on the spectrum data of the near-infrared spectrum of the to-be-tested substance to form a first spectrum matrix; and performing spectrum preprocessing on the spectrum data of the mid-infrared spectrum of the to-be-tested substance to form a second spectrum matrix; the spectrum preprocessing comprises derivative processing or / and vector normalization processing, and the derivative processing comprises first-order derivative processing or / and high-order derivative processing;
[0061] The step of predicting the detection index further comprises:
[0062] performing data-level fusion on the first spectrum matrix and the second spectrum matrix to form a first fusion matrix;
[0063] inputting the first spectrum matrix as an input matrix into the trained detection model to obtain a sixth index matrix as an output matrix;
[0064] inputting the second spectrum matrix as an input matrix into the trained detection model to obtain a seventh index matrix as an output matrix;
[0065] inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth index matrix as an output matrix;
[0066] performing decision-level fusion on the sixth index matrix, the seventh index matrix and the eighth index matrix to form a fourth index matrix.
[0067] According to one aspect of the present application, the step of predicting the detection index further comprises:
[0068] Spectral variable screening: performing spectral variable screening processing on the near-infrared spectrum and the mid-infrared spectrum of the test substance respectively to form a third spectral matrix and a fourth spectral matrix; the spectral variable screening processing comprises variable importance projection processing;
[0069] The step of predicting the detection index further comprises:
[0070] The third spectral matrix and the fourth spectral matrix are fused at the feature level to form a second fusion matrix;
[0071] The third spectral matrix is input as an input matrix into the trained detection model to obtain a ninth index matrix as an output matrix;
[0072] The fourth spectral matrix is input as an input matrix into the trained detection model to obtain a tenth index matrix as an output matrix;
[0073] The second fusion matrix is input as an input matrix into the trained detection model to obtain an eleventh index matrix as an output matrix;
[0074] The ninth index matrix, the tenth index matrix, and the eleventh index matrix are fused at the decision level to form a fourth index matrix;
[0075] Preferably, the step of predicting the detection index further comprises:
[0076] Spectral preprocessing: performing spectral preprocessing on the spectral data of the near-infrared spectrum of the test substance to form a first spectral matrix; performing spectral preprocessing on the spectral data of the mid-infrared spectrum of the test substance to form a second spectral matrix; the spectral preprocessing comprises derivative processing or / and vector normalization processing, and the derivative processing comprises first-order derivative processing or / and high-order derivative processing;
[0077] Spectral variable screening: performing spectral variable screening processing on the first spectral matrix and the second spectral matrix of the test substance respectively to form a fifth spectral matrix and a sixth spectral matrix; the spectral variable screening processing comprises variable importance projection processing;
[0078] The step of predicting the detection index further comprises:
[0079] The first spectral matrix and the second spectral matrix are fused at the data level to form a first fusion matrix;
[0080] The fifth spectral matrix and the sixth spectral matrix are fused at the feature level to form a third fusion matrix;
[0081] The first spectral matrix is input as an input matrix into the trained detection model to obtain a sixth index matrix as an output matrix;
[0082] inputting the second spectrum matrix as an input matrix into the trained detection model to obtain a seventh index matrix as an output matrix;
[0083] inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth index matrix as an output matrix;
[0084] inputting the third fusion matrix as an input matrix into the trained detection model to obtain a twelfth index matrix as an output matrix;
[0085] performing decision-level fusion on the sixth index matrix, the seventh index matrix, the eighth index matrix and the twelfth index matrix to form a fourth index matrix.
[0086] According to an aspect of the present application, the step of training the detection model comprises:
[0087] collecting training samples to construct a training set, wherein the training set comprises near-infrared spectra and mid-infrared spectra of the training samples and index values of detection indexes of the training samples;
[0088] dividing the training set into a calibration set and a validation set to obtain near-infrared spectrum matrices, mid-infrared spectrum matrices and index matrices of the calibration set and near-infrared spectrum matrices, mid-infrared spectrum matrices and index matrices of the validation set;
[0089] respectively performing spectral pretreatment on the near-infrared spectra and the mid-infrared spectra of the calibration set and the validation set to obtain near-infrared spectral pretreatment matrices and mid-infrared spectral pretreatment matrices of the calibration set and near-infrared spectral pretreatment matrices and mid-infrared spectral pretreatment matrices of the validation set; the spectral pretreatment comprises derivative processing or / and vector normalization processing, and the derivative processing comprises first-order derivative processing or / and high-order derivative processing;
[0090] respectively performing spectral variable screening processing on the near-infrared spectra pretreated and the mid-infrared spectra pretreated of the calibration set and the validation set to obtain pretreated near-infrared spectral variable screening matrices and pretreated mid-infrared spectral variable screening matrices of the calibration set and pretreated near-infrared spectral variable screening matrices and pretreated mid-infrared spectral variable screening matrices of the validation set; the spectral variable screening processing comprises competitive adaptive reweighted sampling processing or / and variable importance projection processing;
[0091] inputting the near-infrared spectral pretreatment matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a third coefficient matrix;
[0092] inputting the mid-infrared spectral pretreatment matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a fourth coefficient matrix;
[0093] inputting the near-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the third coefficient matrix to obtain a third index prediction matrix of the calibration set composed of predicted values of the detection index of the calibration set;
[0094] inputting the mid-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix to obtain a fourth index prediction matrix of the calibration set composed of predicted values of the detection index of the calibration set;
[0095] inputting the near-infrared spectrum pretreatment matrix of the validation set into the detection model corresponding to the third coefficient matrix to obtain a third index prediction matrix of the validation set composed of predicted values of the detection index of the validation set;
[0096] inputting the mid-infrared spectrum pretreatment matrix of the validation set into the detection model corresponding to the fourth coefficient matrix to obtain a fourth index prediction matrix of the validation set composed of predicted values of the detection index of the validation set;
[0097] obtaining third validation values and fourth validation values according to the validation index through the third index prediction matrix of the validation set, the fourth index prediction matrix of the validation set and the index matrix, wherein the validation index is used to represent the prediction performance of the detection model, and preferably, the validation index comprises a determination coefficient or / and a prediction root mean square error;
[0098] taking the optimal values of the third validation values and the fourth validation values as optimal validation values, taking the optimal validation values as a threshold value, and taking a range of the threshold value towards the direction in which the prediction performance of the detection model is improved as a threshold value range, preferably, the optimal validation values are the minimum values of the prediction root mean square error or / and the maximum values of the determination coefficient; and the threshold value range is not greater than the minimum values of the prediction root mean square error or / and not less than the maximum values of the determination coefficient;
[0099] performing data-level fusion on the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the calibration set to obtain a second data-level fusion matrix of the calibration set, and inputting the second data-level fusion matrix of the calibration set and the index matrix of the calibration set into the detection model to train the detection model and obtain a sixth coefficient matrix;
[0100] inputting the second data-level fusion matrix of the calibration set as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a sixth index prediction matrix of the calibration set composed of predicted values of the detection index of the validation set;
[0101] inputting the second data-level fusion matrix of the validation set composed of the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the validation set as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a sixth index prediction matrix of the validation set composed of predicted values of the detection index of the validation set;
[0102] obtaining a sixth validation value according to the validation index through the sixth index prediction matrix of the validation set and the index matrix.
[0103] The second feature-level fusion matrix of the calibration set is input into the detection model with the index matrix of the calibration set to train the detection model, and an eighth coefficient matrix is obtained.
[0104] The second feature-level fusion matrix of the calibration set is input into the detection model corresponding to the eighth coefficient matrix to obtain an eighth index prediction matrix of the calibration set, which is composed of the predicted values of the detection indexes of the calibration set.
[0105] The second feature-level fusion matrix of the verification set is input into the detection model corresponding to the eighth coefficient matrix to obtain an eighth index prediction matrix of the verification set, which is composed of the predicted values of the detection indexes of the verification set.
[0106] The eighth verification value is obtained according to the verification index through the eighth index prediction matrix of the verification set and the index matrix.
[0107] The third verification value, the fourth verification value, the sixth verification value and the eighth verification value are screened according to the threshold range, and a verification value group within the threshold range is screened out.
[0108] The index matrix of the calibration set corresponding to the verification value group is decision-level fused to obtain a decision-level fusion matrix of the calibration set, the decision-level fusion matrix of the calibration set and the index matrix of the calibration set are input into the detection model to train the detection model, and a ninth coefficient matrix is obtained, which is the coefficient matrix after training.
[0109] According to an aspect of the present application, in the step of dividing the training set into the calibration set and the verification set:
[0110] The calibration set and the verification set are randomly divided from the training set at a ratio of 2:1-4:1, preferably at a ratio of 3:1.
[0111] According to an aspect of the present application, in the step of training the detection model, the spectrum preprocessing and / or the spectrum variable screening processing have multiple types, and each type of spectrum preprocessing, each type of spectrum variable screening processing and each combination of spectrum preprocessing and spectrum variable screening processing are used to train the model.
[0112] According to an aspect of the present application, the method of data-level fusion, feature-level fusion and decision-level fusion comprises:
[0113] The same dimension matrix splicing is used for data-level fusion, feature-level fusion or decision-level fusion.
[0114] According to a second aspect of the present application, a detection system based on multi-spectral data fusion is provided, comprising:
[0115] a collection module, which collects near-infrared spectra and mid-infrared spectra of a to-be-tested substance to obtain a near-infrared spectrum matrix and a mid-infrared spectrum matrix of the to-be-tested substance;
[0116] a detection model construction module, which constructs a detection model by the following formula: Y = XP T BQ
[0117] wherein X is an input matrix, Y is an output matrix, B is a coefficient matrix, and P and Q are load matrices of X and Y, respectively;
[0118] a training module, which trains the detection model;
[0119] a detection module, which predicts a detection index;
[0120] The training module comprises:
[0121] a training set construction unit, which collects training samples to construct a training set, wherein the training set comprises near-infrared spectra and mid-infrared spectra of a plurality of training samples and index values of a detection index of the plurality of training samples;
[0122] a training set division unit, which divides the training set constructed by the training set construction unit into a calibration set and a validation set to obtain a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an index matrix of the calibration set and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an index matrix of the validation set;
[0123] a spectrum pretreatment unit, which respectively performs spectrum pretreatment on the near-infrared spectra and the mid-infrared spectra of the calibration set and the validation set obtained by the training set division unit to obtain a near-infrared spectrum pretreatment matrix and a mid-infrared spectrum pretreatment matrix of the calibration set and a near-infrared spectrum pretreatment matrix and a mid-infrared spectrum pretreatment matrix of the validation set;
[0124] a spectrum variable screening unit, which respectively performs spectrum variable screening processing on the near-infrared spectra, the mid-infrared spectra, the spectrum pretreated near-infrared spectra and the spectrum pretreated mid-infrared spectra of the calibration set and the validation set obtained by the training set division unit to obtain a near-infrared spectrum variable screening matrix, a mid-infrared spectrum variable screening matrix, a pretreated near-infrared spectrum variable screening matrix and a pretreated mid-infrared spectrum variable screening matrix of the calibration set and a near-infrared spectrum variable screening matrix, a mid-infrared spectrum variable screening matrix, a pretreated near-infrared spectrum variable screening matrix and a pretreated mid-infrared spectrum variable screening matrix of the validation set;
[0125] a first training unit, which inputs the near-infrared spectrum matrix and the index matrix of the calibration set obtained by the training set division unit into the detection model, trains the detection model, and obtains a first coefficient matrix;
[0126] a second training unit, inputting the mid-infrared spectrum matrix and the index matrix of the calibration set obtained by the training set division unit into the detection model, training the detection model, and obtaining a second coefficient matrix;
[0127] a third training unit, inputting the near-infrared spectrum pretreatment matrix and the index matrix of the calibration set obtained by the spectrum pretreatment unit into the detection model, training the detection model, and obtaining a third coefficient matrix;
[0128] a fourth training unit, inputting the mid-infrared spectrum pretreatment matrix and the index matrix of the calibration set obtained by the spectrum pretreatment unit into the detection model, training the detection model, and obtaining a fourth coefficient matrix;
[0129] a first prediction unit, inputting the near-infrared spectrum matrix of the calibration set obtained by the training set division unit into the detection model corresponding to the first coefficient matrix, and obtaining a calibration set first index prediction matrix composed of predicted values of detection indexes of the calibration set;
[0130] a second prediction unit, inputting the mid-infrared spectrum matrix of the calibration set obtained by the training set division unit into the detection model corresponding to the second coefficient matrix, and obtaining a calibration set second index prediction matrix composed of predicted values of detection indexes of the calibration set;
[0131] a third prediction unit, inputting the near-infrared spectrum pretreatment matrix of the calibration set obtained by the spectrum pretreatment unit into the detection model corresponding to the third coefficient matrix, and obtaining a calibration set third index prediction matrix composed of predicted values of detection indexes of the calibration set;
[0132] a fourth prediction unit, inputting the mid-infrared spectrum pretreatment matrix of the calibration set obtained by the spectrum pretreatment unit into the detection model corresponding to the fourth coefficient matrix, and obtaining a calibration set fourth index prediction matrix composed of predicted values of detection indexes of the calibration set;
[0133] a fifth prediction unit, inputting the near-infrared spectrum matrix of the verification set obtained by the training set division unit into the detection model corresponding to the first coefficient matrix, and obtaining a verification set first index prediction matrix composed of predicted values of detection indexes of the verification set;
[0134] a sixth prediction unit, inputting the mid-infrared spectrum matrix of the verification set obtained by the training set division unit into the detection model corresponding to the second coefficient matrix, and obtaining a verification set second index prediction matrix composed of predicted values of detection indexes of the verification set;
[0135] a seventh prediction unit, inputting the near-infrared spectrum pretreatment matrix of the verification set obtained by the spectrum pretreatment unit into the detection model corresponding to the third coefficient matrix, and obtaining a verification set third index prediction matrix composed of predicted values of detection indexes of the verification set;
[0136] An eighth prediction unit inputs the mid-infrared spectrum pretreatment matrix of the verification set obtained by the spectrum pretreatment unit into the detection model corresponding to the fourth coefficient matrix to obtain a verification set fourth index prediction matrix composed of predicted values of the detection index of the verification set;
[0137] A first verification unit obtains a first verification value, a second verification value, a third verification value and a fourth verification value from the first index prediction matrix of the verification set obtained by the fifth prediction unit, the second index prediction matrix of the verification set obtained by the sixth prediction unit, the third index prediction matrix of the verification set obtained by the seventh prediction unit, the fourth index prediction matrix of the verification set obtained by the eighth prediction unit and the index matrix obtained by the training set division unit according to a verification index, wherein the verification index is used to represent the prediction performance of the detection model, and preferably, the verification index includes a determination coefficient or / and a prediction root mean square error;
[0138] A threshold range obtaining unit takes the optimal values of the first verification value, the second verification value, the third verification value and the fourth verification value obtained by the first verification unit as optimal verification values, takes the optimal verification values as thresholds, and takes the range of the thresholds towards the direction in which the prediction performance of the detection model is improved as a threshold range, preferably, the optimal verification values are the minimum value of the prediction root mean square error or / and the maximum value of the determination coefficient; and the threshold range is not greater than the minimum value of the prediction root mean square error or / and not less than the maximum value of the determination coefficient;
[0139] A fifth training unit performs data level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the correction set obtained by the training set division unit to form a correction set first data level fusion matrix, and inputs the correction set index matrix into the detection model to train the detection model to obtain a fifth coefficient matrix;
[0140] A sixth training unit performs data level fusion on the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the correction set obtained by the spectrum pretreatment unit to form a correction set second data level fusion matrix, and inputs the correction set index matrix into the detection model to train the detection model to obtain a sixth coefficient matrix;
[0141] A ninth prediction unit inputs the correction set first data level fusion matrix as an input matrix into the detection model corresponding to the fifth coefficient matrix to obtain a correction set fifth index prediction matrix composed of predicted values of the detection index of the correction set;
[0142] A tenth prediction unit inputs the correction set second data level fusion matrix as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a correction set sixth index prediction matrix composed of predicted values of the detection index of the verification set;
[0143] The eleventh prediction unit takes the first data level fusion matrix of the verification set composed by data level fusion of the near infrared spectrum matrix and the mid-infrared spectrum matrix of the verification set as an input matrix, inputs the detection model corresponding to the fifth coefficient matrix, and obtains the verification set fifth index prediction matrix composed of the predicted values of the detection indexes of the verification set;
[0144] The twelfth prediction unit takes the second data level fusion matrix of the verification set composed by data level fusion of the near infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the verification set as an input matrix, inputs the detection model corresponding to the sixth coefficient matrix, and obtains the verification set sixth index prediction matrix composed of the predicted values of the detection indexes of the verification set;
[0145] The second verification unit obtains the fifth verification value and the sixth verification value according to the verification indexes respectively through the verification set fifth index prediction matrix, the verification set sixth index prediction matrix and the index matrix;
[0146] The seventh training unit takes the first feature level fusion matrix of the calibration set composed by feature level fusion of the near infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set as an input matrix, inputs the index matrix of the calibration set into the detection model, trains the detection model, and obtains the seventh coefficient matrix;
[0147] The eighth training unit takes the second feature level fusion matrix of the calibration set composed by feature level fusion of the pretreated near infrared spectrum variable screening matrix and the pretreated mid-infrared spectrum variable screening matrix of the calibration set as an input matrix, inputs the index matrix of the calibration set into the detection model, trains the detection model, and obtains the eighth coefficient matrix;
[0148] The thirteenth prediction unit takes the first feature level fusion matrix of the calibration set as an input matrix, inputs the detection model corresponding to the seventh coefficient matrix, and obtains the calibration set seventh index prediction matrix composed of the predicted values of the detection indexes of the calibration set;
[0149] The fourteenth prediction unit takes the second feature level fusion matrix of the calibration set as an input matrix, inputs the detection model corresponding to the eighth coefficient matrix, and obtains the calibration set eighth index prediction matrix composed of the predicted values of the detection indexes of the calibration set;
[0150] The fifteenth prediction unit takes the first feature level fusion matrix of the verification set composed by feature level fusion of the near infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the verification set as an input matrix, inputs the detection model corresponding to the seventh coefficient matrix, and obtains the verification set seventh index prediction matrix composed of the predicted values of the detection indexes of the verification set;
[0151] The sixteenth prediction unit takes the second feature level fusion matrix of the verification set composed of the data level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the verification set as an input matrix, inputs the detection model corresponding to the eighth coefficient matrix, and obtains the prediction value of the detection index of the verification set to form the eighth index prediction matrix of the verification set;
[0152] The third verification unit obtains the seventh verification value and the eighth verification value according to the verification index respectively through the seventh index prediction matrix of the verification set, the eighth index prediction matrix of the verification set, and the index matrix;
[0153] The verification value screening unit screens the first verification value to the eighth verification value according to the threshold range, and screens out a verification value group within the threshold range;
[0154] The ninth training unit performs decision level fusion on the index matrix of the correction set corresponding to the verification value group to obtain a correction set decision level fusion matrix, inputs the correction set decision level fusion matrix and the index matrix of the correction set into the detection model, trains the detection model, and obtains the ninth coefficient matrix, which is the coefficient matrix after training;
[0155] The detection module includes:
[0156] The data level fusion unit performs data level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the to-be-detected substance to obtain a spectrum fusion matrix;
[0157] The prediction unit inputs the spectrum fusion matrix obtained by the data level fusion unit into the trained detection model as an input matrix to obtain a first index matrix as an output matrix; and takes the first index matrix as the detection result of the detection index of the to-be-detected substance;
[0158] The index matrix is a matrix composed of index values of the detection index measured by a standard method; the first index matrix is a matrix composed of index values of the detection index predicted by the detection model; and the detection index includes one or more of flash point, pour point, density, and kinematic viscosity;
[0159] Preferably, the detection module further includes:
[0160] The decision level fusion unit inputs the near-infrared spectrum matrix of the to-be-detected substance into the trained detection model as an input matrix to obtain a second index matrix as an output matrix; inputs the mid-infrared spectrum matrix of the to-be-detected substance into the trained detection model as an input matrix to obtain a third index matrix as an output matrix; and performs decision level fusion on the first index matrix, the second index matrix, and the third index matrix to obtain a fourth index matrix;
[0161] The prediction unit inputs the fourth index matrix of the decision-level fusion unit into the trained detection model as the input matrix to obtain the fifth index matrix as the output matrix; the fifth index matrix is used as the detection result of the substance to be detected.
[0162] Among them, the second index matrix, the third index matrix, and the fifth index matrix are matrices composed of the index values of the detection indicators predicted by the detection model.
[0163] According to a third aspect of the present invention, the present invention also provides a computer-readable storage medium comprising a program for fusing multiple spectral data, wherein when the program for fusing multiple spectral data is executed by a processor, the program implements the steps of the above-described method for fusing multiple spectral data.
[0164] According to a fourth aspect of the present invention, the present invention also provides an electronic device, including a memory and a processor, the memory including a program based on the fusion of multiple spectral data, wherein when the program based on the fusion of multiple spectral data is executed by the processor, the steps of the above-described method based on the fusion of multiple spectral data are implemented.
[0165] This invention's near-infrared and mid-infrared spectral fusion technology can simultaneously acquire the fundamental, overtone, and combination frequency information of hydrogen-containing groups. By employing a multi-level fusion approach—data-level fusion, feature-level fusion, and decision-level fusion—to train the detection model, it can obtain more comprehensive, reliable, and richer chemical information from the training samples, improving the comprehensiveness, accuracy, and reliability of the trained detection model. By fusing the near-infrared and mid-infrared spectra of the analyte and using the trained detection model to predict detection indicators, it ensures the comprehensiveness, accuracy, and reliability of both the analyte collection and the detection model training, thereby guaranteeing the accuracy of the predicted detection indicators. Attached Figure Description
[0166] Figure 1 is a schematic diagram of the detection method based on the fusion of multiple spectral data according to the present invention;
[0167] Figure 2 is a schematic diagram of a preferred embodiment of the steps for training the detection model according to the present invention;
[0168] Figure 3 is a schematic block diagram of an embodiment of the detection system based on the fusion of multiple spectral data according to the present invention;
[0169] Figure 4 is a schematic block diagram of an embodiment of the electronic device of the present invention;
[0170] Figures 5(A) and 5(B) are respectively the MIR and NIR spectra of diesel training samples in a specific embodiment of the detection method based on the fusion of multiple spectral data described in this invention;
[0171] Fig. 6(A), Fig. 6(B), Fig. 6(C) and Fig. 6(D) are data-level fusion spectrum diagrams of a specific embodiment of the detection method based on multiple spectrum data fusion according to the present application, respectively, using different spectrum preprocessing methods;
[0172] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0173] It should be understood that the specific embodiments described herein are merely intended to explain the present application and not to limit the present application.
[0174] Fig. 1 is a schematic diagram of the detection method based on multiple spectrum data fusion according to the present application, as shown in Fig. 1, the detection method comprises:
[0175] Step S1, collecting spectrum: collecting near-infrared spectrum and mid-infrared spectrum of the to-be-detected substance to obtain a near-infrared spectrum matrix and a mid-infrared spectrum matrix of the to-be-detected substance;
[0176] Step S2, constructing a detection model by the following formula (1); Y = XP T BQ (1)
[0177] Wherein, X is an input matrix, Y is an output matrix, B is a coefficient matrix, P and Q are load matrices of X and Y, respectively;
[0178] Step S3, training the detection model;
[0179] Step S6, predicting the detection index, inputting the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the to-be-detected substance into the trained detection model to output an index value of the detection index of the to-be-detected substance, the detection index comprising one or more of flash point, pour point, density and kinematic viscosity.
[0180] In some embodiments of the present application, step S3 comprises:
[0181] Step S301, constructing a training set, the training set comprising near-infrared spectrum and mid-infrared spectrum of a plurality of training samples and index values of detection indexes of the plurality of training samples;
[0182] Step S302, dividing the training set into a calibration set and a validation set to obtain near-infrared spectrum matrix, mid-infrared spectrum matrix and index matrix of the calibration set and near-infrared spectrum matrix, mid-infrared spectrum matrix and index matrix of the validation set;
[0183] Step S303, respectively, the near infrared spectrum and the mid-infrared spectrum of the calibration set and the validation set are subjected to spectral pretreatment, and the near infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the calibration set and the near infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the validation set are obtained; the spectral pretreatment includes derivative processing or / and vector normalization processing, and the derivative processing includes first derivative processing or / and high-order derivative processing;
[0184] Step S304, respectively, the near infrared spectrum, the mid-infrared spectrum, the near infrared spectrum after spectral pretreatment and the mid-infrared spectrum after spectral pretreatment of the calibration set and the validation set are subjected to spectral variable screening processing, and the near infrared spectrum variable screening matrix, the mid-infrared spectrum variable screening matrix, the pretreated near infrared spectrum variable screening matrix and the pretreated mid-infrared spectrum variable screening matrix of the calibration set and the near infrared spectrum variable screening matrix, the mid-infrared spectrum variable screening matrix, the pretreated near infrared spectrum variable screening matrix and the pretreated mid-infrared spectrum variable screening matrix of the validation set are obtained; the spectral variable screening processing includes competitive adaptive reweighted sampling processing or / and variable importance projection processing;
[0185] Step S305, the near infrared spectrum matrix and the index matrix of the calibration set are input into the detection model, the detection model is trained, and a first coefficient matrix is obtained;
[0186] Step S306, the mid-infrared spectrum matrix and the index matrix of the calibration set are input into the detection model, the detection model is trained, and a second coefficient matrix is obtained;
[0187] Step S307, the near infrared spectrum pretreatment matrix and the index matrix of the calibration set are input into the detection model, the detection model is trained, and a third coefficient matrix is obtained;
[0188] Step S308, the mid-infrared spectrum pretreatment matrix and the index matrix of the calibration set are input into the detection model, the detection model is trained, and a fourth coefficient matrix is obtained;
[0189] Step S309, the near infrared spectrum matrix of the calibration set is input into the detection model corresponding to the first coefficient matrix, and a calibration set first index prediction matrix composed of the predicted values of the detection indexes of the calibration set is obtained;
[0190] Step S310, the mid-infrared spectrum matrix of the calibration set is input into the detection model corresponding to the second coefficient matrix, and a calibration set second index prediction matrix composed of the predicted values of the detection indexes of the calibration set is obtained;
[0191] Step S311, the near infrared spectrum pretreatment matrix of the calibration set is input into the detection model corresponding to the third coefficient matrix, and a calibration set third index prediction matrix composed of the predicted values of the detection indexes of the calibration set is obtained;
[0192] Step S312, inputting the mid-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix to obtain a calibration set fourth index prediction matrix composed of predicted values of the detection indexes of the calibration set;
[0193] Step S313, inputting the near-infrared spectrum matrix of the verification set into the detection model corresponding to the first coefficient matrix to obtain a verification set first index prediction matrix composed of predicted values of the detection indexes of the verification set;
[0194] Step S314, inputting the mid-infrared spectrum matrix of the verification set into the detection model corresponding to the second coefficient matrix to obtain a verification set second index prediction matrix composed of predicted values of the detection indexes of the verification set;
[0195] Step S315, inputting the near-infrared spectrum pretreatment matrix of the verification set into the detection model corresponding to the third coefficient matrix to obtain a verification set third index prediction matrix composed of predicted values of the detection indexes of the verification set;
[0196] Step S316, inputting the mid-infrared spectrum pretreatment matrix of the verification set into the detection model corresponding to the fourth coefficient matrix to obtain a verification set fourth index prediction matrix composed of predicted values of the detection indexes of the verification set;
[0197] Step S317, obtaining a first verification value, a second verification value, a third verification value and a fourth verification value according to a verification index through the verification set first index prediction matrix, the verification set second index prediction matrix, the verification set third index prediction matrix, the verification set fourth index prediction matrix and the index matrix, the verification index is used to represent the prediction performance of the detection model, preferably, the verification index includes a determination coefficient or / and a prediction root mean square error;
[0198] Step S318, taking the optimal value of the first verification value, the second verification value, the third verification value and the fourth verification value as an optimal verification value, taking the optimal verification value as a threshold value, taking the range of the threshold value towards the direction of better prediction performance of the detection model as a threshold value range, preferably, the optimal verification value is the minimum value of the prediction root mean square error or / and the maximum value of the determination coefficient; the threshold value range is not greater than the minimum value of the prediction root mean square error or / and not less than the maximum value of the determination coefficient;
[0199] Step S319, performing data level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the calibration set to obtain a calibration set first data level fusion matrix, inputting the calibration set first data level fusion matrix and the index matrix of the calibration set into the detection model to train the detection model, and obtaining a fifth coefficient matrix;
[0200] Step S320, data-level fusion is performed on the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the calibration set to form a second data-level fusion matrix of the calibration set, the index matrix of the calibration set is input into the detection model, the detection model is trained, and a sixth coefficient matrix is obtained;
[0201] Step S321, the first data-level fusion matrix of the calibration set is taken as an input matrix, the detection model corresponding to the fifth coefficient matrix is input, a fifth index prediction matrix of the calibration set composed of prediction values of detection indexes of the calibration set is obtained;
[0202] Step S322, the second data-level fusion matrix of the calibration set is taken as an input matrix, the detection model corresponding to the sixth coefficient matrix is input, a sixth index prediction matrix of the calibration set composed of prediction values of detection indexes of the calibration set is obtained;
[0203] Step S323, the first data-level fusion matrix of the verification set composed of data-level fusion of the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the verification set is taken as an input matrix, the detection model corresponding to the fifth coefficient matrix is input, a fifth index prediction matrix of the verification set composed of prediction values of detection indexes of the verification set is obtained;
[0204] Step S324, the second data-level fusion matrix of the verification set composed of data-level fusion of the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the verification set is taken as an input matrix, the detection model corresponding to the sixth coefficient matrix is input, a sixth index prediction matrix of the verification set composed of prediction values of detection indexes of the verification set is obtained;
[0205] Step S325, the fifth verification value and the sixth verification value are obtained according to the verification index respectively through the fifth index prediction matrix of the verification set, the sixth index prediction matrix of the verification set and the index matrix;
[0206] Step S326, the first feature-level fusion matrix of the calibration set composed of feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set is input into the detection model together with the index matrix of the calibration set, the detection model is trained, and a seventh coefficient matrix is obtained;
[0207] Step S327, the second feature-level fusion matrix of the calibration set composed of feature-level fusion of the pretreatment near-infrared spectrum variable screening matrix and the pretreatment mid-infrared spectrum variable screening matrix of the calibration set is input into the detection model together with the index matrix of the calibration set, the detection model is trained, and an eighth coefficient matrix is obtained;
[0208] Step S328, the first feature-level fusion matrix of the calibration set is taken as an input matrix, the detection model corresponding to the seventh coefficient matrix is input, a seventh index prediction matrix of the calibration set composed of prediction values of detection indexes of the calibration set is obtained;
[0209] Step S329, taking the second feature level fusion matrix of the calibration set as an input matrix, inputting the detection model corresponding to the eighth coefficient matrix, and obtaining the calibration set eighth index prediction matrix composed of the predicted values of the detection indexes of the calibration set;
[0210] Step S330, taking the first feature level fusion matrix of the validation set composed of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the validation set as an input matrix, inputting the detection model corresponding to the seventh coefficient matrix, and obtaining the validation set seventh index prediction matrix composed of the predicted values of the detection indexes of the validation set;
[0211] Step S331, taking the second feature level fusion matrix of the validation set composed of the pretreated near-infrared spectrum variable screening matrix and the pretreated mid-infrared spectrum variable screening matrix as an input matrix, inputting the detection model corresponding to the eighth coefficient matrix, and obtaining the validation set eighth index prediction matrix composed of the predicted values of the detection indexes of the validation set;
[0212] Step S332, obtaining the seventh validation value and the eighth validation value according to the validation indexes through the validation set seventh index prediction matrix, the validation set eighth index prediction matrix and the index matrix;
[0213] Step S333, screening the first validation value to the eighth validation value according to the threshold range, and screening out a validation value group within the threshold range;
[0214] Step S334, performing decision level fusion on the calibration set index matrix corresponding to the validation value group, obtaining a calibration set decision level fusion matrix, inputting the calibration set decision level fusion matrix and the index matrix of the calibration set into the detection model, training the detection model, and obtaining a ninth coefficient matrix, the ninth coefficient matrix being a trained coefficient matrix;
[0215] The index matrix is a matrix composed of index values of detection indexes measured by a standard method.
[0216] The application constructs an optimized decision level data fusion method. Under multiple spectrum pretreatment conditions, a single spectrum model with the lowest prediction error is taken as a control group, and the prediction results of single spectrum models, data level fusion models and feature level fusion models with prediction errors lower than or equal to the single spectrum model are fused to establish a decision level fusion model, which can effectively improve the prediction performance of the model.
[0217] In some embodiments of the application, step S302 comprises:
[0218] The training set is randomly divided into a correction set and a verification set in a ratio of 2:1-4:1, preferably in a ratio of 3:1; if the ratio is not within the above range, the correction set will be too large to result in a too small verification set, or the correction set will be too small to result in a too large verification set, because the correction set is used to train the model and the verification set is used to verify the prediction performance of the model, and both of the two phenomena will result in a larger prediction error of the model when determining the verification set.
[0219] In some embodiments of the present application, step S4 comprises:
[0220] The near-infrared spectrum matrix and the mid-infrared spectrum matrix of the to-be-tested substance are data-level fused to obtain a spectrum fusion matrix;
[0221] The spectrum fusion matrix of the to-be-tested substance is input as an input matrix into the trained detection model to obtain a first index matrix as an output matrix; the first index matrix is taken as a detection result of the detection index of the to-be-tested substance.
[0222] The first index matrix is a matrix composed of index values of the detection index predicted by the detection model.
[0223] In some embodiments of the present application, step S6 comprises:
[0224] The near-infrared spectrum matrix and the mid-infrared spectrum matrix of the to-be-tested substance are data-level fused to obtain a spectrum fusion matrix;
[0225] The spectrum fusion matrix of the to-be-tested substance is input as an input matrix into the trained detection model to obtain a first index matrix as an output matrix;
[0226] The near-infrared spectrum matrix of the to-be-tested substance is input as an input matrix into the trained detection model to obtain a second index matrix as an output matrix;
[0227] The mid-infrared spectrum matrix of the to-be-tested substance is input as an input matrix into the trained detection model to obtain a third index matrix as an output matrix;
[0228] The first index matrix, the second index matrix and the third index matrix are decision-level fused to obtain a fourth index matrix;
[0229] The fourth index matrix is input as an input matrix into the trained detection model to obtain a fifth index matrix as an output matrix; the fifth index matrix is taken as a detection result of the detection index of the to-be-tested substance.
[0230] The second index matrix, the third index matrix and the fifth index matrix are matrices composed of index values of the detection index predicted by the detection model.
[0231] In some embodiments of the present application, step S6 comprises:
[0232] Step S4, spectral preprocessing, baseline correction of the near-infrared spectrum and the mid-infrared spectrum of the to-be-tested substance, eliminating the spectral baseline shift phenomenon caused by factors such as instruments, sample backgrounds, etc.
[0233] In some embodiments of the present application, step S4 comprises:
[0234] Spectral data of the near-infrared spectrum of the to-be-tested substance are subjected to spectral preprocessing to form a first spectral matrix;
[0235] Spectral data of the mid-infrared spectrum of the to-be-tested substance are subjected to spectral preprocessing to form a second spectral matrix;
[0236] The spectral preprocessing comprises derivative processing or / and vector normalization processing, and the derivative processing comprises first derivative processing or / and high-order derivative processing.
[0237] In some embodiments of the present application, step S6 comprises:
[0238] The first spectral matrix and the second spectral matrix are subjected to data-level fusion to form a first fusion matrix;
[0239] The first spectral matrix is input as an input matrix into the trained detection model to obtain a sixth index matrix as an output matrix;
[0240] The second spectral matrix is input as an input matrix into the trained detection model to obtain a seventh index matrix as an output matrix;
[0241] The first fusion matrix is input as an input matrix into the trained detection model to obtain an eighth index matrix as an output matrix;
[0242] The sixth index matrix, the seventh index matrix, and the eighth index matrix are subjected to decision-level fusion to form a fourth index matrix;
[0243] The fourth index matrix is input as an input matrix into the trained detection model to obtain a fifth index matrix as an output matrix; and the fifth index matrix is taken as a detection result of the detection index of the to-be-tested substance.
[0244] In some embodiments of the present application, step S6 comprises:
[0245] Step S5, spectral variable screening, spectral variable screening processing is performed on the near-infrared spectrum and the mid-infrared spectrum of the to-be-tested substance to form a third spectral matrix and a fourth spectral matrix; and the spectral variable screening processing comprises variable importance projection processing.
[0246] In some embodiments of the present application, step S6 comprises:
[0247] performing feature-level fusion on the third spectral matrix and the fourth spectral matrix to form a second fusion matrix;
[0248] inputting the third spectral matrix into the trained detection model as an input matrix to obtain a ninth index matrix as an output matrix;
[0249] inputting the fourth spectral matrix into the trained detection model as an input matrix to obtain a tenth index matrix as an output matrix;
[0250] inputting the second fusion matrix into the trained detection model as an input matrix to obtain an eleventh index matrix as an output matrix;
[0251] performing decision-level fusion on the ninth index matrix, the tenth index matrix and the eleventh index matrix to form a fourth index matrix;
[0252] inputting the fourth index matrix into the trained detection model as an input matrix to obtain a fifth index matrix as an output matrix; and taking the fifth index matrix as a detection result of the detection index of the to-be-detected substance.
[0253] In some embodiments of the present application, step S6 comprises:
[0254] In step S4, spectral preprocessing: performing spectral preprocessing on spectral data of the near-infrared spectrum of the to-be-detected substance to form a first spectral matrix; and performing spectral preprocessing on spectral data of the mid-infrared spectrum of the to-be-detected substance to form a second spectral matrix; the spectral preprocessing comprises derivative processing or / and vector normalization processing, and the derivative processing comprises first-order derivative processing or / and high-order derivative processing.
[0255] In step S5, spectral variable screening: performing spectral variable screening processing on the first spectral matrix and the second spectral matrix of the to-be-detected substance respectively to form a fifth spectral matrix and a sixth spectral matrix; the spectral variable screening processing comprises variable importance projection processing.
[0256] In some embodiments of the present application, step S6 comprises:
[0257] performing data-level fusion on the first spectral matrix and the second spectral matrix to form a first fusion matrix;
[0258] performing feature-level fusion on the fifth spectral matrix and the sixth spectral matrix to form a third fusion matrix;
[0259] inputting the first spectral matrix into the trained detection model as an input matrix to obtain a sixth index matrix as an output matrix;
[0260] inputting the second spectral matrix into the trained detection model as an input matrix to obtain a seventh index matrix as an output matrix;
[0261] inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth index matrix as an output matrix;
[0262] inputting the third fusion matrix as an input matrix into the trained detection model to obtain a twelfth index matrix as an output matrix;
[0263] performing decision-level fusion on the sixth index matrix, the seventh index matrix, the eighth index matrix and the twelfth index matrix to form a fourth index matrix;
[0264] inputting the fourth index matrix as an input matrix into the trained detection model to obtain a fifth index matrix as an output matrix; and taking the fifth index matrix as a detection result of the detection index of the to-be-detected substance.
[0265] In some embodiments of the present application, step S3 comprises:
[0266] collecting training samples to construct a training set, wherein the training set comprises near-infrared spectra and mid-infrared spectra of the training samples and index values of the detection indexes of the training samples;
[0267] dividing the training set into a calibration set and a validation set to obtain near-infrared spectrum matrices, mid-infrared spectrum matrices and index matrices of the calibration set and near-infrared spectrum matrices, mid-infrared spectrum matrices and index matrices of the validation set;
[0268] respectively performing spectral pretreatment on the near-infrared spectra and the mid-infrared spectra of the calibration set and the validation set to obtain near-infrared spectral pretreatment matrices and mid-infrared spectral pretreatment matrices of the calibration set and near-infrared spectral pretreatment matrices and mid-infrared spectral pretreatment matrices of the validation set; the spectral pretreatment comprises derivative processing or / and vector normalization processing, and the derivative processing comprises first-order derivative processing or / and high-order derivative processing;
[0269] respectively performing spectral variable screening processing on the near-infrared spectra pretreated and the mid-infrared spectra pretreated of the calibration set and the validation set to obtain pretreated near-infrared spectral variable screening matrices and pretreated mid-infrared spectral variable screening matrices of the calibration set and pretreated near-infrared spectral variable screening matrices and pretreated mid-infrared spectral variable screening matrices of the validation set; the spectral variable screening processing comprises competitive adaptive reweighted sampling processing or / and variable importance projection processing;
[0270] inputting the near-infrared spectral pretreatment matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a third coefficient matrix;
[0271] inputting the mid-infrared spectral pretreatment matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a fourth coefficient matrix;
[0272] inputting the near-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the third coefficient matrix to obtain a third index prediction matrix of the calibration set composed of prediction values of the detection index of the calibration set;
[0273] inputting the mid-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix to obtain a fourth index prediction matrix of the calibration set composed of prediction values of the detection index of the calibration set;
[0274] inputting the near-infrared spectrum pretreatment matrix of the validation set into the detection model corresponding to the third coefficient matrix to obtain a third index prediction matrix of the validation set composed of prediction values of the detection index of the validation set;
[0275] inputting the mid-infrared spectrum pretreatment matrix of the validation set into the detection model corresponding to the fourth coefficient matrix to obtain a fourth index prediction matrix of the validation set composed of prediction values of the detection index of the validation set;
[0276] obtaining third validation values and fourth validation values according to the validation index from the third index prediction matrix of the validation set, the fourth index prediction matrix of the validation set and the index matrix, wherein the validation index is used to represent the prediction performance of the detection model, and preferably, the validation index includes a determination coefficient or / and a prediction root mean square error;
[0277] taking the optimal values of the third validation values and the fourth validation values as optimal validation values, taking the optimal validation values as a threshold value, and taking a range of the threshold value towards the direction of better prediction performance of the detection model as a threshold value range, preferably, the optimal validation values are the minimum values of the prediction root mean square error or / and the maximum values of the determination coefficient; and the threshold value range is not greater than the minimum values of the prediction root mean square error or / and not less than the maximum values of the determination coefficient;
[0278] performing data-level fusion on the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the calibration set to obtain a second data-level fusion matrix of the calibration set, and inputting the second data-level fusion matrix of the calibration set and the index matrix of the calibration set into the detection model to train the detection model and obtain a sixth coefficient matrix;
[0279] inputting the second data-level fusion matrix of the calibration set as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a sixth index prediction matrix of the calibration set composed of prediction values of the detection index of the validation set;
[0280] inputting the second data-level fusion matrix of the validation set composed of the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the validation set as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a sixth index prediction matrix of the validation set composed of prediction values of the detection index of the validation set;
[0281] The sixth verification value is obtained according to the verification index through the sixth index prediction matrix of the verification set and the index matrix;
[0282] The second feature-level fusion matrix of the calibration set is obtained by performing feature-level fusion on the pretreated near-infrared spectrum variable screening matrix and the pretreated mid-infrared spectrum variable screening matrix of the calibration set, and the index matrix of the calibration set is input into the detection model to train the detection model, so as to obtain the eighth coefficient matrix;
[0283] The eighth index prediction matrix of the calibration set is obtained by inputting the second feature-level fusion matrix of the calibration set into the detection model corresponding to the eighth coefficient matrix as an input matrix, and the prediction value of the detection index of the calibration set is obtained.
[0284] The eighth index prediction matrix of the verification set is obtained by inputting the second feature-level fusion matrix of the verification set into the detection model corresponding to the eighth coefficient matrix as an input matrix, and the prediction value of the detection index of the verification set is obtained.
[0285] The eighth verification value is obtained according to the verification index through the eighth index prediction matrix of the verification set and the index matrix.
[0286] The third verification value, the fourth verification value, the sixth verification value and the eighth verification value are screened according to the threshold range, and a verification value group within the threshold range is screened out.
[0287] The calibration set decision-level fusion matrix is obtained by performing decision-level fusion on the index matrix of the calibration set corresponding to the verification value group, and the calibration set decision-level fusion matrix and the index matrix of the calibration set are input into the detection model to train the detection model, so as to obtain the ninth coefficient matrix, which is the coefficient matrix after training.
[0288] Single spectrum can obtain relatively one-sided chemical information of the measured substance, and cannot obtain more comprehensive, reliable and rich chemical information, resulting in low prediction performance of the single spectrum model. Through data fusion, the prediction performance of the model can be effectively improved. Meanwhile, the single spectrum model with the optimal prediction performance is taken as a control group, and the results of the data-level fusion model and the feature-level fusion model superior to the model are used to establish an optimized decision-level fusion model, so that the prediction accuracy of the model can be effectively improved.
[0289] In some embodiments of the present application, in the step of training the detection model, there are multiple spectrum pretreatments and / or spectrum variable screening processes, and each spectrum pretreatment, each spectrum variable screening process and the combination of each spectrum pretreatment and spectrum variable screening process are used to train the model.
[0290] In some embodiments of the present application, in step S3, the root mean square error of prediction (RMSEP) is obtained by the following formula (2), and the coefficient of determination is obtained by the following formula (3), and the RMSEP value is close to 0, The value is closer to 1, which proves that the prediction performance of the detection model is higher, and preferably, the optimal verification value is the minimum root mean square error of prediction and the maximum coefficient of determination:
[0291] Wherein, y act and y pred are the measured value (the index value of the detection index measured by the standard method) and the predicted value (the predicted value of the detection index output by the detection model) of each training sample in the verification set, respectively, and y mean is the average value of the measured values of the detection index of the plurality of training samples in the verification set, and g is the total number of training samples in the verification set.
[0292] In some embodiments of the present application, in step S2, the detection model is constructed by the PLS method, and the step of constructing the detection model by the PLS method comprises:
[0293] Decompose the independent variable X matrix and the dependent variable Y matrix: Y = UQ T +E Y (4) X = TP T +E X (5)
[0294] Wherein, T and U are the score matrices of the independent variable X and the dependent variable Y matrix, respectively; P and Q are the loading matrices of X and Y; E x and E y are the PLS fitting residual matrices of X and Y, respectively;
[0295] Linear regression analysis is performed on the score matrices T and U: U = TB (6) B = (T T T) -1 T T Y (7)
[0296] Determine the linear relationship between X and Y: Y = XP T BQ (1).
[0297] In some embodiments of the present application, the spectral pretreatment comprises one or more of the following steps:
[0298] The first derivative treatment is performed on the near-infrared spectrum and the mid-infrared spectrum by the following formula (8); the first derivative treatment uses a numerical differentiation method to calculate the slope or rate of change of the spectral data, so as to highlight the peaks or troughs in the spectral data and amplify the characteristic signals of the spectrum:
[0299] wherein A is a spectral value, the spectral value is absorbance or / and light intensity, λ is wavelength or wave number, i is wavelength or wave number index, Δλ represents the distance between two adjacent wavelengths or wave numbers;
[0300] The near-infrared spectrum and the mid-infrared spectrum are subjected to second derivative processing by the following formula (9); the second derivative processing calculates the rate of change of the curvature or the rate of change of the spectral data by taking the derivative again, so as to highlight the wide peaks and platforms in the spectral data:
[0301] The near-infrared spectrum and the mid-infrared spectrum are subjected to SG first derivative processing by the following formula (10) in combination with formula (8):
[0302] wherein 2c+1 is the smoothing window width, h i is a derivative coefficient (which needs to be queried from an SG derivative coefficient table according to different window widths), H is a normalization factor, k is the center point of the smoothing window, is the average value of the measurement values of the previous and subsequent c points, A k,smooth is the smoothed value of the spectral value after SG smoothing processing;
[0303] The near-infrared spectrum and the mid-infrared spectrum are subjected to SG second derivative processing by the following formula (10) in combination with formula (9);
[0304] The near-infrared spectrum and the mid-infrared spectrum are subjected to vector normalization by the following formula (11); the vector normalization unifies the scale of the spectral data, so as to prevent the spectral data in different wave numbers from being too different to produce negative optimization to the model:
[0305] wherein A is a spectral matrix, the dimension is 1×m, and m is the total number of wavelengths or wave numbers; A 归一化 is the spectral value after vector normalization.
[0306] In some embodiments of the present application, in step S3, the competitive adaptive weighted sampling processing in the spectral variable screening processing includes:
[0307] N times of sampling are performed by using a Monte Carlo sampling method, a PLS model (detection model) is established by using a spectral matrix A (n×m) and a detection index matrix Y (n×1) to be detected, a regression coefficient b is obtained, at the jth sampling, the retention rate r j is determined by the following formula (12): j = αe -fj (12)
[0308] wherein, n is the total number of training samples of the calibration set;
[0309] The wavelength points with large absolute values of regression coefficients in the PLS model are screened out by CARS, the wavelength points with small weights are removed, and finally the subset with the lowest root mean square error of cross validation (RMSECV) is selected to realize the selection of the optimal spectral variable combination. The NIR and MIR characteristic variables screened out by CARS are matrix C NIR and C MIR , and the RMSECV is obtained by formula (13) as follows:
[0310] Wherein, y act and y pred are the measured value of the detection index measured by the standard method (for example, the measured value of the detection index measured by the standard method in the national standard) and the predicted value output by the detection model of each training sample, y mean is the average value of the measured value.
[0311] In some embodiments of the present application, in step S3, the step of variable importance projection processing in the spectral variable screening processing comprises:
[0312] The vector score is obtained by formula (14) as follows:
[0313] Wherein, H is the total number of PLS optimal principal factors, h is the index of PLS optimal principal factor; w is the weight vector; t is the score vector; q is the load vector; VIP i is the VIP value of the vector corresponding to the ith wave number or wavelength, and the importance of the spectral variable to the measured property is judged by the VIP value, when the VIP value is large, it represents that the spectral variable has strong explanatory ability to the dependent variable;
[0314] The near-infrared spectrum and the mid-infrared spectrum corresponding to the wavelength or the wave number with a VIP value greater than 1 are selected as the characteristic spectrum, and the NIR and MIR characteristic variables screened out by the VIP value are V NIR and V MIR .
[0315] In the above embodiments, the data-level fusion, feature-level fusion and decision-level fusion method comprises: same dimension matrix splicing for data-level fusion, feature-level fusion or decision-level fusion.
[0316] Figure 2 is a schematic diagram of a preferred embodiment of the step of training the detection model, as shown in Figure 2, the step of training the detection model comprises:
[0317] Step S10, a plurality of training samples are collected to form a training set;
[0318] Step S20, randomly divide the training set into a correction set and a validation set in a set proportion, preferably, the set proportion is 3:1;
[0319] Step S30, measure the detection index of the training samples of the correction set and the validation set by a standard method, to form the dependent variable matrix (index matrix) YZ of the correction set and the validation set C and YZ V ;
[0320] Step S40, collect the near-infrared spectrum (NIR) and the mid-infrared spectrum (MIR) of the correction set and the validation set, to obtain the near-infrared spectrum matrix N C and the mid-infrared spectrum matrix M C of the correction set, and the near-infrared spectrum matrix N V and the mid-infrared spectrum matrix M V of the validation set samples;
[0321] Step S50, under a plurality of spectral pretreatment conditions, respectively establish single spectrum models by using the matrix N C and the matrix M C of the correction set, and use the validation set for prediction, including:
[0322] Perform a plurality of spectral pretreatments on the near-infrared spectrum matrix N C and the mid-infrared spectrum matrix M C of the correction set, to obtain the near-infrared spectrum pretreatment matrix N pre-C and the mid-infrared spectrum pretreatment matrix M pre-C of the correction set after spectral pretreatment;
[0323] The near-infrared spectrum pretreatment matrix N pre-C and the mid-infrared spectrum pretreatment matrix M pre-C of the correction set establish single spectrum models by formulas (2)-(4), as shown in formula (1), the input matrix X is the single spectrum matrix N pre-C or M pre-C ;
[0324] Input the near-infrared spectrum pretreatment matrix N pre-C and the mid-infrared spectrum pretreatment matrix M pre-C of the correction set into the single spectrum model, to obtain the detection index prediction value matrix YC N-pred of the near-infrared spectrum of the correction set and the detection index prediction value matrix YC M-pred of the mid-infrared spectrum;
[0325] Perform a plurality of spectral pretreatments on the near-infrared spectrum matrix N V and the mid-infrared spectrum matrix M V of the validation set, to obtain the near-infrared spectrum pretreatment matrix Npre-V and mid-infrared spectral preprocessing matrix M pre-V ;
[0326] The near-infrared spectral preprocessing matrix N of the validation set pre-V and mid-infrared spectral preprocessing matrix M pre-V Inputting into a single spectral model yields the matrix YV, which represents the predicted values of the near-infrared spectra of the validation set. N-pred The predicted value matrix of detection indicators in mid-infrared spectroscopy, YV M-pred ;
[0327] The dependent variable matrix (index matrix) YZ of the validation set V The predicted value matrix YV of the detection index with near-infrared spectroscopy N-pred The coefficient of determination is analyzed based on formulas (2) and (3). The third validation set is obtained by combining the root mean square error of prediction (RMSEP); the dependent variable matrix (index matrix) YZ of the validation set is then used. V The matrix YV of predicted values of detection indicators with mid-infrared spectroscopy M-pred The coefficient of determination is analyzed based on formulas (2) and (3). The fourth set of validation values was obtained by combining the root mean square error of prediction (RMSEP).
[0328] Step S60, preprocess the near-infrared spectral matrix N of the calibration set. pre-C and mid-infrared spectral preprocessing matrix M pre-C To perform data-level fusion, a data-level fusion model (Low) is built using the data-level fusion matrix of the calibration set, and prediction is performed using the validation set. The specific steps are as follows:
[0329] The near-infrared spectral preprocessing matrix N of the calibration set pre-C and mid-infrared spectral preprocessing matrix M pre-C The data-level fusion matrix L of the calibration set is obtained by concatenation. pre-C L pre-C =[N pre-C M pre-C ]
[0330] The data-level fusion matrix L of the calibration set is used to establish the data-level fusion model through formulas (2)-(4), as shown in formula (1). The input matrix X is the data-level fusion matrix L. pre-C ;
[0331] The data-level fusion matrix L of the calibration set pre-C In the input data-level fusion model, the predicted value matrix of the detection index of the calibration set is obtained through data-level fusion.
[0332] The near-infrared spectral preprocessing matrix N of the validation setpre-V and mid-infrared spectral preprocessing matrix M pre-V The data-level fusion matrix L of the validation set is obtained by concatenating the data. pre-V L pre-V =[N pre-V M pre-V ]
[0333] The data-level fusion matrix L of the validation set pre-V In the input data-level fusion model, the predicted value matrix of detection indicators obtained from the data-level fusion of the validation set is obtained.
[0334] The dependent variable matrix (index matrix) YZ of the validation set V Detection index prediction matrix fused with data level The coefficient of determination is analyzed based on formulas (2) and (3). The sixth set of validation values was obtained by combining the root mean square error of prediction (RMSEP).
[0335] Step S70: Under multiple spectral variable screening and processing methods, the near-infrared spectral preprocessing matrix N of the calibration set is... pre- C and mid-infrared spectral preprocessing matrix M pre-C After feature variable selection, feature-level fusion is performed. A feature-level fusion model (Mid) is built using the feature-level fusion matrix of the calibration set, and prediction is performed using the validation set. The specific steps are as follows:
[0336] Near-infrared spectral preprocessing matrix N of the calibration set pre-C and mid-infrared spectral preprocessing matrix M pre-C Multiple spectral variable screening processes are performed to obtain the preprocessed near-infrared spectral variable screening matrix N of the calibration set after multiple spectral variable screening processes. vs-C And the infrared spectral variable screening matrix M in preprocessing vs-C ;
[0337] Screening matrix N for preprocessed near-infrared spectral variables vs-C And the infrared spectral variable screening matrix M in preprocessing vs-C The feature-level fusion matrix L of the calibration set is obtained by concatenation. vs-C L vs-C =[N vs-C M vs-C ]
[0338] The eigenvalue fusion matrix L of the calibration set vs-C The feature-level fusion model is established using formulas (2)-(4), as shown in formula (1). The input matrix X is the feature-level fusion matrix L. vs-C ;
[0339] The feature-level fusion matrix L of the calibration set vs-C The input feature-level fusion model yields the matrix of predicted detection metrics for the feature-level fusion of the calibration set.
[0340] Near-infrared spectral preprocessing matrix N for the validation set pre-V and mid-infrared spectral preprocessing matrix M pre-V Multiple spectral variable screening processes are performed to obtain the preprocessed near-infrared spectral variable screening matrix N of the validation set after multiple spectral variable screening processes. vs-V And the infrared spectral variable screening matrix M in preprocessing vs-V ;
[0341] The preprocessed near-infrared spectral variable screening matrix N of the validation set is used. vs-V And the infrared spectral variable screening matrix M in preprocessing vs-V The feature-level fusion matrix L of the validation set is obtained by concatenation. vs-V L vs-V =[N vs-V M vs-V ]
[0342] The feature-level fusion matrix L of the validation set vs-V The input feature-level fusion model yields the matrix of predicted detection metrics for the feature-level fusion of the validation set.
[0343] The dependent variable matrix (index matrix) YZ of the validation set V Predicted value matrix of detection indicators fused with feature level The coefficient of determination is analyzed based on formulas (2) and (3). The eighth set of validation values was obtained by combining the root mean square error of prediction (RMSEP).
[0344] In step S80, the lowest RMSEP value in the third and fourth validation groups of the different spectral preprocessing single spectral models established in step S50 is used as a threshold. The prediction results of the single spectral models, data-level fusion models, and feature-level fusion models whose RMSEP values are equal to or lower than the threshold in steps S50, S60, and S70 are fused to obtain the optimized decision-level fusion matrix H. Opt And using the corresponding validation set to make predictions, the ninth validation value group is obtained.
[0345] Preferably, it further includes: step S90, which involves setting the RMSEP of each verification group from steps S50 to S80 and Compare the values and find the one with the lowest RMSEP value. The detection model corresponding to the verification group with the highest value is taken as an optimal detection model, so that an optimal coefficient matrix corresponding to the optimal detection model is obtained.
[0346] The present application is based on a decision-level data fusion method of near-infrared spectrum and mid-infrared spectrum, and obtains chemical composition information of diesel from different dimensions, compared with a single spectrum model, can effectively improve the accuracy of the established model for unknown sample prediction.
[0347] Figure 3 is a block diagram of an embodiment of the detection system based on multiple spectrum data fusion according to the present application, as shown in Figure 3, the detection system based on multiple spectrum data fusion comprises:
[0348] The acquisition module 100 acquires the near-infrared spectrum and the mid-infrared spectrum of the to-be-detected substance, and obtains the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the to-be-detected substance;
[0349] The detection model construction module 200 constructs a detection model through formula (1);
[0350] The training module 300 trains the detection model;
[0351] The detection module 400 predicts the detection index.
[0352] In some embodiments of the present application, the training module 300 comprises:
[0353] The training set construction unit 301 acquires training samples to construct a training set, wherein the training set comprises the near-infrared spectrum and the mid-infrared spectrum of a plurality of training samples and the index values of the detection index of a plurality of training samples;
[0354] The training set division unit 302 divides the training set constructed by the training set construction unit into a calibration set and a verification set, and obtains the near-infrared spectrum matrix, the mid-infrared spectrum matrix and the index matrix of the calibration set, and the near-infrared spectrum matrix, the mid-infrared spectrum matrix and the index matrix of the verification set;
[0355] The spectrum pretreatment unit 303 respectively performs spectrum pretreatment on the near-infrared spectrum and the mid-infrared spectrum of the calibration set and the verification set obtained by the training set division unit, and obtains the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the calibration set, and the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the verification set;
[0356] The spectral variable screening unit 304 performs spectral variable screening processing on the near-infrared spectrum, the mid-infrared spectrum, the near-infrared spectrum after spectral preprocessing, and the mid-infrared spectrum after spectral preprocessing of the calibration set and the validation set obtained by the training set division unit respectively, to obtain the near-infrared spectrum variable screening matrix, the mid-infrared spectrum variable screening matrix, the preprocessing near-infrared spectrum variable screening matrix, and the preprocessing mid-infrared spectrum variable screening matrix of the calibration set, and the near-infrared spectrum variable screening matrix, the mid-infrared spectrum variable screening matrix, the preprocessing near-infrared spectrum variable screening matrix, and the preprocessing mid-infrared spectrum variable screening matrix of the validation set;
[0357] The first training unit 305 inputs the near-infrared spectrum matrix and the index matrix of the calibration set obtained by the training set division unit into the detection model, trains the detection model, and obtains a first coefficient matrix;
[0358] The second training unit 306 inputs the mid-infrared spectrum matrix and the index matrix of the calibration set obtained by the training set division unit into the detection model, trains the detection model, and obtains a second coefficient matrix;
[0359] The third training unit 307 inputs the near-infrared spectrum preprocessing matrix and the index matrix of the calibration set obtained by the spectral preprocessing unit into the detection model, trains the detection model, and obtains a third coefficient matrix;
[0360] The fourth training unit 308 inputs the mid-infrared spectrum preprocessing matrix and the index matrix of the calibration set obtained by the spectral preprocessing unit into the detection model, trains the detection model, and obtains a fourth coefficient matrix;
[0361] The first prediction unit 309 inputs the near-infrared spectrum matrix of the calibration set obtained by the training set division unit into the detection model corresponding to the first coefficient matrix, to obtain a calibration set first index prediction matrix composed of predicted values of the detection index of the calibration set;
[0362] The second prediction unit 310 inputs the mid-infrared spectrum matrix of the calibration set obtained by the training set division unit into the detection model corresponding to the second coefficient matrix, to obtain a calibration set second index prediction matrix composed of predicted values of the detection index of the calibration set;
[0363] The third prediction unit 311 inputs the near-infrared spectrum preprocessing matrix of the calibration set obtained by the spectral preprocessing unit into the detection model corresponding to the third coefficient matrix, to obtain a calibration set third index prediction matrix composed of predicted values of the detection index of the calibration set;
[0364] The fourth prediction unit 312 inputs the mid-infrared spectrum preprocessing matrix of the calibration set obtained by the spectral preprocessing unit into the detection model corresponding to the fourth coefficient matrix, to obtain a calibration set fourth index prediction matrix composed of predicted values of the detection index of the calibration set;
[0365] The fifth prediction unit 313 inputs the near-infrared spectrum matrix of the verification set obtained by the training set division unit into the detection model corresponding to the first coefficient matrix, and obtains a verification set first index prediction matrix composed of predicted values of the detection index of the verification set;
[0366] The sixth prediction unit 314 inputs the mid-infrared spectrum matrix of the verification set obtained by the training set division unit into the detection model corresponding to the second coefficient matrix, and obtains a verification set second index prediction matrix composed of predicted values of the detection index of the verification set;
[0367] The seventh prediction unit 315 inputs the near-infrared spectrum pretreatment matrix of the verification set obtained by the spectrum pretreatment unit into the detection model corresponding to the third coefficient matrix, and obtains a verification set third index prediction matrix composed of predicted values of the detection index of the verification set;
[0368] The eighth prediction unit 316 inputs the mid-infrared spectrum pretreatment matrix of the verification set obtained by the spectrum pretreatment unit into the detection model corresponding to the fourth coefficient matrix, and obtains a verification set fourth index prediction matrix composed of predicted values of the detection index of the verification set;
[0369] The first verification unit 317 obtains a first verification value, a second verification value, a third verification value and a fourth verification value according to the verification index respectively by the verification set first index prediction matrix obtained by the fifth prediction unit, the verification set second index prediction matrix obtained by the sixth prediction unit, the verification set third index prediction matrix obtained by the seventh prediction unit, the verification set fourth index prediction matrix obtained by the eighth prediction unit and the index matrix obtained by the training set division unit, wherein the verification index is used to represent the prediction performance of the detection model, and preferably, the verification index includes the determination coefficient or / and the prediction root mean square error;
[0370] The threshold range obtaining unit 318 takes the optimal value of the first verification value, the second verification value, the third verification value and the fourth verification value obtained by the first verification unit as the optimal verification value, takes the optimal verification value as the threshold, and takes the range of the threshold towards the direction of the better prediction performance of the detection model as the threshold range, preferably, the optimal verification value is the minimum value of the prediction root mean square error or / and the maximum value of the determination coefficient; and the threshold range is not greater than the minimum value of the prediction root mean square error or / and not less than the maximum value of the determination coefficient;
[0371] The fifth training unit 319 performs data level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the correction set obtained by the training set division unit to obtain a correction set first data level fusion matrix, inputs the correction set first data level fusion matrix and the index matrix of the correction set into the detection model to train the detection model, and obtains the fifth coefficient matrix;
[0372] The sixth training unit 320 performs data-level fusion of the near-infrared spectral preprocessing matrix and the mid-infrared spectral preprocessing matrix of the calibration set obtained by the spectral preprocessing unit to form the second data-level fusion matrix of the calibration set. This matrix, along with the index matrix of the calibration set, is input into the detection model to train the detection model, resulting in the sixth coefficient matrix.
[0373] The ninth prediction unit 321 takes the first data-level fusion matrix of the calibration set as the input matrix and inputs the detection model corresponding to the fifth coefficient matrix to obtain the fifth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set.
[0374] The tenth prediction unit 322 takes the second data level fusion matrix of the calibration set as the input matrix and inputs the detection model corresponding to the sixth coefficient matrix to obtain the sixth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the validation set.
[0375] The eleventh prediction unit 323 takes the first data-level fusion matrix of the validation set, which is formed by data-level fusion of the near-infrared spectral matrix and the mid-infrared spectral matrix of the validation set, as the input matrix, and inputs the detection model corresponding to the fifth coefficient matrix to obtain the fifth indicator prediction matrix of the validation set, which is formed by the predicted values of the detection indicators of the validation set.
[0376] The twelfth prediction unit 324 takes the second data-level fusion matrix of the validation set, which is formed by data-level fusion of the near-infrared spectral preprocessing matrix and the mid-infrared spectral preprocessing matrix of the validation set, as the input matrix, and inputs the detection model corresponding to the sixth coefficient matrix to obtain the sixth index prediction matrix of the validation set, which is formed by the predicted values of the detection index of the validation set.
[0377] The second verification unit 325 obtains the fifth verification value and the sixth verification value respectively based on the verification indicators by using the fifth indicator prediction matrix of the verification set, the sixth indicator prediction matrix of the verification set, and the indicator matrix.
[0378] The seventh training unit 326 inputs the first feature-level fusion matrix of the calibration set, which is formed by feature-level fusion of the near-infrared spectral variable screening matrix and the mid-infrared spectral variable screening matrix of the calibration set, and the index matrix of the calibration set into the detection model to train the detection model and obtain the seventh coefficient matrix.
[0379] The eighth training unit 327 takes the preprocessed near-infrared spectral variable selection matrix and the preprocessed mid-infrared spectral variable selection matrix of the calibration set as the feature-level fusion matrix, and inputs them together with the index matrix of the calibration set into the detection model to train the detection model and obtain the eighth coefficient matrix.
[0380] The thirteenth prediction unit 328 inputs the detection model corresponding to the seventh coefficient matrix as the input matrix by taking the first characteristic level fusion matrix of the correction set as the input matrix, and obtains the correction set eighth index prediction matrix composed of the predicted values of the detection indexes of the correction set;
[0381] The fourteenth prediction unit 329 inputs the detection model corresponding to the eighth coefficient matrix as the input matrix by taking the second characteristic level fusion matrix of the correction set as the input matrix, and obtains the correction set eighth index prediction matrix composed of the predicted values of the detection indexes of the correction set;
[0382] The fifteenth prediction unit 330 inputs the detection model corresponding to the seventh coefficient matrix as the input matrix by taking the verification set first characteristic level fusion matrix composed of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the verification set and subjected to characteristic level fusion as the input matrix, and obtains the verification set seventh index prediction matrix composed of the predicted values of the detection indexes of the verification set;
[0383] The sixteenth prediction unit 331 inputs the detection model corresponding to the eighth coefficient matrix as the input matrix by taking the verification set second characteristic level fusion matrix composed of the pretreated near-infrared spectrum variable screening matrix and the pretreated mid-infrared spectrum variable screening matrix and subjected to data level fusion as the input matrix, and obtains the verification set eighth index prediction matrix composed of the predicted values of the detection indexes of the verification set;
[0384] The third verification unit 332 obtains the seventh verification value and the eighth verification value according to the verification indexes by taking the verification set seventh index prediction matrix, the verification set eighth index prediction matrix and the index matrix as the input matrix;
[0385] The verification value screening unit 333 screens the first verification value to the ninth verification value according to the threshold range, and screens out the verification value group within the threshold range;
[0386] The ninth training unit 334 performs decision level fusion on the correction set index matrix corresponding to the verification value group to obtain the correction set decision level fusion matrix, inputs the correction set decision level fusion matrix and the index matrix of the correction set into the detection model, trains the detection model, and obtains the ninth coefficient matrix. The ninth coefficient matrix is the trained coefficient matrix.
[0387] In some embodiments of the present application, the detection module 400 comprises:
[0388] The data level fusion unit 403 performs data level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the to-be-detected substance to obtain a spectrum fusion matrix;
[0389] The prediction unit 406 inputs the spectrum fusion matrix obtained by the data level fusion unit into the trained detection model as the input matrix, and obtains the first index matrix as the output matrix; the first index matrix is taken as the detection result of the detection index of the to-be-detected substance;
[0390] wherein the index matrix is a matrix of index values of detection indexes measured by a standard method; the first index matrix is a matrix of index values of detection indexes predicted by the detection model; the detection indexes include one or more of flash point, pour point, density, and kinematic viscosity.
[0391] In some embodiments of the present application, the detection module further comprises:
[0392] The decision-level fusion unit 405 inputs the near-infrared spectrum matrix of the to-be-tested substance as an input matrix into the trained detection model to obtain a second index matrix as an output matrix; inputs the mid-infrared spectrum matrix of the to-be-tested substance as an input matrix into the trained detection model to obtain a third index matrix as an output matrix; and performs decision-level fusion on the first index matrix, the second index matrix, and the third index matrix to obtain a fourth index matrix.
[0393] wherein the prediction unit inputs the fourth index matrix of the decision-level fusion unit as an input matrix into the trained detection model to obtain a fifth index matrix as an output matrix; and takes the fifth index matrix as the detection result of the to-be-tested substance.
[0394] wherein the second index matrix, the third index matrix, and the fifth index matrix are matrices of index values of detection indexes predicted by the detection model.
[0395] In some embodiments of the present application, the prediction module further comprises:
[0396] The spectrum preprocessing unit 401 performs spectrum preprocessing on the spectrum data of the near-infrared spectrum of the to-be-tested substance to form a first spectrum matrix; and performs spectrum preprocessing on the spectrum data of the mid-infrared spectrum of the to-be-tested substance to form a second spectrum matrix; the spectrum preprocessing includes derivative processing or / and vector normalization processing, and the derivative processing includes first-order derivative processing or / and high-order derivative processing.
[0397] wherein the data-level fusion unit 403 performs data-level fusion on the first spectrum matrix and the second spectrum matrix to form a first fusion matrix.
[0398] The decision-level fusion unit 405 inputs the first spectrum matrix as an input matrix into the trained detection model to obtain a sixth index matrix as an output matrix; inputs the second spectrum matrix as an input matrix into the trained detection model to obtain a seventh index matrix as an output matrix; inputs the first fusion matrix as an input matrix into the trained detection model to obtain an eighth index matrix as an output matrix; and performs decision-level fusion on the sixth index matrix, the seventh index matrix, and the eighth index matrix to form the fourth index matrix.
[0399] In some embodiments of the present invention, the prediction module further includes:
[0400] The spectral variable screening unit 402 performs spectral variable screening processing on the near-infrared and mid-infrared spectra of the substance to be tested to form a third spectral matrix and a fourth spectral matrix, respectively; the spectral variable screening processing includes variable importance projection processing;
[0401] The prediction module further includes a feature-level fusion unit 404, which performs feature-level fusion of the third spectral matrix and the fourth spectral matrix to form a second fusion matrix;
[0402] The decision-level fusion unit 405 inputs the third spectral matrix as the input matrix into the trained detection model to obtain the ninth index matrix as the output matrix; inputs the fourth spectral matrix as the input matrix into the trained detection model to obtain the tenth index matrix as the output matrix; inputs the second fusion matrix as the input matrix into the trained detection model to obtain the eleventh index matrix as the output matrix; and performs decision-level fusion of the ninth, tenth, and eleventh index matrices to form the fourth index matrix.
[0403] In one embodiment of the present invention, the prediction module includes a spectral preprocessing unit 401, a spectral variable screening unit 402, a data-level fusion unit 403, a feature-level fusion unit 404, a decision-level fusion unit 405, and a prediction unit 406. Preferably, the spectral variable screening unit 402 performs spectral variable screening on the near-infrared spectrum and mid-infrared spectrum after spectral preprocessing by the spectral preprocessing unit 401.
[0404] The detection methods based on the fusion of multiple spectral data described above in this invention can be applied to electronic device 1. Referring to FIG4, a schematic diagram of the application environment of a preferred embodiment of the detection method based on the fusion of multiple spectral data of this invention is shown.
[0405] In this embodiment, the electronic device 1 can be a terminal device with computing capabilities, such as a server, smartphone, tablet computer, portable computer, or desktop computer.
[0406] The electronic device 1 includes a processor 12 and a memory 11, and may also include a network interface 13, a communication bus 14, etc.
[0407] The memory 11 includes at least one type of readable storage medium. The at least one type of readable storage medium can be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card-type memory, etc. In some embodiments, the readable storage medium can be an internal storage unit of the electronic device 1, for example, a hard disk of the electronic device 1. In other embodiments, the readable storage medium can also be an external memory of the electronic device 1, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 1.
[0408] In the present embodiment, the readable storage medium of the memory 11 is generally used to store the detection program 10 based on multi-spectrum data fusion installed in the electronic device 1, representative samples, data levels of representative samples, etc. The memory 11 can also be used to temporarily store data that has been output or will be output.
[0409] The processor 12 can be a central processing unit (CPU), a microprocessor or other data processing chip in some embodiments, used to run program codes or process data stored in the memory 11, for example, to execute the detection program 10 based on multi-spectrum data fusion, etc.
[0410] The network interface 13 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and is generally used to establish a communication connection between the electronic device 1 and other electronic devices.
[0411] The communication bus 14 is used to realize the connection communication between the components.
[0412] FIG. 4 only shows the electronic device 1 with components 11-14, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be alternatively implemented.
[0413] Optionally, the electronic device 1 can also include a user interface, which can include an input unit such as a keyboard, a voice input device such as a microphone, etc. a device with voice recognition function, a voice output device such as a speaker, a headset, etc. The user interface can also optionally include a standard wired interface, a wireless interface.
[0414] Optionally, the electronic device 1 can also include a display, which can also be referred to as a display screen or a display unit. In some embodiments, the display can be an LED display, a liquid crystal display, a touch liquid crystal display, an Organic Light-Emitting Diode (OLED) touch, or the like. The display is used to display information processed in the electronic device 1 and to display a visualized user interface.
[0415] Optionally, the electronic device 1 also includes a touch sensor. The area provided by the touch sensor for the user to perform a touch operation is referred to as a touch area. In addition, the touch sensor described herein can be a resistive touch sensor, a capacitive touch sensor, or the like. Moreover, the touch sensor can include not only a contact-type touch sensor, but also a proximity-type touch sensor, or the like. In addition, the touch sensor can be a single sensor or a plurality of sensors arranged in an array, for example.
[0416] In addition, the area of the display of the electronic device 1 can be the same as or different from the area of the touch sensor. Optionally, the display and the touch sensor are stacked to form a touch display screen. The device detects a touch operation triggered by the user based on the touch display screen.
[0417] Optionally, the electronic device 1 can also include a radio frequency (RF) circuit, a sensor, an audio circuit, and the like, which are not described herein.
[0418] In addition, the embodiments of the present application also provide a computer readable storage medium, which includes a detection program based on multi-spectrum data fusion. When the detection program based on multi-spectrum data fusion is executed by a processor, the steps of the detection method based on multi-spectrum data fusion of each of the above embodiments are implemented.
[0419] The specific embodiments of the computer readable storage medium of the present application are substantially the same as those of the above detection method based on multi-spectrum data fusion and the specific embodiments of the electronic device, and are not described herein.
[0420] In order to verify the beneficial effects of the present application, the following specific embodiments are carried out:
[0421] The detection method based on multi-spectrum data fusion of this embodiment includes:
[0422] Step one: 138 groups of diesel samples were collected from an oil depot in Beijing as training samples, including 67 groups of 0# diesel, 30 groups of -10# diesel, 16 groups of -20# diesel and 25 groups of -35# diesel. The diesel samples were from different sources and different processing techniques, which ensured the difference in properties of the diesel samples. Through random division, 103 groups of diesel samples were divided into a calibration set for establishing a partial least squares (PLS) detection model, and the other 35 groups of diesel samples were divided into a validation set for verifying the detection model;
[0423] Step two: the flash points of the diesel samples were determined by a standard method to obtain the flash point determination values of the 138 training samples, which constituted a calibration set index matrix YZ C and a validation set index matrix YZ V ;
[0424] Step three: Fourier transform near-infrared (NIR) and mid-infrared (MIR) spectrometers were used to collect the spectral diagrams of the diesel samples. The spectral diagrams are shown in FIG. 5(A) and FIG. 5(B). At the same time, the near-infrared spectrum matrix N C and the mid-infrared spectrum matrix M C of the diesel calibration set were obtained, as well as the near-infrared spectrum matrix N V and the mid-infrared spectrum matrix M V of the validation set;
[0425] Step four: the spectra were pretreated, and the pretreatment methods included SG first derivative (SG 1 st D), SG second derivative (SG 2 nd D) and vector normalization (VN);
[0426] Step five: under the conditions of no pretreatment (None) and SG first derivative (SG 1 st D), SG second derivative (SG 2 nd D) and vector normalization (VN) pretreatment, a single spectrum partial least squares (PLS) detection model was established by the calibration set samples. After the PLS detection model was established, external verification was performed by using the validation set samples, and the results are shown in Table 1:
[0427] Table 1
[0428] In Table 1, the MIR-PLS model after VN pretreatment (VN-MIR-PLS) has the best prediction performance, the RMSEP value of the prediction validation set samples is the smallest, and the value is the largest, which are 2.45 and 0.90, respectively. Therefore, the RMSEP value of the VN-MIR-PLS model is selected as a threshold value for screening other models, so as to construct an optimized decision-level fusion model.
[0429] Step Six: Under the four preprocessing conditions described above, a data-level fusion (Low) model is established by splicing NIR and MIR. The spectra are shown in Figures 6(A), 6(B), 6(C), and 6(D). The specific steps are as follows:
[0430] The NIR and MIR spectra that have undergone the same preprocessing are fused, for example, those processed by SG 1 in step four. st After D preprocessing (this can be replaced with None or SG 2) nd The NIR and MIR matrices of the preprocessing conditions (D and VN) are respectively N SG 1stD and M SG1stD Then in SG 1 st Data-level fusion matrix L under D preprocessing conditions SG1stD For: L SG1stD =[N SG1stD M SG1stD ]
[0431] Establish a data-level fusion model and use the data-level fusion matrix L SG1stD By inputting the data-level fusion model, SG1 can be obtained. st The prediction result matrix Y of the data-level fusion model under D preprocessing conditions SG1stD-L-pred Simultaneously, the RMSEP and % of the data-level fusion model for the validation set samples were calculated under different preprocessing conditions.
[0432] The prediction results of the data-level fusion model validation set samples are shown in Table 2:
[0433] Table 2
[0434] In Table 2, the RMSEP value of the VN-MIR-PLS model is used as a threshold. Models with an RMSEP value lower than or equal to this threshold have passed SG2. nd The Low-PLS model (SG 2) established after D preprocessing nd The RMSEP values of the D-Low-PLS model and the Low-PLS model (VN-Low-PLS) established after VN preprocessing are 2.31 and 2.40, respectively.
[0435] Step 7: Under the four preprocessing conditions described above, feature variable screening is performed on the NIR and MIR data, including Competitive Adaptive Weighted Sampling (CARS) and Variable Importance Projection (VIP). The NIR and MIR feature variables selected by CARS and VIP are then fused. For example, the NIR and MIR feature variables selected in Step 4 (SG 1) are fused together. st After D preprocessing (this can be replaced with None or SG 2) ndNIR and MIR matrixes of D and VN pretreatment conditions, and then CARS (or VIP) is used to screen characteristic variables to obtain C NIR and C MIR . Then the characteristic-level fusion matrix M CARS is obtained by CARS screening CARS = [C NIR , C MIR ]
[0436] Meanwhile, a characteristic-level fusion model is established, and the characteristic-level fusion matrix M CARS is input into the characteristic-level fusion model to obtain the prediction result matrix Y st of the CARS characteristic-level fusion model under the SG 1 SG1stD-CARS-pred D pretreatment condition, and the RMSEP and R2 of the characteristic-level fusion model under different pretreatment conditions are calculated for the validation set samples
[0437] The prediction results of the characteristic-level fusion models established by CARS and VIP for the validation set samples are shown in Table 3:
[0438] Table 3
[0439] In Table 3, the models within the threshold of the RMSEP value of 2.45 are the CARS characteristic-level fusion model without spectral pretreatment condition (None-CARS-PLS), the CARS characteristic-level fusion model under the SG 1 st D pretreatment condition (SG 1 st D-CARS-PLS), the CARS characteristic-level fusion model under the VN pretreatment condition (VN-CARS-PLS), and the VIP characteristic-level fusion model under the SG 2 nd D pretreatment condition (SG 2 nd D-VIP-PLS), and the RMSEP values are 2.28, 1.86, 2.03 and 2.38 respectively.
[0440] Comparative Example
[0441] Step eight: the prediction results of all the single spectrum models, data-level fusion models and characteristic-level fusion models obtained in steps five, six and seven are fused to establish a non-optimized decision-level fusion (High) PLS model, and the specific steps are as follows:
[0442] The prediction results of all the single spectrum models, data-level fusion models and characteristic-level fusion models obtained in steps five, six and seven are fused, that is, Y NONE-N-pred , Y SG1stD-N-pred , Y SG2ndD-N-pred, …, fusion to obtain the non-optimized decision-level fusion matrix H: H = [Y NONE-N-pred ,Y SG1stD-N-pred ,Y SG2ndD-N-pred , …]
[0443] At the same time, the decision-level fusion matrix is established, and the non-optimized decision-level fusion matrix H is input into the decision-level fusion matrix to obtain the prediction result of the non-optimized decision-level fusion model, and the RMSEP of the model on the validation set samples and the R2 of the model on the validation set samples are calculated.
[0444] Embodiment
[0445] Step eight: combine the prediction results of the VN-MIR-PLS, SG 2 nd D-Low-PLS, VN-Low-PLS, None-CARS-PLS, SG 1 st D-CARS-PLS, VN-CARS-PLS, and SG 2 nd D-VIP-PLS models screened in steps five, six and seven to establish an optimized decision-level fusion (Opt-High) model, and the fusion process is repeated in step eight, and the prediction results of all single spectrum models, data-level fusion models and feature-level fusion models in step eight are replaced by the prediction results of the above models. The prediction results of the High-PLS (comparative example) and Opt-High-PLS model (the present application) on the calibration set and the validation set are shown in Table 4:
[0446] Table 4
[0447] As can be seen from Table 4, compared with the VN-MIR-PLS model, the RMSEP value of the High-PLS model established by the comparative example of fusing all model determination results is larger. This is because different spectral pretreatment methods and feature variable screening methods will cause the prediction error of the model to become larger, and the High-PLS model will amplify this part of the prediction error, resulting in a decrease in the prediction performance of the model. In contrast, the preferred model with the best prediction performance is used as the control group in the present application, and the Opt-High-PLS model established based on the prediction results of the preferred model can effectively improve the prediction performance of the model, and the RMSEP value is 1.59. Compared with the VN-MIR-PLS model and the High-PLS model, the RMSEP value is reduced by 35% and 38%, respectively, from 0.90 and 0.89 to 0.96.
[0448] Compared with a single spectrum model, the model established by the optimized decision-level fusion method has a 35% reduction in prediction error; compared with a model established by a non-optimized decision-level data fusion method, the prediction error is reduced by 38%, proving that the optimized decision-level data fusion method can effectively improve the prediction performance of the model.
[0449] The detection method based on multiple spectrum data fusion of the present application is a decision-level data fusion method based on near-infrared and mid-infrared spectra, which can accurately predict the flash point of diesel oil when detecting the flash point of diesel oil.
[0450] The present application establishes a partial least squares model by fusing near-infrared and mid-infrared spectra to determine the flash point of diesel oil. Under various spectrum pretreatment conditions, single spectrum models, data-level fusion models and feature-level fusion models are established by near-infrared and mid-infrared spectra. The prediction error of the single spectrum model with the optimal prediction performance is used as a threshold, and the screened models are combined to establish an optimized decision-level fusion model. Compared with single spectrum models and non-optimized decision-level fusion models, the optimized decision-level data fusion method can effectively reduce the prediction error of the model for unknown samples and improve the prediction performance.
[0451] It should be noted that in this document, the terms "comprising", "including", or any other variant thereof are intended to cover non-exclusive inclusions, so that a process, device, article or method including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, device, article or method. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of another identical element in the process, device, article or method including the element.
[0452] The above-mentioned embodiment numbers of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments. Through the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and necessary general hardware platform, of course, they can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, or network device, etc.) execute the methods described in various embodiments of the present application.
[0453] The above merely describes the preferred embodiments of the present application, and is not intended to limit the patent scope of the present application, and any equivalent structure or equivalent process conversion, or direct or indirect application in other related technical fields, which are made by using the content of the present application specification and drawings, are also included in the patent protection scope of the present application.
Claims
1. A detection method based on multi-spectral data fusion, characterized in that, The method comprises the following steps: Collecting spectra: collecting near-infrared spectra and mid-infrared spectra of the to-be-detected substance to obtain a near-infrared spectrum matrix and a mid-infrared spectrum matrix of the to-be-detected substance; Constructing a detection model: constructing a detection model by the following formula, Y = XP T BQ Wherein, X is an input matrix, Y is an output matrix, B is a coefficient matrix, P and Q are load matrices of X and Y respectively; Training the detection model; Predicting the detection index; The step of training the detection model comprises the following steps: Collecting training samples to construct a training set, wherein the training set comprises near-infrared spectra and mid-infrared spectra of a plurality of training samples and index values of the detection index of the plurality of training samples; Dividing the training set into a calibration set and a validation set to obtain a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an index matrix of the calibration set and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an index matrix of the validation set; Respectively performing spectral pretreatment on the near-infrared spectra and the mid-infrared spectra of the calibration set and the validation set to obtain a near-infrared spectrum pretreatment matrix and a mid-infrared spectrum pretreatment matrix of the calibration set and a near-infrared spectrum pretreatment matrix and a mid-infrared spectrum pretreatment matrix of the validation set; the spectral pretreatment comprises derivative processing or / and vector normalization processing, and the derivative processing comprises first-order derivative processing or / and high-order derivative processing; Respectively performing spectral variable screening processing on the near-infrared spectra, the mid-infrared spectra, the spectral pretreated near-infrared spectra and the spectral pretreated mid-infrared spectra of the calibration set and the validation set to obtain a near-infrared spectrum variable screening matrix, a mid-infrared spectrum variable screening matrix, a pretreated near-infrared spectrum variable screening matrix and a pretreated mid-infrared spectrum variable screening matrix of the calibration set and a near-infrared spectrum variable screening matrix, a mid-infrared spectrum variable screening matrix, a pretreated near-infrared spectrum variable screening matrix and a pretreated mid-infrared spectrum variable screening matrix of the validation set; the spectral variable screening processing comprises competitive adaptive reweighted sampling processing or / and variable importance projection processing; Inputting the near-infrared spectrum matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a first coefficient matrix; Inputting the mid-infrared spectrum matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a second coefficient matrix; Inputting the near-infrared spectrum pretreatment matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a third coefficient matrix; Inputting the mid-infrared spectrum pretreatment matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a fourth coefficient matrix; Inputting the near-infrared spectrum matrix of the calibration set into the detection model corresponding to the first coefficient matrix to obtain a calibration set first index prediction matrix composed of predicted values of the detection index of the calibration set; Inputting the mid-infrared spectrum matrix of the calibration set into the detection model corresponding to the second coefficient matrix to obtain a calibration set second index prediction matrix composed of predicted values of the detection index of the calibration set; Inputting the near-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the third coefficient matrix to obtain a calibration set third index prediction matrix composed of predicted values of the detection index of the calibration set; inputting the mid-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix to obtain a fourth index prediction matrix of the calibration set composed of predicted values of the detection index of the calibration set; inputting the near-infrared spectrum matrix of the verification set into the detection model corresponding to the first coefficient matrix to obtain a first index prediction matrix of the verification set composed of predicted values of the detection index of the verification set; inputting the mid-infrared spectrum matrix of the verification set into the detection model corresponding to the second coefficient matrix to obtain a second index prediction matrix of the verification set composed of predicted values of the detection index of the verification set; inputting the near-infrared spectrum pretreatment matrix of the verification set into the detection model corresponding to the third coefficient matrix to obtain a third index prediction matrix of the verification set composed of predicted values of the detection index of the verification set; inputting the mid-infrared spectrum pretreatment matrix of the verification set into the detection model corresponding to the fourth coefficient matrix to obtain a fourth index prediction matrix of the verification set composed of predicted values of the detection index of the verification set; obtaining a first verification value, a second verification value, a third verification value and a fourth verification value according to the verification index from the first index prediction matrix of the verification set, the second index prediction matrix of the verification set, the third index prediction matrix of the verification set, the fourth index prediction matrix of the verification set and the index matrix, wherein the verification index is used to represent the prediction performance of the detection model; taking the optimal values of the first verification value, the second verification value, the third verification value and the fourth verification value as the optimal verification value, taking the optimal verification value as the threshold value, and taking the range of the threshold value towards the direction of better prediction performance of the detection model as the threshold value range; performing data level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the calibration set to obtain a first data level fusion matrix of the calibration set, and inputting the first data level fusion matrix of the calibration set and the index matrix of the calibration set into the detection model to train the detection model, thereby obtaining a fifth coefficient matrix; performing data level fusion on the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the calibration set to obtain a second data level fusion matrix of the calibration set, and inputting the second data level fusion matrix of the calibration set and the index matrix of the calibration set into the detection model to train the detection model, thereby obtaining a sixth coefficient matrix; inputting the first data level fusion matrix of the calibration set as an input matrix into the detection model corresponding to the fifth coefficient matrix to obtain a fifth index prediction matrix of the calibration set composed of predicted values of the detection index of the calibration set; inputting the second data level fusion matrix of the calibration set as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a sixth index prediction matrix of the calibration set composed of predicted values of the detection index of the calibration set; inputting the first data level fusion matrix of the verification set composed of data level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the verification set as an input matrix into the detection model corresponding to the fifth coefficient matrix to obtain a fifth index prediction matrix of the verification set composed of predicted values of the detection index of the verification set; inputting the second data level fusion matrix of the verification set composed of data level fusion on the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the verification set as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a sixth index prediction matrix of the verification set composed of predicted values of the detection index of the verification set; The fifth verification value and the sixth verification value are obtained according to the verification indexes respectively by the verification set fifth index prediction matrix, the verification set sixth index prediction matrix and the index matrix; The near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set are subjected to feature-level fusion to form a calibration set first feature-level fusion matrix, and the calibration set first feature-level fusion matrix and the index matrix of the calibration set are input into the detection model to train the detection model, so as to obtain a seventh coefficient matrix; The near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set are subjected to feature-level fusion to form a calibration set first feature-level fusion matrix, and the calibration set first feature-level fusion matrix and the index matrix of the calibration set are input into the detection model to train the detection model, so as to obtain a seventh coefficient matrix; The near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set are subjected to feature-level fusion to form a calibration set first feature-level fusion matrix, and the calibration set first feature-level fusion matrix and the index matrix of the calibration set are input into the detection model to train the detection model, so as to obtain a seventh coefficient matrix; The near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set are subjected to feature-level fusion to form a calibration set first feature-level fusion matrix, and the calibration set first feature-level fusion matrix and the index matrix of the calibration set are input into the detection model to train the detection model, so as to obtain a seventh coefficient matrix; The near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set are subjected to feature-level fusion to form a calibration set first feature-level fusion matrix, and the calibration set first feature-level fusion matrix and the index matrix of the calibration set are input into the detection model to train the detection model, so as to obtain a seventh coefficient matrix; The near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set are subjected to feature-level fusion to form a calibration set first feature-level fusion matrix, and the calibration set first feature-level fusion matrix and the index matrix of the calibration set are input into the detection model to train the detection model, so as to obtain a seventh coefficient matrix; The seventh verification value and the eighth verification value are obtained according to the verification indexes respectively by the verification set seventh index prediction matrix, the verification set eighth index prediction matrix and the index matrix; The calibration set index matrix corresponding to the verification value group is subjected to decision-level fusion to obtain a calibration set decision-level fusion matrix, and the calibration set decision-level fusion matrix and the index matrix of the calibration set are input into the detection model to train the detection model, so as to obtain a ninth coefficient matrix, which is a coefficient matrix after training; The step of predicting the detection index comprises: The near-infrared spectrum matrix and the mid-infrared spectrum matrix of the to-be-detected substance are subjected to data-level fusion to obtain a spectrum fusion matrix; The spectrum fusion matrix of the to-be-detected substance is input into the trained detection model as an input matrix, and a first index matrix is obtained as an output matrix; the first index matrix is taken as a detection result of the detection index of the to-be-detected substance. The index matrix is a matrix composed of index values of the detection index measured by a standard method; the first index matrix is a matrix composed of index values of the detection index predicted by the detection model; the detection index comprises one or more of a flash point, a pour point, a density and a kinematic viscosity. The verification indexes comprise a determination coefficient or / and a prediction root mean square error.
2. The detection method based on multi-spectral data fusion according to claim 1, characterized in that, Or / and, the optimal verification value is the minimum value of the predicted root mean square error or / and the maximum value of the determination coefficient; the threshold range is not greater than the minimum value of the predicted root mean square error or / and not less than the maximum value of the determination coefficient; Or / and, the step of predicting the detection index further comprises: Inputting the near-infrared spectrum matrix of the to-be-detected substance as an input matrix into the trained detection model to obtain a second index matrix as an output matrix; Inputting the mid-infrared spectrum matrix of the to-be-detected substance as an input matrix into the trained detection model to obtain a third index matrix as an output matrix; Performing decision-level fusion on the first index matrix, the second index matrix and the third index matrix to obtain a fourth index matrix; Inputting the fourth index matrix as an input matrix into the trained detection model to obtain a fifth index matrix as an output matrix; and taking the fifth index matrix as the detection result of the detection index of the to-be-detected substance; Wherein, the second index matrix, the third index matrix and the fifth index matrix are matrices composed of index values of the detection index predicted by the detection model; Or / and, the step of predicting the detection index further comprises: Spectrum pretreatment: performing spectrum pretreatment on the spectrum data of the near-infrared spectrum of the to-be-detected substance to form a first spectrum matrix; and performing spectrum pretreatment on the spectrum data of the mid-infrared spectrum of the to-be-detected substance to form a second spectrum matrix; the spectrum pretreatment comprises derivative processing or / and vector normalization processing, and the derivative processing comprises first derivative processing or / and high-order derivative processing; The step of predicting the detection index further comprises: Performing data-level fusion on the first spectrum matrix and the second spectrum matrix to form a first fusion matrix; Inputting the first spectrum matrix as an input matrix into the trained detection model to obtain a sixth index matrix as an output matrix; Inputting the second spectrum matrix as an input matrix into the trained detection model to obtain a seventh index matrix as an output matrix; Inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth index matrix as an output matrix; Performing decision-level fusion on the sixth index matrix, the seventh index matrix and the eighth index matrix to form a fourth index matrix.
3. The method of claim 1, wherein the method is based on multi-spectral data fusion. The step of predicting the detection index further comprises: Spectrum variable screening: performing spectrum variable screening processing on the near-infrared spectrum and the mid-infrared spectrum of the to-be-detected substance to form a third spectrum matrix and a fourth spectrum matrix; the spectrum variable screening processing comprises variable importance projection processing; The step of predicting the detection index further comprises: Performing feature-level fusion on the third spectrum matrix and the fourth spectrum matrix to form a second fusion matrix; Inputting the third spectrum matrix as an input matrix into the trained detection model to obtain a ninth index matrix as an output matrix; Inputting the fourth spectrum matrix as an input matrix into the trained detection model to obtain a tenth index matrix as an output matrix; Inputting the second fusion matrix as an input matrix into the trained detection model to obtain an eleventh index matrix as an output matrix; Performing decision-level fusion on the ninth index matrix, the tenth index matrix and the eleventh index matrix to form a fourth index matrix; Preferably, the step of predicting the detection index further comprises: Spectrum pretreatment: performing spectrum pretreatment on spectrum data of the near-infrared spectrum of the to-be-tested substance to form a first spectrum matrix; performing spectrum pretreatment on spectrum data of the mid-infrared spectrum of the to-be-tested substance to form a second spectrum matrix; the spectrum pretreatment includes derivative processing or / and vector normalization processing, and the derivative processing includes first derivative processing or / and high-order derivative processing; Spectrum variable screening: performing spectrum variable screening processing on the first spectrum matrix and the second spectrum matrix of the to-be-tested substance respectively to form a fifth spectrum matrix and a sixth spectrum matrix; the spectrum variable screening processing includes variable importance projection processing; The step of predicting the detection index further includes: performing data-level fusion on the first spectrum matrix and the second spectrum matrix to form a first fusion matrix; performing feature-level fusion on the fifth spectrum matrix and the sixth spectrum matrix to form a third fusion matrix; inputting the first spectrum matrix as an input matrix into the trained detection model to obtain a sixth index matrix as an output matrix; inputting the second spectrum matrix as an input matrix into the trained detection model to obtain a seventh index matrix as an output matrix; inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth index matrix as an output matrix; inputting the third fusion matrix as an input matrix into the trained detection model to obtain a twelfth index matrix as an output matrix; performing decision-level fusion on the sixth index matrix, the seventh index matrix, the eighth index matrix and the twelfth index matrix to form a fourth index matrix.
4. The method of claim 1, wherein the method is based on multi-spectral data fusion. The step of training the detection model includes: collecting training samples to construct a training set, and the training set includes near-infrared spectrum and mid-infrared spectrum of a plurality of training samples and index values of detection indexes of the plurality of training samples; dividing the training set into a calibration set and a validation set to obtain near-infrared spectrum matrices, mid-infrared spectrum matrices and index matrices of the calibration set and near-infrared spectrum matrices, mid-infrared spectrum matrices and index matrices of the validation set; performing spectrum pretreatment on the near-infrared spectrum and the mid-infrared spectrum of the calibration set and the validation set respectively to obtain near-infrared spectrum pretreatment matrices and mid-infrared spectrum pretreatment matrices of the calibration set and near-infrared spectrum pretreatment matrices and mid-infrared spectrum pretreatment matrices of the validation set; the spectrum pretreatment includes derivative processing or / and vector normalization processing, and the derivative processing includes first derivative processing or / and high-order derivative processing; performing spectrum variable screening processing on the spectrum pretreated near-infrared spectrum and the spectrum pretreated mid-infrared spectrum of the calibration set and the validation set respectively to obtain pretreated near-infrared spectrum variable screening matrices and pretreated mid-infrared spectrum variable screening matrices of the calibration set and pretreated near-infrared spectrum variable screening matrices and pretreated mid-infrared spectrum variable screening matrices of the validation set; the spectrum variable screening processing includes competitive adaptive reweighted sampling processing or / and variable importance projection processing; inputting the near-infrared spectrum pretreatment matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a third coefficient matrix; inputting the mid-infrared spectrum pretreatment matrix and the index matrix of the calibration set into the detection model to train the detection model to obtain a fourth coefficient matrix; inputting the near-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the third coefficient matrix to obtain a third index prediction matrix of the calibration set composed of predicted values of the detection index of the calibration set; inputting the mid-infrared spectrum pretreatment matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix to obtain a fourth index prediction matrix of the calibration set composed of predicted values of the detection index of the calibration set; inputting the near-infrared spectrum pretreatment matrix of the validation set into the detection model corresponding to the third coefficient matrix to obtain a third index prediction matrix of the validation set composed of predicted values of the detection index of the validation set; inputting the mid-infrared spectrum pretreatment matrix of the validation set into the detection model corresponding to the fourth coefficient matrix to obtain a fourth index prediction matrix of the validation set composed of predicted values of the detection index of the validation set; obtaining third verification values and fourth verification values from the third index prediction matrix of the validation set, the fourth index prediction matrix of the validation set and the index matrix according to a verification index, wherein the verification index is used to represent the prediction performance of the detection model, and preferably, the verification index comprises a determination coefficient or / and a prediction root mean square error; taking the optimal values of the third verification values and the fourth verification values as optimal verification values, taking the optimal verification values as a threshold value, taking a range of the threshold value towards a direction in which the prediction performance of the detection model is improved as a threshold value range, and preferably, the optimal verification values are the minimum values of the prediction root mean square error or / and the maximum values of the determination coefficient; and the threshold value range is not greater than the minimum values of the prediction root mean square error or / and not less than the maximum values of the determination coefficient; performing data level fusion on the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the calibration set to obtain a second data level fusion matrix of the calibration set, and inputting the second data level fusion matrix of the calibration set and the index matrix of the calibration set into the detection model to train the detection model and obtain a sixth coefficient matrix; inputting the second data level fusion matrix of the calibration set as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a sixth index prediction matrix of the calibration set composed of predicted values of the detection index of the calibration set; inputting the second data level fusion matrix of the validation set as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a sixth index prediction matrix of the validation set composed of predicted values of the detection index of the validation set; obtaining a sixth verification value from the sixth index prediction matrix of the validation set and the index matrix according to the verification index; performing feature level fusion on the pretreatment near-infrared spectrum variable screening matrix and the pretreatment mid-infrared spectrum variable screening matrix of the calibration set to obtain a second feature level fusion matrix of the calibration set, and inputting the second feature level fusion matrix of the calibration set and the index matrix of the calibration set into the detection model to train the detection model and obtain an eighth coefficient matrix; inputting the second feature level fusion matrix of the calibration set as an input matrix into the detection model corresponding to the eighth coefficient matrix to obtain an eighth index prediction matrix of the calibration set composed of predicted values of the detection index of the calibration set; and The second feature level fusion matrix of the verification set formed by data level fusion of the pretreated near-infrared spectrum variable screening matrix and the pretreated mid-infrared spectrum variable screening matrix of the verification set is taken as an input matrix, and the eighth coefficient matrix corresponding to the detection model is input to obtain the eighth index prediction matrix of the verification set formed by the predicted values of the detection indexes of the verification set; The eighth verification value is obtained according to the verification index through the eighth index prediction matrix of the verification set and the index matrix; The third verification value, the fourth verification value, the sixth verification value and the eighth verification value are screened according to the threshold range, and a verification value group within the threshold range is screened out; The index matrix of the calibration set corresponding to the verification value group is subjected to decision level fusion to obtain a calibration set decision level fusion matrix, the calibration set decision level fusion matrix and the index matrix of the calibration set are input into the detection model, the detection model is trained, and the ninth coefficient matrix is obtained, which is the coefficient matrix after training.
5. The method of claim 1, wherein the method is based on multi-spectral data fusion. In the step of dividing the training set into the calibration set and the verification set: The calibration set and the verification set are randomly divided from the training set at a ratio of 2:1-4:1, and preferably at a ratio of 3:
1.
6. The method of claim 1, wherein the method is based on multi-spectral data fusion. In the step of training the detection model, there are multiple spectrum pretreatment and / or spectrum variable screening processes, and each spectrum pretreatment, each spectrum variable screening process and each combination of spectrum pretreatment and spectrum variable screening process is used to train the training model.
7. The detection method based on multi-spectral data fusion according to any one of claims 1-6, characterized in that, The method of data level fusion, feature level fusion and decision level fusion includes: Same dimension matrix splicing for data level fusion, feature level fusion or decision level fusion.
8. A detection system based on fusion of multiple spectral data, characterized in that, It includes: The acquisition module acquires the near-infrared spectrum and the mid-infrared spectrum of the to-be-measured substance to obtain a near-infrared spectrum matrix and a mid-infrared spectrum matrix of the to-be-measured substance; The detection model construction module constructs the detection model by the following formula, Y = XP T BQ Wherein, X is an input matrix, Y is an output matrix, B is a coefficient matrix, P and Q are load matrices of X and Y respectively; The training module trains the detection model; The detection module predicts the detection index; The training module includes: The training set construction unit constructs a training set by collecting training samples, and the training set includes the near-infrared spectrum and the mid-infrared spectrum of multiple training samples and the index values of the detection indexes of multiple training samples; The training set division unit divides the training set constructed by the training set construction unit into a calibration set and a verification set to obtain the near-infrared spectrum matrix, the mid-infrared spectrum matrix and the index matrix of the calibration set and the near-infrared spectrum matrix, the mid-infrared spectrum matrix and the index matrix of the verification set; The spectrum pretreatment unit performs spectrum pretreatment on the near-infrared spectrum and the mid-infrared spectrum of the calibration set and the verification set obtained by the training set division unit respectively to obtain the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the calibration set and the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the verification set; The spectral variable screening unit respectively performs spectral variable screening processing on the near-infrared spectrum, the mid-infrared spectrum, the near-infrared spectrum after spectral preprocessing and the mid-infrared spectrum after spectral preprocessing of the calibration set and the validation set obtained by the training set division unit, to obtain the near-infrared spectrum variable screening matrix, the mid-infrared spectrum variable screening matrix, the preprocessing near-infrared spectrum variable screening matrix and the preprocessing mid-infrared spectrum variable screening matrix of the calibration set, and the near-infrared spectrum variable screening matrix, the mid-infrared spectrum variable screening matrix, the preprocessing near-infrared spectrum variable screening matrix and the preprocessing mid-infrared spectrum variable screening matrix of the validation set; The first training unit inputs the near-infrared spectrum matrix and the index matrix of the calibration set obtained by the training set division unit into the detection model, trains the detection model, and obtains a first coefficient matrix; The second training unit inputs the mid-infrared spectrum matrix and the index matrix of the calibration set obtained by the training set division unit into the detection model, trains the detection model, and obtains a second coefficient matrix; The third training unit inputs the near-infrared spectrum preprocessing matrix and the index matrix of the calibration set obtained by the spectral preprocessing unit into the detection model, trains the detection model, and obtains a third coefficient matrix; The fourth training unit inputs the mid-infrared spectrum preprocessing matrix and the index matrix of the calibration set obtained by the spectral preprocessing unit into the detection model, trains the detection model, and obtains a fourth coefficient matrix; The first prediction unit inputs the near-infrared spectrum matrix of the calibration set obtained by the training set division unit into the detection model corresponding to the first coefficient matrix, to obtain a calibration set first index prediction matrix composed of predicted values of the detection index of the calibration set; The second prediction unit inputs the mid-infrared spectrum matrix of the calibration set obtained by the training set division unit into the detection model corresponding to the second coefficient matrix, to obtain a calibration set second index prediction matrix composed of predicted values of the detection index of the calibration set; The third prediction unit inputs the near-infrared spectrum preprocessing matrix of the calibration set obtained by the spectral preprocessing unit into the detection model corresponding to the third coefficient matrix, to obtain a calibration set third index prediction matrix composed of predicted values of the detection index of the calibration set; The fourth prediction unit inputs the mid-infrared spectrum preprocessing matrix of the calibration set obtained by the spectral preprocessing unit into the detection model corresponding to the fourth coefficient matrix, to obtain a calibration set fourth index prediction matrix composed of predicted values of the detection index of the calibration set; The fifth prediction unit inputs the near-infrared spectrum matrix of the validation set obtained by the training set division unit into the detection model corresponding to the first coefficient matrix, to obtain a validation set first index prediction matrix composed of predicted values of the detection index of the validation set; The sixth prediction unit inputs the mid-infrared spectrum matrix of the validation set obtained by the training set division unit into the detection model corresponding to the second coefficient matrix, to obtain a validation set second index prediction matrix composed of predicted values of the detection index of the validation set; The seventh prediction unit inputs the near-infrared spectrum preprocessing matrix of the validation set obtained by the spectral preprocessing unit into the detection model corresponding to the third coefficient matrix, to obtain a validation set third index prediction matrix composed of predicted values of the detection index of the validation set; The eighth prediction unit inputs the mid-infrared spectrum pretreatment matrix of the verification set obtained by the spectrum pretreatment unit into the detection model corresponding to the fourth coefficient matrix to obtain a verification set fourth index prediction matrix composed of predicted values of the detection index of the verification set; The first verification unit obtains a first verification value, a second verification value, a third verification value and a fourth verification value from the first index prediction matrix of the verification set obtained by the fifth prediction unit, the second index prediction matrix of the verification set obtained by the sixth prediction unit, the third index prediction matrix of the verification set obtained by the seventh prediction unit, the fourth index prediction matrix of the verification set obtained by the eighth prediction unit and the index matrix obtained by the training set division unit according to a verification index, wherein the verification index is used to represent the prediction performance of the detection model, and preferably, the verification index includes a determination coefficient or / and a prediction root mean square error; The threshold range obtaining unit takes the optimal values of the first verification value, the second verification value, the third verification value and the fourth verification value obtained by the first verification unit as optimal verification values, takes the optimal verification values as thresholds, and takes the range of the thresholds towards the direction in which the prediction performance of the detection model is improved as a threshold range, and preferably, the optimal verification values are the minimum value of the prediction root mean square error or / and the maximum value of the determination coefficient; and the threshold range is not greater than the minimum value of the prediction root mean square error or / and not less than the maximum value of the determination coefficient; The fifth training unit performs data level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the correction set obtained by the training set division unit to obtain a correction set first data level fusion matrix, and inputs the correction set first data level fusion matrix and the index matrix of the correction set into the detection model to train the detection model to obtain a fifth coefficient matrix; The sixth training unit performs data level fusion on the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the correction set obtained by the spectrum pretreatment unit to obtain a correction set second data level fusion matrix, and inputs the correction set second data level fusion matrix and the index matrix of the correction set into the detection model to train the detection model to obtain a sixth coefficient matrix; The ninth prediction unit inputs the correction set first data level fusion matrix as an input matrix into the detection model corresponding to the fifth coefficient matrix to obtain a correction set fifth index prediction matrix composed of predicted values of the detection index of the correction set; The tenth prediction unit inputs the correction set second data level fusion matrix as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a correction set sixth index prediction matrix composed of predicted values of the detection index of the verification set; The eleventh prediction unit inputs a verification set first data level fusion matrix composed of data level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the verification set as an input matrix into the detection model corresponding to the fifth coefficient matrix to obtain a verification set fifth index prediction matrix composed of predicted values of the detection index of the verification set; The twelfth prediction unit inputs a verification set second data level fusion matrix composed of data level fusion on the near-infrared spectrum pretreatment matrix and the mid-infrared spectrum pretreatment matrix of the verification set as an input matrix into the detection model corresponding to the sixth coefficient matrix to obtain a verification set sixth index prediction matrix composed of predicted values of the detection index of the verification set; The second verification unit obtains a fifth verification value and a sixth verification value according to the verification indexes by verifying the fifth index prediction matrix of the verification set, the sixth index prediction matrix of the verification set and the index matrix; The seventh training unit inputs the first feature-level fusion matrix of the calibration set, which is formed by performing feature-level fusion on the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set, and the index matrix of the calibration set into the detection model, trains the detection model, and obtains a seventh coefficient matrix; The eighth training unit inputs the second feature-level fusion matrix of the calibration set, which is formed by performing feature-level fusion on the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set, and the index matrix of the calibration set into the detection model, trains the detection model, and obtains an eighth coefficient matrix; The thirteenth prediction unit inputs the first feature-level fusion matrix of the calibration set into the detection model corresponding to the seventh coefficient matrix to obtain a seventh index prediction matrix of the calibration set, which is formed by the prediction values of the detection indexes of the calibration set; The fourteenth prediction unit inputs the second feature-level fusion matrix of the calibration set into the detection model corresponding to the eighth coefficient matrix to obtain an eighth index prediction matrix of the calibration set, which is formed by the prediction values of the detection indexes of the calibration set; The fifteenth prediction unit inputs the first feature-level fusion matrix of the verification set, which is formed by performing feature-level fusion on the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the verification set, into the detection model corresponding to the seventh coefficient matrix to obtain a seventh index prediction matrix of the verification set, which is formed by the prediction values of the detection indexes of the verification set; The sixteenth prediction unit inputs the second feature-level fusion matrix of the verification set, which is formed by performing data-level fusion on the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the verification set, into the detection model corresponding to the eighth coefficient matrix to obtain an eighth index prediction matrix of the verification set, which is formed by the prediction values of the detection indexes of the verification set; The third verification unit obtains a seventh verification value and an eighth verification value according to the verification indexes by verifying the seventh index prediction matrix of the verification set, the eighth index prediction matrix of the verification set and the index matrix; The verification value screening unit screens the first verification value to the eighth verification value according to the threshold range, and screens out a verification value group in the threshold range; The ninth training unit performs decision-level fusion on the index matrix of the calibration set corresponding to the verification value group to obtain a calibration set decision-level fusion matrix, inputs the calibration set decision-level fusion matrix and the index matrix of the calibration set into the detection model, trains the detection model, and obtains a ninth coefficient matrix, which is a coefficient matrix after training; The detection module comprises: The data-level fusion unit performs data-level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the to-be-detected substance to obtain a spectrum fusion matrix; The prediction unit inputs the spectrum fusion matrix obtained by the data-level fusion unit into the trained detection model as an input matrix, obtains a first index matrix as an output matrix, and takes the first index matrix as the detection result of the detection indexes of the to-be-detected substance. The index matrix is a matrix composed of index values of detection indexes measured by a standard method; the first index matrix is a matrix composed of index values of detection indexes predicted by the detection model; the detection indexes include one or more of flash point, pour point, density, and kinematic viscosity; Preferably, the detection module further comprises: The decision-level fusion unit inputs the near-infrared spectrum matrix of the to-be-tested substance as an input matrix into the trained detection model to obtain a second index matrix as an output matrix; inputs the mid-infrared spectrum matrix of the to-be-tested substance as an input matrix into the trained detection model to obtain a third index matrix as an output matrix; and performs decision-level fusion on the first index matrix, the second index matrix, and the third index matrix to obtain a fourth index matrix. The prediction unit inputs the fourth index matrix of the decision-level fusion unit as an input matrix into the trained detection model to obtain a fifth index matrix as an output matrix; and takes the fifth index matrix as the detection result of the to-be-tested substance. The second index matrix, the third index matrix, and the fifth index matrix are matrices composed of index values of detection indexes predicted by the detection model.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium comprises a multi-spectrum data fusion program, and the multi-spectrum data fusion program, when executed by a processor, implements the steps of the multi-spectrum data fusion method according to any one of claims 1-7.
10. An electronic device, comprising: The computer readable storage medium comprises a multi-spectrum data fusion program, and the multi-spectrum data fusion program, when executed by a processor, implements the steps of the multi-spectrum data fusion method according to any one of claims 1-7. The computer readable storage medium comprises a multi-spectrum data fusion program, and the multi-spectrum data fusion program, when executed by a processor, implements the steps of the multi-spectrum data fusion method according to any one of claims 1-7.
Citation Information
Patent Citations
Quantitative detection method for caprolactam in bio-based food packaging film
CN111595807A
Nondestructive testing method for caprolactam content in sauce food
CN112179871A
Trace additive detection technology based on infrared multi-source spectrum
CN114062300A
Pit mud quality detection method based on near infrared-intermediate infrared fusion algorithm
CN114441468A
Rice category identification model, construction method thereof and method for identifying rice category
CN115452758A