Fresh tea leaf grading judgment method and grading instrument

By performing feature extraction, fusion and detection of tea fresh leaves image data, combined with loss function optimization and post-processing optimization, the rapid and accurate grading of tea fresh leaves is achieved, and the problems of low efficiency and high cost of traditional manual grading are solved.

CN120147723APending Publication Date: 2025-06-13CHONGQING ACAD OF AGRI SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510222424.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

Traditional tea fresh leaves grading mainly relies on labor, which is inefficient, highly subjective and high labor costs, and cannot meet the scale and standardization requirements of modern tea production.

Method used

A method of grading determination of tea fresh leaves is adopted to achieve rapid and accurate grading of tea fresh leaves by obtaining tea fresh leaves image data, preprocessing, feature extraction, feature fusion, detection and decoding, loss function optimization and post-processing optimization.

Benefits of technology

It realizes rapid and accurate grading of fresh tea leaves, reduces labor costs, improves grading efficiency and consistency, and meets the needs of modern tea production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120147723A_ABST
    Figure CN120147723A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and discloses a fresh tea leaf grading judgment method and a grading instrument, and the method comprises the steps: obtaining fresh tea leaf image data, and carrying out the preprocessing of the fresh tea leaf image data, and obtaining the preprocessing data; performing feature extraction on the preprocessed data by using a feature extraction module to obtain global features and local features; fusing the global features and the local features by using a feature fusion module to obtain fused features; a detection and decoding module is used to detect and decode the fusion features, and the probability of the predicted category and the target confidence are output; optimizing the predicted category by using a loss function; post-processing optimization is carried out based on the optimization result, the post-processing optimization comprises non-maximum suppression, confidence threshold filtering and classification result output, and the fresh tea leaf category is obtained. The tea leaf grading device can realize rapid and accurate grading of fresh tea leaves, and meets the requirements of modern tea leaf production.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and particularly relates to a method and a classifier for grading fresh tea leaves. Background Art

[0002] With the development of the economy and the improvement of people's living standards, consumers have higher and higher requirements for the quality of tea. From the source, the quality of fresh tea leaves plays a decisive role in the formation of tea quality. Therefore, accurate grading of fresh tea leaves is a key link to improve tea quality. Traditional grading of fresh tea leaves mainly relies on manual operation, which is inefficient, subjective, and has high labor costs. In order to meet the requirements of large-scale and standardized modern tea production and improve the stability of tea quality and market competitiveness, there is an urgent need to develop an efficient, objective, and low-cost method for grading fresh tea leaves. Summary of the Invention

[0003] The purpose of the present invention is to provide a method and a classifier for grading fresh tea leaves to achieve rapid and accurate grading of fresh tea leaves and meet the needs of modern tea production.

[0004] In order to achieve the above purpose, the following technical solutions are adopted:

[0005] In the first aspect, the present invention provides a method for grading fresh tea leaves, the method comprising:

[0006] Obtaining fresh tea leaf image data and preprocessing the fresh tea leaf image data to obtain preprocessed data;

[0007] Using a feature extraction module to extract features from the preprocessed data to obtain global features and local features;

[0008] Using a feature fusion module to fuse the global features and the local features to obtain fused features;

[0009] Using a detection and decoding module to detect and decode the fused features, and outputting the probability of the predicted category and the target confidence; wherein, the category includes single bud, one bud with one leaf, one bud with multiple leaves, and other categories, and the other categories are categories that do not belong to single bud, one bud with one leaf, or one bud with multiple leaves;

[0010] Using a loss function to optimize the predicted category;

[0011] Performing post-processing optimization based on the optimization result, the post-processing optimization including non-maximum suppression, confidence threshold filtering, and classification result output to obtain the fresh tea leaf category.

[0012] Further, the feature extraction module includes a CSP backbone network and an SPPF module. The feature extraction module is used to extract features from the preprocessed data to obtain global features and local features, including:

[0013] Taking the preprocessed data as input features, using the CSP backbone network to divide the input features into two parts, one part extracts deep features through residual blocks, and the other part is directly transmitted to reduce redundancy, obtaining a feature map;

