Flue-cured tobacco moisture and pigment content prediction method and system based on chain type integrated model
Through the method based on the chain integration model, the moisture and pigment content in tobacco leaves are predicted using near-infrared spectral data, which solves the problem of difficulty in predicting moisture and pigment content at the same time in the existing technology, and achieves efficient and accurate multi-index prediction .
Patent Information
- Application Number
- CN202411771697.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-02-21
AI Technical Summary
The prior art is difficult to simultaneously and efficiently predict the moisture and pigment content during tobacco leaf baking, and the traditional detection methods are cumbersome, time-consuming and damage to the samples.
Using a chain-integrated model-based method, a chain-integrated model is constructed to predict multi-index moisture and pigment content through the combination of near-infrared spectral data preprocessing, hierarchical sampling and multiple regression methods.
The simultaneous multiple index prediction of moisture and pigment content during tobacco leaf baking is achieved, the utilization efficiency of spectral data is improved, the characteristic relationship between moisture and pigment content is deeply captured, and the prediction accuracy and stability are improved.
Smart Images

Figure CN119492696A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of model prediction, and in particular relates to a method and a system for predicting moisture and pigment content in flue-cured tobacco based on a chain integrated model. Background Art
[0002] Baking is the most critical link in tobacco production and processing. The baking process greatly affects the industrial quality and economic shape of the baked tobacco. Pigment and moisture content are the main basis for water color determination during the baking process. During the baking and curing process of tobacco leaves, the degree of pigment decomposition is directly related to the formation of the color and aroma of the tobacco leaves; moisture is also an indispensable component of tobacco leaf tissue, which not only affects the physical structure of tobacco leaves, but also directly related to the processing quality of tobacco leaves.
[0003] The traditional method for detecting the moisture and pigment content of tobacco leaves is mainly analytical chemistry. After the pigment is extracted with a chemical solvent, the absorbance of the extract at a specific wavelength is measured on a spectrophotometer to calculate its content; while the moisture content is mainly determined by the drying weighing method, that is, the difference between the initial weight and the weight after drying of the tobacco leaf sample is used to determine it. Although these two methods can ensure high measurement accuracy, they both involve sample collection and processing, which is not only cumbersome and time-consuming, but also damages the sample.
[0004] In recent years, near infrared spectroscopy (NIR) technology has been widely used in tobacco leaf grading, maturity determination and chemical component content detection as an efficient, non-destructive and non-contact analysis method. By measuring the optical reflectance or transmittance of the chemical components of the leaves in a specific band, the component category and content can be inverted.
[0005] Existing spectral data modeling is mainly based on machine learning algorithms. Ensemble learning is a machine learning method that improves overall prediction performance by combining the prediction results of multiple learners (usually multiple models). The core idea is that different models have their own advantages and disadvantages when processing the same task. Ensemble multiple models can take advantage of their advantages and reduce the defects of a single model, thereby improving the overall prediction performance and stability.
[0006] By understanding the interaction between moisture and chlorophyll during tobacco leaf baking, it can be found that the moisture and pigment changes of tobacco leaves are synchronous during baking, and the two are interrelated and affect each other. However, most of the related studies are quantitative analysis of a single component of tobacco leaves, and no multi-target quantitative analysis method involving synchronous regression of pigment and moisture content has been found. Summary of the invention
[0007] In view of the above deficiencies in the prior art, the purpose of the present invention is to provide a method and system for predicting the moisture and pigment content of flue-cured tobacco based on a chain integrated model, which can simultaneously perform multi-indicator prediction of the moisture and pigment content of tobacco leaves during the baking process, and improve the utilization efficiency of spectral data by making full use of the complex spatial characteristics in near-infrared spectral data.
[0008] To achieve the above purpose, the technical solution adopted by the present invention is a method for predicting moisture and pigment content of flue-cured tobacco based on a chain integrated model, comprising the following steps: S1. Collecting the raw data of near-infrared spectra of tobacco leaves at different baking stages as spectral data, and performing black-and-white correction and abnormal sample removal on the spectral data, and then applying a variety of preprocessing methods to perform preprocessing respectively; S2, applying stratified sampling method to divide the preprocessed spectral data into training set and test set; S3. Combine the data obtained by different preprocessing methods with different regression methods to construct full-band prediction models respectively, and train each full-band prediction model based on the training set, compare the prediction effects of the full-band prediction models corresponding to different preprocessing methods, and screen the preprocessing methods; S4, combining the screened pretreatment methods with different characteristic band screening methods, respectively constructing characteristic band prediction models, training each characteristic band prediction model based on the training set, and comparing it with the corresponding full-band prediction model to determine the optimal sub-model for moisture and pigment content prediction; S5. Combine multiple identical optimal sub-models in a cascade manner to construct a chain integration model. Based on the test set, continuously iterate and optimize until the iteration termination condition is met, and output the final prediction result.
[0009] As a preferred embodiment of the present invention, in the S1, the baking stage includes initial baking, half baking and cooked baking stages, and the preprocessing method includes Gaussian smoothing, normalization, mean centering, standard normal variable transformation, SG smoothing, detrending, multivariate scattering correction, and a combination of Gaussian smoothing and first-order derivative.
[0010] As a preferred solution of the present invention, the abnormal sample removal is specifically as follows: The sample data is the collected spectral data. The mean of the sample data is calculated and recorded as , calculate the covariance matrix S of the sample data and the inverse matrix S of the covariance matrix -1 ; Calculate the Mahalanobis distance of each sample data, expressed as: ; In the formula, is the Mahalanobis distance corresponding to the sample data x; the 95% quantile is selected as the threshold, and the sample data exceeding this threshold is removed as an outlier.
[0011] As a preferred embodiment of the present invention, in S1, near infrared spectral data of tobacco leaves at different baking stages are collected, and the process is as follows: S1.1. Divide the tobacco leaf into two symmetrical regions with the main vein of the tobacco leaf as the boundary. Each region is divided into three secondary regions from the leaf tip to the petiole, for a total of six secondary regions, i.e. six measurement partitions, denoted as R1, R2, ..., R6; S1.2. Select a point P at the center of each secondary region i As the measurement point, i=1, 2, ..., 6; excluding the area affected by the leaf veins, at point P i A fiber optic probe with a diameter of 6 mm was placed vertically close to the blade surface at a distance of 3 mm; S1.3, use the reflection method to collect spectral data, set the integration time t = 10 milliseconds, and at each point P i Repeat the scan three times to increase the reliability of the data, and define the spectral data obtained from each scan as S ij , j = 1, 2, 3 represents the number of repeated scans; S1.4. For each point P i , calculate the average of the three scan results , expressed as: ; S1.5. Further average the average values of all points to obtain the overall spectral raw data of the tobacco leaf , as the raw data of the near infrared spectrum of the tobacco leaf at the current baking stage, is expressed as: .
[0012] As a preferred embodiment of the present invention, in S2, the process of dividing into a training set and a test set by using a stratified sampling method is: Assume that the total data set is D, which contains N samples. Each sample consists of a set of spectral data and corresponding labels. The preprocessed spectral data is divided into training set and test set in a ratio of 3:1 by stratified sampling. Let the training set be T and the test set be E, then: ; In the formula, , Represents the number of samples in the training set and the test set respectively; When performing stratified sampling, for each category c k , k=1, 2, ..., K, K is the total number of categories; calculate category ck The proportion q in the total data set D k , and then randomly select the corresponding number of samples from each category according to the ratio and put them into the training set T and the test set E, which can be expressed as: ; In the formula, , Respectively represent category c k The number of samples in the training set T and the test set E.
[0013] As a preferred embodiment of the present invention, in S3, the regression method includes partial least squares regression PLSR, support vector machine regression SVR, and random forest algorithm RF; The spectral data were preprocessed based on eight preprocessing methods, and then full-band prediction models were constructed using three modeling methods. The prediction effects of the full-band prediction models corresponding to different preprocessing methods were compared, and the top six preprocessing methods were selected.
[0014] As a preferred embodiment of the present invention, in said S4, the characteristic band screening method includes four methods: continuous projection algorithm SPA, competitive adaptive resampling algorithm CARS, principal component analysis PCA and independent vector similarity spectrum analysis IVSS; The method for determining the optimal sub-model is that each characteristic band prediction model is a candidate sub-model, and the cross-validation method is used to evaluate the performance of each candidate sub-model, and the optimal sub-model is selected. The performance indicator is the mean square error MSE.
[0015] As a preferred solution of the present invention, in S5, the construction process of the chain integration model is to combine multiple optimal sub-models in a cascade manner, and the cascade manner is that the output of the previous sub-model A is used as the input of the next sub-model B, which is expressed as: ; Where X is the original input feature vector; For the previous sub-model, it receives X and produces an output; For the latter sub-model, receive The output of is taken as input and the output after two transformations is generated. ; The iterative optimization process is to continue to add new optimal sub-models and continue to combine them in a cascade manner. After each addition of a new optimal sub-model, the root mean square error RMSE of the overall chain integration model is calculated. If the RMSE obtained in the current iteration is lower than all previous iterations, the current configuration is retained; otherwise, the iteration is stopped.
[0016] As a preferred embodiment of the present invention, in the iterative optimization process, cross validation, grid search or genetic algorithm is used to find a parameter combination that achieves a higher prediction accuracy in each optimal sub-model parameter space, and the parameters include the number of principal components of PLSR, the penalty coefficient of SVR, the kernel function parameter, the number of decision trees of RF and the maximum depth; The iteration termination condition is that the maximum number of iterations is reached, or the RMSE of the prediction result of the chain integration model is at the lowest extreme value, that is, the model effect is optimal.
[0017] The flue-cured tobacco moisture and pigment content prediction system based on the chain integration model is used to realize the above-mentioned flue-cured tobacco moisture and pigment content prediction method based on the chain integration model, including a micro-spectrometer, a halogen light source, a flexible Y-type optical fiber, a light source focusing mirror, a single-point rubber connection shell, a tobacco leaf flattening clamp, a darkroom and a PC end; the micro-spectrometer is located in the darkroom and is used to obtain single-point spectral information of tobacco leaves, and the wavelength is 900~1700nm; the halogen light source is located in the micro-spectrometer and is used to emit a light source with a required wavelength; one end of the double-end end of the flexible Y-type optical fiber is connected to the micro-spectrometer, and the other end is connected to the halogen light source; the light source focusing mirror is connected to the single end of the flexible Y-type optical fiber to reduce stray light interference; the single-point rubber connection shell is fixed on the outside of the light source focusing mirror, and is used to control the detection sampling height to be 3mm to ensure the consistency of spectral acquisition; the tobacco leaf flattening clamp is used to flatten the tobacco leaves; the PC end is connected to the micro-spectrometer for command control and storage and processing of data.
[0018] The beneficial effects of the present invention are: The present invention can simultaneously predict the moisture and pigment content of tobacco leaves during baking with multiple indicators. By making full use of the complex spatial characteristics in near-infrared spectral data, the utilization efficiency of spectral data is improved. Through the chain integration model, the present invention can deeply capture the deeper characteristic relationship between the moisture and pigment (such as chlorophyll) content during tobacco leaf baking. The study found that the changes in moisture and pigment content are synchronous and interrelated. The model adopted by the present invention meets the data's requirements for accuracy and robustness, provides a new perspective for understanding the interaction between substances inside tobacco leaves, and helps to further explore the mechanism of tobacco leaf quality changes.
[0019] The present invention uses multiple regressors to iteratively construct a chain integration model, so that each sub-model can obtain richer information from the previous sub-model, thereby significantly improving the accuracy and stability of the final prediction results. This method is not only suitable for the detection of moisture and pigment content, but also provides valuable reference significance for the detection of other related substances (such as starch, reducing sugar, etc.), and improves the model performance in different substance detection tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a schematic diagram of the process of the present invention; Figure 2 It is a comparison diagram of pigment content prediction of some full-band prediction models in the verification process of the present invention; Figure 3 It is a comparison diagram of moisture content prediction of some full-band prediction models in the verification process of the present invention; Figure 4 It is a diagram of the evaluation results of the optimal sub-model of moisture content on the training set during the verification process of the present invention; Figure 5 It is a diagram of the evaluation results of the optimal sub-model of moisture on the test set during the verification process of the present invention; Figure 6 It is a diagram of the evaluation results of the moisture chain integrated model on the training set during the verification process of the present invention; Figure 7 It is a diagram of the evaluation results of the moisture chain integration model on the test set during the verification process of the present invention. DETAILED DESCRIPTION
[0021] The embodiments of the present invention are further described below in conjunction with the accompanying drawings: Example 1: Figure 1 As shown in FIG. 1 , the prediction method of moisture and pigment content of flue-cured tobacco based on the chain integration model includes the following steps: S1. Collecting the raw data of near-infrared spectra of tobacco leaves at different baking stages as spectral data, and performing black-and-white correction and abnormal sample removal on the spectral data, and then applying a variety of preprocessing methods to perform preprocessing respectively; S2, applying stratified sampling method to divide the preprocessed spectral data into training set and test set; S3. Combine the data obtained by different preprocessing methods with different regression methods to construct full-band prediction models respectively, and train each full-band prediction model based on the training set, compare the prediction effects of the full-band prediction models corresponding to different preprocessing methods, and screen the preprocessing methods; S4, combining the screened pretreatment methods with different characteristic band screening methods, respectively constructing characteristic band prediction models, training each characteristic band prediction model based on the training set, and comparing it with the corresponding full-band prediction model to determine the optimal sub-model for moisture and pigment content prediction; S5. Combine multiple identical optimal sub-models in a cascade manner to construct a chain integration model. Based on the test set, continuously iterate and optimize until the iteration termination condition is met, and output the final prediction result.
[0022] In S1, the baking stages include initial baking, half baking and cooked baking, and the preprocessing methods include Gaussian smoothing (GS), normalization (NRM), mean centering (MC), standard normal variable transformation (SNV), SG smoothing (Savitzky-Golay smoothing, SG), detrending (Detrend), multivariate scatter correction (MSC), and Gaussian smoothing combined with the first-order derivative (GS+D1st). The spectral data of all stages are used for model training and prediction.
[0023] The specific steps for removing abnormal samples are as follows: The sample data is the collected spectral data. The mean of the sample data is calculated and recorded as , calculate the covariance matrix S of the sample data and the inverse matrix S of the covariance matrix -1 ; Calculate the Mahalanobis distance of each sample data, expressed as: ; In the formula, is the Mahalanobis distance corresponding to the sample data x; the 95% quantile is selected as the threshold, and the sample data exceeding this threshold is removed as an outlier.
[0024] In S1, near infrared spectral data of tobacco leaves at different baking stages are collected. The process is as follows: S1.1. Divide the tobacco leaf into two symmetrical regions with the main vein of the tobacco leaf as the boundary. Each region is divided into three secondary regions from the leaf tip to the petiole, for a total of six secondary regions, i.e. six measurement partitions, denoted as R1, R2, ..., R6; S1.2. Select a point P at the center of each secondary region i As the measurement point, i=1, 2, ..., 6; excluding the area affected by the leaf veins, at point P i A fiber optic probe with a diameter of 6 mm was placed vertically close to the blade surface at a distance of 3 mm; S1.3, use the reflection method to collect spectral data, set the integration time t = 10 milliseconds, and at each point P i Repeat the scan three times to increase the reliability of the data, and define the spectral data obtained from each scan as S ij , j = 1, 2, 3 represents the number of repeated scans; S1.4. For each point P i , calculate the average of the three scan results , expressed as: ; S1.5. Further average the average values of all points to obtain the overall spectral raw data of the tobacco leaf , as the raw data of the near infrared spectrum of the tobacco leaf at the current baking stage, is expressed as: .
[0025] In S2, the process of dividing into training set and test set by stratified sampling is as follows: Assume that the total data set is D, which contains N samples. Each sample consists of a set of spectral data and corresponding labels. When dividing the sample set, it is necessary to ensure that the uniformity of data distribution in each sample set is consistent. Therefore, the preprocessed spectral data is divided into training set and test set in a ratio of 3:1 by stratified sampling. Let the training set be T and the test set be E, then: ; In the formula, , Represents the number of samples in the training set and the test set respectively; When performing stratified sampling, for each category c k , k=1, 2, ..., K, K is the total number of categories; calculate category c k The proportion q in the total data set D k , and then randomly select the corresponding number of samples from each category according to the ratio and put them into the training set T and the test set E, which can be expressed as: ; In the formula, , Respectively represent category c k The number of samples in the training set T and the test set E. This ensures that each category is represented in an appropriate proportion in both the training set and the test set, allowing the model to learn more generalized features.
[0026] In S3, the regression methods include partial least squares regression PLSR, support vector machine regression SVR, and random forest algorithm RF; The spectral data were preprocessed based on eight preprocessing methods, and then full-band prediction models were constructed using three modeling methods. The prediction effects of the full-band prediction models corresponding to different preprocessing methods were compared, and the top six preprocessing methods were selected.
[0027] In S4, the characteristic band screening methods include four methods: continuous projection algorithm SPA, competitive adaptive resampling algorithm CARS, principal component analysis PCA and independent vector similarity spectrum analysis IVSS; The method for determining the optimal sub-model is that each characteristic band prediction model is a candidate sub-model, and the cross-validation method is used to evaluate the performance of each candidate sub-model, and the optimal sub-model is selected. The performance indicator is the mean square error MSE.
[0028] In S5, the construction process of the chain integration model is to combine multiple optimal sub-models in a cascade manner. The cascade manner is that the output of the previous sub-model A is used as the input of the next sub-model B, which is expressed as: ; Where X is the original input feature vector; For the previous sub-model, it receives X and produces an output; For the latter sub-model, receive The output of is taken as input and the output after two transformations is generated. ; The iterative optimization process is to continue to add new optimal sub-models and continue to combine them in a cascade manner. After each addition of a new optimal sub-model, the root mean square error RMSE of the overall chain integration model is calculated. If the RMSE obtained in the current iteration is lower than all previous iterations, the current configuration is retained; otherwise, the iteration is stopped.
[0029] In the iterative optimization process, cross validation, grid search or genetic algorithm is used to find the parameter combination that achieves higher prediction accuracy in each optimal sub-model parameter space. For example, in the genetic algorithm, the fitness function is defined as the negative RMSE value; the parameters include the number of principal components of PLSR, the penalty coefficient of SVR, the kernel function parameters, the number of decision trees and the maximum depth of RF; The iteration termination condition is that the maximum number of iterations is reached, or the RMSE of the prediction result of the chain integration model is at the lowest extreme value, that is, the model effect is optimal.
[0030] Embodiment 2: A flue-cured tobacco moisture and pigment content prediction system based on a chain integrated model is used to implement the flue-cured tobacco moisture and pigment content prediction method based on a chain integrated model in Embodiment 1, comprising a micro-spectrometer, a halogen lamp light source, a flexible Y-type optical fiber, a light source focusing mirror, a single-point rubber connecting shell, a tobacco leaf flattening clamp, a darkroom and a PC terminal; the micro-spectrometer is located in the darkroom and is used to obtain single-point spectral information of tobacco leaves, with a wavelength of 900-1700nm; the halogen lamp light source is located in the micro-spectrometer and is used to emit a light source of a required wavelength; one end of the double-ended end of the flexible Y-type optical fiber is connected to the micro-spectrometer, and the other end is connected to the halogen lamp light source; the light source focusing mirror is connected to the single-ended end of the flexible Y-type optical fiber to reduce stray light interference; the single-point rubber connecting shell is fixed to the outside of the light source focusing mirror, and is used to control the detection sampling height to be 3mm to ensure the consistency of spectral acquisition; the tobacco leaf flattening clamp is used to flatten tobacco leaves; the PC terminal is connected to the micro-spectrometer for command control and storage and processing of data.
[0031] The verification process is: After configuring the flue-cured tobacco moisture and pigment content prediction system based on the chain integration model, turn on the computer (PC side), connect the micro-spectrometer (whose scanning wavelength range is set at 900 to 1700nm, the average resolution is 3.5nm, and the sampling interval is 1.6nm) to the computer, and test whether the device is connected successfully through the information acquisition software.
[0032] During data acquisition, the integration time was set to 10ms, and each measurement point was scanned repeatedly 3 times. Before data acquisition, the light source and the micro-spectrometer needed to be turned on and preheated for 30 minutes. In order to eliminate the interference of the internal dark current and external environmental factors of the system, the black and white correction was performed according to the following formula: ; In the formula, I c Represents the calibrated hyperspectral image data; I R is the original image data; I W The spectral data of the PTFE standard white plate with a reflectivity of about 99.9%; I B The black correction spectrum is obtained when the light source is turned off and the fiber optic terminal is covered, and the reflection intensity is basically zero.
[0033] The flue-cured tobacco variety selected was the representative Yunyan 87, and the sampling sites were all upper leaves. To ensure the consistency and accuracy of the experimental results, the tobacco leaves were preliminarily screened under the guidance of professional baking technicians before the experiment to ensure that the tobacco leaves had high consistency in size, shape and maturity. A total of 1,500 upper leaves of Yunyan 87 were collected.
[0034] The first sampling of the test was before baking ignition and once every 8 hours after ignition, for a total of 16 samples. Each time a sample was taken, the door of the curing room was quickly opened, and samples were taken from the 11th tobacco pole on the middle layer near the door (the initial screening tobacco leaf hanging rack) into the curing room. 50 tobacco leaves were taken each time, for a total of 850 leaves of different types of flue-cured tobacco. At the same time, in order to avoid the influence of light, the taken flue-cured tobacco leaves were placed in a sealed foam box.
[0035] The raw data of flue-cured tobacco at different curing stages are collected using external spectral data. Then, the labels of flue-cured tobacco samples at different curing stages are obtained: Pigment content determination, using ethanol (95%) extraction method to determine LCC (total chlorophyll content), after near-infrared spectral data collection, cut about 0.2g of leaves from 6 locations where the spectrum was collected, avoiding the main veins, cut and mix them, put them into a reagent tube, and then add ethanol to make the volume to 25mL, seal it and soak it in a light-proof and sealed foam box at room temperature for 48 hours. After the extracted leaves turn completely white, use a UV-visible spectrophotometer to test the absorbance of the extract at 665nm and 649nm, and record the data. The LCC calculation method is as follows: ; ; Where A665 and A649 are the absorbances (A) of the spectrophotometer at 665nm and 649nm, respectively; V is the volume of the extract (ml); W is the fresh weight of the flue-cured tobacco leaf sample (g); , Represent the contents of chlorophyll a and chlorophyll b respectively.
[0036] After cutting about 0.2g of leaves, remove the veins of the remaining leaves according to the six-point method, put them into a 10,000-degree balance to weigh their mass, and then put them into an oven to dry at 60°C until constant weight, and then weigh their dry mass to determine the relative water content (LWC) of the leaves. The calculation formula is: ; Where W w Represents the mass of leaves at each natural air-drying stage; W d represents the dry weight of the leaf; W f represents the fresh weight mass of the leaf as a leaf; Abnormal samples are eliminated and samples are divided, and then the optimal sub-models of moisture and pigment are built.
[0037] Four characteristic band screening methods (successive projection algorithm SPA, competitive adaptive resampling algorithm CARS, principal component analysis PCA and independent vector similarity spectrum analysis IVSS) were used to construct characteristic band prediction models with PLSR, SVR and RF algorithms respectively, and compared with the full-band modeling effect to determine the optimal sub-model for moisture and pigment content prediction. The moisture and pigment content prediction models established by the full spectrum (full band, FULL) obtained more comprehensive and accurate optimal models. For moisture content prediction, RF's prediction model had the best effect, and the model effect was the best when RF-SNV-FULL was used, and its test set determination coefficient (R 2 ) and root mean square error (RMSE) are 0.9623 and 2.5171 respectively. For pigment content prediction, the PLSR prediction model has the best effect, and the model effect is best when the PLSR-GS+D1st model is used and 19 principal components are selected. The test set determination coefficient and root mean square error are 0.9185 and 0.5796 respectively. That is, the optimal moisture content prediction sub-model is RF-SNV-FULL, and the optimal pigment content prediction sub-model is PLSR-GS+D1st-FULL. An exemplary comparative evaluation is shown in Table 1.
[0038] Table 1 Evaluation results of characteristic band prediction model
[0039] The comparison of pigment content prediction of some full-band prediction models is as follows Figure 2As shown in Figure 2, the moisture content prediction comparison of some full-band prediction models is as follows: Figure 3 shown. Figure 2 and Figure 3 In the figure, Original means original data, and PLS is the abbreviation of PLSR.
[0040] When constructing a chain integration model, it is necessary to create a sub-chain model for each output, and the sub-chain model is the optimal sub-model for moisture and pigment content prediction, using the output of the second model and the original features as new features for prediction. The first sub-chain model can be the optimal sub-model for moisture content prediction, or the optimal sub-model for moisture and pigment content prediction for pigment content prediction. From the above analysis, it can be seen that the model effect is best when RF-SNV-FULL is used for moisture content prediction, and the model effect is best when PLSR-GS+D1st-FULL is used for pigment content prediction. Therefore, these two models are used to establish a chain integration model, and the grid search strategy and genetic algorithm are used to optimize PLSR and RF respectively. The optimal parameters of PLSR are determined to be n_components=21, and the optimal parameters of RF are n_estimators=20 and max_depth=13 respectively. The effects of the moisture and pigment chain integration models are significantly improved. The results show that different models can complement and cooperate with each other through chain integration to improve the overall prediction ability.
[0041] An exemplary chain integration model evaluation result is shown in Table 2.
[0042] Table 2 Evaluation of various indicators of the optimal sub-model and chain integration model
[0043] In Table 2, RPD (Ratio of Performance to Deviation) is an indicator used to evaluate the performance of analytical methods, especially in chemometrics and spectral analysis. RPD is calculated by comparing the standard deviation (SD) of the predicted value with the standard deviation (SD) of the samples in the calibration set (or training set). Taking the optimal sub-model of moisture and the chained integrated model of moisture as examples, the comparison between the predicted value and the true value of the model is shown in the figure. Figure 4-Figure 7 shown. Figure 4-Figure 7 In the figure, the red line represents the true value, the black dot represents the predicted value, and the shaded part represents the confidence interval. The results show that the present invention has excellent prediction accuracy.
Claims
1. A method for predicting moisture and pigment content in flue-cured tobacco based on a chain integration model, characterized in that The following steps are involved: S1. Collecting the raw data of near-infrared spectra of tobacco leaves at different baking stages as spectral data, and performing black-and-white correction and abnormal sample removal on the spectral data, and then applying a variety of preprocessing methods to perform preprocessing respectively; S2, applying stratified sampling method to divide the preprocessed spectral data into training set and test set; S3. Combine the data obtained by different preprocessing methods with different regression methods to construct full-band prediction models respectively, and train each full-band prediction model based on the training set, compare the prediction effects of the full-band prediction models corresponding to different preprocessing methods, and screen the preprocessing methods; S4, combining the screened pretreatment methods with different characteristic band screening methods, respectively constructing characteristic band prediction models, training each characteristic band prediction model based on the training set, and comparing it with the corresponding full-band prediction model to determine the optimal sub-model for moisture and pigment content prediction; S5. Combine multiple identical optimal sub-models in a cascade manner to construct a chain integration model. Based on the test set, continuously iterate and optimize until the iteration termination condition is met, and output the final prediction result.
2. The method for predicting moisture and pigment content of flue-cured tobacco based on a chain integrated model according to claim 1, characterized in that: In the S1, the baking stage includes initial baking, half baking and cooked baking stages, and the preprocessing methods include Gaussian smoothing, normalization, mean centering, standard normal variable transformation, SG smoothing, detrending, multivariate scattering correction, and a combination of Gaussian smoothing and first-order derivative.
3. The method for predicting moisture and pigment content of flue-cured tobacco based on a chain integrated model according to claim 1, characterized in that: The specific removal of abnormal samples is as follows: The sample data is the collected spectral data. The mean of the sample data is calculated and recorded as , calculate the covariance matrix S of the sample data and the inverse matrix S of the covariance matrix -1 ; Calculate the Mahalanobis distance of each sample data, expressed as: ; In the formula, is the Mahalanobis distance corresponding to the sample data x; the 95% quantile is selected as the threshold, and the sample data exceeding this threshold is removed as an outlier.
4. The method for predicting moisture and pigment content of flue-cured tobacco based on a chain integrated model according to claim 1, characterized in that: In the above S1, near infrared spectral data of tobacco leaves at different baking stages are collected, and the process is as follows: S1.
1. Divide the tobacco leaf into two symmetrical regions with the main vein of the tobacco leaf as the boundary. Each region is divided into three secondary regions from the leaf tip to the petiole, for a total of six secondary regions, i.e. six measurement partitions, denoted as R1, R2, ..., R6; S1.
2. Select a point P at the center of each secondary region i As the measurement point, i=1, 2, ..., 6; Excluding the area affected by the leaf veins, at point P i A fiber optic probe with a diameter of 6 mm was placed vertically close to the blade surface at a distance of 3 mm; S1.3, use the reflection method to collect spectral data, set the integration time t = 10 milliseconds, and at each point P i Repeat the scan three times to increase the reliability of the data, and define the spectral data obtained from each scan as S ij , j = 1, 2, 3 represents the number of repeated scans; S1.
4. For each point P i , calculate the average of the three scan results , expressed as: ; S1.
5. Further average the average values of all points to obtain the overall spectral raw data of the tobacco leaf , as the raw data of the near infrared spectrum of the tobacco leaf at the current baking stage, is expressed as: 。 5. The method for predicting moisture and pigment content of flue-cured tobacco based on a chain integrated model according to claim 1, characterized in that: In S2, the process of dividing into training set and test set by stratified sampling is as follows: Assume that the total data set is D, which contains N samples. Each sample consists of a set of spectral data and corresponding labels. The preprocessed spectral data is divided into training set and test set in a ratio of 3:1 by stratified sampling. Let the training set be T and the test set be E, then: ; In the formula, , Represents the number of samples in the training set and the test set respectively; When performing stratified sampling, for each category c k , k=1, 2, ..., K, K is the total number of categories; calculate category c k The proportion q in the total data set D k , and then randomly select the corresponding number of samples from each category according to the ratio and put them into the training set T and the test set E, which can be expressed as: ; In the formula, , Respectively represent category c k The number of samples in the training set T and the test set E.
6. The method for predicting moisture and pigment content of flue-cured tobacco based on a chain integrated model according to claim 2, characterized in that: In the S3, the regression methods include partial least squares regression PLSR, support vector machine regression SVR, and random forest algorithm RF; The spectral data were preprocessed based on eight preprocessing methods, and then full-band prediction models were constructed using three modeling methods. The prediction effects of the full-band prediction models corresponding to different preprocessing methods were compared, and the top six preprocessing methods were selected.
7. The method for predicting moisture and pigment content of flue-cured tobacco based on a chain integrated model according to claim 1, characterized in that: In the S4, the characteristic band screening methods include four methods: continuous projection algorithm SPA, competitive adaptive resampling algorithm CARS, principal component analysis PCA and independent vector similarity spectrum analysis IVSS; The method for determining the optimal sub-model is that each characteristic band prediction model is a candidate sub-model, and the cross-validation method is used to evaluate the performance of each candidate sub-model, and the optimal sub-model is selected. The performance indicator is the mean square error MSE.
8. The method for predicting moisture and pigment content of flue-cured tobacco based on a chain integrated model according to claim 1, characterized in that: In S5, the construction process of the chain integration model is to combine multiple optimal sub-models in a cascade manner, and the cascade manner is that the output of the previous sub-model A is used as the input of the next sub-model B, which is expressed as: ; Where X is the original input feature vector; For the previous sub-model, it receives X and produces an output; For the latter sub-model, receive The output of is taken as input and produces the output result after two transformations. ; The iterative optimization process is to continue to add new optimal sub-models and continue to combine them in a cascade manner. After each addition of a new optimal sub-model, the root mean square error RMSE of the overall chain integration model is calculated. If the RMSE obtained in the current iteration is lower than all previous iterations, the current configuration is retained; otherwise, the iteration is stopped.
9. The method for predicting moisture and pigment content of flue-cured tobacco based on a chain integrated model according to claim 8, characterized in that: In the iterative optimization process, cross validation, grid search or genetic algorithm is used to find a parameter combination that achieves higher prediction accuracy in each optimal sub-model parameter space, and the parameters include the number of principal components of PLSR, the penalty coefficient of SVR, the kernel function parameter, the number of decision trees of RF and the maximum depth; The iteration termination conditions also include reaching the maximum number of iterations, or the RMSE of the prediction results of the chain integration model is at the lowest extreme value, that is, the model effect is optimal.
10. A flue-cured tobacco moisture and pigment content prediction system based on a chain integrated model, used to implement the flue-cured tobacco moisture and pigment content prediction method based on a chain integrated model according to any one of claims 1 to 9, characterized in that: It includes a micro-spectrometer, a halogen light source, a flexible Y-type optical fiber, a light source focusing mirror, a single-point rubber connection shell, a tobacco leaf flattening clamp, a darkroom and a PC terminal; the micro-spectrometer is located in the darkroom and is used to obtain single-point spectral information of tobacco leaves, with a wavelength of 900-1700nm; the halogen light source is located in the micro-spectrometer and is used to emit a light source with a required wavelength; one end of the double-end end of the flexible Y-type optical fiber is connected to the micro-spectrometer, and the other end is connected to the halogen light source; the light source focusing mirror is connected to the single end of the flexible Y-type optical fiber to reduce stray light interference; the single-point rubber connection shell is fixed on the outside of the light source focusing mirror and is used to control the detection sampling height to 3mm to ensure the consistency of spectral acquisition; the tobacco leaf flattening clamp is used to flatten tobacco leaves; the PC terminal is connected to the micro-spectrometer for command control and storage and processing of data.
Citation Information
Cited By
Tobacco leaf curing state discrimination method and system
CN120495690A
Ginseng seed emergence rate prediction method and system and ginseng seed emergence rate model construction method and system
CN122021366A