Evaluation model construction method for near-infrared spectrometer measurement spectrum prediction
The evaluation model construction method through the multi-task learning mechanism solves the problem of near-infrared spectrometers requiring a large number of standard samples in multi-line detection, improves the model construction speed and accuracy, reduces the detection workload, and achieves more efficient evaluation. Relational model building.
Patent Information
- Application Number
- CN202210915622.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-01
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-08-01
AI Technical Summary
When the near-infrared spectrometer detects fruit in multiple lines in parallel, a large number of standard samples are needed to establish the model, which results in a long modeling and testing cycle and reduces the accuracy and work efficiency of the evaluation relationship model.
An evaluation model construction method using a multi-task learning mechanism is used to optimize model parameters through denoising processing, consistency processing and multi-task learning model parallel training, using optimization algorithms to reduce the workload of testing standard samples and improve model construction speed and accuracy. sex.
Through the multi-task learning mechanism, the correlation between various instrument data sets is used to reduce the workload of standard sample detection, improve the accuracy and efficiency of the evaluation model, and shorten the model construction time.
Smart Images

Figure CN115326746B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of spectral analysis, and in particular to a method for constructing an evaluation model for predicting spectrum measurement using a near-infrared spectrometer, which is an evaluation model construction method based on a multi-task learning mechanism. Background Art
[0002] At present, near-infrared spectroscopy analysis technology is widely used in many industries such as agriculture, petrochemicals, pharmaceuticals, and food. Near-infrared spectroscopy instruments are no longer high-tech scientific research equipment, but indispensable production equipment in factories.
[0003] During the use of the near-infrared spectrometer, for example, on multiple parallel fruit inspection lines, each line must use a near-infrared spectrometer to test a certain quality of the fruit. In order to ensure the accuracy of the inspection, it is necessary to establish an evaluation relationship model between the physical and chemical characteristics of the product to be tested and its near-infrared spectrum, and calibrate the spectrum obtained each time through the model. To this end, it is necessary to use standard samples to establish this model. Standard samples are a batch of products whose physical or chemical characteristics have been measured. They often require a lot of time to collect, and it is difficult for fruit samples to keep their physical and chemical characteristics stable. For each batch of tested products, the near-infrared spectrometer involved in the test requires a large number of standard samples to participate in the establishment of the model. Usually, the modeling process requires each instrument involved in the inspection to test all standard samples, which results in a very long modeling test cycle, which reduces the accuracy of the evaluation relationship model and also reduces work efficiency. Therefore, it is urgent to solve this problem. Summary of the invention
[0004] The purpose of the present invention is to propose a method for constructing an evaluation model for spectrum prediction measured by a near-infrared spectrometer. The method is based on a multi-task learning mechanism. This method does not require each detector to collect data for all standard samples, thereby speeding up the construction of the evaluation model.
[0005] In order to achieve the above object, the technical solution of the present invention is:
[0006] The method for constructing an evaluation model for near-infrared spectrometer measurement spectrum prediction includes multiple near-infrared spectrometers involved in product testing and multiple standard samples that have been obtained, wherein: the evaluation model construction method includes:
[0007] Step 1: Multiple near-infrared spectrometers involved in product testing collect spectrum data of multiple standard samples respectively to obtain spectrum data of multiple standard samples of each near-infrared spectrometer, wherein one near-infrared spectrometer collects more standard samples than the other near-infrared spectrometers;
[0008] Step 2: De-noise the spectral data collected by multiple near-infrared spectrometers;
[0009] The third step is to unify the spectral data collected by multiple near-infrared spectrometers. The process is: the average spectrum of the spectral data of the spectrometer that collects the most standard samples is taken as the ideal spectrum, and the spectral data of the remaining spectrometers are corrected for multivariate scattering using the ideal spectrum;
[0010] Step 4: Use a multi-task learning model to train the spectral data of multiple near-infrared spectrometers in parallel after being processed in a consistent manner, and use an optimization algorithm to optimize the model parameters to obtain the weight of each wavelength;
[0011] Step 5: Get the evaluation model from the weights:
[0012] y forecast =w*S
[0013] in:
[0014] y forecast For the prediction object,
[0015] w is the wavelength weight,
[0016] S is the measured spectrum of this spectrometer.
[0017] The plan further is:
[0018] The multi-task learning model formula is:
[0019]
[0020] in:
[0021] m is the number of near-infrared spectrometers as the number of tasks, n is the number of standard sample spectra for each task, x is each spectral data, y is the parameter to be connected, ‖T|| tr With ‖L|| 2,1 is the trace norm l 2,1 norm, used to establish connections and constraints between tasks. α and β are the first and second weight coefficients, ranging from 1e-6 to 1e6. i With l i is the wavelength weight to be determined.
[0022] The solution is further that: the optimization of the model parameters by using the optimization algorithm is to optimize the first and second weight coefficients by using particle swarm optimization, genetic algorithm, and Bayesian optimization method.
[0023] The solution is further that: the denoising process uses the Savitzky-Golay convolution method to eliminate the noise of the spectral data of each instrument, and the expression of the Savitzky-Golay convolution method is:
[0024]
[0025] in:
[0026] m is the window width, P s is the smoothing coefficient of wavelength point s;
[0027] P s =X′ l+s / X l+s ;
[0028] X′ l+s is the spectral absorbance fitting value at wavelength point l+s, X l+s is the true value of the spectral absorbance at wavelength point l+s, X′ l+s The sample spectrum is fitted by the least squares method, where the window width is 7 and the least squares fitting order is 2.
[0029] The solution is further as follows: the solution formula for the average spectrum is:
[0030]
[0031] in is the spectral data A st The average spectrum of is the spectrum of the i-th sample, and n is the number of spectra in the sample set.
[0032] The scheme further includes: the process of using the ideal spectrum to perform multivariate scattering correction on the spectral data of the remaining spectrometers is:
[0033] First, a univariate linear regression is performed on the spectrum of each sample in the spectrometer and the average spectrum to solve the least squares problem to obtain the baseline shift and offset of each sample; then the spectrum of each sample is subtracted from the obtained baseline shift and divided by the offset to obtain a corrected spectrum.
[0034] The scheme is further: the method further comprises: after completing the first step, the spectral data of the plurality of standard samples by each near infrared spectrometer is standardized, and the formula is:
[0035]
[0036] S is the original spectrum, S st is the standardized spectrum, μ is the average value of all standard sample spectra, and σ is the standard deviation between standard sample spectra.
[0037] The beneficial effects of the present invention are: reducing the workload of the near-infrared spectrometer involved in the detection on the standard sample, utilizing the correlation between the data sets of each instrument through a multi-task learning mechanism, accelerating the speed of building the evaluation model, and improving the accuracy and work efficiency of the evaluation relationship model.
[0038] The present invention is described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 is a schematic diagram of the method flow chart;
[0040] Figure 2 The spectra after denoising the spectral data of the three spectrometers M5, MP5 and MP6;
[0041] Figure 3 Performance of the predicted values for the three spectrometers on the test set. DETAILED DESCRIPTION
[0042] A method for constructing an evaluation model for near-infrared spectrometer measurement spectrum prediction includes multiple near-infrared spectrometers involved in product testing and multiple standard samples that have been obtained, wherein: Figure 1 As shown, the evaluation model building method includes:
[0043] Step 1: Spectral data preparation: multiple near-infrared spectrometers involved in product testing collect spectrum data of multiple standard samples respectively to obtain spectrum data of each near-infrared spectrometer for multiple standard samples. One near-infrared spectrometer collects more standard samples than the other near-infrared spectrometers.
[0044] Step 2: De-noise the spectral data collected by multiple near-infrared spectrometers;
[0045] Step 3: Performing consistency processing on the spectral data collected by multiple near-infrared spectrometers, the process is: taking the average spectrum of the spectral data of the spectrometer that collects the most measurement standard samples as the ideal spectrum, and using the ideal spectrum to perform multivariate scattering correction on the spectral data of the remaining spectrometers, so as to improve the characteristic consistency of the spectral data set;
[0046] Step 4: Use a multi-task learning model to train the spectral data after the uniform processing of multiple near-infrared spectrometers in parallel, and use the optimization algorithm to optimize the model parameters to obtain the weight of each wavelength;
[0047] Step 5: Get the evaluation model from the weights:
[0048] y forecast =w*S
[0049] in:
[0050] yforecast For the prediction object,
[0051] w is the wavelength weight,
[0052] S is the measured spectrum of this spectrometer.
[0053] The multi-task learning model formula in the method is:
[0054]
[0055] in:
[0056] m is the number of near-infrared spectrometers as the number of tasks, n is the number of standard sample spectra for each task, x is each spectral data, y is the parameter to be connected, ‖T|| tr With ‖L|| 2,1 is the trace norm l 2,1 norm, used to establish connections and constraints between tasks. α and β are the first and second weight coefficients, ranging from 1e-6 to 1e6. i With l i is the wavelength weight to be determined.
[0057] The multi-task learning model formula is a minimization solution, so there is no equal sign. The solution of the formula can be obtained by the well-known gradient descent method, which is the same as the solution method of the neural network. i With l i This is the parameter to be solved in the formula, which can generally be solved by gradient descent method. tr With ‖L|| 2,1 is the trace norm l 2,1 Norms are two matrix norms, which are well-known and are basic knowledge of advanced mathematics and linear algebra; the specific expressions are as follows:
[0058]
[0059] The trace norm is the sum of the singular values of the matrix, and the L21 norm is the sum of the L2 norms of the matrix column vectors.
[0060] The optimization of model parameters by using an optimization algorithm is to optimize the first and second weight coefficients using, but not limited to, particle swarm optimization, genetic algorithm, and Bayesian optimization method, and then use the accelerated proximal algorithm to solve multi-task learning. The optimization is performed on the model formula results, and the process can be understood as finding the first and second weight coefficients that can make the model formula optimal. By continuously assigning values to the weight coefficients, the result of the model formula is obtained, and the weight coefficient with the smallest model formula value is selected according to certain rules.
[0061] In the above method, the denoising process is to use the Savitzky-Golay convolution method to eliminate the noise of the spectral data of each instrument. The expression of the Savitzky-Golay convolution method is:
[0062]
[0063] in:
[0064] m is the window width, P s is the smoothing coefficient of wavelength point s;
[0065] P s =X′ l+s / X l+s ;
[0066] X′ l+s is the spectral absorbance fitting value at wavelength point l+s, X l+s is the true value of the spectral absorbance at wavelength point l+s, X′ l+s The sample spectrum is fitted by the least squares method, where the window width is 7 and the least squares fitting order is 2.
[0067] In the above method: the formula for solving the average spectrum is:
[0068]
[0069] in is the spectral data A st The average spectrum of is the spectrum of the i-th sample, and n is the number of spectra in the sample set.
[0070] Wherein: the process of using the ideal spectrum to perform multivariate scattering correction on the spectral data of the remaining spectrometers is:
[0071] First, a univariate linear regression is performed on the spectrum of each sample in the spectrometer and the average spectrum to solve the least squares problem to obtain the baseline shift and offset of each sample; then the spectrum of each sample is subtracted from the obtained baseline shift and divided by the offset to obtain a corrected spectrum.
[0072] The method further comprises: after completing the first step, performing standardization processing on the spectral data of multiple standard samples by each near infrared spectrometer, the formula is:
[0073]
[0074] S is the original spectrum, S st is the standardized spectrum, μ is the average value of all standard sample spectra, and σ is the standard deviation between standard sample spectra.
[0075] The following is an example of building an evaluation model for measuring spectrum prediction using three near-infrared spectrometers: The example uses a real corn spectrum data set, which contains 40 samples, continuous spectrum data from 1100nm to 2400nm measured by spectrometers m5, mp5 and mp6, with a wavelength point every 2nm, and the feature to be measured is fat content, ranging from 9.3% to 10.1%. Among them, 20 samples in the spectrum measured by m5 are selected as training sets, 10 samples in the spectrum measured by mp5 are selected as training sets, and 10 samples in the spectrum measured by mp6 are selected as training sets, and the remaining samples are used as test sets; the above sampling description: the standard samples collected by the spectrometer that collects the most standard samples are twice the standard samples collected by the other near-infrared spectrometers.
[0076] First, the Savitzky-Golay convolution method is used to eliminate the noise of the spectral data of each instrument. The spectrum after the Savitzky-Golay convolution method is as follows: Figure 2 shown.
[0077] The optimization algorithm is used to optimize the model parameters, and the data sets of multiple spectrometers are trained in parallel using the multi-task learning method. Bayesian optimization is used to optimize the first weight coefficient and the second weight coefficient in multi-task learning. The multi-task learning method is solved using the accelerated proximal algorithm. The weights of each wavelength obtained by multi-task learning are extracted to obtain the final model. For a certain spectrometer, its wavelength weight is extracted, w=t+l, and the evaluation model is obtained:
[0078] y forecast =w*S
[0079] Among them, y forecast is the prediction object, w is the wavelength weight, and S is the measured spectrum of this spectrometer.
[0080] The evaluation index of model prediction performance is calculated using the root mean square error RMSE formula:
[0081]
[0082] in, is the predicted value of the physical and chemical properties of the sample to be tested, is the actual value of the physical and chemical properties of the sample to be tested. The performance of the model calibrated simultaneously by three spectrometers on the test set is as follows Figure 3 The RMSE comparison results of the PLS method with each individual model are shown in Table 1.
[0083] Table 1
[0084]
[0085] The above-mentioned embodiment of the evaluation model construction method for near-infrared spectrometer measurement spectrum prediction utilizes the correlation between tasks, that is, the consistency of the near-infrared spectrum band changes of the same material characteristics, and improves the generalization ability and evaluation performance of the model when the number of samples of each instrument is small. In addition, the workload of the near-infrared spectrometer involved in the detection of standard samples is reduced, and the correlation between the data sets of each instrument is utilized through the multi-task learning mechanism, which speeds up the construction of the evaluation model and improves the accuracy and work efficiency of the evaluation relationship model.
Claims
1. A method for constructing an evaluation model for near-infrared spectrometer measurement spectrum prediction, comprising a plurality of near-infrared spectrometers involved in product testing and a plurality of standard samples that have been obtained, characterized in that: The evaluation model building method comprises: Step 1: Multiple near-infrared spectrometers involved in product testing collect spectrum data of multiple standard samples respectively to obtain spectrum data of multiple standard samples of each near-infrared spectrometer, wherein one near-infrared spectrometer collects more standard samples than the other near-infrared spectrometers; Step 2: De-noise the spectral data collected by multiple near-infrared spectrometers; The third step is to unify the spectral data collected by multiple near-infrared spectrometers. The process is: the average spectrum of the spectral data of the spectrometer that collects the most standard samples is taken as the ideal spectrum, and the spectral data of the remaining spectrometers are corrected for multivariate scattering using the ideal spectrum; Step 4: Use a multi-task learning model to train the spectral data of multiple near-infrared spectrometers in parallel after being processed in a consistent manner, and use an optimization algorithm to optimize the model parameters to obtain the weight of each wavelength; Step 5: Get the evaluation model from the weights: y forecast =w*S in: y forecast For the prediction object, w is the wavelength weight, S is the measured spectrum of this spectrometer; The multi-task learning model formula is: in: m is the number of near-infrared spectrometers as the number of tasks, n is the number of standard sample spectra for each task, x is each spectral data, y is the parameter to be connected, ||T|| tr With ||L|| 2,1 is the trace norm l 2,1 norm, used to establish connections and constraints between tasks. α and β are the first and second weight coefficients, ranging from 1e-6 to 1e6. i With l i is the wavelength weight to be determined; The method of optimizing the model parameters by using an optimization algorithm is to optimize the first and second weight coefficients by using a particle swarm optimization, a genetic algorithm, or a Bayesian optimization method.
2. The method for constructing an evaluation model according to claim 1, characterized in that: The de-noising process uses the Savitzky-Golay convolution method to eliminate the noise of the spectral data of each instrument. The expression of the Savitzky-Golay convolution method is: in: m is the window width, P s is the smoothing coefficient of wavelength point s; P s =X′ l+s / X l+s ; X′ l+s is the spectral absorbance fitting value at wavelength point l+s, X l+s is the true value of the spectral absorbance at wavelength point l+s, X′ l+s The sample spectrum is fitted by the least squares method, where the window width is 7 and the least squares fitting order is 2.
3. The method for constructing an evaluation model according to claim 1, characterized in that: The solution formula for the average spectrum is: in is the spectral data A st The average spectrum of is the spectrum of the i-th sample, and n is the number of spectra in the sample set.
4. The method for constructing an evaluation model according to claim 3, characterized in that: The process of using the ideal spectrum to perform multivariate scattering correction on the spectral data of the remaining spectrometers is: First, a univariate linear regression is performed on the spectrum of each sample in the spectrometer and the average spectrum to solve the least squares problem to obtain the baseline shift and offset of each sample; then the spectrum of each sample is subtracted from the obtained baseline shift and divided by the offset to obtain a corrected spectrum.
5. The method for constructing an evaluation model according to claim 1, characterized in that: The method further comprises: after completing the first step, performing standardization processing on the spectral data of multiple standard samples by each near infrared spectrometer, the formula is: S is the original spectrum, S st is the standardized spectrum, μ is the average value of all standard sample spectra, and σ is the standard deviation between standard sample spectra.
Citation Information
Patent Citations
Spectral model transmission method and system for quantitatively evaluating polymerization degree of insulation paper
CN114036456A
Analysing spectral data for the selection of a calibration model
EP2128599A1
Predicting Machine-Learned Model Performance from the Parameter Values of the Model
US20210256422A1
Qualitative and quantitative combined method for constructing near infrared quantitative model
WO2018010352A1
Method of and system for adapting multiple trained machine learning models on unlabelled dataset
WO2022107076A1