[0014] Based on the SPPF module, through pooling kernels of multiple different sizes, downsampling the feature map to extract global features and local features.

[0015] Further, the feature fusion module includes a Feature Pyramid Network (FPN) and a Path Aggregation Network (PAN). The feature fusion module is used to fuse the global features and the local features to obtain fused features, including:

[0016] Based on the Feature Pyramid Network, extracting deep features from the global features, where the deep features carry global semantic information;

[0017] Based on the Path Aggregation Network, extracting shallow features from the local features and transmitting the shallow features to the deep features, gradually fusing low-level detailed information to obtain fused features.

[0018] Further, using the detection and decoding module to detect and decode the fused features, and output the predicted classes, including:

[0019] For each detection position, output the predicted probabilities of each class, and predict the boundaries of the corresponding target boxes;

[0020] Using the YOLOv8 detection head to directly output the center position offset of the target box;

[0021] Based on the center position offset of the target box to determine the target confidence.

[0022] Further, the loss function includes a bounding box loss and a classification loss. The bounding box loss uses the CIoU loss, comprehensively considering the overlapping area, center point distance, and aspect ratio of the target box; the classification loss uses the Focal Loss function.

[0023] Further, the post-processing optimization further includes small target retention and multi-class processing after non-maximum suppression, confidence threshold filtering, and classification result output; wherein, the small target retention includes taking single buds in tea grading as small targets, and adjusting the IoU threshold or confidence filtering threshold of non-maximum suppression to improve the retention rate of small targets; the multi-class processing includes performing independent non-maximum suppression calculations on multi-class prediction results to reduce confusion between classes.

[0024] Further, the non-maximum suppression includes:

[0025] Sorting the target boxes according to the target confidence values of each target box from high to low;

[0026] Calculating the IoU value between each sorted target box and other target boxes one by one; wherein, the IoU value is the ratio of the intersection area to the union area between the target box and other target boxes;

[0027] Taking the target boxes with an oU value greater than the set threshold as the target boxes of the same target, and removing the target boxes below the set threshold.

[0028] Further, the confidence threshold filtering includes filtering out false detections in the background area by setting a confidence threshold to ensure that only the actual tea fresh leaf categories are output.

[0029] Further, the classification result output includes, for each remaining target box, selecting the category with the highest category score based on the category probability distribution as the classification result of the target.

[0030] In a second aspect, the present invention provides a tea fresh leaf grader, which includes a bracket, a weighing unit, a tray rack, a camera, and an industrial control computer; wherein, the bottom of the bracket is connected to the weighing unit, the tray rack is arranged on the weighing unit, the camera and the industrial control computer are installed on the bracket, the tray rack is used to place tea fresh leaves, the camera is used to capture tea fresh leaf images to obtain tea fresh leaf image data, the weighing unit is used to measure the mass of the tea fresh leaves, the industrial control computer is connected to the weighing unit and the camera, and the industrial control computer is configured to:

[0031] Obtain tea fresh leaf image data and preprocess the tea fresh leaf image data to obtain preprocessed data;

[0032] Use a feature extraction module to extract features from the preprocessed data to obtain global features and local features;

[0033] Use a feature fusion module to fuse the global features and the local features to obtain fused features;

[0034] The detection and decoding module is used to detect and decode the fusion features, and output the probability of the predicted category and the target confidence; wherein, the category includes single bud, one bud with one leaf, one bud with multiple leaves and other categories, and the other categories are those that do not belong to single bud, one bud with one leaf or one bud with multiple leaves.

[0035] The loss function is used to optimize the predicted category.

[0036] Based on the optimization result, post-processing optimization is performed. The post-processing optimization includes non-maximum suppression, confidence threshold filtering, and classification result output to obtain the category of fresh tea leaves.

[0037] Obtain the total weight of fresh tea leaves, multiply it by the unit price of fresh leaves corresponding to the category of fresh tea leaves, and obtain the total price of fresh tea leaves collected on the same day.

[0038] The beneficial effects of the present invention are as follows:

[0039] The present invention can realize rapid and accurate grading of fresh leaves, meeting the needs of modern tea production. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It shows a flowchart of a method for grading and determining fresh tea leaves according to an embodiment of the present invention.

