Detection method, system, medium and device based on fusion of multiple spectral data
Through a variety of spectral data fusion technologies, combining near-infrared and mid-infrared spectral data, an oil detection model is constructed, which solves the problem that a single spectral technology cannot obtain rich chemical information, and significantly improves the detection and prediction performance.
Patent Information
- Application Number
- CN202410697313.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-05-31
AI Technical Summary
The existing rapid detection methods for oil products rely on a single spectral technology and cannot obtain more comprehensive and reliable chemical information, resulting in limited predictive performance.
Using a method based on the fusion of multiple spectral data, we use data-level, feature-level and decision-level fusions to build detection models to improve prediction performance by collecting near-infrared and mid-infrared spectral data.
It achieves the acquisition of more comprehensive and reliable chemical information, improves the comprehensiveness, accuracy and reliability of the detection model, and improves the prediction performance.
Smart Images

Figure CN118603931B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of gasoline and diesel detection, and in particular to a method, system, medium and device based on multiple spectral data fusion. Background Art
[0002] There are two main methods for rapid detection of oil products:
[0003] One is to combine near-infrared spectroscopy with chemometric models. For example, near-infrared spectroscopy is used to establish a chemometric model to determine the ethanol content in ethanol gasoline.
[0004] The other is mid-infrared spectroscopy combined with chemometric models. For example, the diesel cetane number is determined using mid-infrared spectroscopy combined with chemometric models.
[0005] Both of the above methods use a single spectral technology to obtain the chemical information of the components to be tested (using near-infrared spectroscopy or mid-infrared spectroscopy), which has the disadvantage of obtaining a relatively one-sided chemical information of the components to be tested. For example, the near-infrared spectroscopy of the first oil rapid detection method can only obtain the frequency harmonics and combination frequency information of the hydrogen-containing group vibration; the mid-infrared spectroscopy of the second oil rapid detection method can only obtain the fundamental frequency information of the supplementary hydrogen-containing group. Therefore, a single spectrum cannot obtain more comprehensive, more reliable and richer chemical information. For this reason, there is still room for improvement in the prediction performance of a single spectral model (for example, determining the flash point of diesel). Summary of the invention
[0006] The present invention provides a detection method based on the fusion of multiple spectral data, comprising:
[0007] Spectrum collection: collecting near-infrared spectrum and mid-infrared spectrum of the substance to be tested, and obtaining near-infrared spectrum matrix and mid-infrared spectrum matrix of the substance to be tested;
[0008] Construct the detection model: Construct the detection model through the following formula,
[0009]
[0010] in, is the input matrix, is the output matrix, B is the coefficient matrix, P and Q are the loading matrices of X and Y respectively;
[0011] Train the detection model;
[0012] Predictive testing indicators;
[0013] The step of training the detection model includes:
[0014] Collecting training samples to construct a training set, wherein the training set includes near-infrared spectra and mid-infrared spectra of a plurality of training samples and index values of detection indexes of a plurality of training samples;
[0015] The training set is divided into a calibration set and a validation set, and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an indicator matrix of the calibration set and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an indicator matrix of the validation set are obtained;
[0016] Performing spectral preprocessing on the near-infrared spectra and mid-infrared spectra of the calibration set and the validation set respectively, obtaining the near-infrared spectrum preprocessing matrix and mid-infrared spectrum preprocessing matrix of the calibration set and the near-infrared spectrum preprocessing matrix and mid-infrared spectrum preprocessing matrix of the validation set; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing;
[0017] The near infrared spectra, mid-infrared spectra, near infrared spectra after spectral preprocessing and mid-infrared spectra after spectral preprocessing of the calibration set and the validation set are respectively subjected to spectral variable screening processing to obtain the near infrared spectra variable screening matrix, mid-infrared spectra variable screening matrix, preprocessed near infrared spectra variable screening matrix and preprocessed mid-infrared spectra variable screening matrix of the calibration set and the near infrared spectra variable screening matrix, mid-infrared spectra variable screening matrix, preprocessed near infrared spectra variable screening matrix and preprocessed mid-infrared spectra variable screening matrix of the validation set; the spectral variable screening processing includes competitive adaptive weighted sampling processing and / or variable importance projection processing;
[0018] Inputting the near infrared spectrum matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a first coefficient matrix;
[0019] Inputting the mid-infrared spectrum matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a second coefficient matrix;
[0020] Inputting the near infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a third coefficient matrix;
[0021] Inputting the mid-infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a fourth coefficient matrix;
[0022] Inputting the near infrared spectrum matrix of the calibration set into the detection model corresponding to the first coefficient matrix to obtain the first indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set;
[0023] Inputting the mid-infrared spectrum matrix of the calibration set into the detection model corresponding to the second coefficient matrix, obtaining the calibration set second index prediction matrix composed of the predicted values of the detection indexes of the calibration set;
[0024] Inputting the near infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the third coefficient matrix, obtaining the calibration set third index prediction matrix composed of the predicted values of the detection indexes of the calibration set;
[0025] Inputting the mid-infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix, obtaining the fourth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set;
[0026] Inputting the near infrared spectrum matrix of the validation set into the detection model corresponding to the first coefficient matrix to obtain the first indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0027] Inputting the mid-infrared spectrum matrix of the validation set into the detection model corresponding to the second coefficient matrix, obtaining the second indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0028] Inputting the near infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the third coefficient matrix, obtaining the third indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0029] Inputting the mid-infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the fourth coefficient matrix, obtaining the fourth indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0030] Through the first indicator prediction matrix of the verification set, the second indicator prediction matrix of the verification set, the third indicator prediction matrix of the verification set, the fourth indicator prediction matrix of the verification set and the indicator matrix, a first verification value, a second verification value, a third verification value and a fourth verification value are respectively obtained according to the verification indicators, and the verification indicators are used to characterize the prediction performance of the detection model;
[0031] The optimal value of the first verification value, the second verification value, the third verification value, and the fourth verification value is used as the optimal verification value, the optimal verification value is used as the threshold, and the range of the threshold in the direction where the prediction performance of the detection model becomes better is used as the threshold range;
[0032] The near-infrared spectrum matrix and the mid-infrared spectrum matrix of the calibration set are fused at the data level to form the first data-level fusion matrix of the calibration set, and the matrix and the indicator matrix of the calibration set are input into the detection model to train the detection model, so as to obtain the fifth coefficient matrix;
[0033] The near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the calibration set are fused at the data level to form the second data-level fusion matrix of the calibration set, and the index matrix of the calibration set is input into the detection model to train the detection model to obtain the sixth coefficient matrix;
[0034] The first data-level fusion matrix of the calibration set is used as an input matrix, and the detection model corresponding to the fifth coefficient matrix is input to obtain the fifth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set;
[0035] The second data level fusion matrix of the calibration set is used as the input matrix, and the detection model corresponding to the sixth coefficient matrix is input to obtain the sixth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the validation set;
[0036] The first data-level fusion matrix of the validation set formed by data-level fusion of the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the validation set is used as the input matrix, and the detection model corresponding to the fifth coefficient matrix is input to obtain the fifth indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set;
[0037] The second data-level fusion matrix of the validation set formed by data-level fusion of the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the validation set is used as the input matrix, and the detection model corresponding to the sixth coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the sixth indicator prediction matrix of the validation set;
[0038] Through the fifth indicator prediction matrix of the verification set, the sixth indicator prediction matrix of the verification set, and the indicator matrix, the fifth verification value and the sixth verification value are obtained according to the verification indicators respectively;
[0039] The near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set are fused at the feature level to form the first feature-level fusion matrix of the calibration set, and the matrix and the indicator matrix of the calibration set are input into the detection model to train the detection model to obtain the seventh coefficient matrix;
[0040] The preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set are subjected to feature-level fusion to form the second feature-level fusion matrix of the calibration set, and the matrix and the indicator matrix of the calibration set are input into the detection model to train the detection model to obtain the eighth coefficient matrix;
[0041] The first feature level fusion matrix of the calibration set is used as an input matrix, and the detection model corresponding to the seventh coefficient matrix is input to obtain the seventh indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set;
[0042] The second feature level fusion matrix of the calibration set is used as an input matrix, and the detection model corresponding to the eighth coefficient matrix is input to obtain the eighth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set;
[0043] The first feature-level fusion matrix of the validation set formed by feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the validation set is used as the input matrix, and the detection model corresponding to the seventh coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the seventh indicator prediction matrix of the validation set;
[0044] The second feature-level fusion matrix of the validation set formed by data-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set is used as the input matrix, and the detection model corresponding to the eighth coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the eighth indicator prediction matrix of the validation set;
[0045] Through the seventh indicator prediction matrix of the verification set, the eighth indicator prediction matrix of the verification set, and the indicator matrix, the seventh verification value and the eighth verification value are obtained according to the verification indicators respectively;
[0046] Screening the first to eighth verification values according to the threshold range to select a verification value group within the threshold range;
[0047] The correction set indicator matrix corresponding to the verification value group is subjected to decision-level fusion to obtain the correction set decision-level fusion matrix, the correction set decision-level fusion matrix and the correction set indicator matrix are input into the detection model, the detection model is trained to obtain the ninth coefficient matrix, and the ninth coefficient matrix is the coefficient matrix after training;
[0048] The step of predicting the detection index includes:
[0049] The near-infrared spectrum matrix and the mid-infrared spectrum matrix of the substance to be tested are fused at the data level to obtain a spectrum fusion matrix;
[0050] Inputting the spectrum fusion matrix of the substance to be detected into the trained detection model as an input matrix to obtain a first indicator matrix as an output matrix; using the first indicator matrix as a detection result of the detection indicator of the substance to be detected;
[0051] Among them, the indicator matrix is a matrix composed of indicator values of detection indicators measured by standard methods; the first indicator matrix is a matrix composed of indicator values of detection indicators predicted by the detection model; the detection indicators include one or more of flash point, pour point, density and kinematic viscosity.
[0052] According to one aspect of the present invention, the validation index includes a determination coefficient and / or a prediction root mean square error.
[0053] According to one aspect of the present invention, the optimal verification value is the minimum value of the predicted root mean square error and / or the maximum value of the determination coefficient; the threshold range is not greater than the minimum value of the predicted root mean square error and / or not less than the maximum value of the determination coefficient.
[0054] According to one aspect of the present invention, the step of predicting the detection index further includes:
[0055] Inputting the near infrared spectrum matrix of the substance to be tested into the trained detection model as an input matrix to obtain a second indicator matrix as an output matrix;
[0056] Inputting the mid-infrared spectrum matrix of the substance to be tested into the trained detection model as an input matrix, and obtaining a third indicator matrix as an output matrix;
[0057] The first indicator matrix, the second indicator matrix and the third indicator matrix are fused at the decision level to obtain a fourth indicator matrix;
[0058] Input the fourth indicator matrix as an input matrix into the trained detection model to obtain a fifth indicator matrix as an output matrix; and use the fifth indicator matrix as a detection result of the detection index of the substance to be detected;
[0059] Among them, the second indicator matrix, the third indicator matrix and the fifth indicator matrix are matrices composed of indicator values of the detection indicators predicted by the detection model.
[0060] According to one aspect of the present invention, the step of predicting the detection index also includes:
[0061] Spectral preprocessing: performing spectral preprocessing on the spectral data of the near-infrared spectrum of the substance to be tested to form a first spectral matrix; performing spectral preprocessing on the spectral data of the mid-infrared spectrum of the substance to be tested to form a second spectral matrix; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing;
[0062] The step of predicting the detection index also includes:
[0063] fusing the first spectral matrix and the second spectral matrix at data level to form a first fused matrix;
[0064] Inputting the first spectral matrix as an input matrix into the trained detection model to obtain a sixth indicator matrix as an output matrix;
[0065] Inputting the second spectral matrix as an input matrix into the trained detection model to obtain a seventh indicator matrix as an output matrix;
[0066] Inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth indicator matrix as an output matrix;
[0067] The sixth indicator matrix, the seventh indicator matrix and the eighth indicator matrix are integrated at the decision level to form the fourth indicator matrix.
[0068] According to one aspect of the present invention, the step of predicting the detection index also includes:
[0069] Spectral variable screening: performing spectral variable screening processing on the near infrared spectrum and mid-infrared spectrum of the substance to be tested respectively to form a third spectral matrix and a fourth spectral matrix; the spectral variable screening processing includes variable importance projection processing;
[0070] The step of predicting the detection index also includes:
[0071] Performing feature-level fusion on the third spectral matrix and the fourth spectral matrix to form a second fusion matrix;
[0072] Inputting the third spectral matrix as an input matrix into the trained detection model to obtain a ninth indicator matrix as an output matrix;
[0073] Inputting the fourth spectral matrix as an input matrix into the trained detection model to obtain a tenth indicator matrix as an output matrix;
[0074] Inputting the second fusion matrix as an input matrix into the trained detection model to obtain an eleventh indicator matrix as an output matrix;
[0075] The ninth indicator matrix, the tenth indicator matrix and the eleventh indicator matrix are integrated at the decision-making level to form a fourth indicator matrix;
[0076] Preferably, before the step of predicting the detection index, the step also includes:
[0077] Spectral preprocessing: performing spectral preprocessing on the spectral data of the near-infrared spectrum of the substance to be tested to form a first spectral matrix; performing spectral preprocessing on the spectral data of the mid-infrared spectrum of the substance to be tested to form a second spectral matrix; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing;
[0078] Spectral variable screening: performing spectral variable screening processing on the first spectral matrix and the second spectral matrix of the substance to be tested to form a fifth spectral matrix and a sixth spectral matrix; the spectral variable screening processing includes variable importance projection processing;
[0079] The step of predicting the detection index also includes:
[0080] fusing the first spectral matrix and the second spectral matrix at data level to form a first fused matrix;
[0081] Performing feature-level fusion on the fifth spectral matrix and the sixth spectral matrix to form a third fusion matrix;
[0082] Inputting the first spectral matrix as an input matrix into the trained detection model to obtain a sixth indicator matrix as an output matrix;
[0083] Inputting the second spectral matrix as an input matrix into the trained detection model to obtain a seventh indicator matrix as an output matrix;
[0084] Inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth indicator matrix as an output matrix;
[0085] Inputting the third fusion matrix as an input matrix into the trained detection model to obtain a twelfth indicator matrix as an output matrix;
[0086] The sixth indicator matrix, the seventh indicator matrix, the eighth indicator matrix and the twelfth indicator matrix are integrated at the decision level to form the fourth indicator matrix.
[0087] According to one aspect of the present invention, the step of training the detection model comprises:
[0088] Collecting training samples to construct a training set, wherein the training set includes near-infrared spectra and mid-infrared spectra of a plurality of training samples and index values of detection indexes of a plurality of training samples;
[0089] The training set is divided into a calibration set and a validation set, and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an indicator matrix of the calibration set and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an indicator matrix of the validation set are obtained;
[0090] Performing spectral preprocessing on the near-infrared spectra and mid-infrared spectra of the calibration set and the validation set respectively, obtaining the near-infrared spectrum preprocessing matrix and mid-infrared spectrum preprocessing matrix of the calibration set and the near-infrared spectrum preprocessing matrix and mid-infrared spectrum preprocessing matrix of the validation set; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing;
[0091] Performing spectral variable screening processing on the near infrared spectra after spectral preprocessing and the mid-infrared spectra after spectral preprocessing of the calibration set and the validation set, respectively, to obtain the preprocessed near infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set and the preprocessed near infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set; the spectral variable screening processing includes competitive adaptive weighted sampling processing and / or variable importance projection processing;
[0092] Inputting the near infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a third coefficient matrix;
[0093] Inputting the mid-infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a fourth coefficient matrix;
[0094] Inputting the near infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the third coefficient matrix, obtaining the calibration set third index prediction matrix composed of the predicted values of the detection indexes of the calibration set;
[0095] Inputting the mid-infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix, obtaining the fourth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set;
[0096] Inputting the near infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the third coefficient matrix, obtaining the third indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0097] Inputting the mid-infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the fourth coefficient matrix, obtaining the fourth indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0098] Through the third indicator prediction matrix of the validation set, the fourth indicator prediction matrix of the validation set and the indicator matrix, a third validation value and a fourth validation value are respectively obtained according to the validation indicators, wherein the validation indicators are used to characterize the prediction performance of the detection model, and preferably, the validation indicators include a determination coefficient and / or a prediction root mean square error;
[0099] The optimal value of the third verification value and the fourth verification value is taken as the optimal verification value, the optimal verification value is taken as the threshold, and the range of the threshold in the direction where the prediction performance of the detection model becomes better is taken as the threshold range. Preferably, 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;
[0100] The near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the calibration set are fused at the data level to form the second data-level fusion matrix of the calibration set, and the index matrix of the calibration set is input into the detection model to train the detection model to obtain the sixth coefficient matrix;
[0101] The second data level fusion matrix of the calibration set is used as the input matrix, and the detection model corresponding to the sixth coefficient matrix is input to obtain the sixth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the validation set;
[0102] The second data-level fusion matrix of the validation set formed by data-level fusion of the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the validation set is used as the input matrix, and the detection model corresponding to the sixth coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the sixth indicator prediction matrix of the validation set;
[0103] Obtain a sixth verification value according to the verification indicator through the sixth indicator prediction matrix and the indicator matrix of the verification set;
[0104] The second feature-level fusion matrix of the calibration set formed by feature-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set is input into the detection model together with the indicator matrix of the calibration set, and the detection model is trained to obtain the eighth coefficient matrix;
[0105] The second feature level fusion matrix of the calibration set is used as an input matrix, and the detection model corresponding to the eighth coefficient matrix is input to obtain the eighth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set;
[0106] The second feature-level fusion matrix of the validation set formed by data-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set is used as the input matrix, and the detection model corresponding to the eighth coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the eighth indicator prediction matrix of the validation set;
[0107] Obtain the eighth verification value according to the verification indicator through the eighth indicator prediction matrix and the indicator matrix of the verification set;
[0108] Screening the third verification value, the fourth verification value, the sixth verification value, and the eighth verification value according to the threshold range to screen out a verification value group within the threshold range;
[0109] The correction set indicator matrix corresponding to the verification value group is fused at the decision level to obtain the correction set decision level fusion matrix. The correction set decision level fusion matrix and the correction set indicator matrix are input into the detection model, and the detection model is trained to obtain the ninth coefficient matrix, which is the coefficient matrix after training.
[0110] According to one aspect of the present invention, in the step of dividing the training set into a calibration set and a validation set:
[0111] The training set is randomly divided into a calibration set and a validation set at a ratio of 2:1-4:1. Preferably, the training set is randomly divided into a calibration set and a validation set at a ratio of 3:1.
[0112] According to one aspect of the present invention, in the step of training the detection model, there are multiple types of spectral preprocessing and / or spectral variable screening processing, and the training model is trained using each spectral preprocessing, each spectral variable screening processing, and each combination of spectral preprocessing and spectral variable screening processing.
[0113] According to one aspect of the present invention, the method of data level fusion, feature level fusion and decision level fusion includes:
[0114] Matrices of the same dimension are concatenated for data-level fusion, feature-level fusion, or decision-level fusion.
[0115] According to a second aspect of the present invention, a detection system based on fusion of multiple spectral data is provided, comprising:
[0116] An acquisition module collects the near-infrared spectrum and the mid-infrared spectrum of the substance to be tested, and obtains the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the substance to be tested;
[0117] The detection model building module builds the detection model through the following formula:
[0118]
[0119] in, is the input matrix, is the output matrix, B is the coefficient matrix, P and Q are the loading matrices of X and Y respectively;
[0120] Training module, training detection model;
[0121] Detection module, predicts detection indicators;
[0122] The training modules include:
[0123] A training set construction unit collects training samples to construct a training set, wherein the training set includes near-infrared spectra and mid-infrared spectra of a plurality of training samples and index values of detection indexes of a plurality of training samples;
[0124] A training set division unit is used to divide the training set constructed by the training set construction unit into a calibration set and a validation set, and obtain a near infrared spectrum matrix, a mid infrared spectrum matrix and an indicator matrix of the calibration set and a near infrared spectrum matrix, a mid infrared spectrum matrix and an indicator matrix of the validation set;
[0125] A spectral preprocessing unit performs spectral preprocessing on the near-infrared spectra and mid-infrared spectra of the calibration set and the validation set obtained by the training set division unit, respectively, to obtain a near-infrared spectrum preprocessing matrix and a mid-infrared spectrum preprocessing matrix of the calibration set and a near-infrared spectrum preprocessing matrix and a mid-infrared spectrum preprocessing matrix of the validation set;
[0126] a spectral variable screening unit, performing spectral variable screening on the near-infrared spectra, mid-infrared spectra, near-infrared spectra after spectral preprocessing, and mid-infrared spectra after spectral preprocessing of the calibration set and the validation set obtained by the training set division unit, respectively, to obtain the near-infrared spectra variable screening matrix, mid-infrared spectra variable screening matrix, preprocessed near-infrared spectra variable screening matrix, and preprocessed mid-infrared spectra variable screening matrix of the calibration set, as well as the near-infrared spectra variable screening matrix, mid-infrared spectra variable screening matrix, preprocessed near-infrared spectra variable screening matrix, and preprocessed mid-infrared spectra variable screening matrix of the validation set;
[0127] A first training unit inputs the near infrared spectrum matrix and the indicator 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;
[0128] A second training unit inputs the mid-infrared spectrum matrix and the indicator 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;
[0129] A third training unit inputs the near infrared spectrum preprocessing matrix and the indicator matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model, trains the detection model, and obtains a third coefficient matrix;
[0130] A fourth training unit, inputting the mid-infrared spectrum preprocessing matrix and the indicator matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model, training the detection model, and obtaining a fourth coefficient matrix;
[0131] A first prediction unit inputs the near-infrared spectrum matrix of the calibration set obtained by the training set division unit into a detection model corresponding to the first coefficient matrix to obtain a first indicator prediction matrix of the calibration set composed of predicted values of the detection indicators of the calibration set;
[0132] 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 second indicator prediction matrix of the calibration set composed of predicted values of the detection indicators of the calibration set;
[0133] A third prediction unit inputs the near-infrared spectrum preprocessing matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model corresponding to the third coefficient matrix to obtain a third indicator prediction matrix of the calibration set composed of predicted values of the detection indicators of the calibration set;
[0134] A fourth prediction unit inputs the mid-infrared spectrum preprocessing matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model corresponding to the fourth coefficient matrix to obtain a fourth indicator prediction matrix of the calibration set composed of predicted values of the detection indicators of the calibration set;
[0135] 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, to obtain a first indicator prediction matrix of the verification set composed of predicted values of the detection indicators of the verification set;
[0136] 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, to obtain a second indicator prediction matrix of the verification set composed of predicted values of the detection indicators of the verification set;
[0137] A seventh prediction unit, inputting the near infrared spectrum preprocessing matrix of the verification set obtained by the spectrum preprocessing unit into the detection model corresponding to the third coefficient matrix, and obtaining a third indicator prediction matrix of the verification set composed of the predicted values of the detection indicators of the verification set;
[0138] An eighth prediction unit, inputting the mid-infrared spectrum preprocessing matrix of the verification set obtained by the spectrum preprocessing unit into the detection model corresponding to the fourth coefficient matrix, and obtaining a fourth indicator prediction matrix of the verification set composed of predicted values of the detection indicators of the verification set;
[0139] A first verification unit obtains a first verification value, a second verification value, a third verification value, and a fourth verification value according to verification indicators, respectively, through a first indicator prediction matrix of a verification set obtained by a fifth prediction unit, a second indicator prediction matrix of a verification set obtained by a sixth prediction unit, a third indicator prediction matrix of a verification set obtained by a seventh prediction unit, a fourth indicator prediction matrix of a verification set obtained by an eighth prediction unit, and an indicator matrix obtained by a training set division unit. The verification indicators are used to characterize the prediction performance of a detection model. Preferably, the verification indicators include a determination coefficient and / or a prediction root mean square error;
[0140] A threshold range obtaining unit, which 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 in the direction where the prediction performance of the detection model becomes better as the threshold range, preferably, 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;
[0141] A fifth training unit, which performs data-level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the calibration set obtained by the training set division unit to form a first data-level fusion matrix of the calibration set, and inputs the matrix and the indicator matrix of the calibration set into the detection model to train the detection model, thereby obtaining a fifth coefficient matrix;
[0142] The sixth training unit fuses the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the calibration set obtained by the spectrum preprocessing unit at the data level to form a second data-level fusion matrix of the calibration set, and inputs the matrix and the indicator matrix of the calibration set into the detection model to train the detection model, thereby obtaining a sixth coefficient matrix;
[0143] The ninth prediction unit uses the first data level fusion matrix of the calibration set as an input matrix, inputs the detection model corresponding to the fifth coefficient matrix, and obtains the calibration set fifth indicator prediction matrix composed of the predicted values of the detection indicators of the calibration set;
[0144] The tenth prediction unit uses the second data level fusion matrix of the calibration set as an input matrix, inputs the detection model corresponding to the sixth coefficient matrix, and obtains the calibration set sixth indicator prediction matrix composed of the predicted values of the detection indicators of the validation set;
[0145] The eleventh prediction unit uses the first data-level fusion matrix of the verification set formed 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 fifth indicator prediction matrix of the verification set formed by the predicted values of the detection indicators of the verification set;
[0146] The twelfth prediction unit uses the second data-level fusion matrix of the verification set formed by data-level fusion of the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the verification set as an input matrix, inputs the detection model corresponding to the sixth coefficient matrix, and obtains the sixth indicator prediction matrix of the verification set formed by the predicted values of the detection indicators of the verification set;
[0147] The second verification unit obtains a fifth verification value and a sixth verification value according to the verification indicators through the fifth indicator prediction matrix of the verification set, the sixth indicator prediction matrix of the verification set, and the indicator matrix;
[0148] The seventh training unit is to perform feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set to form the first feature-level fusion matrix of the calibration set, and the indicator matrix of the calibration set to input into the detection model, train the detection model, and obtain the seventh coefficient matrix;
[0149] In the eighth training unit, the second feature-level fusion matrix of the calibration set formed by feature-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set and the indicator matrix of the calibration set are input into the detection model to train the detection model and obtain the eighth coefficient matrix;
[0150] The thirteenth prediction unit uses the first feature level fusion matrix of the correction set as an input matrix, inputs the detection model corresponding to the seventh coefficient matrix, and obtains the seventh indicator prediction matrix of the correction set composed of the predicted values of the detection indicators of the correction set;
[0151] The fourteenth prediction unit uses the second feature level fusion matrix of the correction set as an input matrix, inputs the detection model corresponding to the eighth coefficient matrix, and obtains the eighth indicator prediction matrix of the correction set composed of the predicted values of the detection indicators of the correction set;
[0152] The fifteenth prediction unit uses the first feature-level fusion matrix of the validation set formed by feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the validation set as an input matrix, inputs the detection model corresponding to the seventh coefficient matrix, and obtains the seventh indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set;
[0153] The sixteenth prediction unit uses the second feature-level fusion matrix of the validation set formed by data-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set as an input matrix, inputs the detection model corresponding to the eighth coefficient matrix, and obtains the eighth indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set;
[0154] The third verification unit obtains a seventh verification value and an eighth verification value according to the verification indicators through the seventh indicator prediction matrix of the verification set, the eighth indicator prediction matrix of the verification set, and the indicator matrix;
[0155] A verification value screening unit, screening the first to eighth verification values according to a threshold range, and screening out a verification value group within the threshold range;
[0156] The ninth training unit performs decision-level fusion on the correction set indicator 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 correction set indicator matrix into the detection model, trains the detection model, and obtains the ninth coefficient matrix, which is the coefficient matrix after training;
[0157] The detection module includes:
[0158] A data-level fusion unit, which performs data-level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the substance to be tested to obtain a spectrum fusion matrix;
[0159] The prediction unit inputs the spectrum fusion matrix obtained by the data-level fusion unit as an input matrix into the trained detection model to obtain a first indicator matrix as an output matrix; and uses the first indicator matrix as a detection result of the detection index of the substance to be detected;
[0160] Among them, the indicator matrix is a matrix composed of indicator values of the detection indicators measured by the standard method; the first indicator matrix is a matrix composed of indicator values of the detection indicators predicted by the detection model; the detection indicators include one or more of flash point, pour point, density and kinematic viscosity;
[0161] Preferably, the detection module further includes:
[0162] A decision-level fusion unit, inputting the near-infrared spectrum matrix of the substance to be tested as an input matrix into the trained detection model to obtain a second indicator matrix as an output matrix; inputting the mid-infrared spectrum matrix of the substance to be tested as an input matrix into the trained detection model to obtain a third indicator matrix as an output matrix; performing decision-level fusion on the first indicator matrix, the second indicator matrix and the third indicator matrix to obtain a fourth indicator matrix;
[0163] The prediction unit inputs the fourth indicator matrix of the decision-level fusion unit as an input matrix into the trained detection model to obtain a fifth indicator matrix as an output matrix; and uses the fifth indicator matrix as the detection result of the substance to be detected;
[0164] Among them, the second indicator matrix, the third indicator matrix and the fifth indicator matrix are matrices composed of indicator values of the detection indicators predicted by the detection model.
[0165] According to the third aspect of the present invention, the present invention also provides a computer-readable storage medium, which includes a program based on multiple spectral data fusion. When the program based on multiple spectral data fusion is executed by a processor, the steps of the above-mentioned method based on multiple spectral data fusion are implemented.
[0166] According to a fourth aspect of the present invention, the present invention also provides an electronic device, comprising a memory and a processor, wherein the memory comprises a program based on multiple spectral data fusion, and when the program based on multiple spectral data fusion is executed by the processor, the steps of the above-mentioned method based on multiple spectral data fusion are implemented.
[0167] The near-infrared and mid-infrared spectral fusion technology of the present invention can simultaneously obtain the fundamental frequency, double frequency and combined frequency combination information of hydrogen-containing groups, and adopts a multi-level fusion method of data-level fusion, feature-level fusion and decision-level fusion to train the detection model, so as to obtain more comprehensive, reliable and richer chemical information of the training samples, thereby improving the comprehensiveness, accuracy and reliability of the detection model after training; the near-infrared spectrum and the mid-infrared spectrum of the substance to be tested are fused to predict the detection index through the trained detection model, thereby ensuring the comprehensiveness, accuracy and reliability of the collection of the substance to be tested and the training of the detection model, thereby ensuring the accuracy of the prediction of the detection index. BRIEF DESCRIPTION OF THE DRAWINGS
[0168] Figure 1 is a schematic diagram of the detection method based on fusion of multiple spectral data according to the present invention;
[0169] Figure 2 is a schematic diagram of a preferred embodiment of the steps of training a detection model according to the present invention;
[0170] Figure 3 It is a schematic diagram of a block diagram of an embodiment of a detection system based on fusion of multiple spectral data according to the present invention;
[0171] Figure 4 is a schematic block diagram of an embodiment of the electronic device of the present invention;
[0172] Figure 5(A) and (B) are respectively MIR and NIR spectra of a diesel training sample of a specific embodiment of the detection method based on fusion of multiple spectral data of the present invention;
[0173] Figure 6 (A), (B), (C) and (D) are respectively data-level fusion spectra using different spectral preprocessing methods in a specific embodiment of the detection method based on fusion of multiple spectral data of the present invention;
[0174] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0175] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0176] Figure 1 is a schematic diagram of the detection method based on the fusion of multiple spectral data according to the present invention, such as Figure 1 As shown, the detection method comprises:
[0177] Step S1, spectrum acquisition: acquiring a near infrared spectrum and a mid infrared spectrum of the substance to be tested, and obtaining a near infrared spectrum matrix and a mid infrared spectrum matrix of the substance to be tested;
[0178] Step S2, construct a detection model through the following formula (1);
[0179] (1)
[0180] in, is the input matrix, is the output matrix, B is the coefficient matrix, P and Q are the loading matrices of X and Y respectively;
[0181] Step S3, training the detection model;
[0182] Step S6, predicting the detection index, by fusing the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the substance to be tested into the trained detection model, and outputting the index value of the detection index of the substance to be tested, wherein the detection index includes one or more of flash point, pour point, density and kinematic viscosity.
[0183] In some embodiments of the present invention, step S3 includes:
[0184] Step S301, constructing a training set, wherein the training set includes near-infrared spectra and mid-infrared spectra of multiple training samples and index values of detection indicators of multiple training samples;
[0185] Step S302, dividing the training set into a calibration set and a validation set, obtaining a near-infrared spectrum matrix, a mid-infrared spectrum matrix, and an indicator matrix of the calibration set, and a near-infrared spectrum matrix, a mid-infrared spectrum matrix, and an indicator matrix of the validation set;
[0186] Step S303, performing spectral preprocessing on the near-infrared spectra and mid-infrared spectra of the calibration set and the validation set, respectively, to obtain a near-infrared spectrum preprocessing matrix and a mid-infrared spectrum preprocessing matrix of the calibration set and a near-infrared spectrum preprocessing matrix and a mid-infrared spectrum preprocessing matrix of the validation set; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing;
[0187] Step S304, performing spectral variable screening processing on the near infrared spectrum, mid-infrared spectrum, near infrared spectrum after spectral preprocessing and mid-infrared spectrum after spectral preprocessing of the calibration set and the validation set, respectively, to obtain the near infrared spectrum variable screening matrix, mid-infrared spectrum variable screening matrix, preprocessed near infrared spectrum variable screening matrix and preprocessed mid-infrared spectrum variable screening matrix of the calibration set, and the near infrared spectrum variable screening matrix, mid-infrared spectrum variable screening matrix, preprocessed near infrared spectrum variable screening matrix and preprocessed mid-infrared spectrum variable screening matrix of the validation set; the spectral variable screening processing includes competitive adaptive weighted sampling processing and / or variable importance projection processing;
[0188] Step S305, inputting the near infrared spectrum matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a first coefficient matrix;
[0189] Step S306, inputting the mid-infrared spectrum matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a second coefficient matrix;
[0190] Step S307, inputting the near infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a third coefficient matrix;
[0191] Step S308, inputting the mid-infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a fourth coefficient matrix;
[0192] Step S309, inputting the near infrared spectrum matrix of the calibration set into the detection model corresponding to the first coefficient matrix, and obtaining the calibration set first index prediction matrix composed of the predicted values of the detection indexes of the calibration set;
[0193] Step S310, inputting the mid-infrared spectrum matrix of the calibration set into the detection model corresponding to the second coefficient matrix, and obtaining the calibration set second index prediction matrix composed of the predicted values of the detection indexes of the calibration set;
[0194] Step S311, inputting the near infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the third coefficient matrix, and obtaining the calibration set third index prediction matrix composed of the predicted values of the detection indexes of the calibration set;
[0195] Step S312, inputting the mid-infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix, and obtaining the fourth index prediction matrix of the calibration set composed of the predicted values of the detection indexes of the calibration set;
[0196] Step S313, inputting the near infrared spectrum matrix of the validation set into the detection model corresponding to the first coefficient matrix, and obtaining the first indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0197] Step S314, inputting the mid-infrared spectrum matrix of the verification set into the detection model corresponding to the second coefficient matrix, and obtaining the second indicator prediction matrix of the verification set composed of the predicted values of the detection indicators of the verification set;
[0198] Step S315, inputting the near infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the third coefficient matrix, and obtaining the third indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0199] Step S316, inputting the mid-infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the fourth coefficient matrix, and obtaining the fourth indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0200] Step S317, obtaining a first verification value, a second verification value, a third verification value and a fourth verification value according to the verification indicators through the first indicator prediction matrix of the verification set, the second indicator prediction matrix of the verification set, the third indicator prediction matrix of the verification set, the fourth indicator prediction matrix of the verification set and the indicator matrix, respectively, wherein the verification indicators are used to characterize the prediction performance of the detection model, and preferably, the verification indicators include a determination coefficient and / or a prediction root mean square error;
[0201] 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 the optimal verification value, taking the optimal verification value as the threshold, and taking the range of the threshold in the direction where the prediction performance of the detection model becomes better as the threshold range, preferably, 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;
[0202] Step S319, performing data-level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the calibration set to form a first data-level fusion matrix of the calibration set, and inputting the matrix and the indicator matrix of the calibration set into the detection model to train the detection model, thereby obtaining a fifth coefficient matrix;
[0203] Step S320, performing data-level fusion on the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the calibration set to form a second data-level fusion matrix of the calibration set, and inputting the matrix and the indicator matrix of the calibration set into the detection model to train the detection model, thereby obtaining a sixth coefficient matrix;
[0204] Step S321, taking the first data level fusion matrix of the calibration set as an input matrix, inputting the detection model corresponding to the fifth coefficient matrix, and obtaining the fifth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set;
[0205] Step S322, taking the second data level fusion matrix of the calibration set as the input matrix, inputting the detection model corresponding to the sixth coefficient matrix, and obtaining the calibration set sixth index prediction matrix composed of the predicted values of the detection index of the validation set;
[0206] Step S323, using the first data-level fusion matrix of the validation set formed by data-level fusion of the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the validation set as the input matrix, inputting the detection model corresponding to the fifth coefficient matrix, and obtaining the fifth indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set;
[0207] Step S324, using the second data-level fusion matrix of the validation set formed by data-level fusion of the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the validation set as the input matrix, inputting the detection model corresponding to the sixth coefficient matrix, and obtaining the sixth indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set;
[0208] Step S325, obtaining a fifth verification value and a sixth verification value according to the verification indicators through the fifth indicator prediction matrix of the verification set, the sixth indicator prediction matrix of the verification set, and the indicator matrix;
[0209] Step S326, the first feature-level fusion matrix of the calibration set formed by feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set and the indicator matrix of the calibration set are input into the detection model, the detection model is trained, and the seventh coefficient matrix is obtained;
[0210] Step S327, the second feature-level fusion matrix of the calibration set formed by feature-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set and the indicator matrix of the calibration set are input into the detection model, the detection model is trained, and an eighth coefficient matrix is obtained;
[0211] Step S328, taking the first feature level fusion matrix of the calibration set as an input matrix, inputting the detection model corresponding to the seventh coefficient matrix, and obtaining the seventh index prediction matrix of the calibration set composed of the predicted values of the detection indexes of the calibration set;
[0212] 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;
[0213] Step S330, taking the first feature-level fusion matrix of the validation set formed by feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the validation set as the input matrix, inputting the detection model corresponding to the seventh coefficient matrix, and obtaining the seventh indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set;
[0214] Step S331, using the second feature-level fusion matrix of the validation set formed by data-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set as the input matrix, inputting the detection model corresponding to the eighth coefficient matrix, and obtaining the eighth indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set;
[0215] Step S332, obtaining a seventh verification value and an eighth verification value according to the verification indicators through the seventh indicator prediction matrix of the verification set, the eighth indicator prediction matrix of the verification set, and the indicator matrix;
[0216] Step S333, screening the first to eighth verification values according to the threshold range, and screening out the verification value group within the threshold range;
[0217] Step S334, performing decision-level fusion on the calibration set indicator matrix corresponding to the verification value group to obtain the calibration set decision-level fusion matrix, inputting the calibration set decision-level fusion matrix and the calibration set indicator matrix into the detection model, training the detection model, and obtaining the ninth coefficient matrix, which is the trained coefficient matrix;
[0218] The indicator matrix is a matrix composed of indicator values of detection indicators measured by standard methods.
[0219] The present invention constructs an optimized decision-level data fusion method. Under various spectral preprocessing conditions, the single spectral model with the lowest prediction error is used as the control group, and the prediction results of the single spectral model with a prediction error less than or equal to , the data-level fusion model and the feature-level fusion model are fused to establish a decision-level fusion model, which can effectively improve the prediction performance of the model.
[0220] In some embodiments of the present invention, step S302 includes:
[0221] The calibration set and the validation set are randomly divided from the training set at a ratio of 2:1-4:1. Preferably, the calibration set and the validation set are randomly divided from the training set at a ratio of 3:1. If the ratio is not within the above range, the calibration set will be too large, which will lead to a too small validation set, or the calibration set will be too small, which will lead to a too large validation set. Because the calibration set is used to train the model, and the validation set is used to verify the prediction performance of the model, both of these phenomena will lead to a larger prediction error when the model is measuring the validation set.
[0222] In some embodiments of the present invention, step S4 includes:
[0223] The near-infrared spectrum matrix and the mid-infrared spectrum matrix of the substance to be tested are fused at the data level to obtain a spectrum fusion matrix;
[0224] Inputting the spectrum fusion matrix of the substance to be detected into the trained detection model as an input matrix to obtain a first indicator matrix as an output matrix; using the first indicator matrix as a detection result of the detection indicator of the substance to be detected;
[0225] Among them, the first indicator matrix is a matrix composed of indicator values of detection indicators predicted by the detection model.
[0226] In some embodiments of the present invention, step S6 includes:
[0227] The near-infrared spectrum matrix and the mid-infrared spectrum matrix of the substance to be tested are fused at the data level to obtain a spectrum fusion matrix;
[0228] Inputting the spectrum fusion matrix of the substance to be tested into the trained detection model as an input matrix to obtain a first indicator matrix as an output matrix;
[0229] Inputting the near infrared spectrum matrix of the substance to be tested into the trained detection model as an input matrix to obtain a second indicator matrix as an output matrix;
[0230] Inputting the mid-infrared spectrum matrix of the substance to be tested into the trained detection model as an input matrix, and obtaining a third indicator matrix as an output matrix;
[0231] The first indicator matrix, the second indicator matrix and the third indicator matrix are fused at the decision level to obtain a fourth indicator matrix;
[0232] Input the fourth indicator matrix as an input matrix into the trained detection model to obtain a fifth indicator matrix as an output matrix; and use the fifth indicator matrix as a detection result of the detection index of the substance to be detected;
[0233] Among them, the second indicator matrix, the third indicator matrix and the fifth indicator matrix are matrices composed of indicator values of detection indicators predicted by the detection model.
[0234] In some embodiments of the present invention, before step S6, the process includes:
[0235] Step S4, spectral preprocessing, baseline correction is performed on the near-infrared spectrum and mid-infrared spectrum of the substance to be tested to eliminate the spectral baseline offset caused by factors such as instrument and sample background;
[0236] In some embodiments of the present invention, step S4 includes:
[0237] A first spectral matrix is formed by spectrally preprocessing spectral data of a near-infrared spectrum of a substance to be tested;
[0238] Performing spectral preprocessing on the spectral data of the mid-infrared spectrum of the substance to be tested to form a second spectral matrix;
[0239] Wherein, the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing.
[0240] In some embodiments of the present invention, step S6 includes:
[0241] fusing the first spectral matrix and the second spectral matrix at data level to form a first fused matrix;
[0242] Inputting the first spectral matrix as an input matrix into the trained detection model to obtain a sixth indicator matrix as an output matrix;
[0243] Inputting the second spectral matrix as an input matrix into the trained detection model to obtain a seventh indicator matrix as an output matrix;
[0244] Inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth indicator matrix as an output matrix;
[0245] The sixth indicator matrix, the seventh indicator matrix and the eighth indicator matrix are integrated at the decision level to form a fourth indicator matrix;
[0246] The fourth indicator matrix is input as an input matrix into the trained detection model to obtain a fifth indicator matrix as an output matrix; and the fifth indicator matrix is used as a detection result of the detection index of the substance to be detected.
[0247] In some embodiments of the present invention, before step S6, the process includes:
[0248] Step S5, spectral variable screening, performing spectral variable screening processing on the near-infrared spectrum and mid-infrared spectrum of the substance to be tested to form a third spectral matrix and a fourth spectral matrix; the spectral variable screening processing includes variable importance projection processing.
[0249] In some embodiments of the present invention, step S6 includes:
[0250] Performing feature-level fusion on the third spectral matrix and the fourth spectral matrix to form a second fusion matrix;
[0251] Inputting the third spectral matrix as an input matrix into the trained detection model to obtain a ninth indicator matrix as an output matrix;
[0252] Inputting the fourth spectral matrix as an input matrix into the trained detection model to obtain a tenth indicator matrix as an output matrix;
[0253] Inputting the second fusion matrix as an input matrix into the trained detection model to obtain an eleventh indicator matrix as an output matrix;
[0254] The ninth indicator matrix, the tenth indicator matrix and the eleventh indicator matrix are integrated at the decision-making level to form a fourth indicator matrix;
[0255] The fourth indicator matrix is input as an input matrix into the trained detection model to obtain a fifth indicator matrix as an output matrix; and the fifth indicator matrix is used as a detection result of the detection index of the substance to be detected.
[0256] In some embodiments of the present invention, before step S6, the process includes:
[0257] Step S4, spectral preprocessing: performing spectral preprocessing on the spectral data of the near-infrared spectrum of the substance to be tested to form a first spectral matrix; performing spectral preprocessing on the spectral data of the mid-infrared spectrum of the substance to be tested to form a second spectral matrix; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing;
[0258] Step S5, spectral variable screening: performing spectral variable screening processing on the first spectral matrix and the second spectral matrix of the substance to be tested respectively to form a fifth spectral matrix and a sixth spectral matrix; the spectral variable screening processing includes variable importance projection processing.
[0259] In some embodiments of the present invention, step S6 includes:
[0260] fusing the first spectral matrix and the second spectral matrix at data level to form a first fused matrix;
[0261] Performing feature-level fusion on the fifth spectral matrix and the sixth spectral matrix to form a third fusion matrix;
[0262] Inputting the first spectral matrix as an input matrix into the trained detection model to obtain a sixth indicator matrix as an output matrix;
[0263] Inputting the second spectral matrix as an input matrix into the trained detection model to obtain a seventh indicator matrix as an output matrix;
[0264] Inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth indicator matrix as an output matrix;
[0265] Inputting the third fusion matrix as an input matrix into the trained detection model to obtain a twelfth indicator matrix as an output matrix;
[0266] The sixth indicator matrix, the seventh indicator matrix, the eighth indicator matrix and the twelfth indicator matrix are integrated at the decision level to form a fourth indicator matrix;
[0267] The fourth indicator matrix is input as an input matrix into the trained detection model to obtain a fifth indicator matrix as an output matrix; and the fifth indicator matrix is used as a detection result of the detection index of the substance to be detected.
[0268] In some embodiments of the present invention, step S3 includes:
[0269] Collecting training samples to construct a training set, wherein the training set includes near-infrared spectra and mid-infrared spectra of a plurality of training samples and index values of detection indexes of a plurality of training samples;
[0270] The training set is divided into a calibration set and a validation set, and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an indicator matrix of the calibration set and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an indicator matrix of the validation set are obtained;
[0271] Performing spectral preprocessing on the near-infrared spectra and mid-infrared spectra of the calibration set and the validation set respectively, obtaining the near-infrared spectrum preprocessing matrix and mid-infrared spectrum preprocessing matrix of the calibration set and the near-infrared spectrum preprocessing matrix and mid-infrared spectrum preprocessing matrix of the validation set; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing;
[0272] Performing spectral variable screening processing on the near infrared spectra after spectral preprocessing and the mid-infrared spectra after spectral preprocessing of the calibration set and the validation set, respectively, to obtain the preprocessed near infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set and the preprocessed near infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set; the spectral variable screening processing includes competitive adaptive weighted sampling processing and / or variable importance projection processing;
[0273] Inputting the near infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a third coefficient matrix;
[0274] Inputting the mid-infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a fourth coefficient matrix;
[0275] Inputting the near infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the third coefficient matrix, obtaining the calibration set third index prediction matrix composed of the predicted values of the detection indexes of the calibration set;
[0276] Inputting the mid-infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix, obtaining the fourth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set;
[0277] Inputting the near infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the third coefficient matrix, obtaining the third indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0278] Inputting the mid-infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the fourth coefficient matrix, obtaining the fourth indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set;
[0279] Through the third indicator prediction matrix of the validation set, the fourth indicator prediction matrix of the validation set and the indicator matrix, a third validation value and a fourth validation value are respectively obtained according to the validation indicators, wherein the validation indicators are used to characterize the prediction performance of the detection model, and preferably, the validation indicators include a determination coefficient and / or a prediction root mean square error;
[0280] The optimal value of the third verification value and the fourth verification value is taken as the optimal verification value, the optimal verification value is taken as the threshold, and the range of the threshold in the direction where the prediction performance of the detection model becomes better is taken as the threshold range. Preferably, 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;
[0281] The near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the calibration set are fused at the data level to form the second data-level fusion matrix of the calibration set, and the index matrix of the calibration set is input into the detection model to train the detection model to obtain the sixth coefficient matrix;
[0282] The second data level fusion matrix of the calibration set is used as the input matrix, and the detection model corresponding to the sixth coefficient matrix is input to obtain the sixth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the validation set;
[0283] The second data-level fusion matrix of the validation set formed by data-level fusion of the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the validation set is used as the input matrix, and the detection model corresponding to the sixth coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the sixth indicator prediction matrix of the validation set;
[0284] Obtain a sixth verification value according to the verification indicator through the sixth indicator prediction matrix and the indicator matrix of the verification set;
[0285] The second feature-level fusion matrix of the calibration set formed by feature-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set is input into the detection model together with the indicator matrix of the calibration set, and the detection model is trained to obtain the eighth coefficient matrix;
[0286] The second feature level fusion matrix of the calibration set is used as an input matrix, and the detection model corresponding to the eighth coefficient matrix is input to obtain the eighth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set;
[0287] The second feature-level fusion matrix of the validation set formed by data-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set is used as the input matrix, and the detection model corresponding to the eighth coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the eighth indicator prediction matrix of the validation set;
[0288] Obtain the eighth verification value according to the verification indicator through the eighth indicator prediction matrix and the indicator matrix of the verification set;
[0289] Screening the third verification value, the fourth verification value, the sixth verification value, and the eighth verification value according to the threshold range to screen out a verification value group within the threshold range;
[0290] The correction set indicator matrix corresponding to the verification value group is fused at the decision level to obtain the correction set decision level fusion matrix. The correction set decision level fusion matrix and the correction set indicator matrix are input into the detection model, and the detection model is trained to obtain the ninth coefficient matrix, which is the coefficient matrix after training.
[0291] The chemical information of the substance to be tested obtained by a single spectrum is relatively one-sided, and it is impossible to obtain more comprehensive, more reliable and richer chemical information, resulting in low prediction performance of the single spectrum model. The present invention can effectively improve the prediction performance of the model through data fusion. At the same time, the single spectrum model with the best prediction performance is used as a control group, and the results of the data-level fusion model and the feature-level fusion model that are better than the model are used to establish an optimized decision-level fusion model, which can effectively improve the prediction accuracy of the model.
[0292] In some embodiments of the present invention, in the step of training the detection model, there are multiple types of spectral preprocessing and / or spectral variable screening processing, and the training model is trained using each spectral preprocessing, each spectral variable screening processing, and each combination of spectral preprocessing and spectral variable screening processing.
[0293] In some embodiments of the present invention, 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), the RMSEP value is close to 0, The closer the value is to 1, the higher the prediction performance of the detection model. Preferably, the optimal verification value is the one with the smallest prediction root mean square error and the largest determination coefficient:
[0294] (2)
[0295] (3)
[0296] in, y act and y pred are the measured value of the detection index of each training sample in the validation set (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), respectively, and y mean is the average value of the detection index of multiple training samples in the validation set, and g is the total number of training samples in the validation set.
[0297] In some embodiments of the present invention, in step S2, a detection model is constructed by a PLS method, and the step of constructing a detection model by a PLS method includes:
[0298] Decompose the independent variable X matrix and the dependent variable Y matrix:
[0299] (4)
[0300] (5)
[0301] Among them, 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;
[0302] Perform linear regression analysis on the score matrices T and U:
[0303] (6)
[0304] (7)
[0305] Determine the linear relationship between X and Y:
[0306] (1).
[0307] In some embodiments of the invention, spectral preprocessing includes one or more of the following steps:
[0308] The first-order derivative processing of the near-infrared spectrum and the mid-infrared spectrum is performed by the following formula (8); the first-order derivative processing uses the numerical differentiation method to calculate the slope or rate of change of the spectral data to highlight the peaks or valleys in the spectral data and amplify the characteristic signals of the spectrum:
[0309] (8)
[0310] Wherein, A is a spectral value, which is absorbance or / and light intensity, λ is a wavelength or wave number, i is a wavelength or wave number index, and Δλ represents the distance between two adjacent wavelengths or wave numbers;
[0311] The near-infrared spectrum and the mid-infrared spectrum are processed by the second-order derivative through the following formula (9); the second-order derivative processing calculates the curvature or the rate of change of the spectral data by taking the derivative of the first-order derivative again, so as to highlight the broad peaks and platforms in the spectral data:
[0312] (9)
[0313] The SG first-order derivative processing of the near-infrared spectrum and the mid-infrared spectrum is performed by combining the following formula (10) and formula (8):
[0314] (10)
[0315] Among them, 2c+1 is the smoothing window width, , h i is the derivative coefficient (need to query the SG derivative coefficient table according to different window widths), H is the normalization factor, is the center point of the smoothing window, is the average value of the measured values of the c points before and after, is the smoothed value of the spectrum after SG smoothing;
[0316] The SG second-order derivative processing of the near-infrared spectrum and the mid-infrared spectrum is performed by combining the following formula (10) and formula (9);
[0317] The near-infrared spectrum and mid-infrared spectrum are vector normalized by the following formula (11). Vector normalization unifies the scale of the spectral data to prevent the spectral data in different wave numbers from having too large a difference and causing negative optimization of the model:
[0318] (11)
[0319] in, is the spectrum matrix with dimension 1×m, where m is the total number of wavelengths or wave numbers; ; is the spectral value after vector normalization.
[0320] In some embodiments of the present invention, in step S3, the competitive adaptive weighted sampling process in the spectral variable screening process includes:
[0321] Monte Carlo sampling is used to sample N times, through the spectral matrix A ( n × m ) and the detection index matrix to be tested Y ( n ×1) establish a PLS model (detection model) and obtain the regression coefficient b. j The retention rate of each spectral variable when sampling r j Determined by the following formula (12):
[0322] (12)
[0323] in, ,f ; n is the total number of training samples in the calibration set;
[0324] CARS is used to filter out wavelengths with large absolute values of regression coefficients in the PLS model, remove wavelengths with smaller weights, and finally select a subset with the lowest root mean square error of cross validation (RMSECV) to achieve the selection of the optimal spectral variable combination. The NIR and MIR feature variables filtered out by CARS are matrices C NIR and C MIR , RMSECV is obtained by the following formula (13):
[0325] (13)
[0326] in, y act and y pred They are the measured values of the detection indicators of each training sample measured by the standard method (for example, the measured values of the detection indicators measured by the standard method in the national standard) and the predicted values output by the detection model. y mean is the average of the measured values.
[0327] In some embodiments of the present invention, in step S3, the step of variable importance projection processing in the spectral variable screening process includes:
[0328] The vector score is obtained by the following formula (14):
[0329] (14)
[0330] Among them, H is the total number of PLS best main factors, h is the index of PLS best main factors; w is the weight vector; t is the score vector; q is the load vector; For the The VIP value of the vector corresponding to the wave number or wavelength. The importance of the spectral variable to the property to be measured is judged by the VIP value. When the VIP value is large, it means that the spectral variable has a strong explanatory power for the dependent variable.
[0331] The near-infrared spectrum and mid-infrared spectrum corresponding to the wavelength or wave number with a VIP value greater than 1 are selected as the characteristic spectrum, and the NIR and MIR characteristic variables screened by the VIP value are V NIR and V MIR .
[0332] In the above embodiments, the methods of data level fusion, feature level fusion and decision level fusion include: concatenating matrices of the same dimension to perform data level fusion, feature level fusion or decision level fusion.
[0333] Figure 2 is a schematic diagram of a preferred embodiment of the steps of training the detection model of the present invention, such as Figure 2 As shown, the step of training the detection model includes:
[0334] Step S10, collecting multiple training samples to form a training set;
[0335] Step S20, randomly dividing the training set according to a set ratio to form a calibration set and a validation set respectively, preferably, the set ratio is 3:1;
[0336] Step S30, using standard methods to measure the detection index of the training samples of the calibration set and the validation set, and forming the dependent variable matrix (index matrix) of the calibration set and the validation set YZ C and YZ V ;
[0337] Step S40, collecting the near infrared spectra (NIR) and mid infrared spectra (MIR) of the calibration set and the validation set to obtain the near infrared spectrum matrix of the calibration set N C and mid-infrared spectral matrix M C , and the near infrared spectrum matrix of the validation set samples N V and mid-infrared spectral matrix M V ;
[0338] Step S50, under various spectral preprocessing conditions, respectively using the matrix of the calibration setN C and matrix M C Build a single spectrum model and use the validation set to make predictions, including:
[0339] Near infrared spectral matrix of the calibration set N C and mid-infrared spectral matrix M C Perform various spectral preprocessing to obtain the near-infrared spectral preprocessing matrix of the calibration set after spectral preprocessing N pre-C and mid-infrared spectrum preprocessing matrix M pre-C ;
[0340] Near infrared spectroscopy preprocessing matrix of calibration set N pre-C and mid-infrared spectrum preprocessing matrix M pre-C A single spectrum model is established through formulas (2)-(4). As shown in formula (1), the input matrix X is a single spectrum matrix N pre-C or M pre-C ;
[0341] The near infrared spectrum preprocessing matrix of the calibration set N pre-C and mid-infrared spectrum preprocessing matrix M pre-C Input a single spectral model to obtain the detection index prediction value matrix of the near-infrared spectrum of the calibration set YC N-pred and the detection index prediction value matrix of mid-infrared spectroscopy YC M-pred ;
[0342] Near infrared spectral matrix for the validation set N V and mid-infrared spectral matrix M V Perform various spectral preprocessing to obtain the near-infrared spectral preprocessing matrix of the validation set after spectral preprocessing N pre-V and mid-infrared spectrum preprocessing matrix M pre-V ;
[0343] The near infrared spectrum preprocessing matrix of the validation set N pre-V and mid-infrared spectrum preprocessing matrix M pre-VInput a single spectral model to obtain the detection index prediction value matrix of the near-infrared spectrum of the validation set YV N-pred and the detection index prediction value matrix of mid-infrared spectroscopy YV M-pred ;
[0344] The dependent variable matrix (indicator matrix) of the validation set YZ V Detection index prediction value matrix with near infrared spectroscopy YV N-pred According to formula (2) and formula (3), the coefficient of determination ( ) and the root mean square error of prediction (RMSEP) to obtain the third validation value group; the dependent variable matrix (indicator matrix) of the validation set is YZ V Detection index prediction value matrix with mid-infrared spectroscopy YV M-pred According to formula (2) and formula (3), the coefficient of determination ( ) and the root mean square error of prediction (RMSEP) to obtain the fourth validation value group;
[0345] Step S60: preprocessing the near infrared spectrum matrix of the calibration set N pre-C and mid-infrared spectrum preprocessing matrix M pre-C Perform data-level fusion, use the data-level fusion matrix of the calibration set to establish a data-level fusion model (Low), and use the validation set for prediction. The specific steps are as follows:
[0346] The near infrared spectrum preprocessing matrix of the calibration set N pre-C and mid-infrared spectrum preprocessing matrix M pre-C Splicing to obtain the data-level fusion matrix of the calibration set
[0347]
[0348] The data-level fusion matrix L of the correction set is used to establish a data-level fusion model through formulas (2)-(4). As shown in formula (1), the input matrix X is the data-level fusion matrix ;
[0349] The data level fusion matrix of the calibration set Input the data-level fusion model to obtain the detection index prediction value matrix of the calibration set data-level fusion ;
[0350] The near infrared spectrum preprocessing matrix of the validation set Npre-V and mid-infrared spectrum preprocessing matrix M pre-V Splice to get the data-level fusion matrix of the validation set
[0351]
[0352] The data level fusion matrix of the validation set Input the data-level fusion model to obtain the detection index prediction value matrix of the data-level fusion of the validation set ;
[0353] The dependent variable matrix (indicator matrix) of the validation set YZ V Detection index prediction value matrix fused with data level According to formula (2) and formula (3), the coefficient of determination ( ) and the root mean square error of prediction (RMSEP) to obtain the sixth validation value group;
[0354] Step S70, under a plurality of spectral variable screening processing methods, the near infrared spectral preprocessing matrix of the calibration set is N pre-C and mid-infrared spectrum preprocessing matrix M pre-C After feature variable screening, feature-level fusion is performed, and the feature-level fusion matrix of the calibration set is used to establish a feature-level fusion model (Mid), and the validation set is used for prediction. The specific steps are as follows:
[0355] Preprocessing matrix of near infrared spectra for calibration set N pre-C and mid-infrared spectrum preprocessing matrix M pre-C Perform various spectral variable screening processes to obtain a pre-processed near infrared spectral variable screening matrix of the calibration set after various spectral variable screening processes N vs-C and preprocessing mid-infrared spectroscopy variable screening matrix M vs-C ;
[0356] Preprocessing near infrared spectroscopy variable screening matrix N vs-C and preprocessing mid-infrared spectroscopy variable screening matrix M vs-C The feature-level fusion matrix of the calibration set is obtained by splicing
[0357]
[0358] Feature-level fusion matrix of the calibration set The feature-level fusion model is established through formulas (2)-(4). As shown in formula (1), the input matrix X is the feature-level fusion matrix ;
[0359] The feature-level fusion matrix of the calibration set Input the feature-level fusion model to obtain the detection index prediction value matrix of the feature-level fusion of the calibration set ;
[0360] Preprocessing matrix of near infrared spectra for validation set N pre-V and mid-infrared spectrum preprocessing matrix M pre-V Perform multiple spectral variable screening processes to obtain the preprocessed near-infrared spectral variable screening matrix of the validation set after multiple spectral variable screening processes N vs-V and preprocessing mid-infrared spectroscopy variable screening matrix M vs-V ;
[0361] The preprocessed near infrared spectroscopy variable screening matrix of the validation set N vs-V and preprocessing mid-infrared spectroscopy variable screening matrix M vs-V Concatenate to get the feature-level fusion matrix of the validation set
[0362]
[0363] The feature-level fusion matrix of the validation set Input the feature-level fusion model to obtain the detection index prediction value matrix of the feature-level fusion of the validation set ;
[0364] The dependent variable matrix (indicator matrix) of the validation set YZ V Detection index prediction value matrix fused with feature level According to formula (2) and formula (3), the coefficient of determination ( ) and the root mean square error of prediction (RMSEP) to obtain the eighth validation value group;
[0365] Step S80, taking the lowest RMSEP value in the third validation group and the fourth validation group of the single spectral model with different spectral preprocessing established in step S50 as a threshold, fusing the prediction results of the single spectral model, the data-level fusion model, and the feature-level fusion model whose RMSEP value in steps S50, S60, and S70 is equal to or lower than the threshold to obtain an optimized decision-level fusion matrix H Opt, and use the corresponding validation set to make predictions to obtain the ninth validation value group.
[0366] Preferably, the method further comprises: step S90, comparing the RMSEP and The values are compared to find the lowest RMSEP value and The detection model corresponding to the validation group with the highest value is taken as the optimal detection model, thereby obtaining the optimal coefficient matrix corresponding to the optimal detection model.
[0367] The present invention is based on a decision-level data fusion method of near-infrared spectroscopy and mid-infrared spectroscopy, and obtains the chemical composition information of diesel from different dimensions. Compared with a single spectral model, the accuracy of the established model in predicting unknown samples can be effectively improved.
[0368] Figure 3 FIG. 1 is a schematic diagram of a block diagram of an embodiment of a detection system based on fusion of multiple spectral data according to the present invention. Figure 3 As shown, the detection system based on fusion of multiple spectral data includes:
[0369] The acquisition module 100 acquires the near infrared spectrum and the mid infrared spectrum of the substance to be tested, and obtains the near infrared spectrum matrix and the mid infrared spectrum matrix of the substance to be tested;
[0370] The detection model building module 200 builds the detection model through formula (1);
[0371] A training module 300 is used to train a detection model;
[0372] The detection module 400 predicts detection indicators.
[0373] In some embodiments of the present invention, the training module 300 includes:
[0374] A training set construction unit 301 collects training samples to construct a training set, wherein the training set includes near-infrared spectra and mid-infrared spectra of a plurality of training samples and index values of detection indexes of a plurality of training samples;
[0375] The training set division unit 302 divides the training set constructed by the training set construction unit into a calibration set and a validation set, and obtains a near infrared spectrum matrix, a mid infrared spectrum matrix and an indicator matrix of the calibration set and a near infrared spectrum matrix, a mid infrared spectrum matrix and an indicator matrix of the validation set;
[0376] A spectral preprocessing unit 303 performs spectral preprocessing on the near-infrared spectra and mid-infrared spectra of the calibration set and the validation set obtained by the training set division unit, respectively, to obtain a near-infrared spectrum preprocessing matrix and a mid-infrared spectrum preprocessing matrix of the calibration set and a near-infrared spectrum preprocessing matrix and a mid-infrared spectrum preprocessing matrix of the validation set;
[0377] The spectral variable screening unit 304 performs spectral variable screening on the near infrared spectrum, mid-infrared spectrum, near infrared spectrum after spectral preprocessing and 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, mid-infrared spectrum variable screening matrix, preprocessed near infrared spectrum variable screening matrix and preprocessed mid-infrared spectrum variable screening matrix of the calibration set, as well as the near infrared spectrum variable screening matrix, mid-infrared spectrum variable screening matrix, preprocessed near infrared spectrum variable screening matrix and preprocessed mid-infrared spectrum variable screening matrix of the validation set;
[0378] The first training unit 305 inputs the near infrared spectrum matrix and the indicator 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;
[0379] The second training unit 306 inputs the mid-infrared spectrum matrix and the indicator 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;
[0380] The third training unit 307 inputs the near infrared spectrum preprocessing matrix and the indicator matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model, trains the detection model, and obtains a third coefficient matrix;
[0381] A fourth training unit 308 inputs the mid-infrared spectrum preprocessing matrix and the indicator matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model, trains the detection model, and obtains a fourth coefficient matrix;
[0382] 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 indicator prediction matrix composed of predicted values of the detection indicators of the calibration set;
[0383] 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 indicator prediction matrix composed of predicted values of the detection indicators of the calibration set;
[0384] The third prediction unit 311 inputs the near-infrared spectrum preprocessing matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model corresponding to the third coefficient matrix to obtain a calibration set third indicator prediction matrix composed of predicted values of the detection indicators of the calibration set;
[0385] The fourth prediction unit 312 inputs the mid-infrared spectrum preprocessing matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model corresponding to the fourth coefficient matrix to obtain a fourth indicator prediction matrix of the calibration set composed of predicted values of the detection indicators of the calibration set;
[0386] 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 to obtain a first indicator prediction matrix of the verification set composed of predicted values of the detection indicators of the verification set;
[0387] 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 to obtain a second indicator prediction matrix of the verification set composed of predicted values of the detection indicators of the verification set;
[0388] The seventh prediction unit 315 inputs the near infrared spectrum preprocessing matrix of the verification set obtained by the spectrum preprocessing unit into the detection model corresponding to the third coefficient matrix to obtain a third indicator prediction matrix of the verification set composed of the predicted values of the detection indicators of the verification set;
[0389] An eighth prediction unit 316 inputs the mid-infrared spectrum preprocessing matrix of the verification set obtained by the spectrum preprocessing unit into the detection model corresponding to the fourth coefficient matrix to obtain a fourth indicator prediction matrix of the verification set composed of predicted values of the detection indicators of the verification set;
[0390] 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 indicators, respectively, through the first indicator prediction matrix of the verification set obtained by the fifth prediction unit, the second indicator prediction matrix of the verification set obtained by the sixth prediction unit, the third indicator prediction matrix of the verification set obtained by the seventh prediction unit, the fourth indicator prediction matrix of the verification set obtained by the eighth prediction unit and the indicator matrix obtained by the training set division unit. The verification indicators are used to characterize the prediction performance of the detection model. Preferably, the verification indicators include a determination coefficient and / or a prediction root mean square error.
[0391] The threshold range obtaining unit 318 uses 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, uses the optimal verification value as the threshold, and uses the range of the threshold in the direction where the prediction performance of the detection model becomes better as the threshold range. Preferably, 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;
[0392] The fifth training unit 319 performs data-level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the calibration set obtained by the training set division unit to form a first data-level fusion matrix of the calibration set, and inputs the matrix and the indicator matrix of the calibration set into the detection model to train the detection model, thereby obtaining a fifth coefficient matrix;
[0393] The sixth training unit 320 performs data-level fusion on the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the calibration set obtained by the spectrum preprocessing unit to form a second data-level fusion matrix of the calibration set, and inputs the matrix and the indicator matrix of the calibration set into the detection model to train the detection model, thereby obtaining a sixth coefficient matrix;
[0394] The ninth prediction unit 321 uses the first data level fusion matrix of the calibration set as an input matrix, inputs the detection model corresponding to the fifth coefficient matrix, and obtains the calibration set fifth indicator prediction matrix composed of the predicted values of the detection indicators of the calibration set;
[0395] The tenth prediction unit 322 uses the second data level fusion matrix of the calibration set as an input matrix, inputs the detection model corresponding to the sixth coefficient matrix, and obtains the calibration set sixth indicator prediction matrix composed of the predicted values of the detection indicators of the validation set;
[0396] The eleventh prediction unit 323 uses the first data-level fusion matrix of the verification set formed 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 fifth indicator prediction matrix of the verification set formed by the predicted values of the detection indicators of the verification set;
[0397] The twelfth prediction unit 324 uses the second data-level fusion matrix of the verification set formed by data-level fusion of the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the verification set as an input matrix, inputs the detection model corresponding to the sixth coefficient matrix, and obtains the sixth indicator prediction matrix of the verification set formed by the predicted values of the detection indicators of the verification set;
[0398] The second verification unit 325 obtains a fifth verification value and a sixth verification value according to the verification indicators through the fifth indicator prediction matrix of the verification set, the sixth indicator prediction matrix of the verification set, and the indicator matrix;
[0399] The seventh training unit 326 performs feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set to form a first feature-level fusion matrix of the calibration set, and the indicator matrix of the calibration set to input into the detection model, train the detection model, and obtain a seventh coefficient matrix;
[0400] The eighth training unit 327 performs feature-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set to form a second feature-level fusion matrix of the calibration set, and the indicator matrix of the calibration set to input into the detection model, train the detection model, and obtain an eighth coefficient matrix;
[0401] The thirteenth prediction unit 328 uses the first feature level fusion matrix of the correction set as an input matrix, inputs the detection model corresponding to the seventh coefficient matrix, and obtains the seventh indicator prediction matrix of the correction set composed of the predicted values of the detection indicators of the correction set;
[0402] The fourteenth prediction unit 329 uses the second feature level fusion matrix of the correction set as an input matrix, inputs the detection model corresponding to the eighth coefficient matrix, and obtains the eighth indicator prediction matrix of the correction set composed of the predicted values of the detection indicators of the correction set;
[0403] The fifteenth prediction unit 330 uses the first feature-level fusion matrix of the validation set formed by feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the validation set as an input matrix, inputs the detection model corresponding to the seventh coefficient matrix, and obtains the seventh indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set;
[0404] The sixteenth prediction unit 331 uses the second feature-level fusion matrix of the validation set formed by data-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set as an input matrix, inputs the detection model corresponding to the eighth coefficient matrix, and obtains the eighth indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set;
[0405] The third verification unit 332 obtains a seventh verification value and an eighth verification value according to the verification indicators through the seventh indicator prediction matrix of the verification set, the eighth indicator prediction matrix of the verification set, and the indicator matrix;
[0406] A verification value screening unit 333 screens the first to ninth verification values according to a threshold range, and screens out a verification value group within the threshold range;
[0407] The ninth training unit 334 performs decision-level fusion on the correction set indicator 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 correction set indicator matrix into the detection model, trains the detection model, and obtains the ninth coefficient matrix, which is the trained coefficient matrix.
[0408] In some embodiments of the present invention, the detection module 400 includes:
[0409] A data level fusion unit 403 performs data level fusion on the near infrared spectrum matrix and the mid infrared spectrum matrix of the substance to be tested to obtain a spectrum fusion matrix;
[0410] The prediction unit 406 inputs the spectrum fusion matrix obtained by the data-level fusion unit as an input matrix into the trained detection model to obtain a first indicator matrix as an output matrix; and uses the first indicator matrix as a detection result of the detection index of the substance to be detected;
[0411] Among them, the indicator matrix is a matrix composed of indicator values of detection indicators measured by standard methods; the first indicator matrix is a matrix composed of indicator values of detection indicators predicted by the detection model; the detection indicators include one or more of flash point, pour point, density and kinematic viscosity.
[0412] In some embodiments of the present invention, the detection module further includes:
[0413] The decision-level fusion unit 405 inputs the near-infrared spectrum matrix of the substance to be tested as an input matrix into the trained detection model to obtain a second indicator matrix as an output matrix; inputs the mid-infrared spectrum matrix of the substance to be tested as an input matrix into the trained detection model to obtain a third indicator matrix as an output matrix; and performs decision-level fusion on the first indicator matrix, the second indicator matrix, and the third indicator matrix to obtain a fourth indicator matrix;
[0414] The prediction unit inputs the fourth indicator matrix of the decision-level fusion unit as an input matrix into the trained detection model to obtain a fifth indicator matrix as an output matrix; and uses the fifth indicator matrix as the detection result of the substance to be detected;
[0415] Among them, the second indicator matrix, the third indicator matrix and the fifth indicator matrix are matrices composed of indicator values of the detection indicators predicted by the detection model.
[0416] In some embodiments of the present invention, the prediction module further includes:
[0417] A spectral preprocessing unit 401 performs spectral preprocessing on the spectral data of the near-infrared spectrum of the substance to be tested to form a first spectral matrix; performs spectral preprocessing on the spectral data of the mid-infrared spectrum of the substance to be tested to form a second spectral matrix; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing;
[0418] 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;
[0419] The decision-level fusion unit 405 inputs the first spectral matrix as an input matrix into the trained detection model to obtain a sixth indicator matrix as an output matrix; inputs the second spectral matrix as an input matrix into the trained detection model to obtain a seventh indicator matrix as an output matrix; inputs the first fusion matrix as an input matrix into the trained detection model to obtain an eighth indicator matrix as an output matrix; and performs decision-level fusion on the sixth indicator matrix, the seventh indicator matrix and the eighth indicator matrix to form a fourth indicator matrix.
[0420] In some embodiments of the present invention, the prediction module further includes:
[0421] A spectral variable screening unit 402 performs spectral variable screening processing on the near infrared spectrum and the mid-infrared spectrum of the substance to be tested to form a third spectral matrix and a fourth spectral matrix; the spectral variable screening processing includes variable importance projection processing;
[0422] The prediction module further includes a feature-level fusion unit 404, which performs feature-level fusion on the third spectral matrix and the fourth spectral matrix to form a second fusion matrix;
[0423] The decision-level fusion unit 405 inputs the third spectral matrix as an input matrix into the trained detection model to obtain a ninth indicator matrix as an output matrix; inputs the fourth spectral matrix as an input matrix into the trained detection model to obtain a tenth indicator matrix as an output matrix; inputs the second fusion matrix as an input matrix into the trained detection model to obtain an eleventh indicator matrix as an output matrix; and performs decision-level fusion on the ninth indicator matrix, the tenth indicator matrix and the eleventh indicator matrix to form a fourth indicator matrix.
[0424] 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 the mid-infrared spectrum after spectral preprocessing by the spectral preprocessing unit 401.
[0425] The above detection methods based on the fusion of multiple spectral data of the present invention can be applied to the electronic device 1. Figure 4 FIG. 1 is a schematic diagram of the application environment of a preferred embodiment of the detection method based on the fusion of multiple spectral data of the present invention.
[0426] In this embodiment, the electronic device 1 may be a terminal device with computing functions, such as a server, a smart phone, a tablet computer, a portable computer, or a desktop computer.
[0427] The electronic device 1 includes: a processor 12 and a memory 11 , and may also include a network interface 13 , a communication bus 14 and the like.
[0428] The memory 11 includes at least one type of readable storage medium. The at least one type of readable storage medium may 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 may be an internal storage unit of the electronic device 1, such as a hard disk of the electronic device 1. In other embodiments, the readable storage medium may also be an external memory of the electronic device 1, such as a plug-in hard disk equipped on the electronic device 1, a smart memory card (SmartMediaCard, SMC), a secure digital (SecureDigital, SD) card, a flash card (FlashCard), etc.
[0429] In this embodiment, the readable storage medium of the memory 11 is generally used to store the detection program 10 based on the fusion of multiple spectral data, representative samples and data levels of representative samples installed in the electronic device 1. The memory 11 can also be used to temporarily store data that has been output or is to be output.
[0430] In some embodiments, the processor 12 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 11, such as executing a detection program 10 based on the fusion of multiple spectral data.
[0431] The network interface 13 may 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.
[0432] The communication bus 14 is used to realize the connection and communication between these components.
[0433] Figure 4 The electronic device 1 is shown only with components 11 - 14 , but it should be understood that implementation of all of the components shown is not required, and more or fewer components may alternatively be implemented.
[0434] Optionally, the electronic device 1 may further include a user interface, which may include an input unit such as a keyboard, a voice input device such as a microphone and other devices with voice recognition function, a voice output device such as a speaker, headphones, etc. Optionally, the user interface may also include a standard wired interface or a wireless interface.
[0435] Optionally, the electronic device 1 may further include a display, which may also be referred to as a display screen or a display unit. In some embodiments, it may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an organic light-emitting diode (OLED) touch device. The display is used to display information processed in the electronic device 1 and to display a visual user interface.
[0436] Optionally, the electronic device 1 further includes a touch sensor. The area provided by the touch sensor for the user to perform a touch operation is called a touch control area. In addition, the touch sensor described here may be a resistive touch sensor, a capacitive touch sensor, etc. Moreover, the touch sensor includes not only a contact touch sensor, but also a proximity touch sensor, etc. In addition, the touch sensor may be a single sensor or a plurality of sensors arranged in an array, for example.
[0437] 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 touch operations triggered by the user based on the touch display screen.
[0438] Optionally, the electronic device 1 may further include a radio frequency (RF) circuit, a sensor, an audio circuit, etc., which will not be described in detail here.
[0439] In addition, an embodiment of the present invention also provides a computer-readable storage medium, which includes a detection program based on the fusion of multiple spectral data. When the detection program based on the fusion of multiple spectral data is executed by a processor, the steps of the detection method based on the fusion of multiple spectral data of the above-mentioned embodiments are implemented.
[0440] The specific implementation of the computer-readable storage medium of the present invention is substantially the same as the specific implementation of the above-mentioned detection method and electronic device based on fusion of multiple spectral data, and will not be described in detail here.
[0441] In order to verify the beneficial effects of the present invention, the following specific examples were carried out:
[0442] The detection method based on the fusion of multiple spectral data in this embodiment includes:
[0443] Step 1: Collect 138 groups of diesel samples as training samples in an oil depot in Beijing, including 67 groups of 0# diesel, 30 groups of -10# diesel, 16 groups of -20# diesel, and 25 groups of -35# diesel. Their wide sources and different processing techniques ensure the differences in the properties of diesel samples. By randomly dividing the 138 groups of diesel samples, 103 groups of diesel samples were divided into calibration sets for establishing the partial least squares (PLS) detection model, and the other 35 groups of diesel samples were divided into validation sets for verifying the detection model;
[0444] Step 2: Use the standard method to determine the flash point of diesel samples, obtain the flash point values of 138 training samples, and form the calibration set indicator matrix YZ C And the validation set indicator matrix YZ V ;
[0445] Step 3: Use Fourier transform near infrared (NIR) and mid infrared (MIR) spectrometers to collect the spectrum of the diesel sample. The spectrum is as follows: Figure 5 At the same time, the near-infrared spectrum matrix of the diesel calibration set is obtained. N C and mid-infrared spectral matrix M C , and the near-infrared spectral matrix of the validation set N V and mid-infrared spectral matrix M V ;
[0446] Step 4: Preprocess the spectrum. The preprocessing methods include SG first-order derivative (SG 1 st D), SG second-order derivative (SG2 nd D) and vector normalization (VN);
[0447] Step 5: Without preprocessing (None) and SG first-order derivative (SG 1 st D), SG second-order derivative (SG 2 nd Under the conditions of D) and vector normalization (VN) preprocessing, a single spectrum partial least squares (PLS) detection model was established through the calibration set samples. After the PLS detection model was established, the validation set samples were used for external validation. The results are shown in Table 1:
[0448] Table 1
[0449]
[0450] In Table 1, the best prediction performance is the MIR-PLS model established after VN preprocessing (VN-MIR-PLS), which predicts the smallest RMSEP value of the validation set samples and The values are the largest, which are 2.45 and 0.90 respectively. Therefore, the RMSEP value of the VN-MIR-PLS model is selected as the threshold to screen other models and thus construct an optimized decision-level fusion model.
[0451] Step 6: Under the above four preprocessing conditions, a data-level fusion (Low) model is established by splicing NIR and MIR. The spectrum is as follows: Figure 6 As shown in (A), (B), (C) and (D) in the figure, the specific steps are:
[0452] The NIR and MIR spectra that have undergone the same preprocessing are fused. For example, the spectra that have undergone SG 1 in step 4 st D after preprocessing (can be replaced by None, SG 2 nd D and VN pretreatment conditions) are respectively N SG 1stD and M SG 1stD . Then in SG 1 st Data-level fusion matrix under D preprocessing L SG 1stD for:
[0453]
[0454] Establish a data-level fusion model and transform the data-level fusion matrix L SG 1stD Input data level fusion model, we can get SG 1 st The prediction result matrix of the data-level fusion model under D preprocessing conditions Y SG 1stD-L-pred , and calculate the RMSEP and ;
[0455] The prediction results of the data-level fusion model validation set samples are shown in Table 2:
[0456] Table 2
[0457]
[0458] In Table 2, the RMSEP value of the VN-MIR-PLS model is taken as the threshold, and the models below or equal to this threshold have undergone SG 2 nd The Low-PLS model established after D preprocessing (SG 2 nd The RMSEP values of the D-Low-PLS model and the Low-PLS model established after VN preprocessing (VN-Low-PLS) were 2.31 and 2.40, respectively.
[0459] Step 7: Under the above four preprocessing conditions, the NIR and MIR data are subjected to feature variable screening, including competitive adaptive weighted sampling (CARS) and variable importance projection (VIP), and the NIR and MIR feature variables screened by CARS and VIP are fused. For example, the NIR and MIR feature variables screened by SG 1 in step 4 are fused. st D after preprocessing (can be replaced by None, SG 2 nd D and VN pretreatment conditions), and then the characteristic variables are screened by CARS (which can be replaced by VIP here) to obtain C NIR and C MIR Then the feature-level fusion matrix filtered by CARS is M CARS for
[0460]
[0461] At the same time, a feature-level fusion model is established, and the feature-level fusion matrix M CARS Input feature level fusion model to get SG 1 st Prediction result matrix of CARS feature-level fusion model under D preprocessing conditions Y SG 1stD-CARS-pred , and calculate the RMSEP and ;
[0462] The prediction results of the feature-level fusion model established by CARS and VIP for the validation set samples are shown in Table 3:
[0463] Table 3
[0464]
[0465] In Table 3, the models with RMSEP values within the threshold of 2.45 include the CARS feature-level fusion model without spectral preprocessing (None-CARS-PLS), the SG 1 st D preprocessing condition CARS feature level fusion model (SG 1 st D-CARS-PLS), VN-CARS-PLS and SG 2 nd D preprocessing condition VIP feature level fusion model (SG 2 nd For D-VIP-PLS, the RMSEP values are 2.28, 1.86, 2.03, and 2.38, respectively.
[0466] Comparative Example
[0467] Step 8: The prediction results of all single spectrum models, data-level fusion models, and feature-level fusion models obtained in steps 5, 6, and 7 are integrated to establish an unoptimized decision-level fusion (High) PLS model. The specific steps are as follows:
[0468] The prediction results of all single spectrum models, data-level fusion models, and feature-level fusion models obtained in steps 5, 6, and 7 are fused, that is, Y NONE-N-pred , Y SG 1stD-N-pred , Y SG 2ndD-N-pred , ... to fuse and obtain the unoptimized decision-level fusion matrix H :
[0469]
[0470] At the same time, a decision-level fusion matrix is established, and the unoptimized decision-level fusion matrix H inputs the decision-level fusion matrix Array , the prediction results of the unoptimized decision-level fusion model can be obtained, and the RMSEP and .
[0471] Example
[0472] Step 8': VN-MIR-PLS and SG 2 selected in steps 5, 6 and 7 nd D-Low-PLS, VN-Low-PLS, None-CARS-PLS, SG 1 st D-CARS-PLS, VN-CARS-PLS and SG 2 nd The prediction results of the seven D-VIP-PLS models are combined to establish an optimized decision-level fusion (Opt-High) model. The fusion process repeats 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 with the prediction results of the above models. The prediction results of the High-PLS (comparative example) and Opt-High-PLS models (this application) for the calibration set and the validation set are shown in Table 4:
[0473] Table 4
[0474]
[0475] It can be seen from Table 4 that compared with the VN-MIR-PLS model, the RMSEP value of the High-PLS model established by integrating the measurement results of all models is larger. This is because different spectral preprocessing methods and characteristic 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. On the contrary, the embodiment of the present application uses the single spectral model with the best prediction performance as the control group. 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 values are reduced by 35% and 38%, respectively. Improved from 0.90 and 0.89 to 0.96.
[0476] Compared with the single spectral model, the prediction error of the model established by the optimized decision-level fusion method in the present invention is reduced by 35%; compared with the model established by the unoptimized decision-level data fusion method, the prediction error is reduced by 38%, which proves that the optimized decision-level data fusion method can effectively improve the prediction performance of the model.
[0477] The detection method based on fusion of multiple spectral data of the present invention is a decision-level data fusion method based on near-infrared and mid-infrared spectra, and when used for diesel flash point detection, it can accurately predict the diesel flash point.
[0478] The present invention fuses near-infrared and mid-infrared spectra and establishes a partial least squares model for determining the flash point of diesel. Under various spectral preprocessing conditions, a single spectral model, a data-level fusion model, and a feature-level fusion model are established through near-infrared and mid-infrared spectra. The prediction error of the single spectral model with the best prediction performance is used as a threshold, and the screened models are combined to establish an optimized decision-level fusion model. Compared with a single spectral model and an unoptimized decision-level fusion model, the optimized decision-level data fusion method can effectively reduce the prediction error of the model for unknown samples and improve the prediction performance.
[0479] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.
[0480] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. Through the description of the above implementation modes, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases the former is a better implementation mode. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, 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 number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0481] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A detection method based on fusion of multiple spectral data, characterized in that: include: Spectrum collection: collecting near-infrared spectrum and mid-infrared spectrum of the substance to be tested, and obtaining near-infrared spectrum matrix and mid-infrared spectrum matrix of the substance to be tested; Construct the detection model: Construct the detection model through the following formula, in, is the input matrix, is the output matrix, B is the coefficient matrix, P and Q are the loading matrices of X and Y respectively; T is the score matrix of the independent variable X; Train the detection model; Predictive testing indicators; The step of training the detection model includes: Collecting training samples to construct a training set, wherein the training set includes near-infrared spectra and mid-infrared spectra of a plurality of training samples and index values of detection indexes of a plurality of training samples; The training set is divided into a calibration set and a validation set, and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an indicator matrix of the calibration set and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an indicator matrix of the validation set are obtained; Performing spectral preprocessing on the near-infrared spectra and mid-infrared spectra of the calibration set and the validation set respectively, obtaining the near-infrared spectrum preprocessing matrix and mid-infrared spectrum preprocessing matrix of the calibration set and the near-infrared spectrum preprocessing matrix and mid-infrared spectrum preprocessing matrix of the validation set; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing; The near infrared spectra, mid-infrared spectra, near infrared spectra after spectral preprocessing and mid-infrared spectra after spectral preprocessing of the calibration set and the validation set are respectively subjected to spectral variable screening processing to obtain the near infrared spectra variable screening matrix, mid-infrared spectra variable screening matrix, preprocessed near infrared spectra variable screening matrix and preprocessed mid-infrared spectra variable screening matrix of the calibration set and the near infrared spectra variable screening matrix, mid-infrared spectra variable screening matrix, preprocessed near infrared spectra variable screening matrix and preprocessed mid-infrared spectra variable screening matrix of the validation set; the spectral variable screening processing includes competitive adaptive weighted sampling processing and / or variable importance projection processing; Inputting the near infrared spectrum matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a first coefficient matrix; Inputting the mid-infrared spectrum matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a second coefficient matrix; Inputting the near infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a third coefficient matrix; Inputting the mid-infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining 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 the first indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set; Inputting the mid-infrared spectrum matrix of the calibration set into the detection model corresponding to the second coefficient matrix, obtaining the calibration set second index prediction matrix composed of the predicted values of the detection indexes of the calibration set; Inputting the near infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the third coefficient matrix, obtaining the calibration set third index prediction matrix composed of the predicted values of the detection indexes of the calibration set; Inputting the mid-infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix, obtaining the fourth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set; Inputting the near infrared spectrum matrix of the validation set into the detection model corresponding to the first coefficient matrix to obtain the first indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set; Inputting the mid-infrared spectrum matrix of the validation set into the detection model corresponding to the second coefficient matrix, obtaining the second indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set; Inputting the near infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the third coefficient matrix, obtaining the third indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set; Inputting the mid-infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the fourth coefficient matrix, obtaining the fourth indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set; Through the first indicator prediction matrix of the verification set, the second indicator prediction matrix of the verification set, the third indicator prediction matrix of the verification set, the fourth indicator prediction matrix of the verification set and the indicator matrix, a first verification value, a second verification value, a third verification value and a fourth verification value are respectively obtained according to the verification indicators, and the verification indicators are used to characterize the prediction performance of the detection model; The optimal value of the first verification value, the second verification value, the third verification value, and the fourth verification value is used as the optimal verification value, the optimal verification value is used as the threshold, and the range of the threshold in the direction where the prediction performance of the detection model becomes better is used as the threshold range; The near-infrared spectrum matrix and the mid-infrared spectrum matrix of the calibration set are fused at the data level to form the first data-level fusion matrix of the calibration set, and the matrix and the indicator matrix of the calibration set are input into the detection model to train the detection model, so as to obtain the fifth coefficient matrix; The near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the calibration set are fused at the data level to form the second data-level fusion matrix of the calibration set, and the index matrix of the calibration set is input into the detection model to train the detection model to obtain the sixth coefficient matrix; The first data-level fusion matrix of the calibration set is used as an input matrix, and the detection model corresponding to the fifth coefficient matrix is input to obtain the fifth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set; The second data level fusion matrix of the calibration set is used as the input matrix, and the detection model corresponding to the sixth coefficient matrix is input to obtain the sixth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the validation set; The first data-level fusion matrix of the validation set formed by data-level fusion of the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the validation set is used as the input matrix, and the detection model corresponding to the fifth coefficient matrix is input to obtain the fifth indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set; The second data-level fusion matrix of the validation set formed by data-level fusion of the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the validation set is used as the input matrix, and the detection model corresponding to the sixth coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the sixth indicator prediction matrix of the validation set; Through the fifth indicator prediction matrix of the verification set, the sixth indicator prediction matrix of the verification set, and the indicator matrix, the fifth verification value and the sixth verification value are obtained according to the verification indicators respectively; The near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set are fused at the feature level to form the first feature-level fusion matrix of the calibration set, and the matrix and the indicator matrix of the calibration set are input into the detection model to train the detection model to obtain the seventh coefficient matrix; The preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set are subjected to feature-level fusion to form the second feature-level fusion matrix of the calibration set, and the matrix and the indicator matrix of the calibration set are input into the detection model to train the detection model to obtain the eighth coefficient matrix; The first feature level fusion matrix of the calibration set is used as an input matrix, and the detection model corresponding to the seventh coefficient matrix is input to obtain the seventh indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set; The second feature level fusion matrix of the calibration set is used as an input matrix, and the detection model corresponding to the eighth coefficient matrix is input to obtain the eighth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set; The first feature-level fusion matrix of the validation set formed by feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the validation set is used as the input matrix, and the detection model corresponding to the seventh coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the seventh indicator prediction matrix of the validation set; The second feature-level fusion matrix of the validation set formed by data-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set is used as the input matrix, and the detection model corresponding to the eighth coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the eighth indicator prediction matrix of the validation set; Through the seventh indicator prediction matrix of the verification set, the eighth indicator prediction matrix of the verification set, and the indicator matrix, the seventh verification value and the eighth verification value are obtained according to the verification indicators respectively; Screening the first to eighth verification values according to the threshold range to select a verification value group within the threshold range; The correction set indicator matrix corresponding to the verification value group is subjected to decision-level fusion to obtain the correction set decision-level fusion matrix, the correction set decision-level fusion matrix and the correction set indicator matrix are input into the detection model, the detection model is trained to obtain the ninth coefficient matrix, and the ninth coefficient matrix is the coefficient matrix after training; The step of predicting the detection index includes: The near-infrared spectrum matrix and the mid-infrared spectrum matrix of the substance to be tested are fused at the data level to obtain a spectrum fusion matrix; Inputting the spectrum fusion matrix of the substance to be detected into the trained detection model as an input matrix to obtain a first indicator matrix as an output matrix; using the first indicator matrix as a detection result of the detection indicator of the substance to be detected; Among them, the indicator matrix is a matrix composed of indicator values of detection indicators measured by standard methods; the first indicator matrix is a matrix composed of indicator values of detection indicators predicted by the detection model; the detection indicators include one or more of flash point, pour point, density and kinematic viscosity.
2. The detection method based on fusion of multiple spectral data according to claim 1, characterized in that: The verification index includes the coefficient of determination and / or the root mean square error of prediction; 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 includes: Inputting the near infrared spectrum matrix of the substance to be tested into the trained detection model as an input matrix to obtain a second indicator matrix as an output matrix; Inputting the mid-infrared spectrum matrix of the substance to be tested into the trained detection model as an input matrix, and obtaining a third indicator matrix as an output matrix; The first indicator matrix, the second indicator matrix and the third indicator matrix are fused at the decision level to obtain a fourth indicator matrix; Input the fourth indicator matrix as an input matrix into the trained detection model to obtain a fifth indicator matrix as an output matrix; and use the fifth indicator matrix as a detection result of the detection index of the substance to be detected; Wherein, the second indicator matrix, the third indicator matrix and the fifth indicator matrix are matrices composed of indicator values of the detection indicators predicted by the detection model; Or / and, before the step of predicting the detection index, the step also includes: Spectral preprocessing: performing spectral preprocessing on the spectral data of the near-infrared spectrum of the substance to be tested to form a first spectral matrix; performing spectral preprocessing on the spectral data of the mid-infrared spectrum of the substance to be tested to form a second spectral matrix; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing; The step of predicting the detection index also includes: fusing the first spectral matrix and the second spectral matrix at data level to form a first fused matrix; Inputting the first spectral matrix as an input matrix into the trained detection model to obtain a sixth indicator matrix as an output matrix; Inputting the second spectral matrix as an input matrix into the trained detection model to obtain a seventh indicator matrix as an output matrix; Inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth indicator matrix as an output matrix; The sixth indicator matrix, the seventh indicator matrix and the eighth indicator matrix are integrated at the decision level to form the fourth indicator matrix.
3. The detection method based on fusion of multiple spectral data according to claim 1, characterized in that: The step of predicting the detection index also includes: Spectral variable screening: performing spectral variable screening processing on the near infrared spectrum and mid-infrared spectrum of the substance to be tested respectively to form a third spectral matrix and a fourth spectral matrix; the spectral variable screening processing includes variable importance projection processing; The step of predicting the detection index also includes: Performing feature-level fusion on the third spectral matrix and the fourth spectral matrix to form a second fusion matrix; Inputting the third spectral matrix as an input matrix into the trained detection model to obtain a ninth indicator matrix as an output matrix; Inputting the fourth spectral matrix as an input matrix into the trained detection model to obtain a tenth indicator matrix as an output matrix; Inputting the second fusion matrix as an input matrix into the trained detection model to obtain an eleventh indicator matrix as an output matrix; The ninth indicator matrix, the tenth indicator matrix and the eleventh indicator matrix are integrated at the decision-making level to form the fourth indicator matrix.
4. The detection method based on fusion of multiple spectral data according to claim 1, characterized in that: The step of predicting the detection index also includes: Spectral preprocessing: performing spectral preprocessing on the spectral data of the near-infrared spectrum of the substance to be tested to form a first spectral matrix; performing spectral preprocessing on the spectral data of the mid-infrared spectrum of the substance to be tested to form a second spectral matrix; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing; Spectral variable screening: spectral variable screening processing is performed on the first spectral matrix and the second spectral matrix of the substance to be tested to form a fifth spectral matrix and a sixth spectral matrix; the spectral variable screening processing includes variable importance projection processing.
5. The detection method based on fusion of multiple spectral data according to claim 4, characterized in that: The step of predicting the detection index also includes: fusing the first spectral matrix and the second spectral matrix at data level to form a first fused matrix; Performing feature-level fusion on the fifth spectral matrix and the sixth spectral matrix to form a third fusion matrix; Inputting the first spectral matrix as an input matrix into the trained detection model to obtain a sixth indicator matrix as an output matrix; Inputting the second spectral matrix as an input matrix into the trained detection model to obtain a seventh indicator matrix as an output matrix; Inputting the first fusion matrix as an input matrix into the trained detection model to obtain an eighth indicator matrix as an output matrix; Inputting the third fusion matrix as an input matrix into the trained detection model to obtain a twelfth indicator matrix as an output matrix; The sixth indicator matrix, the seventh indicator matrix, the eighth indicator matrix and the twelfth indicator matrix are integrated at the decision level to form the fourth indicator matrix.
6. The detection method based on fusion of multiple spectral data according to claim 1, characterized in that: The step of training the detection model comprises: Collecting training samples to construct a training set, wherein the training set includes near-infrared spectra and mid-infrared spectra of a plurality of training samples and index values of detection indexes of a plurality of training samples; The training set is divided into a calibration set and a validation set, and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an indicator matrix of the calibration set and a near-infrared spectrum matrix, a mid-infrared spectrum matrix and an indicator matrix of the validation set are obtained; Performing spectral preprocessing on the near-infrared spectra and mid-infrared spectra of the calibration set and the validation set respectively, obtaining the near-infrared spectrum preprocessing matrix and mid-infrared spectrum preprocessing matrix of the calibration set and the near-infrared spectrum preprocessing matrix and mid-infrared spectrum preprocessing matrix of the validation set; the spectral preprocessing includes derivative processing and / or vector normalization processing, and the derivative processing includes first-order derivative processing and / or high-order derivative processing; Performing spectral variable screening processing on the near infrared spectra after spectral preprocessing and the mid-infrared spectra after spectral preprocessing of the calibration set and the validation set, respectively, to obtain the preprocessed near infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set and the preprocessed near infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set; the spectral variable screening processing includes competitive adaptive weighted sampling processing and / or variable importance projection processing; Inputting the near infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a third coefficient matrix; Inputting the mid-infrared spectrum preprocessing matrix and the indicator matrix of the calibration set into the detection model, training the detection model, and obtaining a fourth coefficient matrix; Inputting the near infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the third coefficient matrix, obtaining the calibration set third index prediction matrix composed of the predicted values of the detection indexes of the calibration set; Inputting the mid-infrared spectrum preprocessing matrix of the calibration set into the detection model corresponding to the fourth coefficient matrix, obtaining the fourth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set; Inputting the near infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the third coefficient matrix, obtaining the third indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set; Inputting the mid-infrared spectrum preprocessing matrix of the validation set into the detection model corresponding to the fourth coefficient matrix, obtaining the fourth indicator prediction matrix of the validation set composed of the predicted values of the detection indicators of the validation set; Obtaining a third verification value and a fourth verification value respectively according to the verification indicators through the third indicator prediction matrix of the verification set, the fourth indicator prediction matrix of the verification set, and the indicator matrix, wherein the verification indicators are used to characterize the prediction performance of the detection model; The optimal value of the third verification value and the fourth verification value is used as the optimal verification value, the optimal verification value is used as the threshold, and the range of the threshold in the direction where the prediction performance of the detection model becomes better is used as the threshold range; The near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the calibration set are fused at the data level to form the second data-level fusion matrix of the calibration set, and the index matrix of the calibration set is input into the detection model to train the detection model to obtain the sixth coefficient matrix; The second data level fusion matrix of the calibration set is used as the input matrix, and the detection model corresponding to the sixth coefficient matrix is input to obtain the sixth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the validation set; The second data-level fusion matrix of the validation set formed by data-level fusion of the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the validation set is used as the input matrix, and the detection model corresponding to the sixth coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the sixth indicator prediction matrix of the validation set; Obtain a sixth verification value according to the verification indicator through the sixth indicator prediction matrix and the indicator matrix of the verification set; The second feature-level fusion matrix of the calibration set formed by feature-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set is input into the detection model together with the indicator matrix of the calibration set, and the detection model is trained to obtain the eighth coefficient matrix; The second feature level fusion matrix of the calibration set is used as an input matrix, and the detection model corresponding to the eighth coefficient matrix is input to obtain the eighth indicator prediction matrix of the calibration set composed of the predicted values of the detection indicators of the calibration set; The second feature-level fusion matrix of the validation set formed by data-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set is used as the input matrix, and the detection model corresponding to the eighth coefficient matrix is input to obtain the predicted values of the detection indicators of the validation set to form the eighth indicator prediction matrix of the validation set; Obtain the eighth verification value according to the verification indicator through the eighth indicator prediction matrix and the indicator matrix of the verification set; Screening the third verification value, the fourth verification value, the sixth verification value, and the eighth verification value according to the threshold range to screen out a verification value group within the threshold range; The correction set indicator matrix corresponding to the verification value group is fused at the decision level to obtain the correction set decision level fusion matrix. The correction set decision level fusion matrix and the correction set indicator matrix are input into the detection model, and the detection model is trained to obtain the ninth coefficient matrix, which is the coefficient matrix after training.
7. The detection method based on fusion of multiple spectral data according to claim 6, characterized in that: The verification index includes the determination coefficient and / or the prediction root mean square error.
8. The detection method based on fusion of multiple spectral data according to claim 6, characterized in that: The optimal verification value is the minimum value of the predicted root mean square error and / or the maximum value of the determination coefficient; the threshold range is not greater than the minimum value of the predicted root mean square error and / or not less than the maximum value of the determination coefficient.
9. The detection method based on fusion of multiple spectral data according to claim 1, characterized in that: In the step of dividing the training set into a calibration set and a validation set: The training set is randomly divided into a calibration set and a validation set in a ratio of 2:1-4:
1.
10. The detection method based on fusion of multiple spectral data according to claim 9, characterized in that: The training set was randomly divided into a calibration set and a validation set in a ratio of 3:
1.
11. The detection method based on fusion of multiple spectral data according to claim 1, characterized in that: In the step of training the detection model, there are multiple types of spectral preprocessing and / or spectral variable screening processing, and the training model is trained using each spectral preprocessing, each spectral variable screening processing, and each combination of spectral preprocessing and spectral variable screening processing.
12. The detection method based on fusion of multiple spectral data according to any one of claims 1 to 11, characterized in that: The methods of data-level fusion, feature-level fusion and decision-level fusion include: Matrices of the same dimension are concatenated for data-level fusion, feature-level fusion, or decision-level fusion.
13. A detection system based on the fusion of multiple spectral data, characterized in that: include: An acquisition module collects the near-infrared spectrum and the mid-infrared spectrum of the substance to be tested, and obtains the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the substance to be tested; The detection model building module builds the detection model through the following formula: in, is the input matrix, is the output matrix, B is the coefficient matrix, P and Q are the loading matrices of X and Y respectively; T is the score matrix of the independent variable X; Training module, training detection model; Detection module, predicts detection indicators; The training modules include: A training set construction unit collects training samples to construct a training set, wherein the training set includes near-infrared spectra and mid-infrared spectra of a plurality of training samples and index values of detection indexes of a plurality of training samples; A training set division unit is used to divide the training set constructed by the training set construction unit into a calibration set and a validation set, and obtain a near infrared spectrum matrix, a mid infrared spectrum matrix and an indicator matrix of the calibration set and a near infrared spectrum matrix, a mid infrared spectrum matrix and an indicator matrix of the validation set; A spectral preprocessing unit performs spectral preprocessing on the near-infrared spectra and mid-infrared spectra of the calibration set and the validation set obtained by the training set division unit, respectively, to obtain a near-infrared spectrum preprocessing matrix and a mid-infrared spectrum preprocessing matrix of the calibration set and a near-infrared spectrum preprocessing matrix and a mid-infrared spectrum preprocessing matrix of the validation set; a spectral variable screening unit, performing spectral variable screening on the near-infrared spectra, mid-infrared spectra, near-infrared spectra after spectral preprocessing, and mid-infrared spectra after spectral preprocessing of the calibration set and the validation set obtained by the training set division unit, respectively, to obtain the near-infrared spectra variable screening matrix, mid-infrared spectra variable screening matrix, preprocessed near-infrared spectra variable screening matrix, and preprocessed mid-infrared spectra variable screening matrix of the calibration set, as well as the near-infrared spectra variable screening matrix, mid-infrared spectra variable screening matrix, preprocessed near-infrared spectra variable screening matrix, and preprocessed mid-infrared spectra variable screening matrix of the validation set; A first training unit inputs the near infrared spectrum matrix and the indicator 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; A second training unit inputs the mid-infrared spectrum matrix and the indicator 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; A third training unit inputs the near infrared spectrum preprocessing matrix and the indicator matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model, trains the detection model, and obtains a third coefficient matrix; A fourth training unit, inputting the mid-infrared spectrum preprocessing matrix and the indicator matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model, training the detection model, and obtaining a fourth coefficient matrix; A first prediction unit inputs the near-infrared spectrum matrix of the calibration set obtained by the training set division unit into a detection model corresponding to the first coefficient matrix to obtain a first indicator prediction matrix of the calibration set composed of predicted values of the detection indicators 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 second indicator prediction matrix of the calibration set composed of predicted values of the detection indicators of the calibration set; A third prediction unit inputs the near-infrared spectrum preprocessing matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model corresponding to the third coefficient matrix to obtain a third indicator prediction matrix of the calibration set composed of predicted values of the detection indicators of the calibration set; A fourth prediction unit inputs the mid-infrared spectrum preprocessing matrix of the calibration set obtained by the spectrum preprocessing unit into the detection model corresponding to the fourth coefficient matrix to obtain a fourth indicator prediction matrix of the calibration set composed of predicted values of the detection indicators of the calibration set; 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, to obtain a first indicator prediction matrix of the verification set composed of predicted values of the detection indicators of the verification set; 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, to obtain a second indicator prediction matrix of the verification set composed of predicted values of the detection indicators of the verification set; A seventh prediction unit, inputting the near infrared spectrum preprocessing matrix of the verification set obtained by the spectrum preprocessing unit into the detection model corresponding to the third coefficient matrix, and obtaining a third indicator prediction matrix of the verification set composed of the predicted values of the detection indicators of the verification set; An eighth prediction unit, inputting the mid-infrared spectrum preprocessing matrix of the verification set obtained by the spectrum preprocessing unit into the detection model corresponding to the fourth coefficient matrix, and obtaining a fourth indicator prediction matrix of the verification set composed of predicted values of the detection indicators of the verification set; A first verification unit obtains a first verification value, a second verification value, a third verification value, and a fourth verification value according to the verification indicators, respectively, through the first indicator prediction matrix of the verification set obtained by the fifth prediction unit, the second indicator prediction matrix of the verification set obtained by the sixth prediction unit, the third indicator prediction matrix of the verification set obtained by the seventh prediction unit, the fourth indicator prediction matrix of the verification set obtained by the eighth prediction unit, and the indicator matrix obtained by the training set division unit, wherein the verification indicators are used to characterize the prediction performance of the detection model; a threshold range obtaining unit, which uses 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, uses the optimal verification value as the threshold, and uses the range of the threshold in the direction where the prediction performance of the detection model becomes better as the threshold range; A fifth training unit, which performs data-level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the calibration set obtained by the training set division unit to form a first data-level fusion matrix of the calibration set, and inputs the matrix and the indicator matrix of the calibration set into the detection model to train the detection model, thereby obtaining a fifth coefficient matrix; The sixth training unit fuses the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the calibration set obtained by the spectrum preprocessing unit at the data level to form a second data-level fusion matrix of the calibration set, and inputs the matrix and the indicator matrix of the calibration set into the detection model to train the detection model, thereby obtaining a sixth coefficient matrix; The ninth prediction unit uses the first data level fusion matrix of the calibration set as an input matrix, inputs the detection model corresponding to the fifth coefficient matrix, and obtains the calibration set fifth indicator prediction matrix composed of the predicted values of the detection indicators of the calibration set; The tenth prediction unit uses the second data level fusion matrix of the calibration set as an input matrix, inputs the detection model corresponding to the sixth coefficient matrix, and obtains the calibration set sixth indicator prediction matrix composed of the predicted values of the detection indicators of the validation set; The eleventh prediction unit uses the first data-level fusion matrix of the verification set formed 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 fifth indicator prediction matrix of the verification set formed by the predicted values of the detection indicators of the verification set; The twelfth prediction unit uses the second data-level fusion matrix of the verification set formed by data-level fusion of the near-infrared spectrum preprocessing matrix and the mid-infrared spectrum preprocessing matrix of the verification set as an input matrix, inputs the detection model corresponding to the sixth coefficient matrix, and obtains the sixth indicator prediction matrix of the verification set formed by the predicted values of the detection indicators of the verification set; The second verification unit obtains a fifth verification value and a sixth verification value according to the verification indicators through the fifth indicator prediction matrix of the verification set, the sixth indicator prediction matrix of the verification set, and the indicator matrix; The seventh training unit is to perform feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the calibration set to form the first feature-level fusion matrix of the calibration set, and the indicator matrix of the calibration set to input into the detection model, train the detection model, and obtain the seventh coefficient matrix; In the eighth training unit, the second feature-level fusion matrix of the calibration set formed by feature-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the calibration set and the indicator matrix of the calibration set are input into the detection model to train the detection model and obtain the eighth coefficient matrix; The thirteenth prediction unit uses the first feature level fusion matrix of the correction set as an input matrix, inputs the detection model corresponding to the seventh coefficient matrix, and obtains the seventh indicator prediction matrix of the correction set composed of the predicted values of the detection indicators of the correction set; The fourteenth prediction unit uses the second feature level fusion matrix of the correction set as an input matrix, inputs the detection model corresponding to the eighth coefficient matrix, and obtains the eighth indicator prediction matrix of the correction set composed of the predicted values of the detection indicators of the correction set; The fifteenth prediction unit uses the first feature-level fusion matrix of the validation set formed by feature-level fusion of the near-infrared spectrum variable screening matrix and the mid-infrared spectrum variable screening matrix of the validation set as an input matrix, inputs the detection model corresponding to the seventh coefficient matrix, and obtains the seventh indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set; The sixteenth prediction unit uses the second feature-level fusion matrix of the validation set formed by data-level fusion of the preprocessed near-infrared spectrum variable screening matrix and the preprocessed mid-infrared spectrum variable screening matrix of the validation set as an input matrix, inputs the detection model corresponding to the eighth coefficient matrix, and obtains the eighth indicator prediction matrix of the validation set formed by the predicted values of the detection indicators of the validation set; The third verification unit obtains a seventh verification value and an eighth verification value according to the verification indicators through the seventh indicator prediction matrix of the verification set, the eighth indicator prediction matrix of the verification set, and the indicator matrix; A verification value screening unit, screening the first to eighth verification values according to a threshold range, and screening out a verification value group within the threshold range; The ninth training unit performs decision-level fusion on the correction set indicator 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 correction set indicator matrix into the detection model, trains the detection model, and obtains the ninth coefficient matrix, which is the coefficient matrix after training; The detection module includes: A data-level fusion unit, which performs data-level fusion on the near-infrared spectrum matrix and the mid-infrared spectrum matrix of the substance to be tested to obtain a spectrum fusion matrix; The prediction unit inputs the spectrum fusion matrix obtained by the data-level fusion unit as an input matrix into the trained detection model to obtain a first indicator matrix as an output matrix; and uses the first indicator matrix as a detection result of the detection index of the substance to be detected; Among them, the indicator matrix is a matrix composed of indicator values of detection indicators measured by standard methods; the first indicator matrix is a matrix composed of indicator values of detection indicators predicted by the detection model; the detection indicators include one or more of flash point, pour point, density and kinematic viscosity.
14. The detection system based on fusion of multiple spectral data according to claim 13, characterized in that System, The detection module also includes: A decision-level fusion unit, inputting the near-infrared spectrum matrix of the substance to be tested as an input matrix into the trained detection model to obtain a second indicator matrix as an output matrix; inputting the mid-infrared spectrum matrix of the substance to be tested as an input matrix into the trained detection model to obtain a third indicator matrix as an output matrix; performing decision-level fusion on the first indicator matrix, the second indicator matrix and the third indicator matrix to obtain a fourth indicator matrix; The prediction unit inputs the fourth indicator matrix of the decision-level fusion unit as an input matrix into the trained detection model to obtain a fifth indicator matrix as an output matrix; and uses the fifth indicator matrix as the detection result of the substance to be detected; Among them, the second indicator matrix, the third indicator matrix and the fifth indicator matrix are matrices composed of indicator values of detection indicators predicted by the detection model.
15. The detection system based on fusion of multiple spectral data according to claim 13, characterized in that: The verification index includes the determination coefficient and / or the prediction root mean square error.
16. The detection system based on fusion of multiple spectral data according to claim 13, characterized in that: The optimal verification value is the minimum value of the predicted root mean square error and / or the maximum value of the determination coefficient; the threshold range is not greater than the minimum value of the predicted root mean square error and / or not less than the maximum value of the determination coefficient.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a program based on fusion of multiple spectral data. When the program based on fusion of multiple spectral data is executed by a processor, the steps of the detection method based on fusion of multiple spectral data as described in any one of claims 1-12 are implemented.
18. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory comprises a program based on fusion of multiple spectral data, and when the program based on fusion of multiple spectral data is executed by the processor, the steps of the detection method based on fusion of multiple spectral data as described in any one of claims 1-12 are implemented.
