Tea leaf grading method using tea leaf RegNet
By using adaptive bilateral filtering and histogram equalization preprocessing, combined with improvements to the S-ENet and Tea RegNet models, the problems of background interference and small object segmentation in tea grading were solved, achieving higher accuracy and efficiency in tea grading.
Patent Information
- Application Number
- CN202311456250.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-03
- Publication Date
- 2026-04-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing tea grading methods are easily affected by the complex background of tea gardens during the picking process, resulting in low grading accuracy. Furthermore, traditional methods have errors or omissions in the segmentation of small tea leaves, making it difficult to effectively distinguish tea categories with similar characteristics.
Adaptive bilateral filtering and histogram equalization are used to preprocess tea images. The S-ENet model is used for image segmentation. Residual connections and FPN modules are added to the backbone layer of RegNet to construct a tea RegNet model. The weighted cross-entropy loss function is used for tea grading.
提高了茶叶分级的准确性,特别是在小目标茶叶分割和相似特征区分上,提升了分级的准确性和效率。
Smart Images

Figure CN121883337A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of tea grading technology, specifically a tea grading method utilizing Tea RegNet. Background Technology
[0002] China boasts a long and rich tea culture, with tea holding an extremely important place in Chinese culture, considered a national treasure and an integral part of daily life. Tea is also an important agricultural product, its quality closely related to its appearance. Tea can be graded into different levels based on its appearance, each with a corresponding value. Therefore, an automated tea grading system and method are needed to accurately and quickly grade tea, improving the quality and efficiency of tea production.
[0003] There is limited literature on automated tea grading. For example, Chinese patent application CN202111017041.8 discloses a method for grading tea buds that combines an improved attention mechanism and knowledge distillation. Based on the improved attention mechanism, a multi-size convolutional block attention module is constructed, and a tea bud grading model is established. The tea bud grading model and a ResNet32 model are pre-trained to obtain their weight parameters. A model training strategy combining dual transfer learning and knowledge distillation is used to train the tea bud grading model. Images of tea buds to be graded from the test set are imported into the trained tea bud grading model, and various indicators of the grading results and model specifications are recorded. However, this method does not perform image segmentation processing on the tea images, making them susceptible to interference from the complex background of the tea garden during actual harvesting, resulting in low tea grading accuracy. Furthermore, Chinese patent application CN202110695923.3 discloses a tea identification and grading method based on an improved capsule network. The method includes: dividing known varieties and grades of tea into several units and placing them sequentially on a white background; acquiring n images of each category of tea using a camera; performing binarization and various data augmentation processes on the tea image data based on the Otsu method; establishing a tea image database based on tea grade labels; deepening the original capsule network structure and combining it with residual blocks to construct an improved capsule network model suitable for tea grading; importing data from the tea image database into the improved capsule network model for training to obtain a tea grading model; laying the tea to be graded flat on the white background, capturing the image data to be identified using the camera, and inputting it into the trained tea grading model to obtain the tea grade identification result. However, this patent identifies tea after harvesting, and the capsule layers in the capsule network have a large number of parameters, requiring proper initialization and optimization. Failure to combine optimal parameters will result in low tea grading accuracy.
[0004] The grading standards for tea vary depending on the stage of tea production. Fresh tea leaves before picking can be categorized by size into single bud, one bud and one leaf, one bud and two leaves, and one bud and three leaves. The grading of fresh tea leaves can be detected using the RegNet algorithm. RegNet is a deep neural network architecture for image classification tasks, proposed by Facebook AI Research in 2020. The key idea of RegNet is to use a regularized scale for the network, rather than traditional manual design or automated search methods to define the network architecture. RegNet's design goal is to provide a simple yet efficient network structure that achieves good performance even with limited computational resources.
[0005] To address the issue of low accuracy in tea grading, a tea grading method utilizing Tea RegNet is proposed. Summary of the Invention
[0006] The purpose of this invention is to provide a tea grading method using Tea RegNet.
[0007] To achieve the above objectives, the present invention provides the following technical solution:
[0008] Tea grading methods using RegNet include:
[0009] Collect tea leaf images and construct a tea leaf image dataset.
[0010] Furthermore, acquiring tea leaf images also includes preprocessing the tea leaf images using adaptive bilateral filtering and histogram equalization. Specific steps include:
[0011] The tea image is denoised using adaptive bilateral filtering;
[0012] The denoised tea image is then enhanced using histogram equalization.
[0013] Further, the adaptive bilateral filtering includes: the window of the adaptive bilateral filtering is 3×3; the pixel value of the denoised pixel is calculated through the adaptive bilateral filtering; the denoised pixel value s(x,y) of the pixel (x,y) is obtained by weighting the pixel values z(u,v) of the neighboring pixels (u,v) within the 3×3 window centered on the pixel (x,y), and the specific formula is as follows:
[0014]
[0015] Where Θ(x,y) represents a 3×3 window centered at pixel (x,y); w(x,y,u,v) are weight coefficients; w(x,y,u,v) can be expressed as:
[0016]
[0017] Where exp() is an exponential function with the mathematical constant e as the base; t(x,y) represents the gradient value of pixel (x,y); t(u,v) represents the gradient value of neighboring pixel (u,v); σ d It is the location variance; σ r It is the variance of grayscale values; σ t It is the gradient variance.
[0018] Furthermore, the step of denoising the tea image using adaptive bilateral filtering includes:
[0019] Input a tea leaf image;
[0020] Based on the tea leaf image, determine the parameters of the bilateral filter, including spatial domain parameters, intensity domain parameters, and gradient mean parameters;
[0021] For each pixel in the tea image, the adaptive bilateral filter calculates its spatial distance and intensity difference with surrounding pixels, and performs a weighted average based on the weights.
[0022] The output is the pixel image of the tea leaves after processing with an adaptive bilateral filter;
[0023] Input the corresponding denoised tea leaf image.
[0024] Furthermore, the step of performing image enhancement processing on the denoised tea image using histogram equalization includes:
[0025] The denoised tea image is converted from the RGB color space to the HSV color space to obtain the tea HSV image;
[0026] Extract the component representing the brightness of the tea leaf image from the HSV image of the tea leaf;
[0027] Perform histogram equalization on the luminance component;
[0028] The equalized luminance component is recombined with the original saturation and hue components to obtain the equalized tea HSV image.
[0029] The equalized tea HSV image is converted back to the RGB color space to obtain the final image-enhanced tea image.
[0030] Furthermore, the histogram equalization step for the luminance component includes:
[0031] Calculate the histogram and cumulative histogram of the luminance component;
[0032] Calculate the brightness mapping function based on the cumulative histogram;
[0033] Map the original brightness value to the equalized brightness value.
[0034] The S-ENet model is used to segment the tea images, and the S-ENet tea image dataset is output.
[0035] Furthermore, the convolutional layers in the initialization module of the S-ENet model are replaced with a single 3x3 dilated convolutional layer, wherein the stride of the dilated convolutional layer is 2, the number of channels is 16, and the interval is 2; the softmax loss function is used as the segmentation loss function, and the expression of the softmax loss function is:
[0036]
[0037] Where L is the value of the softmax loss function, w1 is the proportion of pixels belonging to the tea category to the total number of pixels, and w2 is the proportion of pixels belonging to the non-tea category to the total number of pixels. f1 represents the number of pixels correctly segmented into the tea category by the S-ENet model, where f1 is the number of pixels in the tea category. f1 represents the number of pixels correctly segmented for non-tea categories by the S-ENet model, and f2 represents the number of pixels for non-tea categories.
[0038] Furthermore, the image segmentation of the tea image using the S-ENet model includes:
[0039] The tea image dataset is divided into an image segmentation training set and an image segmentation test set. The images in the image segmentation training set are labeled at the pixel level, and the labels divide the image pixels into tea regions and non-tea regions.
[0040] S-ENet is trained using the training dataset. During training, the input image is fed into the network, the output segmentation result is calculated, and it is compared with the true label to calculate the softmax loss function.
[0041] The network parameters are updated using the backpropagation algorithm to minimize the softmax loss function;
[0042] Training ends when the softmax loss function reaches its minimum; otherwise, training continues.
[0043] Output the trained S-ENet model;
[0044] Input the image segmentation test set into the trained S-ENet model;
[0045] Output the S-ENet tea leaf image dataset.
[0046] Residual connections are used between different block layers in the backbone of RegNet, and an FPN module is added after the backbone layer. The weighted cross-entropy loss function is used as the loss function for tea grading to construct the tea RegNet model.
[0047] Furthermore, the weighted cross-entropy loss function includes:
[0048] The expression for the weighted cross-entropy loss function is:
[0049]
[0050] Where L represents the weighted cross-entropy loss value; i represents the S-ENet tea image grade label; i = 1 indicates that the S-ENet tea image grade is Special Grade; i = 2 indicates that the S-ENet tea image grade is Level 1; i = 3 indicates that the S-ENet tea image grade is Level 2; i = 4 indicates that the S-ENet tea image grade is Level 3; T i This represents the number of real S-ENet tea images at level i; This represents the number of correctly detected S-ENet tea images in the i-th level; l i This represents the proportion of real S-ENet tea images at level i to the total number of S-ENet tea images, i.e.
[0051] The S-ENet tea image dataset is input into the tea RegNet model to obtain tea grading results.
[0052] Further, the S-ENet tea image is input into the backbone layer of the Tea RegNet, and after convolution through different block layers, it outputs feature images of different scales from the S-ENet tea image; the feature images of different scales are input into the FPN module, which upsamples and fuses features layer by layer and applies global average pooling to transform the feature maps into feature vectors; the feature vectors are input into the output layer of the Tea RegNet and combined with the weighted cross-entropy loss function to classify the tea; the steps of the Tea RegNet in classifying tea include:
[0053] The S-ENet tea image dataset is divided into a graded training set and a graded test set, and the S-ENet tea images in the graded training set are graded.
[0054] The tea RegNet model was trained using a graded training set. During the training process, S-ENet tea images were input into the network, the tea grading results were calculated and compared with the true grades, and the weighted cross-entropy loss function was calculated.
[0055] Training ends when the weighted cross-entropy loss function reaches its minimum; otherwise, training continues.
[0056] Output the trained tea leaf RegNet model.
[0057] Furthermore, the grading of the S-ENet tea images in the grading training set includes at least three grades: Special Grade, Grade 1, Grade 2, and Grade 3; Special Grade refers to a single bud; Grade 1 refers to one bud and one leaf; Grade 2 refers to one bud and two leaves; and Grade 3 refers to one bud and three leaves.
[0058] Furthermore, the tea RegNet includes an FPN module for learning feature information of the tea feature map output by the backbone layer; the information includes color features, texture features, and shape features; the texture features include the smoothness of the leaf edge and the distribution of leaf veins.
[0059] Furthermore, the step of extracting feature information from the S-ENet tea image using the tea RegNet includes:
[0060] Input the S-ENet tea leaf image into the Tea Leaf RegNet network;
[0061] The input image is passed from the input layer of the network to the backbone layer through forward propagation to extract feature images;
[0062] The extracted feature images are fed into the FPN module, which upsamples layer by layer and generates multi-scale feature images layer by layer.
[0063] For feature images at multiple scales, extract feature information;
[0064] Global average pooling is applied to fuse the extracted feature information at multiple scales at different levels through convolution operations;
[0065] Finally, the FPN module outputs the feature information of the S-ENet tea image after feature fusion.
[0066] Output the tea grading results.
[0067] Furthermore, the output tea grading results include: output tea grading results in the grading test set; the results include the tea grade and tea grading accuracy of each S-ENet tea image in the grading test set.
[0068] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0069] 1. This invention acquires tea leaf images and uses the gradient mean to construct an adaptive bilateral filter function. The adaptive bilateral filter algorithm is then used to denoise the images. Compared to the standard bilateral filter algorithm, the adaptive bilateral filter pays more attention to the edge regions of the tea leaf images while preserving details, thereby improving the accuracy of tea leaf grading.
[0070] 2. This invention, based on the ENet model, replaces the convolutional layers in the initialization module of the ENet model with dilated convolutional layers, and constructs the S-ENet model using the softmax loss function as the segmentation loss function. The S-ENet model is then used for tea image segmentation. S-ENet addresses the shortcomings of the ENet model in handling small objects, which results in significant errors or omissions in the semantic segmentation of small objects. This improves the accuracy of S-ENet in tea image segmentation, thereby enhancing the accuracy of tea grading.
[0071] 3. This invention, based on the RegNet model, uses residual connections between different block layers in the RegNet backbone layer and adds an FPN module after the backbone layer. It constructs a tea RegNet model using a weighted cross-entropy loss function as the loss function for tea grading, and then uses this model for tea grading. The tea RegNet model addresses the problem that RegNet cannot effectively model and distinguish categories with similar features, thus improving the accuracy of tea grading. Attached Figure Description
[0072] Figure 1 This is a schematic diagram of the tea grading method using Tea RegNet provided in an embodiment of the present invention;
[0073] Figure 2 This is a schematic diagram illustrating different grades of tea provided in an embodiment of the present invention;
[0074] Figure 3 This is a schematic diagram of the S-ENet module composition provided in an embodiment of the present invention;
[0075] Figure 4 These are schematic diagrams illustrating the segmentation effects of two models provided in embodiments of the present invention;
[0076] Figure 5 A schematic diagram of the tea RegNet network structure and its substructures provided in an embodiment of the present invention;
[0077] Figure 6 The diagram illustrates the effects of six models provided in this embodiment of the invention on S-ENet tea image grading. Detailed Implementation
[0078] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0079] Please see Figures 1 to 6 This invention provides a tea grading method using tea RegNet, the technical solution of which is as follows:
[0080] As one embodiment of the present invention, refer to Figure 1 A tea grading method using Tea RegNet includes: acquiring tea images and constructing a tea image dataset; segmenting the tea images using the S-ENet model to output the S-ENet tea image dataset; using residual connections between different block layers in the backbone layer of RegNet and adding an FPN module after the backbone layer, using a weighted cross-entropy loss function as the loss function for tea grading to construct a tea RegNet model; inputting the S-ENet tea image dataset into the tea RegNet model to obtain the tea grading results; and outputting the tea grading results.
[0081] S10. Collect tea images and construct a tea image dataset.
[0082] Furthermore, the present invention collected 2,400 images of tea leaves of different grades, the grades including at least special grade, first grade, second grade and third grade; special grade refers to single bud; first grade refers to one bud and one leaf; second grade refers to one bud and two leaves; and third grade refers to one bud and three leaves.
[0083] Furthermore, the acquisition of tea leaf images also includes preprocessing the tea leaf images using adaptive bilateral filtering and histogram equalization, specifically including the following steps:
[0084] The tea image is denoised using adaptive bilateral filtering;
[0085] The denoised tea image is then enhanced using histogram equalization.
[0086] Further, the adaptive bilateral filtering includes: the window of the adaptive bilateral filtering is 3×3; the pixel value of the denoised pixel is calculated through the adaptive bilateral filtering; the denoised pixel value s(x,y) of the pixel (x,y) is obtained by weighting the pixel values z(u,v) of the neighboring pixels (u,v) within the 3×3 window centered on the pixel (x,y), and the specific formula is as follows:
[0087]
[0088] Where Θ(x,y) represents a 3×3 window centered at pixel (x,y); w(x,y,u,v) are weight coefficients; w(x,y,u,v) can be expressed as:
[0089]
[0090] Where exp() is an exponential function with the mathematical constant e as the base; t(x,y) represents the gradient value of pixel (x,y); t(u,v) represents the gradient value of neighboring pixel (u,v); σ d It is the location variance; σ r It is the variance of grayscale values; σ t It is the gradient variance.
[0091] Furthermore, the step of denoising the tea image using adaptive bilateral filtering includes:
[0092] Input a tea leaf image;
[0093] Based on the tea leaf image, determine the parameters of the bilateral filter, including spatial domain parameters, intensity domain parameters, and gradient mean parameters;
[0094] For each pixel in the tea image, the adaptive bilateral filter calculates its spatial distance and intensity difference with surrounding pixels, and performs a weighted average based on the weights.
[0095] The output is the pixel image of the tea leaves after processing with an adaptive bilateral filter;
[0096] Input the corresponding denoised tea leaf image.
[0097] Furthermore, the step of performing image enhancement processing on the denoised tea image using histogram equalization includes:
[0098] The denoised tea image is converted from the RGB color space to the HSV color space to obtain the tea HSV image;
[0099] Extract the component representing the brightness of the tea leaf image from the HSV image of the tea leaf;
[0100] Perform histogram equalization on the luminance component;
[0101] The equalized luminance component is recombined with the original saturation and hue components to obtain the equalized tea HSV image.
[0102] The equalized tea HSV image is converted back to the RGB color space to obtain the final image-enhanced tea image.
[0103] Furthermore, the histogram equalization step for the luminance component includes:
[0104] Calculate the histogram and cumulative histogram of the luminance component;
[0105] Calculate the brightness mapping function based on the cumulative histogram;
[0106] Map the original brightness value to the equalized brightness value.
[0107] Furthermore, in this embodiment, this step involves acquiring tea leaf images and inputting the gradient mean into a bilateral filtering function to construct an adaptive bilateral filter. The adaptive bilateral filtering algorithm is then used to denoise the image. Compared to the bilateral filtering algorithm, the adaptive bilateral filtering can pay more attention to the edge regions of the tea leaf image while preserving details, thereby improving the accuracy of tea leaf grading.
[0108] S20. Use the S-ENet model to segment the tea images and output the S-ENet tea image dataset.
[0109] Furthermore, S-ENet stands for Segmentation Efficient Neural Network. (Reference) Figure 4 The S-ENet model includes: replacing the convolutional layers in the initialization module of the S-ENet model with a single 3x3 dilated convolutional layer, wherein the stride of the dilated convolutional layer is 2, the number of channels is 16, and the interval is 2; and using the softmax loss function as the segmentation loss function, the expression of which is:
[0110]
[0111] Where L is the value of the softmax loss function, w1 is the proportion of pixels belonging to the tea category to the total number of pixels, and w2 is the proportion of pixels belonging to the non-tea category to the total number of pixels. f1 represents the number of pixels correctly segmented into the tea category by the S-ENet model, where f1 is the number of pixels in the tea category. f1 represents the number of pixels correctly segmented for non-tea categories by the S-ENet model, and f2 represents the number of pixels for non-tea categories.
[0112] Furthermore, the image segmentation of the tea image using the S-ENet model includes:
[0113] The tea image dataset was divided into an image segmentation training set and an image segmentation test set in a 7:3 ratio. The images in the image segmentation training set were labeled at the pixel level, and the labels divided the image pixels into tea regions and non-tea regions.
[0114] S-ENet is trained using the training dataset. During training, the input image is fed into the network, the output segmentation result is calculated, and it is compared with the true label to calculate the softmax loss function.
[0115] The network parameters are updated using the backpropagation algorithm to minimize the softmax loss function;
[0116] Training ends when the softmax loss function reaches its minimum; otherwise, training continues.
[0117] Output the trained S-ENet model;
[0118] Input the image segmentation test set into the trained S-ENet model;
[0119] Output the S-ENet tea leaf image dataset.
[0120] Furthermore, the image segmentation training set contains 1680 tea images, and the image segmentation test set contains 720 tea images.
[0121] Furthermore, in this embodiment, while using the S-ENet model for tea image segmentation, an ENet model is also used for tea image segmentation. Twenty repeated experiments were conducted on both the S-ENet and ENet models. After each experiment, the average proportion of correctly segmented pixels in the 720 tea images in the test set was calculated. Specific results are as follows: Figure 4 As shown. According to Figure 4 It can be seen that after 20 repeated experiments, the S-ENet model outperforms the ENet model in segmenting tea images. To more intuitively demonstrate the segmentation performance of the two models on tea images, the segmentation results from the 20 trials were averaged. The results show that the average segmentation accuracy of the S-ENet model after 20 trials is 99.30%, while the average segmentation accuracy of the ENet model after 20 trials is 97.56%.
[0122] Furthermore, in this embodiment, based on the ENet model, the convolutional layer in the initialization module is replaced with a single 3x3 dilated convolutional layer. The dilated convolutional layer has a stride of 2, 16 channels, and an interval of 2. The softmax loss function is used as the segmentation loss function to construct the S-ENet model, which is then used to segment tea images. S-ENet addresses the shortcomings of the ENet model in handling small objects, resulting in significant errors or omissions in the semantic segmentation of small objects. This improves the accuracy of S-ENet in tea image segmentation, thereby enhancing the accuracy of tea grading.
[0123] S30. Residual connections are used between different Block layers in the backbone layer of RegNet, and an FPN module is added after the backbone layer. The weighted cross-entropy loss function is used as the loss function for tea grading to construct the tea RegNet model.
[0124] Furthermore, the weighted cross-entropy loss function includes:
[0125] The expression for the weighted cross-entropy loss function is:
[0126]
[0127] Where L represents the weighted cross-entropy loss value; i represents the S-ENet tea image grade label; i = 1 indicates that the S-ENet tea image grade is Special Grade; i = 2 indicates that the S-ENet tea image grade is Level 1; i = 3 indicates that the S-ENet tea image grade is Level 2; i = 4 indicates that the S-ENet tea image grade is Level 3; T i This represents the number of real S-ENet tea images at level i; This represents the number of correctly detected S-ENet tea images in the i-th level; l i This represents the proportion of real S-ENet tea images at level i to the total number of S-ENet tea images, i.e.
[0128] S40. Use the S-ENet tea image dataset to perform tea grading using Tea RegNet.
[0129] Further, refer to Figure 5 The S-ENet tea image is input into the backbone layer of the Tea RegNet, and after convolution through different block layers, it outputs feature images of different scales from the S-ENet tea image. These feature images of different scales are input into the FPN module, which upsamples and fuses features layer by layer and applies global average pooling to transform the feature maps into feature vectors. The feature vectors are then input into the output layer of the Tea RegNet and combined with a weighted cross-entropy loss function to classify the tea. The steps of the Tea RegNet in classifying tea include:
[0130] The S-ENet tea image dataset was divided into a graded training set and a graded test set in a 7:3 ratio, and the S-ENet tea images in the graded training set were graded.
[0131] The tea RegNet model was trained using a graded training set. During the training process, S-ENet tea images were input into the network, the tea grading results were calculated and compared with the true grades, and the weighted cross-entropy loss function was calculated.
[0132] Training ends when the weighted cross-entropy loss function reaches its minimum; otherwise, training continues.
[0133] Output the trained tea RegNet model;
[0134] The graded test set is input into the trained tea RegNet model.
[0135] Furthermore, the grading training set contains 504 S-ENet tea images, and the grading test set contains 216 S-ENet tea images. The grading of the S-ENet tea images in the grading training set includes grading into four levels: Special Grade, Grade 1, Grade 2, and Grade 3. Special Grade refers to a single bud; Grade 1 refers to one bud and one leaf; Grade 2 refers to one bud and two leaves; and Grade 3 refers to one bud and three leaves.
[0136] Furthermore, the FPN module of the tea RegNet is used to learn the feature information of the tea feature map output by the backbone layer; the information includes color features, texture features and shape features; the texture features include the smoothness of the leaf edge and the distribution of leaf veins.
[0137] Furthermore, the step of extracting feature information from the S-ENet tea image using the tea RegNet includes:
[0138] Input the S-ENet tea leaf image into the Tea Leaf RegNet network;
[0139] The input image is passed from the input layer of the network to the backbone layer through forward propagation to extract feature images;
[0140] The extracted feature images are fed into the FPN network, which upsamples layer by layer to generate multi-scale feature images.
[0141] For feature images at multiple scales, extract feature information;
[0142] Global average pooling is applied to fuse the extracted feature information at multiple scales at different levels through convolution operations;
[0143] Finally, the FPN module outputs the feature information of the S-ENet tea image after feature fusion.
[0144] Furthermore, in this embodiment, based on the RegNet model, residual connections are used between different block layers in the RegNet backbone layer, and an FPN module is added after the backbone layer. A weighted cross-entropy loss function is used as the loss function for tea grading to construct a tea RegNet model, and this model is then used for tea grading. The tea RegNet model addresses the problem that RegNet cannot effectively model and distinguish categories with similar features, thus improving the accuracy of tea grading.
[0145] S50. Output the tea grading results.
[0146] Furthermore, the output tea grading results include: output tea grading results in the grading test set; the results include the tea grade and tea grading accuracy of each S-ENet tea image in the grading test set.
[0147] In addition to the model used in this embodiment, five other models were used to classify tea images to verify the effectiveness of the model in this embodiment. See the results below. Figure 6 Model 1 uses adaptive bilateral filtering to denoise the tea image, then uses S-ENet for segmentation, and finally uses the RegNet model to grade the tea. Model 2 uses bilateral filtering to denoise the tea image, then uses S-ENet for segmentation, and finally uses the RegNet model to grade the tea. Model 3 uses adaptive bilateral filtering to denoise the tea image, then uses ENet for segmentation, and finally uses the RegNet model to grade the tea. Model 4 uses adaptive bilateral filtering to denoise the tea image, then uses S-ENet for segmentation, and finally uses the RegNet model to grade the tea. Model 5 uses bilateral filtering to denoise the tea image, then uses ENet for segmentation, and finally uses the RegNet model to grade the tea. Model 6 uses the improved capsule algorithm mentioned in the background technology to directly grade the tea image. Each model was repeated 20 times. Figure 6 It can be seen that, in 20 repeated trials, Model 1 had a higher accuracy in grading tea leaves than Models 2, 3, 4, 5, and 6. According to... Figure 6The results of each experiment were averaged to obtain the comparison table of experimental effects of the six tea grading models shown in Table 1. Table 1 clearly shows that the average classification accuracy rate of Model 1 is 97.41%, Model 2 is 92.04%, Model 3 is 91.18%, Model 4 is 89.50%, Model 5 is 88.84%, and Model 6 is 91.90%. Model 1 is more effective than Models 2, 3, 4, 5, and 6 in tea grading.
[0148] Table 1 Comparison of Experimental Results of Six Tea Grading Models
[0149] Model Model 1 Model 2 Model 3 Model 4 Model 5 Model 6 Classification accuracy 97.41% 92.04% 91.18% 89.50% 88.84% 91.90%
[0150] In summary, this embodiment acquires tea images, constructs a tea image dataset, and uses the gradient mean to construct an adaptive bilateral filter function. The adaptive bilateral filter algorithm is then used to denoise the images. Compared to the traditional bilateral filter algorithm, the adaptive bilateral filter pays more attention to the edge regions of the tea images while preserving details, thus improving the accuracy of tea grading. Next, the convolutional layers in the ENet model initialization module are replaced with dilated convolutional layers, and the softmax loss function is used as the segmentation loss function to construct the S-ENet model. The S-ENet model is then used to segment the tea images, outputting the S-ENet tea image dataset. S-ENet addresses the limitations of the ENet model in handling small objects, which can lead to significant errors or omissions in the semantic segmentation of small objects. This improves the accuracy of S-ENet in tea image segmentation, thereby enhancing the accuracy of tea grading. Residual connections are then used between different block layers in the backbone of RegNet, and an FPN module is added after the backbone layers. A weighted cross-entropy loss function is used as the loss function for tea grading to construct the tea RegNet model. S-ENet tea images are input into the backbone layer of the tea RegNet, and after convolution in different block layers, feature images of different scales of the S-ENet tea images are output. These feature images are then input into the FPN module, which upsamples and fuses features layer by layer and applies global average pooling to transform the feature maps into feature vectors. Finally, the feature vectors are input into the output layer of the tea RegNet and combined with the weighted cross-entropy loss function for tea grading. The tea RegNet solves the problem that RegNet cannot effectively model and distinguish categories with similar features, thus improving the accuracy of tea grading. The final output is the tea grading result, including the accuracy of the detected tea grade.
[0151] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0152] One or more embodiments of this specification are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of one or more embodiments of this specification should be included within the scope of protection of this disclosure.
Claims
1. A tea grading method using Tea RegNet, characterized in that, include: Collect tea leaf images and construct a tea leaf image dataset; The tea images are segmented using the S-ENet model to output the S-ENet tea image dataset. Residual connections are used between different Block layers in the backbone layer of RegNet, and an FPN module is added after the backbone layer. The weighted cross-entropy loss function is used as the loss function for tea grading to construct the tea RegNet model. The S-ENet tea image dataset is input into the tea RegNet model to obtain tea grading results; The S-ENet tea image is input into the backbone layer of the tea RegNet, and after convolution through different block layers, it outputs feature images of different scales of the S-ENet tea image. The feature images of different scales are input into the FPN module, which upsamples layer by layer, fuses features, and applies global average pooling to transform the feature map into a feature vector. The feature vectors are input into the output layer of the RegNet for tea leaves and combined with a weighted cross-entropy loss function to classify the tea leaves. The steps for grading tea using the RegNet tea grading method include: The S-ENet tea image dataset is divided into a graded training set and a graded test set, and the S-ENet tea images in the graded training set are graded. The tea RegNet model was trained using a graded training set. During the training process, S-ENet tea images were input into the network, the tea grading results were calculated and compared with the true grades, and the weighted cross-entropy loss function was calculated. Training ends when the weighted cross-entropy loss function converges and the classification accuracy is higher than 95%; otherwise, training continues. Output the trained tea RegNet model; Output the tea grading results.
2. The tea grading method using Tea RegNet according to claim 1, characterized in that, The acquisition of tea leaf images also includes: The tea image is preprocessed using adaptive bilateral filtering and histogram equalization, with the following specific steps: The tea image is denoised using adaptive bilateral filtering; The denoised tea image is then enhanced using histogram equalization.
3. The tea grading method using Tea RegNet according to claim 2, characterized in that, The adaptive bilateral filtering includes: The window size for the adaptive bilateral filter is 3×3; The pixel value of the denoised pixel is calculated using adaptive bilateral filtering. The denoised pixel value s(x,y) of pixel (x,y) is obtained by weighting the pixel values z(u,v) of the neighboring pixels (u,v) within a 3×3 window centered on pixel (x,y). The specific formula is as follows: Where Θ(x,y) represents a 3×3 window centered at pixel (x,y); w(x,y,u,v) are weight coefficients; w(x,y,u,v) can be expressed as Where exp() is an exponential function with the mathematical constant e as the base; t(x,y) represents the gradient value of pixel (x,y); t(u,v) represents the gradient value of neighboring pixel (u,v); σ d It is the location variance; σ r It is the variance of grayscale values; σ t It is the gradient variance.
4. The tea grading method using Tea RegNet according to claim 1, characterized in that, The S-ENet model includes: Replace the convolutional layer in the initialization module of the ENet model with a 3x3 dilated convolutional layer, where the stride of the dilated convolutional layer is 2, the number of channels is 16, and the interval is 2. The softmax loss function is used as the segmentation loss function, and the expression for the softmax loss function is: Where L is the value of the softmax loss function, w1 is the proportion of pixels belonging to the tea category to the total number of pixels, w2 is the proportion of pixels belonging to the non-tea category to the total number of pixels, and f1 is the value of the softmax loss function. 1 f1 represents the number of pixels correctly segmented into the tea category by the S-ENet model, and f1 represents the number of pixels in the tea category. 2 f1 represents the number of pixels correctly segmented for non-tea categories by the S-ENet model, and f2 represents the number of pixels for non-tea categories.
5. The tea grading method using Tea RegNet according to claim 1, characterized in that, The image segmentation of the tea image using the S-ENet model includes: The tea image dataset is divided into an image segmentation training set and an image segmentation test set. The images in the image segmentation training set are labeled at the pixel level, and the labels divide the image pixels into tea regions and non-tea regions. S-ENet is trained using the training dataset. During training, the input image is fed into the network, the output segmentation result is calculated, and it is compared with the true label to calculate the softmax loss function. The network parameters are updated using the backpropagation algorithm to minimize the softmax loss function; Training ends when the softmax loss function reaches its minimum; otherwise, training continues. Output the trained S-ENet model; Input the image segmentation test set into the trained S-ENet model; Output the S-ENet tea leaf image dataset.
6. The tea grading method using Tea RegNet according to claim 1, characterized in that, The step of grading the S-ENet tea images in the grading training set includes: The grades include Special Grade, Grade 1, Grade 2, and Grade 3; The term "special grade" refers to a single bud. The term "first level" refers to one bud and one leaf. The term "second level" refers to one bud and two leaves. The term "third level" refers to one bud and three leaves.
7. The tea grading method using Tea RegNet according to claim 1, characterized in that, The tea RegNet includes: The FPN module of the tea RegNet is used to learn the feature information of the tea feature map output by the backbone layer; The information includes color features, texture features, and shape features; The texture features include the smoothness of the leaf edges and the distribution of leaf veins.
8. The tea grading method using Tea RegNet according to claim 7, characterized in that, The steps for extracting feature information from the S-ENet tea image using the tea RegNet include: Input the S-ENet tea leaf image into the Tea Leaf RegNet network; The input image is passed from the input layer of the network to the backbone layer through forward propagation to extract feature images; The extracted feature images are fed into the FPN module, which upsamples layer by layer and generates multi-scale feature images layer by layer. For feature images at multiple scales, extract feature information; Global average pooling is applied to fuse the extracted feature information at multiple scales at different levels through convolution operations; Finally, the FPN module outputs the feature information of the S-ENet tea image after feature fusion.
9. The tea grading method using Tea RegNet according to claim 1, characterized in that, The weighted cross-entropy loss function includes: The expression for the weighted cross-entropy loss function is: Where L represents the weighted cross-entropy loss value; i represents the S-ENet tea image grade label; i = 1 indicates that the S-ENet tea image grade is Special Grade; i = 2 indicates that the S-ENet tea image grade is Level 1; i = 3 indicates that the S-ENet tea image grade is Level 2; i = 4 indicates that the S-ENet tea image grade is Level 3; T i This represents the number of real S-ENet tea images at level i; This represents the number of correctly detected S-ENet tea images in the i-th level; l i This represents the proportion of real S-ENet tea images at level i to the total number of S-ENet tea images, i.e.
10. The tea grading method using Tea RegNet according to claim 1, characterized in that, The output tea grading results include: Output the grading results of tea leaves from the grading test set; The results include the tea grade and tea grading accuracy for each S-ENet tea image in the grading test set.
Citation Information
Patent Citations
Tea identifying and grading method based on improved capsule network
CN113343886A
Tea tender shoot grading method combining improved attention mechanism and knowledge distillation
CN113807215A