[0041] Figure 2 It shows an exemplary output result obtained after processing the fresh tea leaf image data one according to the method for grading and determining fresh tea leaves in an embodiment of the present invention.

[0042] Figure 3 It shows an exemplary output result obtained after processing the fresh tea leaf image data two according to the method for grading and determining fresh tea leaves in an embodiment of the present invention.

[0043] Figure 4 It shows a structural diagram of a fresh tea leaf grader according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0044] The following specific examples illustrate the embodiments of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other.

[0045] The following further describes in detail the specific embodiments of the present invention in conjunction with the drawings and embodiments.

[0046] An embodiment of the present invention provides a method for grading and determining fresh tea leaves. This method can be based on a model for realizing the grading and determination of fresh tea leaves. The model can directly output the grade of fresh tea leaves in response to the input fresh tea leaf image. The grade of fresh leaves is determined through six steps: data preprocessing, feature extraction, feature fusion, detection and decoding, loss function and optimization, and post-processing, so as to achieve rapid and accurate grading of fresh leaves and meet the needs of modern tea production.

[0047] Figure 1 The flowchart of a method for grading and determining fresh tea leaves according to an embodiment of the present invention is shown. As Figure 1 shown, this method includes steps S100 to S600, which are introduced in detail as follows.

[0048] S100, Obtain fresh tea leaf image data and preprocess the fresh tea leaf image data to obtain preprocessed data.

[0049] Data preprocessing is the starting point of the entire detection process. Its goal is to standardize and enhance the input data and then send it into the neural network model to make it adapt to the model structure and improve the generalization ability of the model.

[0050] In some embodiments, step S100 includes the following steps S110 to S130.

[0051] S110, Image size adjustment.

[0052] Step S110 includes:

[0053] S111, Aspect ratio preservation: Adjust the image to the target size through a scaling operation while keeping the aspect ratio of the original image unchanged. This is particularly important for fresh tea leaf detection because the shapes of targets such as single buds and one bud with one leaf are relatively slender or irregular, and aspect ratio distortion may lead to feature loss.

[0054] S112, Border padding: For the unfilled parts, black pixels will be used to fill (up and down or left and right) to completely cover the target size.

[0055] S120, Normalization.

[0056] Step S120 includes:

[0057] S121, Pixel value processing: Divide the pixel values of the image by 255 (the maximum value of pixel values) to map the range from [0, 255] to [0, 1].

[0058] S122, Uniform distribution: After normalization, the pixel value distribution of the image is more compact, which helps to improve the numerical stability of the network.

[0059] S130, Data augmentation.

[0060] Step S130 includes:

[0061] S131, Random cropping: Randomly crop some regions in the image to generate new samples containing partial fresh leaf targets. This enables the model to learn to detect targets such as single buds or one bud with one leaf in the case of partial information loss.

[0062] S132, Flipping: Randomly horizontally or vertically flip the image to enhance the model's adaptability to fresh leaf categories (such as single buds, one bud with multiple leaves) in different directions.

[0063] S133, Color perturbation: By changing brightness, contrast, and hue, simulate actual situations such as light and dark and tea color changes, and further improve the model's robustness to complex backgrounds and lighting conditions.

[0064] S200, Use the feature extraction module to extract features from the preprocessed data to obtain global features and local features.

[0065] In some embodiments, the feature extraction module includes a CSP backbone network and an SPPF module. Step S200, using the feature extraction module to extract features from the preprocessed data to obtain global features and local features, specifically includes the following steps S210 and S220.

[0066] S210, Taking the preprocessed data as input features, using the CSP backbone network to divide the input features into two parts, one part extracts deep features through residual blocks, and the other part is directly passed to reduce redundancy to obtain a feature map.

[0067] In this embodiment, the CSP backbone network can achieve hierarchical feature processing and gradient optimization. Among them, hierarchical feature processing: divides the input features into two parts, one part extracts deep features through residual blocks, and the other part is directly passed to reduce redundancy. The design of gradient optimization can maintain gradient fluidity and make the model more stable during training.

