A method for identifying the grade of flue-cured tobacco leaves based on integration technology
By integrating three feature extraction methods and the SVM Boosting ensemble framework, the subjectivity and accuracy issues in the grading of flue-cured tobacco leaves in traditional visual processing techniques are resolved, achieving more efficient tobacco leaf grade recognition.
Patent Information
- Application Number
- CN202110809022.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-16
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2041-07-16
AI Technical Summary
Traditional visual processing technology suffers from high subjectivity and low accuracy in grading flue-cured tobacco leaves, especially in large-scale grading operations where worker visual fatigue and emotional fluctuations lead to unsatisfactory grading results.
Three feature extraction methods combined with ensemble techniques were used to identify the grade of flue-cured tobacco leaves, including traditional appearance features, VGG16 deep network features, and fine-grained features. The Boosting ensemble framework of SVM was used to integrate classifiers to improve grading accuracy.
It significantly enhances the robustness and accuracy of flue-cured tobacco leaf grading. By combining expert experience and features extracted through deep learning, the accuracy of grading is further improved through integrated technology.
Smart Images

Figure CN113743399B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, specifically to image segmentation, feature extraction, deep learning, and integration technology, and more specifically to a flue-cured tobacco leaf grade identification technology based on integration technology. Background Technology
[0002] Tobacco, as an important economic crop, occupies a vital position in national economic development. To process and produce cigarettes of different grades, the raw flue-cured tobacco leaves need to be graded and purchased. The standards for grading flue-cured tobacco leaves include: maturity, leaf structure, grade, oil content, color, length, and damage level. Manual grading relies solely on a combination of senses, including sight, touch, and taste. In large-scale tobacco grading operations, workers often experience visual fatigue and emotional fluctuations, making traditional grading methods highly subjective. Even a typical worker typically requires two years of practical grading training to achieve a satisfactory grading accuracy. Therefore, tobacco grading has significant practical value and presents considerable challenges.
[0003] Conventional visual methods for grading flue-cured tobacco leaves, employing traditional visual processing techniques including feature extraction and classifier training, have achieved a certain degree of "intelligence." However, because features need to be designed manually, we can only utilize some known expert knowledge, such as the length and color of the tobacco leaves. This is an advantage of manual feature extraction. Furthermore, these features change with the seasons; for example, dehydration causes the leaves to darken in color and curl, shortening their length. This is a disadvantage of manual feature extraction. Therefore, current visual processing techniques are not ideal for grading tobacco leaves, and their accuracy is not high. Summary of the Invention
[0004] This invention provides a method for identifying the grade of flue-cured tobacco leaves based on ensemble technology. It extracts features of flue-cured tobacco leaves using three different feature extraction methods, then trains different classifiers using these features and corresponding labels, and finally integrates these three different classifiers using ensemble technology to achieve the best overall effect and obtain better flue-cured tobacco leaf grading results.
[0005] To achieve the above objectives, the present invention provides the following technical solution:
[0006] A method for identifying the grade of flue-cured tobacco leaves based on integrated technology includes the following steps:
[0007] Step 1: Image acquisition. Use a visible light camera to obtain the frontal reflection image of flue-cured tobacco leaves, and divide the collected data into training set and test set. Use grading experts to label these images.
[0008] Step 2: Image preprocessing, removing irregular data, using grayscale and thresholding techniques to find the largest connected region, and obtaining the target region and the corresponding binarization mask;
[0009] Step 3: Feature extraction, extracting traditional appearance features, VGG16 deep network output features, and fine-grained features from the flue-cured tobacco leaf images;
[0010] Step 4: Establish a Boosting ensemble framework that includes SVMs to learn the parameters and weights of each SVM.
[0011] Furthermore, in step 2, the removal of non-standard data is carried out using the following steps:
[0012] To determine whether the tobacco leaf image crosses the horizontal axis, and considering the number of the largest connected regions, image segmentation is then performed. First, the image is Gaussian smoothed; then, through grayscale conversion and thresholding, the largest connected region is found, and this region is considered the region of interest. Finally, features of flue-cured tobacco leaves are extracted within this region.
[0013] Furthermore, in step 3, the extracted features include three types:
[0014] 1) Appearance features, including geometric shape features, color features, and texture features;
[0015] The geometric shape features include seven aspects: perimeter, area, breakage rate, roundness, major axis length, minor axis length, and aspect ratio.
[0016] The color features include 267 features, including 256-dimensional HSV histogram color features, the mean and standard deviation of 11-dimensional HSV three components, the mean of B and G color components, and the standard deviation of B, G, and R.
[0017] There are five texture features, including entropy, energy, contrast, consistency, and autocorrelation.
[0018] 2) Features extracted by convolutional neural networks
[0019] The VGG16 classification network was selected to extract image features, and only the output of the last pooling layer of VGG16 was retained as the final feature.
[0020] 3) Features extracted by fine-grained neural networks
[0021] The network layers before the last pooling layer of VGG16 are selected as the feature maps to be processed. First, these feature maps are preprocessed, including square root regularization and L2 normalization. Then, the normalized feature maps are inner-producted pairwise, and kernel function techniques are used to establish non-linear relationships between different feature channels.
[0022] Furthermore, the geometric features are obtained in the following ways:
[0023] Based on roiMsk and fullMsk, traverse roiMsk through fullMsk, and count the number of holes with zero pixel values (hole_area) and the number of non-zero pixels (contoure_area) within the ROI region of roiMsk. This yields the total surface area of the blade.
[0024]
[0025] The formula for calculating the breakage rate is as follows:
[0026]
[0027] The perimeter calculation only requires counting the number of pixels in the contour of the largest connected region, maxContoureNum:
[0028]
[0029] Define roundness:
[0030]
[0031] The lengths of the major and minor axes are obtained by using the minimum inscribed ellipse of the ROI region. The minimum inscribed ellipse is obtained by fitting the ellipse with the contour points of the largest connected region, and the lengths of the major and minor axes are obtained. The lengths of the major and minor axes of the tobacco leaf, as well as their ratio, are then calculated.
[0032] .
[0033] Furthermore, color features are obtained in the following ways:
[0034] First, the color space of the ROI image is converted from RGB to HSV, where each component ranges from 0 to 255. Then, the color components are statistically summed pixel-by-pixel within the ROI region, and the HSV color histogram is calculated using the following formula:
[0035]
[0036]
[0037] Where hData[i], sData[i], and vData[i] represent the H, S, and V color component values of the i-th pixel, respectively; they are shifted right by 4, 6, and 6 bits, respectively, that is, HSV is quantized to the value range of 0~15, 0~3, and 0~3; after pixel-by-pixel statistics are completed, the HSV color histogram is normalized:
[0038]
[0039] Normalizing the sum of the color components of the three HSV channels and the sum of the G and B color components of the two RGB channels yields...
[0040]
[0041] Where area represents the tobacco leaf area and pixelNum represents the number of pixels traversed; a 256-dimensional HSV color histogram feature and a 5-dimensional color component mean feature are obtained; the ROI region is traversed again to obtain the standard deviation of each color component:
[0042]
[0043] The standard deviation of the color components in 6 dimensions is obtained. Combined with the histogram features in 256 dimensions and the mean features of the color components in 5 dimensions, the final color features in 267 dimensions are obtained.
[0044] Furthermore, texture features are obtained in the following ways:
[0045] For the ROI image, it is converted to grayscale, and then the grayscale feature matrices in the horizontal, vertical, and two diagonal directions are calculated, and five grayscale features in each direction are obtained. Finally, the average of these five features is calculated to obtain the final texture features, including the following sub-steps:
[0046] i) Gray-scale leveling;
[0047] ii) Initialize the co-occurrence matrix;
[0048] iii) Calculate the gray-level co-occurrence matrix (GLCM) in four directions: 0°, 45°, 90°, and 135°.
[0049] iv) Normalize the gray-level co-occurrence matrix, i.e.
[0050]
[0051] The first four steps can be used to calculate the entropy, energy, contrast, and inverse difference of the co-occurrence matrix.
[0052]
[0053]
[0054]
[0055]
[0056] Where GLCM_CLASS represents the grayscale level;
[0057] v) Based on the normalized gray-level co-occurrence matrix, calculate the mean and variance of the correlation in both directions. The calculation is as follows:
[0058]
[0059] After calculating the above four quantities, the autocorrelation is calculated:
[0060] .
[0061] Furthermore, in step 4, the three different SVM classifiers are integrated to obtain a Boosting ensemble framework that includes SVM, including the following steps:
[0062] (1) Initialize sample weights
[0063] (2) Calculate the distribution function and cumulative probability.
[0064] (3) Randomly select samples for training to obtain a classifier, and calculate the weight of the classifier based on the classification results of the original training set.
[0065] (4) Update the sample weights according to the classifier weights.
[0066] (5) Voting is conducted using three different classifiers, their respective weights, and voting rules to obtain the integrated hierarchical results.
[0067] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0068] It can extract features using expert experience and deep features extracted by deep learning, and utilizes more refined fine-grained features, which can significantly enhance the robustness of flue-cured tobacco leaf grading. Combined with integrated technology, it further improves the accuracy of grading. Attached Figure Description
[0069] Figure 1 A chart showing the grading of flue-cured tobacco leaves;
[0070] Figure 2 This is a diagram of the image preprocessing process;
[0071] Figure 3 A network framework for extracting flue-cured tobacco leaf features from VGG16;
[0072] Figure 4 This is a schematic diagram of fine-grained feature extraction based on the VGG16 network framework;
[0073] Figure 5 A schematic diagram of a multi-SVM ensemble framework (training);
[0074] Figure 6 A schematic diagram of a multi-SVM integration framework (test);
[0075] Table 1 shows a comparison of the results of the practical application of the present invention;
[0076] Table 2 is the confusion matrix of the integrated classification of this invention;
[0077] Table 3 shows the confusion matrix improved based on integrated classification in subsequent studies of this invention. Detailed Implementation
[0078] The technical solutions provided by the present invention will be described in detail below with reference to specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention.
[0079] This invention provides a method for identifying the grade of flue-cured tobacco leaves based on integrated technology, which consists of five steps, as follows:
[0080] Step 1: Image Acquisition. A Jai LT-400-CL 3 CMOS RGB linear scan camera was used to acquire frontal reflectance images of flue-cured tobacco leaves at a resolution of 8000*4096, saved in IPEG format. The acquired data was divided into training and test sets in a 7:3 ratio. In this experiment, 831 images were used as the training set and 355 as the test set. Figure 1 As shown, there are five levels in total: B2F, B3F, C2F, C3F, and C4F. During the experiment, these levels were labeled 1 through 5.
[0081] Step 2: Image preprocessing, first removing irregular data. The process is as follows: Figure 2 As shown, the flue-cured tobacco leaves are grayscaled, and then binarized with a threshold of 30 to obtain a binary image. Let the number of connected regions in the binary image be denoted as . If the binary image is entirely white, then If the binary image is completely black, then Then iterate through the horizontal axis of the binary image, starting from row 4000, and count the number of gray values of 255. The following rules will be used to determine whether this image is acceptable.
[0082]
[0083] By determining whether the tobacco leaf image crosses the horizontal axis and combining this with the number of the largest connected components to remove most of the unqualified images, we can eliminate cases where the tobacco leaf is only in the upper or lower half, or where it is entirely black or entirely white. After this data filtering step, the final training set consisted of 814 images, and the test set consisted of 351 images.
[0084] Then, image segmentation is performed, which involves the following steps:
[0085] 1) Apply Gaussian smoothing to the original image orgImage to remove some noise.
[0086] 2) Perform grayscale processing on 1).
[0087] 3) Perform thresholding on 2) with a threshold of 30 to obtain a binary mask image mskImage, where black pixels have a value of 0 and white pixels have a value of 255.
[0088] 4) Traverse each connected region and find the connected region with the largest area.
[0089] 5) Based on the maximum connected region, find the minimum bounding rectangle of this region.
[0090] 6) Cropping orgImage and mskImage based on the minimum bounding rectangle of step 5) retains the positions corresponding to the minimum bounding rectangle, resulting in roiImage and roiMsk. At this point, roiMsk is a binary mask image enclosed by the contour of the largest connected region, and its image center includes holes, i.e., points with a pixel value of 0. We design a mask image fullMsk with the same contour, the only difference being that the interior of fullMsk is entirely composed of points with a pixel value of 125. Performing a pixel-by-pixel logical AND operation between fullMsk and orgImage converts the pixels with a pixel value of 125 in fullMsk to 1, ultimately obtaining the target region (ROI) image. The area occupied by this image is called the ROI region.
[0091] Step 3: Feature extraction. This involves extracting traditional visual features, VGG16 deep network output features, and fine-grained features from the flue-cured tobacco leaf images. The specific feature extraction methods are as follows:
[0092] 1) Extraction of appearance features
[0093] It includes 7-dimensional geometric features, 267-dimensional color features, and 5-dimensional texture features.
[0094] a) Geometric features include perimeter, area, breakage rate, roundness, major axis length, minor axis length, and aspect ratio (major axis length / minor axis length).
[0095] In step 3, based on roiMsk and fullMsk, roiMsk is traversed through fullMsk to count the number of holes with zero pixel values (hole_area) and the number of non-zero pixels (contoure_area) within the ROI region of roiMsk. This yields the total surface area of the blade (excluding damaged parts).
[0096]
[0097] The formula for calculating the breakage rate is as follows:
[0098]
[0099] The perimeter can be calculated simply by counting the number of pixels in the contour of the largest connected region, maxContoureNum.
[0100]
[0101] The middle tobacco leaves are rounder and thicker than the upper tobacco leaves, while the upper tobacco leaves appear more slender. We can define roundness as follows:
[0102]
[0103] We obtain the lengths of the major and minor axes using the minimum inscribed ellipse of the ROI region. The minimum inscribed ellipse is obtained by fitting an ellipse to the contour points of the largest connected region, yielding the lengths of the major and minor axes, 'a' and 'b'. This allows us to calculate the lengths of the major and minor axes of the tobacco leaf, as well as their ratio.
[0104]
[0105] b) The color features include 267 features, including 256-dimensional HSV histogram color features, the mean and standard deviation of 11-dimensional HSV components, the mean of B and G color components, and the standard deviation of B, G, and R (the mean of R is the same as the mean of V, so it is omitted).
[0106] First, the color space of the ROI image is converted from RGB to HSV. Each component of HSV ranges from 0 to 255. This is because the HSV color space is better suited for computers to distinguish the differences in tobacco color. Then, the color components are statistically summed pixel-by-pixel within the ROI region, and the HSV color histogram is calculated using the following formula:
[0107]
[0108]
[0109] Where hData[i], sData[i], and vData[i] represent the H, S, and V color component values of the i-th pixel, respectively. Shifting them right by 4, 6, and 6 bits respectively quantizes the HSV to the range of 0~15, 0~3, and 0~3. After pixel-by-pixel statistics are completed, the HSV color histogram is normalized:
[0110]
[0111] Normalizing the sum of the color components of the three HSV channels and the sum of the G and B color components of the two RGB channels yields...
[0112]
[0113] The tobacco leaf area is calculated in the region where area is 1, and pixelNum is the number of pixels traversed. Thus, we obtain 256 ( The 5-dimensional HSV color histogram features and the 5-dimensional color component mean features are obtained. Then, the standard deviation of each color component is obtained by iterating through the ROI region again.
[0114]
[0115] We obtained a 6-dimensional color component standard deviation feature, plus a 256-dimensional histogram feature and a 5-dimensional color component mean feature, so we can finally obtain a 267-dimensional color feature.
[0116] c) Texture features include entropy, energy, contrast, inverse gap, and autocorrelation. Entropy represents the amount of information in an image, reflecting the degree of non-uniformity or complexity of the texture. Energy is the sum of the squares of the elements in the gray-level co-occurrence matrix, reflecting the uniformity of the gray-level distribution and the coarseness of the texture. Contrast reflects the sharpness of the image and the depth of the texture grooves. Inverse gap reflects the homogeneity of the image texture, measuring the amount of local variation in the image texture. Autocorrelation measures the similarity of the elements in the spatial gray-level co-occurrence matrix in the row or column direction.
[0117] For the ROI image, we convert it to grayscale, then calculate the grayscale feature matrices in the horizontal, vertical, and two diagonal directions, and obtain five grayscale features in each direction. Finally, we average these five features to obtain the final texture features.
[0118] The main steps are as follows:
[0119] i) Gray-scale leveling, the level in this experiment is 8.
[0120] ii) Initialize the co-occurrence matrix, and the statistical distance of the gray-level co-occurrence matrix is 2.
[0121] iii) Calculate the gray-level co-occurrence matrix (GLCM) in four directions: 0°, 45°, 90°, and 135°.
[0122] iv) Normalize the gray-level co-occurrence matrix, i.e.
[0123]
[0124] The first four steps can be used to calculate the entropy, energy, contrast, and inverse difference of the co-occurrence matrix.
[0125]
[0126]
[0127]
[0128]
[0129] Where GLCM_CLASS is the grayscale level, and in this experiment, it is set to 8.
[0130] v) Based on the normalized gray-level co-occurrence matrix, calculate the mean and variance of the correlation in both directions. The calculation is as follows:
[0131]
[0132] After calculating the above four quantities, we can calculate the autocorrelation:
[0133]
[0134] The decimal added to the denominator is to prevent invalid calculations.
[0135] 2) Features extracted by convolutional neural network (VGG16)
[0136] Convolutional neural networks have strong feature extraction capabilities, therefore we choose... Figure 3 The VGG16 classification network shown is used to extract image features. We only retain the output of the last pooling layer of VGG16, which has 512 feature maps, each with a dimension of 7*7. Flattening and stretching the feature matrix yields 25088-dimensional features. This paper uses the Darknet deep learning framework to extract convolutional neural network features. First, the original 8000*4096 resolution flue-cured tobacco leaf image is scaled down to 256*256 as the input to the Darknet framework, and then scaled down to 224*224 as the input to the VGG16 network.
[0137] 3) Features extracted by fine-grained neural networks
[0138] Unlike coarse-grained classification tasks, our task of grading flue-cured tobacco leaves is a more complex fine-grained classification. The differences in global features between adjacent grades of leaves in the same part are very subtle, with only minor differences in leaf tip, auricle, stem, and vein pattern. For example, C2F and C3F flue-cured tobacco leaves have very similar global color and shape features, with only slight differences in chroma and leaf tip angle in some areas. This important classification information is often overlooked by the main operations of general deep neural networks (such as pooling), requiring special extraction strategies to uncover these hidden subtle details. Fine-grained recognition is a subtask of classification, capable of distinguishing similar objects based on differences in local detailed features, and has been widely studied and applied. Therefore, this invention also considers using fine-grained feature extraction methods to extract the aforementioned subtle differences between adjacent grades of tobacco leaves. The bilinear fine-grained feature extraction method is based on deep network features and does not require the construction of an additional fine-grained deep network; this invention still uses VGG16 as the base network. Furthermore, fine-grained features can be seen as a supplement to traditional visual features and general deep features.
[0139] like Figure 4 As shown, we select the network layer before the last pooling layer in VGG16 as the feature map we will process. This layer also has 512 feature maps, with a dimension of 14*14. Let the feature maps we obtain be as follows: ,in For each feature map We first vectorize it to obtain , Then to Each element Perform square root regularization, that is ,in for elements The symbol. For vectors The module length. Finally, the updated... Perform L2 norm normalization, i.e. The final fine-grained flue-cured tobacco leaf features are obtained by performing pairwise inner products on the updated feature maps. Due to the matrix Since it is a symmetric matrix, we only take the elements of the upper triangular matrix as the final feature, and the number of dimensions is 131328.
[0140]
[0141] To more effectively model the nonlinear relationships between feature maps, this paper uses a kernelized bilinear aggregation method with an exponential kernel function. elements in After kernel function mapping, it becomes ,in .
[0142] Step 4: Establish a Boosting ensemble framework that includes SVMs to learn the parameters and weights of each SVM. A diagram of the multi-SVM ensemble framework is shown below. Figure 5 , 6 As shown.
[0143] a) Feature preprocessing
[0144] Following the feature extraction method described above, three different features are extracted from the training set. Let these three features be denoted as follows: .in , The number of samples in the training set. For the first The dimension of the feature. And .
[0145] Max-min normalization is applied to the three features. The normalization formula is as follows:
[0146]
[0147] The normalization interval for this experiment is: ,Right now . and For a certain feature, the maximum or minimum value is denoted as . For an element of a eigenvector of a certain dimension, These are the normalized elements. For each... Normalization is performed. The minimum and maximum values of all dimensions for each feature are retained to normalize the test set data.
[0148] b) Ensemble model training
[0149] SVM is a simple and effective classification model; finding the optimal model is equivalent to finding the optimal separating hyperplane. Given feature vectors and labels, we can train three different SVM classification models using the LIBSVM toolkit. Considering time complexity, we use a linear kernel instead of an RBF kernel. We employ five-fold cross-validation to find the best classification model. The linear kernel optimization function only requires continuously adjusting the value of C to find a local optimum within a specified range.
[0150] Model ensembles are widely used in practical problems. The main idea of ensemble is to combine multiple weak classifiers into a strong classifier through some ensemble method. When training weak classifiers, we need them to reach a certain stage before training stops, such as meeting a certain number of iterations or reaching a preset accuracy. Then, these weak classifiers are combined to obtain the final strong classifier. We can view this strong classifier as a cascaded classifier, because the result of the first classifier affects the second, and the second affects the third. Specifically, the classifier in the later stage is the hard sample classifier of the previous stage, focusing on those misclassified samples. This paper uses the three different SVM models mentioned above for ensemble, obtaining a Boosting ensemble framework that includes SVM, improving the classification accuracy. The training of the classifiers and the weight calculation methods are as follows:
[0151] 1. Initialize sample weights (i.e., the probability of each sample being selected). , This represents the number of training samples.
[0152] 2. If the number of training iterations t is less than CLASSIFIERNUM (t is initially set to 0, representing the number of classifiers)
[0153] 2.1 Constructing a new distribution function
[0154]
[0155] 2.2 The cumulative probability formula is as follows:
[0156]
[0157] 2.3 If random numbers If sample i is added to the training set, this process is repeated N times. If t=0, then all 814 samples are added to the training set. This means that no samples are repeated during the first training iteration of the model.
[0158] 2.4 Regarding the sample The features are used to train an SVM to obtain a classification model. .
[0159] 2.5 The model from 2.4 was tested on the initial training set of 814 samples. The weights of the incorrectly predicted samples were accumulated as follows:
[0160]
[0161] 2.6 Calculation Weight :
[0162]
[0163] 2.7 Update Sample Weights
[0164]
[0165] c) Model Integration and Testing
[0166] We have already obtained three different feature vectors for prediction. Using the classification model obtained in b) above, we get three probability-based prediction results. , These represent the prediction probabilities of five levels, respectively. By rearranging their order, they can represent the prediction probabilities of B2F, B3F, C2F, C3F, and C4F. (This is because SVM labels are read sequentially during training; for example, the first sample is labeled 2, the second sample is labeled 3, and so on.) This represents the probability of predicting the label as 2. (This represents the probability of predicting the label as 3).
[0167] Weighted summation of the three different prediction probabilities:
[0168]
[0169] For ensemble prediction probabilities Find the highest probability and the second highest probability Final prediction result:
[0170]
[0171] The experimental results are shown in Tables 1 and 2. It can be seen that the ensemble performance is higher than the results of training three separate units. The distinction between different parts of the flue-cured tobacco is relatively clear, with an accuracy of 326 / 351 = 92.88%. However, C2F and C3F are more difficult to distinguish, and a significant portion of C4F is still classified as B2F because C4F and B2F are adjacent. We also attempted to classify C2F and C3F separately. If the classification result was either of these two categories, LDA classification was performed. The accuracy of the integrated classification result was significantly improved, reaching 70.66%, as shown in Table 3.
[0172] Table 1. Comparison of Integration Effects
[0173]
[0174] Table 2. Confusion Matrix of Integration Results
[0175]
[0176] Table 3. LDA classification results of C2F and C3F based on Boosting.
[0177]
[0178] The technical means disclosed in this invention are not limited to those disclosed in the above embodiments, but also include technical solutions composed of any combination of the above technical features. It should be noted that those skilled in the art can make various improvements and modifications without departing from the inventive principle, and these improvements and modifications are also considered within the scope of protection of this invention.
Claims
1. A method for identifying the grade of flue-cured tobacco leaves based on integrated technology, characterized in that, Includes the following steps: Step 1: Image acquisition. Use a visible light camera to obtain the frontal reflection image of flue-cured tobacco leaves, and divide the collected data into training set and test set. Use grading experts to label these images. Step 2: Image preprocessing, removing irregular data, using grayscale and thresholding techniques to find the largest connected region, and obtaining the target region and the corresponding binarization mask; Step 3: Feature extraction. This involves extracting traditional visual features, VGG16 deep network output features, and fine-grained features from the flue-cured tobacco leaf images. The extracted features include three types: 1) Appearance features, including geometric shape features, color features, and texture features; The geometric shape features include seven aspects: perimeter, area, breakage rate, roundness, major axis length, minor axis length, and aspect ratio. The color features include 267 features, including 256-dimensional HSV histogram color features, the mean and standard deviation of 11-dimensional HSV three components, the mean of B and G color components, and the standard deviation of B, G, and R. There are five texture features, including entropy, energy, contrast, consistency, and autocorrelation. 2) Features extracted by convolutional neural networks The VGG16 classification network was selected to extract image features, and only the output of the last pooling layer of VGG16 was retained as the final feature. 3) Features extracted by fine-grained neural networks The network layers before the last pooling layer of VGG16 are selected as the feature maps to be processed. First, these feature maps are preprocessed, including square root regularization and L2 normalization. Then, the normalized feature maps are inner-producted pairwise, and kernel function techniques are used to establish non-linear relationships between different feature channels. Step 4: Establish a Boosting ensemble framework that includes SVMs to learn the parameters and weights of each SVM.
2. The method for identifying the grade of flue-cured tobacco leaves based on integrated technology according to claim 1, characterized in that, In step 2, the removal of non-standard data is carried out using the following steps: To determine whether the tobacco leaf image crosses the horizontal axis, and considering the number of the largest connected regions, image segmentation is then performed. First, the image is Gaussian smoothed; then, through grayscale conversion and thresholding, the largest connected region is found, and this region is considered the region of interest. Finally, features of flue-cured tobacco leaves are extracted within this region.
3. The method for identifying the grade of flue-cured tobacco leaves based on integrated technology according to claim 1, characterized in that, Geometric features are obtained in the following ways: Based on roiMsk and fullMsk, traverse roiMsk through fullMsk, count the number of holes with zero pixel values (hole_area) and the number of non-zero pixels (contoure_area) within the ROI region of roiMsk; obtain the total surface area of the blade. The formula for calculating the breakage rate is as follows: The perimeter calculation only requires counting the number of pixels in the contour of the largest connected region, maxContoureNum: Define roundness: The lengths of the major and minor axes are obtained by using the minimum inscribed ellipse of the ROI region. The minimum inscribed ellipse is obtained by fitting the ellipse with the contour points of the largest connected region, and the lengths of the major and minor axes are obtained. The lengths of the major and minor axes of the tobacco leaf, as well as their ratio, are then calculated. 。 4. The method for identifying the grade of flue-cured tobacco leaves based on integrated technology according to claim 1, characterized in that, Color characteristics are obtained in the following ways: First, the color space of the ROI image is converted from RGB to HSV, where each component ranges from 0 to 255. Then, the color components are statistically summed pixel-by-pixel within the ROI region, and the HSV color histogram is calculated using the following formula: Where hData[i], sData[i], and vData[i] represent the H, S, and V color component values of the i-th pixel, respectively; they are shifted right by 4, 6, and 6 bits, respectively, that is, HSV is quantized to the value range of 0~15, 0~3, and 0~3; after pixel-by-pixel statistics are completed, the HSV color histogram is normalized: Normalizing the sum of the color components of the three HSV channels and the sum of the G and B color components of the two RGB channels yields... Where area represents the tobacco leaf area and pixelNum represents the number of pixels traversed; a 256-dimensional HSV color histogram feature and a 5-dimensional color component mean feature are obtained; the ROI region is traversed again to obtain the standard deviation of each color component: The standard deviation of the color components in 6 dimensions is obtained. Combined with the histogram features in 256 dimensions and the mean features of the color components in 5 dimensions, the final color features in 267 dimensions are obtained.
5. The method for identifying the grade of flue-cured tobacco leaves based on integrated technology according to claim 1, characterized in that, Texture features are obtained in the following ways: For the ROI image, convert it to grayscale, then calculate the grayscale feature matrices in the horizontal, vertical, and two diagonal directions, and find the 5 grayscale features in each direction. Finally, the average value of these 5-dimensional features is calculated to obtain the final texture features, including the following sub-steps: i) Gray-scale leveling; ii) Initialize the co-occurrence matrix; iii) Calculate the gray-level co-occurrence matrix (GLCM) in four directions: 0°, 45°, 90°, and 135°. iv) Normalize the gray-level co-occurrence matrix, i.e. The first four steps can be used to calculate the entropy, energy, contrast, and inverse difference of the co-occurrence matrix. Where GLCM_CLASS represents the grayscale level; v) Based on the normalized gray-level co-occurrence matrix, calculate the mean and variance of the correlation in both directions. The calculation is as follows: After calculating the above four quantities, the autocorrelation is calculated: 。 6. The method for identifying the grade of flue-cured tobacco leaves based on integrated technology according to claim 1, characterized in that, In step 4, three different SVM classifiers are integrated to obtain a Boosting ensemble framework that includes SVM, which includes the following steps: (1) Initialize sample weights (2) Calculate the distribution function and cumulative probability. (3) Randomly select samples for training to obtain a classifier, and calculate the weight of the classifier based on the classification results of the original training set; (4) Update the sample weights according to the classifier weights; (5) Voting is conducted using three different classifiers, their respective weights, and voting rules to obtain the integrated hierarchical results.
Citation Information
Patent Citations
Tobacco leaf grading method and system
CN110807760A
System and Method for Extremely Efficient Image and Pattern Recognition and Artificial Intelligence Platform
US20200184278A1
