A spectral data enhancement method based on conditional variational autoencoder
By combining conditional variational autoencoders and semi-supervised ladder networks, virtual samples matching labeled spectra are generated, which solves the problem of insufficient labeled samples in spectral calibration, achieves more accurate and effective spectral calibration modeling, and improves the model prediction accuracy.
Patent Information
- Application Number
- CN202111546557.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-12-17
AI Technical Summary
In spectral calibration, due to insufficient labeled samples, existing technology is difficult to effectively extract data features, resulting in unsatisfactory model prediction results. Semi-supervised learning and data enhancement methods have problems with distribution deviation and lack of directionality when processing unlabeled samples.
A spectral data enhancement method based on a combination of conditional variational autoencoders and semi-supervised ladder networks is used to generate virtual spectral samples to ensure that they belong to the same distribution as the labeled spectra, and a semi-supervised learning model is used to build a calibration model to ensure the accuracy of the virtual samples. effectiveness.
This method can effectively enhance the training set, ensure that the virtual spectrum has the same distribution as the actual spectrum, improve the accuracy and effectiveness of the model, avoid damage to the model accuracy caused by external interference, and significantly improve the effect of spectral calibration modeling.
Smart Images

Figure CN114239399B
Abstract
Description
Technical Field
[0001] The present invention relates to a spectral data enhancement method, and in particular to a spectral data enhancement method based on conditional variational autoencoding. Background Art
[0002] In recent years, near-infrared spectroscopy has become increasingly popular for in-situ measurements of biological and chemical processes due to its ease of online operation, strong anti-interference ability and high measurement accuracy. The key issue in using spectroscopy for component measurement is the development of calibration models. Spectral calibration modeling can be viewed as a regression task. Due to the complexity of the production process, such as environmental disturbances, operating conditions, etc., the production process often exhibits complex nonlinearities, which leads to a highly nonlinear relationship between spectral variables and component content. Traditional machine learning methods have difficulty in effectively extracting data features, so that the prediction effect of the model is not ideal.
[0003] In recent years, deep learning methods represented by neural networks have been used to model complex and nonlinear process data. However, for regression tasks based on deep learning, a large amount of sample data and its corresponding labels are required. However, it is difficult for the process industry to obtain a large amount of data, especially for calibration model tasks. Labeling unlabeled data requires expert operation and timely analysis by laboratory-specific equipment, which is laborious and time-consuming.
[0004] To address the problem of lack of labeled samples, one approach is to use unlabeled data to enhance the parameter information of the model. Semi-supervised methods can effectively use unlabeled samples to obtain a more accurate data distribution. However, semi-supervised learning is based on the assumption that both labeled and unlabeled samples are generated from the same distribution. Given the large number of unlabeled samples and the interference of environmental conditions, it is difficult to ensure that all unlabeled samples come from the same distribution as labeled samples. In this case, the introduction of unlabeled samples will damage the accuracy of the model. Another approach is to expand the dataset so that model parameters can be enhanced using data augmentation. The data augmentation method first synthesizes virtual samples for augmenting the dataset, and then uses the expanded dataset in conjunction with the original data to construct a regressor. A representative data augmentation method is the generative adversarial network, which has been applied to classification problems. However, the generative adversarial network model is difficult to train and is prone to collapse and non-convergence, which is not suitable for practical applications, especially for spectral calibration. Another important representative data augmentation method is the variational autoencoder, which approximates the original data distribution in the latent variable space. However, the data enhancement method based on the variational autoencoder does not take into account the required target information, which makes such a data enhancement method lack directionality. Therefore, some scholars have proposed a data enhancement method based on a conditional variational autoencoder. However, the proposed data enhancement method based on the conditional variational autoencoder is still only effective for classification tasks. It is not effective enough for regression tasks where the label value is continuous. The conditional variational autoencoder can ensure that the generated samples and the original data belong to the same distribution, but the same label value can generate different samples. If the generated samples and labels are directly used for data modeling, it cannot be guaranteed that the enhanced data is conducive to model construction. Therefore, the present invention proposes a spectral calibration modeling method combining a conditional variational autoencoder with a semi-supervised ladder network. Summary of the invention
[0005] In order to solve the problem of insufficient labeled samples in a spectral calibration model, the present invention provides a spectral data enhancement method based on conditional variational autoencoder for spectral calibration modeling.
[0006] The present invention is implemented by the following technical solution: a spectral data enhancement method based on conditional variational autoencoding, comprising the following steps:
[0007] Step 1: Preprocess the collected historical data
[0008] The concentration of product components is measured by the instrument, and a labeled training set is obtained, including labeled spectra X L =[x1;x2;x i ;…;x L ] and the corresponding component concentration Y L, draw a trend graph of the obtained product component concentrations, and remove the spectra and component contents that do not conform to the process trend from the training set; then, the clean training set X L and Y L Perform standardization to reduce the impact of external interference on the spectrum;
[0009] Step 2: Establish a conditional variational autoencoder based on encoder q(z|x,y) and decoder p(x|z,y), and set the virtual component content Y in the modeling set U , to generate a virtual spectrum X U , where x and y are the spectrum and component concentration of the training set, respectively, p represents the probability distribution function, and z represents the latent variable;
[0010] Generate similar samples of representative labeled samples, written as p(x|y)
[0011] p(x|y)=∫p(z)p(x|y,z)dz
[0012] Building a probability model is to maximize the collected data, expressed as:
[0013]
[0014] where logp(x|y) is further decomposed into:
[0015]
[0016] Where L ELBO is the variational lower bound;
[0017] Since the KL divergence is non-negative and its value is greater than or equal to 0, we have
[0018] logp(x|y)≥L ELBO
[0019] Where L ELBO Further broken down into:
[0020] L ELBO =-KL(q(z|x,y)||p(z|y))+∫q(z|x,y)logp(x|z,y)dz
[0021] Step 3: Train the semi-supervised ladder network to build a calibration model;
[0022] Step 4: Input the online spectral samples into the semi-supervised ladder network spectral calibration model guided by the established conditional variational autoencoder to detect the component content online in real time.
[0023] Preferably, in step 1, the training set X L and Y LThe standardization formula is:
[0024]
[0025] Where: x i,std represents the absorbance of the i-th spectral data after normalization; x i represents the absorbance of the i-th spectral data wave; m represents the mean absorbance of the labeled spectral data; s represents the standard deviation of the absorbance of the labeled spectral data.
[0026] Preferably, the virtual component content Y in step 2 U In Y L Within the range of , the step size is set, and the number of virtual spectra generated is more than 10 times the amount of labeled data.
[0027] Preferably, in step 3, the virtual sample X generated by the conditional variational autoencoder is used U Input to the unlabeled part of the semi-supervised ladder network, and convert the real labeled sample X L and Y L The labeled part is input into the semi-supervised ladder network, and the semi-supervised ladder network is used for semi-supervised learning to obtain a spectral calibration model of the semi-supervised ladder network guided by a conditional variational autoencoder.
[0028] Compared with the prior art, the present invention has the following advantages:
[0029] 1. Compared with the semi-supervised calibration model established by using the real unlabeled data of the process, the present invention can ensure that the generated virtual spectrum and the labeled spectrum belong to the same distribution, avoiding the problem that the real unlabeled spectrum deviates from the real distribution and damages the model accuracy due to external interference;
[0030] 2. The conditional variational autoencoder in the present invention is designed to generate virtual spectra with the same distribution as the component concentration to enhance the training set and facilitate the development of the calibration model. In order to use the generated virtual spectra for modeling, a regression learning model based on a semi-supervised ladder network is used; this method combines the generated virtual unlabeled spectra with the real labeled samples, which can ensure that the generated virtual spectra and the actual labeled spectra have the same distribution, ensuring the effectiveness of semi-supervised learning. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The present invention will be further described below in conjunction with the accompanying drawings.
[0032] Figure 1 Flowchart of the spectral data enhancement method based on conditional variational autoencoder for spectral calibration modeling;
[0033] Figure 2 Spectral data generation method based on conditional variational autoencoder. DETAILED DESCRIPTION
[0034] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.
[0035] Example 1
[0036] A spectral data enhancement method based on conditional variational autoencoding comprises the following steps:
[0037] Step 1: Preprocess the collected historical data;
[0038] When using spectroscopy for real-time measurement, samples are taken from the process at regular intervals and the concentration of product components is measured using a specific instrument. This results in a labeled training set, including labeled spectra X L =[x1;x2;x i ;…;x L ] and the corresponding component concentration YL. Since manual labeling may cause operational errors, these labeled samples may damage the accuracy of the model, so these samples must be excluded from the training set. When excluding samples, the obtained product component concentrations are plotted in a trend graph, and the spectra and component contents that do not conform to the process trend are deleted from the training set; then, the clean training set X L and Y L Perform standardization to reduce the impact of external interference on the spectrum;
[0039]
[0040] Where: x i,std represents the absorbance of the i-th spectral data after normalization; x i represents the absorbance of the i-th spectral data wave; m represents the mean absorbance of the labeled spectral data; s represents the standard deviation of the absorbance of the labeled spectral data;
[0041] In this implementation case, a spectrum is obtained every 1 minute, and sampling is performed every half an hour. The sampling instrument is a near-infrared spectrometer;
[0042] Step 2: Establish a conditional variational autoencoder based on encoder q(z|x,y) and decoder p(x|z,y), and set the virtual component content Y in the modeling set U , to generate a virtual spectrum XU , where x and y are the spectrum and component concentration of the training set, respectively, p represents the probability distribution function, and z represents the latent variable;
[0043] Train a conditional variational autoencoder to generate virtual spectral samples X U , which is a key step in establishing a spectral semi-supervised calibration model;
[0044] Generate similar samples of representative labeled samples, written as p(x|y)
[0045] p(x|y)=∫p(z)p(x|y,z)dz
[0046] Building a probability model is to maximize the collected data, expressed as:
[0047]
[0048] where logp(x|y) is further decomposed into:
[0049]
[0050] Where L ELBO is the variational lower bound;
[0051] Since the KL divergence is non-negative and its value is greater than or equal to 0, we have
[0052] logp(x|y)≥L ELBO
[0053] Where L ELBO Further broken down into:
[0054] L ELBO =-KL(q(z|x,y)||p(z|y))+∫q(z|x,y)logp(x|z,y)dz
[0055] Note that the virtual component content Y U In Y L Within the range of , the set step size, the number of virtual spectra generated is more than 10 times the amount of labeled data;
[0056] Step 3: Train the semi-supervised ladder network to build a calibration model;
[0057] In this step, the virtual samples X generated by the conditional variational autoencoder are used U Input to the unlabeled part of the semi-supervised ladder network, and convert the real labeled sample X L and Y LThe labeled part is input into the semi-supervised ladder network, and the semi-supervised ladder network is used for semi-supervised learning to obtain the spectral calibration model of the semi-supervised ladder network guided by the conditional variational autoencoder. The specific experimental reference of the semi-supervised ladder network is "Semi-Supervised Learning-Based Calibration Model Building of NIR Spectroscopy for In Situ Measurement of Biochemical Processes Under Insufficiently and Inaccurately Labeled Samples," IEEE Transactions on Instrumentation and Measurement, vol. 70, pp. 1-12, 2021, Art no. 2509912, which is not the protection content of the present invention.
[0058] Step 4: Use the calibration model constructed by the semi-supervised ladder network to detect the component content online;
[0059] The online spectral samples are input into the established semi-supervised ladder network spectral calibration model guided by the conditional variational autoencoder to detect the component content online in real time.
[0060] Example 2
[0061] In order to verify the effectiveness of the present invention, an experimental verification was conducted in which glucose with a concentration of 120 g / L was converted into ethanol in a 5-liter fermenter.
[0062] The pH value of the fermenter was adjusted by NaOH solution, and the temperature was measured by Pt100 and regulated by a heating device and a circulating cooler. The stirring paddle speed was set to 200rpm to maintain a uniform liquid phase. Each batch run time of the process was 12-15 hours. A near-infrared spectrometer with an immersed transmission probe used a one-minute sampling cycle to detect the fermentation process in real time. At the same time, 5mL of liquid was taken out of the fermenter every half an hour, and the ethanol concentration was measured offline using a gas chromatograph. In the real-time measurement, each collected near-infrared spectrum had 936 spectral variables ranging from 4,790-12,000cm -1 .
[0063] Eight batches of glucose fermentation experiments were performed, seven of which were used for calibration modeling of NIR spectroscopy and the eighth for model validation.
[0064] In order to illustrate the effectiveness of the method, it is compared with eight existing methods, including partial least squares, least squares support vector machine, denoising autoencoder, denoising source separation, supervised ladder network, semi-supervised denoising autoencoder, semi-supervised denoising source separation and semi-supervised ladder network. Among them, partial least squares and least squares support vector machine obtain the optimal model parameters through cross-validation, and the remaining deep learning methods have 5 hidden layers, with the number of neurons in each layer being 1000, 500, 300, 200, 100, the learning rate being 0.003, the training batch size being 300, and the noise excitation level being 0.12. For the specific experimental processes and results of the first eight methods, see the reference "Semi-Supervised Learning-Based Calibration Model Building of NIR Spectroscopy for In Situ Measurement of Biochemical Processes Under Insufficiently and Inaccurately Labeled Samples," IEEE Transactions on Instrumentation and Measurement, vol. 70, pp. 1-12, 2021, Art no. 2509912. The parameters in the method of the present invention are consistent with those in the reference article. Table 1 shows the prediction results of the ethanol concentration of the eighth batch of fermentation experiments using nine methods. It can be seen that the prediction accuracy of the proposed method is much better than that of the supervised ladder network (high determination coefficient and small prediction root mean square error), which has the best prediction effect when only labeled samples are used. Due to differences in operating environments, it cannot be guaranteed that all unlabeled samples are generated from the same distribution as the labeled samples. However, all virtual labeled samples are generated from the same distribution as the component concentration, so the proposed method is better than the semi-supervised ladder network method.
[0065] Table 1 Comparison of prediction results based on the eighth batch of samples
[0066]
[0067] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A spectral data enhancement method based on conditional variational autoencoder, characterized by: The following steps are involved: Step 1: Preprocess the collected historical data; The concentration of product components is measured by the instrument, and a labeled training set is obtained, including labeled spectra X L =[x1;x2;x i ;…;x L ] and the corresponding component concentration Y L , draw a trend graph of the obtained product component concentrations, and remove the spectra and component contents that do not conform to the process trend from the training set; then, the clean training set X L and Y L Perform standardization to reduce the impact of external interference on the spectrum; Step 2: Train the conditional variational autoencoder to generate virtual samples; Establish a conditional variational autoencoder based on encoder q(z|x,y) and decoder p(x|z,y), and set the virtual component content Y in the modeling set U , to generate a virtual spectrum X U , where x and y are the spectrum and component concentration of the training set, respectively, p represents the probability distribution function, and z represents the latent variable; Generate similar samples of representative labeled samples, written as p(x|y) p(x|y)=∫p(z)p(x|y,z)dz Building a probability model is to maximize the collected data, expressed as: where logp(x|y) is further decomposed into: Where L ELBO is the variational lower bound; Since the KL divergence is non-negative and its value is greater than or equal to 0, we have logp(x|y)≥L ELBO Where L ELBO Further broken down into: L ELBO =-KL(q(z|x,y)||p(z|y))+∫q(z|x,y)logp(x|z,y)dz Step 3: Train the semi-supervised ladder network to build a calibration model; Step 4: Use the calibration model constructed by the semi-supervised ladder network to detect the component content online; The online spectral samples are input into the established semi-supervised ladder network spectral calibration model guided by the conditional variational autoencoder to detect the component content online in real time.
2. The spectral data enhancement method based on conditional variational autoencoder according to claim 1, characterized in that: In step 1, the training set X L and Y L The standardization formula is: Where: x i,std represents the absorbance of the i-th spectral data after normalization; x i represents the absorbance of the i-th spectral data wave; m represents the mean absorbance of the labeled spectral data; s represents the standard deviation of the absorbance of the labeled spectral data.
3. The spectral data enhancement method based on conditional variational autoencoder according to claim 1, characterized in that: The virtual component content Y in step 2 U In Y L Within the range of , the step size is set, and the number of virtual spectra generated is more than 10 times the amount of labeled data.
4. The spectral data enhancement method based on conditional variational autoencoder according to claim 1, characterized in that: In step 3, the virtual sample X generated by the conditional variational autoencoder will be used U Input to the unlabeled part of the semi-supervised ladder network, and convert the real labeled sample X L and Y L The labeled part is input into the semi-supervised ladder network, and the semi-supervised ladder network is used for semi-supervised learning to obtain a spectral calibration model of the semi-supervised ladder network guided by a conditional variational autoencoder.
Citation Information
Cited By
Continuous variable regression prediction-oriented auto-encoder spectral data enhancement method
CN118211063A
Continuous spectrum space reconstruction method based on depth generation model
CN121982201A