[0068] The role of the CSP backbone network for fresh tea leaves: Single buds are usually slender and small targets, and the CSP backbone network can capture their local features in deep features. For targets such as one bud with one leaf or one bud with multiple leaves, the CSP backbone network can extract corresponding texture and boundary information from multi-scale features.

[0069] S220, Based on the SPPF module, downsample the feature map through multiple pooling kernels of different sizes to extract global features and local features.

[0070] In this embodiment, the SPPF module downsamples the feature map through pooling kernels of different sizes such as 1×1, 3×3, 5×5 to extract global and local features.

[0071] The role of the SPPF module in fresh tea leaves: Single buds and one bud with one leaf are often small targets, and the SPPF ensures that these small targets are not missed through a larger receptive field.

[0072] S300. Use the feature fusion module to fuse the global feature and the local feature to obtain a fused feature.

[0073] In this embodiment, the feature fusion module Neck improves the model's detection ability for multi-scale targets (such as single buds and one bud with multiple leaves) by integrating features of different depths and resolutions.

[0074] In some embodiments, the feature fusion module includes a Feature Pyramid Network (FPN) and a Path Aggregation Network (PAN). S300. Use the feature fusion module to fuse the global feature and the local feature to obtain a fused feature, which specifically includes the following steps S310 and S320.

[0075] S310. Based on the Feature Pyramid Network, extract deep features from the global feature, and the deep features carry global semantic information.

[0076] Single buds and other small targets benefit from shallow features because these features contain more edge and texture information. Large targets such as one bud with multiple leaves benefit from deep features, which carry global semantic information.

[0077] S320. Based on the Path Aggregation Network, extract shallow features from the local feature and transfer the shallow features to the deep features, gradually fusing low-level detail information to obtain a fused feature.

[0078] The Path Aggregation Network PAN transfers from shallow to deep, gradually fusing low-level detail information. Processing at different scales of the feature map ensures that both large targets and small targets (single buds) can be effectively detected.

[0079] S400. Use the detection and decoding module to detect and decode the fused feature, and output the probability of the predicted class and the target confidence; wherein, the classes include single bud, one bud with one leaf, one bud with multiple leaves, and other classes, and the other classes are classes that do not belong to single bud, one bud with one leaf, or one bud with multiple leaves.

[0080] In some embodiments, step S400 specifically includes the following steps S410 to S440.

[0081] S410. Design an Anchor-Free mechanism.

[0082] For each detection position, output the prediction probabilities of 4 classes (single bud, one bud with one leaf, one bud with multiple leaves, other), and predict the boundaries of the corresponding target boxes.

[0083] S420, Target box prediction and decoding.

[0084] Bounding box prediction: The YOLOv8 detection head directly outputs the center position offsets (Δx, Δy) of the target box. Role in tea leaf detection:

[0085] Single bud: Since the single bud is a small and slender target, the Anchor-Free mechanism can flexibly capture the true boundaries of the target without being restricted by the size of the anchor box.

[0086] Other categories: Such as one bud with one leaf or one bud with multiple leaves, the directly predicted bounding boxes are more adaptable to the shapes and sizes of different targets.

[0087] S430, Target confidence prediction.

[0088] By the level of target confidence, background noise and environmental interference (such as picking tools or other non-fresh leaf parts) can be effectively reduced.

[0089] S440, Class prediction.

[0090] Since the characteristics of one bud with one leaf and one bud with multiple leaves may be relatively similar, the detection head distinguishes these categories through deeper feature extraction and class prediction to ensure classification accuracy.

[0091] S500, Optimize the predicted class using a loss function.

[0092] In some embodiments, the loss function includes a bounding box loss and a classification loss. Characteristics of the bounding box loss: CIoU loss is adopted, comprehensively considering the overlapping area, center point distance, and aspect ratio of the target box. Characteristics of the classification loss: FocalLoss enhances the attention to difficult-to-classify samples (such as similar samples of one bud with one leaf and one bud with multiple leaves).

[0093] S600, Perform post-processing optimization based on the optimization results. The post-processing optimization includes non-maximum suppression, confidence threshold filtering, and classification result output to obtain the fresh tea leaf category.

