Method for predicting moisture content of cigar tobacco leaves in air-curing process in natural suspension state
By collecting the front and back images of cigar leaves under the natural drooping state, an integrated learning model is constructed, and the accuracy and operational complexity of moisture content prediction during the drying process of cigar leaves in the prior art is solved, and a high-precision and convenient moisture content prediction method is achieved.
Patent Information
- Application Number
- CN202411694840.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-14
AI Technical Summary
The prior art is difficult to accurately predict the moisture content during the drying process under the natural dangling state of cigar leaves, and the existing methods are complex in operation and are difficult to apply to actual production.
By collecting the front and back images of cigar leaves in natural drooping state, an integrated learning model is constructed, and the moisture content of cigar leaves is obtained using data set training and verification.
It has achieved high-precision prediction of the moisture content in the drying process of cigar tobacco leaves, which is convenient to operate, is suitable for actual production, and performs well on cigar tobacco leaves across varieties, years and across production areas.
Smart Images

Figure CN119625702A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of cigar tobacco leaf airing and computer vision technology, and in particular to a method for predicting the moisture content of cigar tobacco leaves during airing in a natural hanging state. Background Art
[0002] Air-drying is a critical stage for the loss of moisture and the formation of quality of cigar tobacco leaves. As the tobacco leaves continue to dry, their appearance changes greatly, which is manifested in the wrinkling of the leaves and the darkening of the color. As a key substance in the air-drying process of cigar tobacco leaves, the dynamic changes in its content directly affect the external quality and internal composition of the tobacco leaves after air-drying. The monitoring of the moisture content of cigar tobacco leaves during the air-drying process mainly relies on the experience and judgment of technicians. This method is highly subjective and has a low accuracy rate. Although the quantitative detection method has a high degree of accuracy, it cannot achieve non-destructive testing and is difficult to apply in production. At present, the existing method for predicting the moisture content of cigar tobacco leaves during the drying process relies on manual measurement (CN114931227A), which is a cumbersome and labor-intensive process. In the actual drying process of cigar tobacco leaves, the tobacco leaves are hung in the drying room, and as the moisture is lost, the leaves gradually shrink and roll up, and the exposed information is further reduced. The existing methods for measuring the moisture content of cigar tobacco leaves by relying on computer vision technology (CN118038149A) and (CN115736317A) all focus on laying the tobacco leaves flat and collecting the front image of the tobacco leaves in the flat state. Although this method can achieve a high accuracy rate, the operation is relatively complicated and difficult to apply to actual production.
[0003] Therefore, how to collect images of cigar leaves that are naturally hanging in a rolled state during the drying process and use computer vision and machine learning technology to accurately predict the moisture content of cigar leaves during the drying process is an urgent problem to be solved. Summary of the invention
[0004] The purpose of the present invention is to propose a method for predicting the moisture content of cigar tobacco leaves during the drying process in a natural hanging state, so as to solve the problems existing in the above-mentioned prior art, and the method has the advantages of high accuracy, convenient operation, and applicability to actual production.
[0005] To achieve the above object, the present invention provides the following solutions:
[0006] The method for predicting the moisture content of cigar tobacco leaves during the drying process under natural hanging state includes:
[0007] Collecting image data of cigar tobacco leaves to be predicted in a hanging and airing state;
[0008] The cigar leaf image data to be predicted is input into a preset moisture content prediction model to obtain the moisture content of the cigar leaf; wherein the preset moisture content prediction model is an integrated learning model; and is obtained by training and verifying a data set, wherein the data set is constructed based on the front and back image data of the cigar leaf at preset different periods during the drying process.
[0009] Optionally, constructing the data set includes:
[0010] The front and back image data of cigar tobacco leaves at different preset periods during the drying process;
[0011] Performing image preprocessing on the front and back image data;
[0012] Extract preset features from the preprocessed image data and perform label encoding;
[0013] Screening the extracted preset features;
[0014] The data set is constructed based on the screened features and the front and back image data.
[0015] Optionally, the preset different periods include: withering period, yellowing period, browning period, color fixing period and tendon drying period.
[0016] Optionally, performing image preprocessing on the front and back image data includes:
[0017] Constructing a binary mask of the front and back image data;
[0018] The binary mask is combined with the front and back image data to obtain tobacco leaf ROI image data.
[0019] Optionally, the preset features include: a plurality of color features and a plurality of texture features.
[0020] Optionally, screening the extracted preset features includes:
[0021] Using a filtering method to perform a preliminary screening of key features of the preset features;
[0022] For the features after preliminary screening, the Pearson correlation coefficient between the feature index and the moisture content of tobacco leaves is calculated, and the features with correlation coefficients lower than the preset value are eliminated;
[0023] For the remaining features after elimination, the autocorrelation of each feature is calculated. For the features with correlation higher than the preset value, the features with high correlation with the moisture content of tobacco leaves are selected and retained.
[0024] Optionally, the preset moisture content stacking prediction model includes: base learners: MLP, RF, GBDT; meta learner: LR.
[0025] The beneficial effects of the present invention are:
[0026] The present invention collects images of the front and back sides of cigar leaves in a naturally hanging state during the drying process, and has a high prediction accuracy for the moisture content of cigar leaves in five drying periods without overfitting (and has good prediction results for cigar leaves across varieties, years, and production areas). The present invention provides an effective and easy-to-operate method for predicting the moisture content of cigar leaves during the drying process for cigar growing areas. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0028] Figure 1 It is a schematic flow chart of a method for predicting moisture content of cigar tobacco leaves during airing in a natural hanging state according to an embodiment of the present invention;
[0029] Figure 2 A schematic diagram of an image acquisition device according to an embodiment of the present invention;
[0030] Figure 3 is an image segmentation flow chart of an embodiment of the present invention;
[0031] Figure 4 Schematic diagram of the correlation between the front and back image features of a cigar tobacco leaf and the moisture content of the tobacco leaf according to an embodiment of the present invention;
[0032] Figure 5 This is a schematic diagram of autocorrelation analysis of feature subset 1 according to an embodiment of the present invention;
[0033] Figure 6 A schematic diagram of comprehensive scoring using the entropy weight method for candidate machine learning models according to an embodiment of the present invention;
[0034] Figure 7 A schematic diagram showing a comparison of prediction results of a stacking model and various base models according to an embodiment of the present invention;
[0035] Figure 8 A schematic diagram showing comparison of prediction results of different feature combination schemes according to an embodiment of the present invention;
[0036] Fig. 9 Schematic diagram of comprehensive scores under different stacking combination strategies in an embodiment of the present invention;
[0037] Fig.10This is a schematic diagram of the moisture content prediction result of the Zhangjiajie cigar variety "Cuba No. 7" in 2024 according to an embodiment of the present invention;
[0038] Fig.11 A schematic diagram of a training process of stacked ensemble learning according to an embodiment of the present invention;
[0039] Fig.12 This is a schematic diagram of the morphology of cigar tobacco leaves in a suspended state at different air-drying periods according to an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0042] This embodiment proposes a method for predicting the moisture content of cigar tobacco leaves during the drying process in a natural hanging state, including:
[0043] Collecting image data of cigar tobacco leaves to be predicted in a hanging and airing state;
[0044] The cigar leaf image data to be predicted is input into a preset moisture content prediction model to obtain the moisture content of the cigar leaf; wherein the preset moisture content prediction model is an integrated learning model; and is obtained by training and verifying a data set, wherein the data set is constructed based on the front and back image data of the cigar leaf at preset different periods during the drying process.
[0045] In this embodiment, the front and back images of cigar tobacco leaves in a naturally hanging state during the drying process are collected, and the features of the front and back images of tobacco leaves are extracted based on the Python OpenCV library to construct a tobacco leaf moisture content prediction model based on stacking integration. The moisture content prediction accuracy of cigar tobacco leaves in five drying periods is high, and there is no overfitting phenomenon (test set R 2 =0.989, training set R 2 =0.990), and has good prediction results for cigar tobacco leaves across varieties, years, and production areas. This embodiment provides an effective and easy-to-operate method for predicting the moisture content of cigar tobacco leaves during the drying process for cigar tobacco growing areas.
[0046] Furthermore, constructing the dataset includes:
[0047] The front and back image data of cigar tobacco leaves at different preset periods during the drying process;
[0048] Perform image preprocessing on the front and back image data;
[0049] Extract preset features from the preprocessed image data and perform label encoding;
[0050] Screening the extracted preset features;
[0051] Based on the filtered features and front and back image data, a dataset is constructed.
[0052] Furthermore, different preset periods include: withering period, yellowing period, browning period, color fixing period and tendon drying period.
[0053] Furthermore, image preprocessing of the front and back image data includes:
[0054] Construct a binary mask of the front and back image data;
[0055] The binary mask is combined with the front and back image data to obtain the tobacco leaf ROI image data.
[0056] Furthermore, the preset features include: a plurality of color features and a plurality of texture features.
[0057] Furthermore, screening the extracted preset features includes:
[0058] Use filtering method to preliminarily screen key features of preset features;
[0059] For the features after preliminary screening, the Pearson correlation coefficient between the feature index and the moisture content of tobacco leaves is calculated, and the features with correlation coefficients lower than the preset value are eliminated;
[0060] For the remaining features after elimination, the autocorrelation of each feature is calculated. For the features with correlation higher than the preset value, the features with high correlation with the moisture content of tobacco leaves are selected and retained.
[0061] Specifically, in this embodiment,
[0062] (1) Sample the cigar tobacco leaves during the drying process and hang them in the image acquisition device ( Figure 2 ). Among them, the size of the dark box is 80cm 3, a white background board was laid on the back, two 40W white lamps were fixed on the top as light sources, and a PVC bearing rod with a clip was installed at the vertical position of the lamp to fix the tobacco leaves. The distance between the bearing rod and the white background board was 1.5cm to prevent the interference of light and shadow on the image. The front and back images of the tobacco leaves were collected using a telephoto distortion-free camera. A total of 880 cigar tobacco leaves were tested. The number of samples taken at each period and position and the moisture content of the tobacco leaves are shown in Table 1.
[0063] Table 1 Descriptive statistics of the number of samples taken at different air-drying periods and leaf positions and the moisture content of tobacco leaves
[0064]
[0065] (2) The camera model was Canon Mark II, the image resolution was 2080 × 3120 pixels, a 24-70 / f4 lens, the focal length was set to 35 mm, and the photos were taken perpendicular to the tobacco leaves.
[0066] (3) After image acquisition, the python opencv library is used for image preprocessing.
[0067] (4) The preprocessing process mainly involves creating a binary mask of the tobacco leaf image and merging it with the original tobacco leaf image to obtain a tobacco leaf ROI image ( Figure 3 ).
[0068] (5) For step 4), set the color threshold range T to T min =[H min ,S min ,V min ]=[15,20,15];T max =[H max ,S max ,V max ]=[175,255,255].
[0069] (6) Images of the front and back of cigar leaves from different periods Fig.12 shown.
[0070] (7) 24 color features (12 for the front and 12 for the back) and 10 texture features (5 for the front and 5 for the back) were extracted from the tobacco leaf images. At the same time, the leaf position and drying period were encoded using the Python built-in label encoder and converted into discrete data for processing. The meanings and abbreviations of each feature are shown in Table 3.
[0071] Table 3 Cigar leaf image features and their abbreviations
[0072]
[0073] (8) For the extracted features, use the filter method to screen the key features to avoid "information redundancy" in the modeling process.
[0074] (9) The Pearson correlation coefficients between the 35 characteristic indicators and the moisture content of tobacco leaves were calculated, and the characteristics with correlation coefficients less than 0.45 and p-value>0.5 were eliminated. Figure 4 .
[0075] (10) For the features removed in step 7), the autocorrelation of each feature is calculated ( Figure 5 ), for the two features with correlation higher than 0.9, select the one with higher correlation with tobacco leaf moisture content ( Figure 4 ) features are retained.
[0076] After filtering the features, the retained features are B f , G f , R f 、StdB f 、a f *、Stda f *、Stdb f *、ASM f 、IDM f , B r , G r 、b r *、Stda r *, LP, AP.
[0077] Furthermore, the preset moisture content prediction model includes: MLP sub-model, RF sub-model, and GBDT sub-model.
[0078] Specifically, (11) we first construct three types of machine learning models, totaling 9 models, namely: single algorithm model (single model): LR (linear regression), SVR (support vector regression), MLP (Multilayer Perceptron); bagging-based ensemble learning algorithm: RF (random forest), ET (extra tree regression); boosting-based ensemble learning algorithm: GBDT (gradient boosting decision tree regression), XGboost (extra gradient boosting regression), Adaboost (adaptive boosting regression), LightGBM (light gradient boosting machine).
[0079] (12) The hyperparameters of the nine machine learning models were all optimized using genetic algorithms. The optimized hyperparameters are shown in Table 4.
[0080] Table 4 Hyperparameters after optimization of each machine learning model
[0081]
[0082]
[0083] (13) For the new data set after feature screening, 35 samples were selected from each of the five drying periods (withering period, yellowing period, browning period, color fixing period, and dry period) as the test set, and the rest were used as the training set. There were 175 test set data and 705 training set data in total. Both the training set and the test set data were standardized to unify the dimensions.
[0084] (14) For the 9 candidate base learners constructed in step 10), a five-fold cross-validation method was used in the training set data, and five commonly used evaluation indicators of regression models were used, including: EVS, R 2 , MSE, MAE, and MAPE are used to evaluate the model.
[0085] (15) Calculate the mean of the five evaluation indicators in the five-fold cross-validation to measure the model performance; calculate the standard deviation and coefficient of variation in the five-fold cross-validation to evaluate the generalization ability of the model; record the time taken for the five-fold cross-validation of each candidate machine learning model to measure the complexity of the model.
[0086] (16) For the mean, standard deviation, and coefficient of variation (15) of each evaluation indicator in the cross-validation, the 15 indicators for evaluating model performance and generalization ability were standardized and R was specified. 2 , EVS are positive indicators, and the rest are negative indicators. Based on the entropy weight method, the comprehensive scores of each model in the five-fold cross validation are calculated. The comprehensive scores of each model and the cross validation time are shown in Figure 6 .
[0087] (17) For the stacking ensemble learning model, the present invention selects the base learner based on the principle of "good performance and as much diversity as possible"; the selection of the meta-learner is based on the complexity of the algorithm, and the algorithm should be kept as simple as possible to better summarize the prediction results of each base learner. The present invention uses MLP, RF, GBDT and LR to construct a stacking ensemble learning model to predict the moisture content of cigar tobacco leaves during the drying process. The training process of stacking ensemble learning is as follows: Fig.11 shown.
[0088] Since a single model may only be able to capture limited information from the data, stacked ensemble learning can obtain a more comprehensive data perspective by combining the predictions of multiple models, thereby improving the overall prediction accuracy. The steps for constructing a stacked ensemble model in this embodiment are as follows: Fig.11 As shown in the figure, specifically: 1) The stacked ensemble learning model is a two-layer model structure, in which the first layer is composed of n machine learning algorithms optimized by genetic algorithms. For the training set data, a five-fold cross-validation method is used to complete the training of the first layer of base learners. 2) The result output by the cross-validation of the nth base learner is recorded as v n-1 ~v n-5 , forming a new feature set. 3) Take the feature set obtained in step 2) as the training input and the moisture content of tobacco leaves as the output to train the second-layer meta-learner.
[0089] The testing process of the stacked ensemble learning model is basically the same as the training process. The test set data is input into the first layer base learner for prediction, and the test set features t1~t n , the new features are input into the second-layer meta-learner to complete the prediction of tobacco leaf moisture content.
[0090] (18) The three types of machine learning models with better performance were selected as base models, namely MLP, RF, and GBDT.
[0091] (19) The meta-learner selects the LR with the shortest five-fold cross-validation run time.
[0092] (20) After the stacking ensemble learning model is constructed and trained using the training set data, the test set data is predicted.
[0093] (21) The same method is used to make predictions for the base learner and the meta learner, and the results are shown in Figure 7 .
[0094] (22) The results show that the integrated learning model constructed in this paper has good performance and does not have overfitting phenomenon (training set R 2 =0.990, test set R 2 =0.989).
[0095] (23) In order to verify the necessity of feature selection in this embodiment, 7 feature combinations were constructed: Scheme 1: front image feature, Scheme 2: back image feature, Scheme 3: front image feature + back image feature, Scheme 4: front image feature + leaf feature, Scheme 5: back image feature + leaf feature, Scheme 6: original feature, Scheme 7: preferred feature subset.
[0096] (24) The stacking model was used to predict the seven models. The results are as follows Figure 8 shown.
[0097] (25) To verify the superiority of the moisture content model constructed in this embodiment, it is compared with other model combination schemes. The prediction results of the test set and the training set are evaluated using the five evaluation indicators in step 10).
[0098] (26) Similarly, the entropy weighted method was used to evaluate the comprehensive score of each model combination scheme.
[0099] (27) The specific method of entropy weighting method is: calculate the R of the prediction results of the test set and the training set 2 , EVS, MSE, MAE, MAPE, and calculate the difference between the two R sub 2 、EVS sub , MSE sub 、MAE sub 、MAPE sub The prediction performance of the model is measured by the values of various evaluation indicators of the test set, and the generalization ability of the model is measured by the difference between the evaluation indicators of the training set and the test set.
[0100] (28)Specify R 2 , EVS, MSE sub 、MAE sub 、MAPE sub is a positive indicator, and the rest are negative indicators. The comprehensive score of each combination is calculated. Fig. 9 shown.
[0101] (29) Figure 8It is shown that the moisture content prediction model constructed in this embodiment has the highest comprehensive score compared with other model combination schemes.
[0102] (30) To verify the applicability of this embodiment, a prediction was made for the 2024 Zhangjiajie cigar variety "Cuba No. 7". 150 cigar leaves in the drying process were randomly sampled and predicted. The results are as follows: Fig.10 As shown, R 2 =0.926. This proves that this embodiment also has good prediction ability for cigar tobacco leaves across production areas, years, and varieties.
[0103] In this embodiment, first, a digital camera (Canon Mark II, image resolution of 2080×3120 pixels, 24-70 / f4 lens, focal length set to 35mm) is used to collect the front image and reverse image of the cigar tobacco leaves in the hanging state, and then the region of interest (ROI) of the cigar tobacco leaf image is extracted to obtain its color and texture features, and the leaf position and drying period are converted into categorical variables using label encoding. Afterwards, in order to avoid the impact of multicollinearity on the model, the Pearson correlation coefficient (PCC) between the image features and the moisture content of the tobacco leaves and within the image features is calculated, and the image features are screened using a filtering method to obtain a preferred image feature subset, and the data set is split according to the drying period. Nine machine learning algorithms were constructed as candidate base learners, including three single machine learning algorithms: liner regression (LR), Multilayer Perceptron (MLP), support vector regression (SVR), two bagging-based ensemble learning algorithms random forest (RF), gradient boosting decision tree (GBDT) and four boosting-based ensemble learning algorithms extreme gradient boosting (XGBoost), adaptive boosting (AdaBoost), and light gradient boosting machine (LightGBM). For all base learners, their hyperparameters were adjusted using genetic algorithms, and then the entropy weighted method was used to calculate the comprehensive score of each candidate base learner with the results of 5-fold cross validation. The prediction performance and generalization ability of each model were evaluated, and the best performing model in each type of machine learning model was selected for the construction of the stacked ensemble learning model, and the test set data was predicted. Finally, the Cuban No. 7 tobacco leaves grown in the Zhangjiajie cigar producing area in 2024 were verified.
[0104] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.
Claims
1. A method for predicting the moisture content of cigar tobacco leaves during the drying process under natural hanging state, characterized in that: include: Collecting image data of cigar tobacco leaves to be predicted in a hanging and airing state; The cigar leaf image data to be predicted is input into a preset moisture content stacking prediction model to obtain the moisture content of the cigar leaf; wherein the preset moisture content stacking prediction model is a stacking ensemble learning model; and is obtained by training and validating a data set, wherein the data set is constructed based on the front and back image data of the cigar leaf at preset different periods during the drying process.
2. The method for predicting moisture content of cigar tobacco leaves during airing in a natural hanging state according to claim 1, characterized in that: Constructing the dataset includes: The front and back image data of cigar tobacco leaves at different preset periods during the drying process; Performing image preprocessing on the front and back image data; Extract preset features from the preprocessed image data and perform label encoding; Screening the extracted preset features; The data set is constructed based on the screened features and the front and back image data.
3. The method for predicting moisture content of cigar tobacco leaves during airing in a natural hanging state according to claim 2, characterized in that: The preset different periods include: withering period, yellowing period, browning period, color fixing period and tendon drying period.
4. The method for predicting moisture content of cigar tobacco leaves during airing in a natural hanging state according to claim 2, characterized in that: The image preprocessing of the front and back image data includes: Constructing a binary mask of the front and back image data; The binary mask is combined with the front and back image data to obtain tobacco leaf ROI image data.
5. The method for predicting moisture content of cigar tobacco leaves during airing in a natural hanging state according to claim 2, characterized in that: The preset features include: a plurality of color features and a plurality of texture features.
6. The method for predicting moisture content of cigar tobacco leaves during airing in a natural hanging state according to claim 2, characterized in that: Screening the extracted preset features includes: Using a filtering method to perform a preliminary screening of key features of the preset features; For the features after preliminary screening, the Pearson correlation coefficient between the feature index and the moisture content of tobacco leaves is calculated, and the features with correlation coefficients lower than the preset value are eliminated; For the remaining features after elimination, the autocorrelation of each feature is calculated. For the features with correlation higher than the preset value, the features with high correlation with the moisture content of tobacco leaves are selected and retained.
7. The method for predicting moisture content of cigar tobacco leaves during airing in a natural hanging state according to claim 1, characterized in that: The preset moisture content stacking prediction model includes: base learners: MLP, RF, GBDT; meta learner: LR.
Citation Information
Patent Citations
A rapid method for determining the moisture content of cigar tobacco leaves during the drying process
CN114931227A
Prediction method for optimizing moisture content of cigar tobacco leaves in air-curing process based on random forest characteristics
CN118038149A