[0094] In some embodiments, step S600 specifically includes the following steps S610 to S640.

[0095] S610, Non-maximum suppression (NMS), including:

[0096] S611, Confidence sorting: Sort in descending order according to the target confidence values of each predicted box.

[0097] S612, Calculate IoU (Intersection over Union): Calculate the IoU value (the ratio of the intersection area to the union area) of each box after sorting with other boxes one by one.

[0098] S613. If the IoU value is greater than a set threshold (e.g., 0.5), it is considered that these bounding boxes represent the same object, and the bounding boxes with low confidence are removed.

[0099] S614. Retain the detection results: Only retain the bounding box with the highest confidence and an IoU lower than the threshold as the final output.

[0100] The role of non-maximum suppression in tea leaf detection: For example, single buds and one bud with one leaf may generate multiple overlapping bounding boxes due to adjacent positions. Through NMS, redundancy can be effectively eliminated, and only the most accurate detection results are retained.

[0101] S620. Confidence threshold filtering.

[0102] False detections in the background area (such as picking tools or leaf shadows) can be filtered out by setting a reasonable confidence threshold to ensure that only the actual tea leaf categories are output.

[0103] S630. Classification result output.

[0104] Class probability calculation: For each remaining object bounding box, select the class with the highest class score (single bud, one bud with one leaf, one bud with multiple leaves, other) based on the class probability distribution as the classification result of the object.

[0105] Exemplarily, the output result format can be, for example: The output of each object bounding box includes: the coordinates of the bounding box (x_min, y_min, x_max, y_max), the object class (single bud, one bud with one leaf, one bud with multiple leaves, other), and the confidence score.

[0106] S640. Post-processing optimization.

[0107] Step S640 includes the following steps S641 and S642.

[0108] S641. Small object retention: Single buds in tea leaf grading are typical small objects. Through specific optimizations (such as adjusting the IoU threshold or confidence filtering threshold of NMS), the retention rate of small objects can be improved.

[0109] S642. Multi-class processing: In the tea leaf grading task, the model needs to distinguish multiple classes (such as single buds and one bud with one leaf). In the post-processing stage, independent NMS calculations can be performed on the multi-class results to reduce confusion between classes.

[0110] An exemplary output result obtained after processing two different fresh tea leaf image data through the above steps S100 to S600 is respectively as Figure 2 and Figure 3 shown.

[0111] An embodiment of the present invention also provides a fresh tea leaf grader, as Figure 4 shown. The fresh tea leaf grader includes a bracket 401, a weighing unit 402, a tray rack 403, a camera 404, and an industrial control computer 405. Among them, the bottom of the bracket 401 is connected to the weighing unit 402, the tray rack 403 is arranged on the weighing unit 402, the camera 404 and the industrial control computer 405 are installed on the bracket 401. The tray rack 403 is used to place fresh tea leaves, the camera 404 is used to capture images of fresh tea leaves to obtain fresh tea leaf image data, the weighing unit 402 is used to measure the mass of the fresh tea leaves, the industrial control computer 405 is connected to the weighing unit 402 and the camera 404, and the industrial control computer 405 is configured to:

[0112] Obtain fresh tea leaf image data and preprocess the fresh tea leaf image data to obtain preprocessed data;

[0113] Use a feature extraction module to extract features from the preprocessed data to obtain global features and local features;

[0114] Use a feature fusion module to fuse the global features and the local features to obtain fused features;

[0115] Use a detection and decoding module to detect and decode the fused features, and output the probability of the predicted category and the target confidence level. Among them, the category includes single bud, one bud with one leaf, one bud with multiple leaves, and other categories, and the other categories are categories that do not belong to single bud, one bud with one leaf, or one bud with multiple leaves;

[0116] Use a loss function to optimize the predicted category;

[0117] Perform post-processing optimization based on the optimization result. The post-processing optimization includes non-maximum suppression, confidence threshold filtering, and classification result output to obtain the fresh tea leaf category;

[0118] Obtain the total weight of the fresh tea leaves, multiply it by the unit price of the fresh leaves corresponding to the fresh tea leaf category, and obtain the total price of the fresh tea leaves collected on the same day.

[0119] In some embodiments, the feature extraction module includes a CSP backbone network and an SPPF module, and the industrial control computer 405 is further configured to:

[0120] Use the preprocessed data as input features, and use the CSP backbone network to divide the input features into two parts. One part extracts deep features through residual blocks, and the other part is directly transmitted to reduce redundancy to obtain a feature map;

[0121] Based on the SPPF module, perform downsampling on the feature map through multiple pooling kernels of different sizes to extract global features and local features.

[0122] In some embodiments, the feature fusion module includes a Feature Pyramid Network and a Path Aggregation Network, and the industrial control computer 405 is further configured to:

[0123] Based on the Feature Pyramid Network, extract deep features from the global features, where the deep features carry global semantic information;

[0124] Based on the Path Aggregation Network, extract shallow features from the local features, and transfer the shallow features to the deep features to gradually fuse low-level detail information to obtain fused features.

[0125] In some embodiments, the industrial control computer 405 is further configured to:

[0126] For each detection position, output the prediction probabilities of each category, and predict the boundaries of the corresponding target boxes;

[0127] Use the YOLOv8 detection head to directly output the center position offset of the target box;

[0128] Determine the target confidence based on the center position offset of the target box.

[0129] In some embodiments, the loss function includes a bounding box loss and a classification loss. The bounding box loss uses the CIoU loss, which comprehensively considers the overlapping area, center point distance, and aspect ratio of the target boxes; the classification loss uses the FocalLoss function.

[0130] In some embodiments, the industrial control computer 405 is further configured to make the post-processing optimization further include small target retention and multi-category processing after non-maximum suppression, confidence threshold filtering, and classification result output; where the small target retention includes using single buds in tea grading as small targets, and adjusting the IoU threshold or confidence filtering threshold of non-maximum suppression to improve the retention rate of small targets; the multi-category processing includes performing independent non-maximum suppression calculations on the multi-category prediction results to reduce confusion between categories.

[0131] In some embodiments, the non-maximum suppression includes:

[0132] Sort the target boxes according to the target confidence values of each target box from high to low;

[0133] Calculate the IoU value of each sorted target box with other target boxes one by one; where the IoU value is the ratio of the intersection area of the target box and other target boxes to the union area;

[0134] Use the target boxes with IoU values greater than the set threshold as the target boxes of the same target, and remove the target boxes below the set threshold.

[0135] In some embodiments, the confidence threshold filtering includes filtering out false detections in the background region by setting a confidence threshold, so as to ensure that only the actual fresh tea leaf categories are output.

[0136] In some embodiments, the classification result output includes, for each remaining target box, selecting the category with the highest category score based on the category probability distribution as the classification result of the target.

[0137] It should be noted that this fresh tea leaf grader belongs to the same technical concept as the previously described method, and has the same technical principle and beneficial effects, so it will not be elaborated here.

[0138] The above embodiments are only used to illustrate the present invention, rather than to limit the present invention. Those of ordinary skill in the relevant technical fields can also make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, all equivalent technical solutions also belong to the scope of the present invention, and the patent protection scope of the present invention shall be defined by the claims.

Claims

1. A method for grading fresh tea leaves, characterized in that: The method comprises: Acquiring fresh tea leaf image data and preprocessing the fresh tea leaf image data to obtain preprocessed data; Using a feature extraction module to extract features from the preprocessed data to obtain global features and local features; Using a feature fusion module to fuse the global feature and the local feature to obtain a fused feature; Detecting and decoding the fused features using a detection and decoding module, and outputting the probability of the predicted category and the target confidence; wherein the categories include single bud, one bud and one leaf, one bud and multiple leaves, and other categories, and the other categories are categories that do not belong to single bud, one bud and one leaf, or one bud and multiple leaves; Optimizing the predicted category using a loss function; Post-processing optimization is performed based on the optimization result, and the post-processing optimization includes non-maximum suppression, confidence threshold filtering and classification result output to obtain the fresh tea leaf category.

2. The method according to claim 1, characterized in that The feature extraction module includes a CSP backbone network and an SPPF module. The feature extraction module is used to extract features from the preprocessed data to obtain global features and local features, including: Taking the preprocessed data as input features, the CSP backbone network is used to divide the input features into two parts, one of which is extracted through a residual block to extract deep features, and the other is directly transmitted to reduce redundancy, thereby obtaining a feature map; Based on the SPPF module, the feature map is downsampled through multiple pooling kernels of different sizes to extract global features and local features.

3. The method according to claim 1, characterized in that The feature fusion module includes a feature pyramid network and a path aggregation network. The feature fusion module is used to fuse the global features and the local features to obtain fused features, including: Based on the feature pyramid network, deep features are extracted from the global features, where the deep features carry global semantic information; Based on the path aggregation network, shallow features are extracted from the local features, and the shallow features are transferred to deep features, and low-level detail information is gradually fused to obtain fused features.

4. The method according to claim 1, characterized in that The fusion features are detected and decoded using the detection and decoding module, and the predicted categories are output, including: For each detection position, output the predicted probability of each category and predict the boundary of the corresponding target box; Use the YOLOv8 detection head to directly output the center position offset of the target frame; The target confidence is determined based on the center position offset of the target box.

5. The method according to claim 1, characterized in that The loss function includes a bounding box loss and a classification loss. The bounding box loss adopts the CIoU loss, which comprehensively considers the overlapping area, center point distance and aspect ratio of the target box; the classification loss adopts the FocalLoss function.

6. The method according to claim 1, characterized in that The post-processing optimization also includes small target retention and multi-category processing after non-maximum suppression, confidence threshold filtering and classification result output; wherein, the small target retention includes taking a single bud in tea grading as a small target, and adjusting the IoU threshold or confidence filtering threshold of non-maximum suppression to improve the retention rate of small targets; the multi-category processing includes performing independent non-maximum suppression calculations on multi-category prediction results to reduce confusion between categories.

7. The method according to claim 6, characterized in that The non-maximum suppression includes: Sort each target box by its target confidence value from high to low; Calculate the IoU value of the sorted target frame with other target frames one by one; wherein the IoU value is the ratio of the intersection area of ​​the target frame and the union area of ​​the other target frames; The target boxes with oU values ​​greater than the set threshold are taken as the target boxes of the same target, and the target boxes below the set threshold are removed.

8. The method according to claim 6, characterized in that The confidence threshold filtering includes filtering out false detections of background areas by setting a confidence threshold, thereby ensuring that only actual fresh tea leaf categories are output.

9. The method according to claim 6, characterized in that The classification result output includes, for each remaining target box, selecting the category with the highest category score as the classification result of the target based on the category probability distribution.

10. A fresh tea leaf grader, characterized in that: The fresh tea leaf grader comprises a bracket, a weighing unit, a tray rack, a camera and an industrial computer; wherein the bottom of the bracket is connected to the weighing unit, the tray rack is arranged on the weighing unit, the camera and the industrial computer are installed on the bracket, the tray rack is used to place fresh tea leaves, the camera is used to take images of fresh tea leaves to obtain fresh tea leaf image data, the weighing unit is used to measure the quality of the fresh tea leaves, the industrial computer is connected to the weighing unit and the camera, and the industrial computer is configured as follows: Acquiring fresh tea leaf image data and preprocessing the fresh tea leaf image data to obtain preprocessed data; Using a feature extraction module to extract features from the preprocessed data to obtain global features and local features; Using a feature fusion module to fuse the global feature and the local feature to obtain a fused feature; Detecting and decoding the fused features using a detection and decoding module, and outputting the probability of the predicted category and the target confidence; wherein the categories include single bud, one bud and one leaf, one bud and multiple leaves, and other categories, and the other categories are categories that do not belong to single bud, one bud and one leaf, or one bud and multiple leaves; Optimizing the predicted category using a loss function; Performing post-processing optimization based on the optimization results, wherein the post-processing optimization includes non-maximum suppression, confidence threshold filtering, and classification result output to obtain the fresh tea leaf category; Get the total weight of fresh tea leaves, multiply it by the unit price of fresh tea leaves of the corresponding tea leaf category, and get the total price of fresh tea leaves collected on that day.