A tea fresh leaf sorting method based on a frequency domain tree type topology network, a computer device and a computer readable medium

By using a frequency domain tree topology network method, a structural association map of fresh tea leaves is constructed, which solves the problems of manual dependence and insufficient recognition accuracy in the sorting of fresh tea leaves, and realizes efficient, stable and automated sorting of fresh tea leaves.

CN121280779BActive Publication Date: 2026-07-03JIANGXI ACAD OF AGRI SCI INST OF AGRI ENG

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIANGXI ACAD OF AGRI SCI INST OF AGRI ENG
Filing Date
2025-09-29
Publication Date
2026-07-03

Smart Images

  • Figure CN121280779B_ABST
    Figure CN121280779B_ABST
Patent Text Reader

Abstract

This invention discloses a method for sorting fresh tea leaves based on a frequency-domain tree-structured topology network, along with a computer device and storage medium. The method encompasses a complete process: image acquisition, preprocessing, frequency-domain decomposition, depth modeling, map construction, and classification. First, image quality is improved through color normalization and edge enhancement. Then, frequency-domain tree-structured decomposition using wavelet transform and discrete cosine transform is performed to extract multi-scale features. Subsequently, long- and short-range dependency modeling and residual convolution modules are integrated to achieve multi-level feature representation. Finally, a tree-structured topology attention path and structure map simulating the bud-leaf-vein relationship are constructed to enhance semantic understanding. A tree-structure-aware classification function is used to achieve fine-grained classification of single buds, one bud and one leaf, one bud and two leaves, and one bud and multiple leaves. During training, cross-entropy loss, data augmentation, and regularization strategies are combined to improve model robustness. This method demonstrates high classification accuracy and stability on multiple tea image datasets, effectively improving the practicality of automatic sorting of fresh tea leaves.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of tea leaf sorting technology, and in particular to a tea leaf sorting method, computer equipment, and computer-readable medium based on a frequency domain tree topology network. Background Technology

[0002] In current tea production and processing, the tenderness grade of fresh tea leaves is considered a key indicator determining the quality, aroma, and taste of tea, directly impacting subsequent processing techniques and product grading. Traditional fresh leaf sorting methods rely primarily on manual experience and visual judgment, which is not only labor-intensive and inefficient but also suffers from inconsistent and unstable results due to strong human subjectivity, failing to meet the practical needs of modern tea processing for automated, precise, and standardized sorting. In recent years, with the development of agricultural informatization and computer vision technology, image recognition and deep learning have been widely introduced into tea sorting tasks, becoming the main technical path for achieving intelligent tenderness recognition. Some studies have used convolutional neural networks for feature extraction and classification of fresh tea leaf images, while others have introduced lightweight networks to adapt to embedded device deployment scenarios, achieving some progress.

[0003] However, existing methods largely rely on the color and texture features of RGB images in the spatial domain, making it difficult to effectively identify detailed changes in leaf tip contours, edge curvature, and pubescence density in fresh tea leaves. This is especially problematic under less than ideal conditions such as varying natural light or complex backgrounds, leading to inaccurate identification and insufficient robustness. Furthermore, the natural growth state of fresh tea leaves exhibits a hierarchical topological structure, progressing from "single bud," "one bud and one leaf," "one bud and two leaves," to "one bud and multiple leaves." Traditional convolutional neural networks struggle to explicitly model the structural dependencies between buds and leaves, thus affecting the discrimination performance for multi-level, fine-grained categories. Some works have attempted to introduce frequency domain methods such as wavelet transform and Fourier transform to enhance texture representation, or to leverage attention mechanisms to improve semantic feature modeling capabilities. However, most have failed to effectively integrate frequency domain features with structural modeling, remaining at the level of image enhancement or shallow modeling, unable to construct a deep representation model with consistent structure and frequency.

[0004] In summary, current technologies have significant shortcomings in terms of feature extraction dimensions, structural topology modeling capabilities, frequency domain fusion mechanisms, and overall model expressiveness. Therefore, this paper proposes a tea leaf sorting method, computer equipment, and computer-readable medium based on a frequency domain tree topology network to address these issues. Summary of the Invention

[0005] Therefore, the purpose of this invention is to provide a method for sorting fresh tea leaves based on a frequency domain tree topology network, a computer device, and a computer-readable medium, so as to at least solve the above problems.

[0006] The technical solution adopted in the first aspect of this invention is as follows:

[0007] A method for sorting fresh tea leaves based on a frequency domain tree topology network, the method comprising the following steps:

[0008] Step S1: Under a standardized acquisition environment, high-resolution imaging equipment is used to acquire images of multiple batches of fresh tea leaves of the same variety and at different picking stages, construct a tea leaf image dataset, and perform image preprocessing, including color normalization, edge enhancement, and noise suppression.

[0009] Step S2: The frequency domain tree decomposition method based on wavelet transform and discrete cosine transform is used to extract frequency domain features from the preprocessed image to obtain multiple frequency domain sub-images. Wavelet transform is used to extract high-frequency texture features, and discrete cosine transform is used to extract low-frequency structural features.

[0010] Step S3: Input the frequency domain subgraph into a deep neural network containing a long-short-range dependency modeling module and a residual convolution module to extract high-order semantic features containing structural dependencies. The long-short-range dependency modeling module is used to model long-distance structural dependencies, and the residual convolution module is used to extract local textures and spatial details.

[0011] Step S4: By constructing a tree-shaped topological attention path that simulates the spatial hierarchy of bud-leaf-vein, a structural association graph is established, and a graph neural network is used to aggregate and propagate structural information;

[0012] Step S5: Based on the structure map, the tree structure perception classification function module is used to integrate the context information between structure nodes to achieve fine-grained discrimination of single bud, one bud and one leaf, one bud and two leaves, and one bud and multiple leaves.

[0013] Furthermore, the image preprocessing in step S1 specifically includes:

[0014] Color normalization processing: The image is converted from the RGB color space to the Lab color space of lightness-red-green-yellow-blue. The pixel distribution characteristics of each channel are extracted. With reference to the mean and standard deviation of the standard image in the Lab space, a linear transformation is used to adjust the lightness channel L, red-green component channel a, and yellow-blue component channel b to make the color statistical characteristics of the image consistent with the reference image and eliminate color deviation caused by changes in lighting or device differences.

[0015] Edge enhancement processing: The Sobel operator is used to calculate the gradient of the image in the horizontal and vertical directions to generate an edge magnitude map. Combined with non-maximum suppression and double thresholding, the contour information of structural regions such as leaf edges and leaf tips is enhanced.

[0016] Noise suppression processing: The application of medium-medium filtering removes salt-and-pepper noise from the image. By extracting a neighborhood window centered on a pixel and calculating the median to replace the original value, local abrupt changes are suppressed while edge details are preserved. For smooth areas in the image, a bilateral filtering method is introduced, which combines the spatial distance between pixels and the gray-level difference for weighted averaging to reduce high-frequency noise interference while preserving detailed textures.

[0017] Furthermore, the frequency domain tree decomposition method in step S2 specifically includes:

[0018] A two-dimensional discrete wavelet transform is performed on the input image to decompose the image into a low-frequency part and three high-frequency parts, which correspond to the changes in the image in the horizontal, vertical and diagonal directions, respectively. The high-frequency part contains the texture and edge detail information in the image, which is used to extract the structural features of the high-frequency region of the leaf tip and serrated edge.

[0019] A two-dimensional discrete cosine transform is further applied to the low-frequency sub-band after wavelet decomposition to extract the low-frequency features of the energy concentration region in the image, which are used to model the overall outline of the blade and the global structural information of the main vein.

[0020] By combining wavelet transform and discrete cosine transform, a tree-structured frequency domain decomposition representation is formed, in which the high-frequency branch captures edge and texture details, while the low-frequency branch represents the overall morphological structure. The two complement each other in terms of features through the coupling of scale and frequency dimensions.

[0021] Furthermore, the deep neural network in step S3 specifically includes:

[0022] Long-range and short-range dependency modeling module: Based on the state-space model, it realizes the modeling of dependencies between distant structures in the image by dynamically modeling the state transition process, and captures the dependencies between distant structures in the image;

[0023] Residual Convolution Module: Employs local convolution operations to extract local detail features of image edges, textures, and contours. Its structure includes standard convolutional layers and a residual connection mechanism, which maintains stable feature transfer and gradient flow through residual connections.

[0024] Feature fusion module: It combines the global features output by the long-range and short-range dependency modeling module with the local features extracted by the residual convolution module to form a multi-level image representation that has both long-range dependency modeling capability and local structure perception capability.

[0025] Furthermore, the construction of the tree-based topology attention path in step S4 specifically includes:

[0026] Structural node extraction: Identify and extract key regions of buds, leaves and veins from the image, set the buds as root nodes, the leaves as intermediate nodes, and the veins as terminal nodes to form a structural representation with growth hierarchy;

[0027] Hierarchical connection relationship construction: Based on the spatial dependence order of leaf veins pointing to leaves and leaves pointing to buds, multi-layered directed connections are established in a bottom-up manner to form a tree-like topology structure that conforms to the natural growth law of plants.

[0028] Attention path formation: A learnable attention mechanism is introduced into each directed edge. After mapping node features to a unified space through linear transformation, the features are concatenated and attention weights are calculated through a scoring function. This allows feature information to flow along the biological structural path and dynamically adjusts the transmission weights between different nodes.

[0029] Furthermore, the construction of the structural association map in step S4 specifically includes:

[0030] Node representation: Representative structural units such as buds, leaf edges, and midribs are extracted as graph nodes, and each node is represented by its local image feature vector;

[0031] Edge connection construction: Based on the spatial layout and physiological relationship between structural parts, construct connecting edges between nodes to form a preliminary graph structure;

[0032] Attention weight introduction: Learnable attention weights are introduced on each edge to reflect the importance of information transfer between different structures;

[0033] Feature propagation and aggregation: Graph neural networks are used to perform multiple rounds of feature propagation and aggregation operations, enabling each node to fuse information from its adjacency structure and update it into a global structure-aware representation that includes upstream and downstream semantics.

[0034] Furthermore, the classification step in step S5 specifically includes:

[0035] Node feature extraction: Extract feature representations of each structural node from the structural association map, including the location features of different levels of buds, leaves, and leaf veins;

[0036] Clear topological connections: Clearly define the topological connections between nodes and construct the structural path of bud-leaf-vein;

[0037] Structure-aware attention weighted: For each structural path, a structure-aware attention mechanism is introduced to weight and fuse the node features in the path to generate a global representation with context awareness.

[0038] Tree structure perception classification function: Based on the hierarchical position information in the structural path, it performs discriminative modeling of different structural combinations, calculates the classification probability, and realizes fine-grained tea leaf category discrimination.

[0039] Furthermore, this includes the model training steps:

[0040] Use a dataset of fresh tea leaf images with standard labels for single bud, one bud and one leaf, one bud and two leaves, and one bud and multiple leaves;

[0041] The cross-entropy loss function is used as the objective function to measure the difference between the predicted results and the true labels, and the backpropagation algorithm guides the iterative update of the model parameters.

[0042] Combine data augmentation strategies, including rotation, scaling, brightness and color saturation adjustment, and noise addition, to improve the model's adaptability to different shooting angles and lighting conditions;

[0043] Regularization strategies are introduced, including applying L2 regularization terms to the weight parameters and setting a random deactivation mechanism in the network, to suppress overfitting and improve the model's generalization ability and robustness.

[0044] The technical solution adopted in the second aspect of the present invention is as follows:

[0045] A computer device includes a processor, a memory, and a communication bus. The memory stores a computer program, and the processor executes the program to implement the method mentioned in the first aspect, specifically including:

[0046] Control the image acquisition device to acquire raw images of fresh tea leaves;

[0047] The image preprocessing module is invoked to perform color normalization, edge enhancement, and noise suppression operations.

[0048] The frequency domain decomposition module is invoked to perform wavelet transform and discrete cosine transform to extract structural features of different frequency bands;

[0049] The deep modeling module is invoked to input image features into a neural network containing a long-short-range dependency modeling module and a residual convolution module, extracting and fusing global dependency and local texture information;

[0050] The structure graphing module is invoked to construct tree-like topological paths and generate a structure graph. An attention mechanism is introduced to model the information flow between structures.

[0051] The classification module is invoked, and the tree structure-aware classification function is executed to perform classification operations based on the hierarchical information of the structure graph.

[0052] During training, the cross-entropy loss function is used to optimize the model, and data augmentation and regularization strategies are combined to improve model performance.

[0053] Complete model training, package and save the data, and deploy and run it via storage or remote means.

[0054] The technical solution adopted in the third aspect of this invention is as follows:

[0055] A computer-readable storage medium having a computer program stored thereon, the program, when executed by a processor, implementing the method mentioned in the first aspect, comprising:

[0056] Image acquisition and preprocessing, frequency domain decomposition, depth modeling, topology construction, classification and judgment, and model packaging and deployment steps;

[0057] The program can be loaded onto a processor for execution, or stored in a computer-readable storage medium and invoked.

[0058] Compared with the prior art, the beneficial effects of the present invention are:

[0059] This invention proposes a tea leaf sorting method, computer equipment, and computer-readable medium based on a frequency-domain tree-structured topology network. Addressing the problems of unstable image quality, low structural recognition accuracy, and insufficient automation in traditional sorting methods, it constructs a complete workflow from image acquisition, preprocessing, frequency-domain decomposition, deep modeling, structural mapping, graph classification, to model deployment. Image quality is improved through color normalization and edge enhancement. Multi-level structural features are extracted using frequency-domain tree-structured decomposition combining wavelet and discrete cosine transform. Long- and short-range dependency modeling modules are integrated with residual convolution modules to achieve long- and short-range feature modeling. Semantic understanding is enhanced by utilizing a tree-structured topology attention path and structural graph simulating the "bud-leaf-vein" relationship. Fine-grained classification of different tea leaf types is achieved based on a tree structure-aware classification function module, and structural information propagation is optimized through a graph neural network. During the training phase, a cross-entropy loss function combined with data augmentation and regularization strategies is introduced to improve model robustness. Finally, automated and efficient tea leaf identification and sorting are achieved through deployment on computer equipment and a readable storage medium. The results show that the method exhibits high classification accuracy and stability on image datasets of multiple tea varieties, effectively improving the automation level and practical value of intelligent sorting of fresh tea leaves. Attached Figure Description

[0060] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only preferred embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0061] Figure 1 This is a schematic diagram of the overall process of Embodiment 1 of the present invention.

[0062] Figure 2 This is a schematic diagram of the overall network architecture of Embodiment 1 of the present invention.

[0063] Figure 3 This is a schematic diagram of the frequency domain tree decomposition module according to Embodiment 1 of the present invention.

[0064] Figure 4 This is a schematic diagram of the depth modeling module in Embodiment 1 of the present invention.

[0065] Figure 5 This is a schematic diagram of the tree-type topology attention path module in Embodiment 1 of the present invention.

[0066] Figure 6 This is a schematic diagram of the structural correlation map module of Embodiment 1 of the present invention. Detailed Implementation

[0067] The principles and features of the present invention are described below with reference to the accompanying drawings. The listed embodiments are only used to explain the present invention and are not intended to limit the scope of the present invention.

[0068] Example 1

[0069] Reference Figure 1-6 This invention provides a method for sorting fresh tea leaves based on a frequency domain tree topology network, the method comprising the following steps:

[0070] Step S1: Under a standardized acquisition environment, high-resolution imaging equipment is used to acquire images of multiple batches of fresh tea leaves of the same variety and at different harvesting stages, constructing a tea leaf image dataset, and performing image preprocessing, including color normalization, edge enhancement, and noise suppression; the image preprocessing specifically includes:

[0071] Color normalization processing: The image is converted from the RGB color space to the Lab color space of lightness-red-green-yellow-blue. The pixel distribution characteristics of each channel are extracted. With reference to the mean and standard deviation of the standard image in the Lab space, a linear transformation is used to adjust the lightness channel L, red-green component channel a, and yellow-blue component channel b to make the color statistical characteristics of the image consistent with the reference image and eliminate color deviation caused by changes in lighting or device differences.

[0072] Edge enhancement processing: The Sobel operator is used to calculate the gradient of the image in the horizontal and vertical directions to generate an edge magnitude map. Combined with non-maximum suppression and double thresholding, the contour information of structural regions such as leaf edges and leaf tips is enhanced.

[0073] Noise suppression processing: The application of medium-medium filtering removes salt-and-pepper noise from the image. By extracting a neighborhood window centered on a pixel and calculating the median to replace the original value, local abrupt changes are suppressed while edge details are preserved. For smooth areas in the image, a bilateral filtering method is introduced, which combines the spatial distance between pixels and the gray-level difference for weighted averaging to reduce high-frequency noise interference while preserving detailed textures.

[0074] For example, the acquired raw images of fresh tea leaves are preprocessed to improve the accuracy of subsequent structural analysis and feature extraction. First, the image is converted from the RGB color space to the Lab color space (lightness-red-green-yellow-blue). By extracting the pixel distribution features of each channel and referencing the mean and standard deviation of a standard image in the Lab space, a linear transformation is applied to adjust the lightness channel L, the red-green component channel a, and the yellow-blue component channel b, ensuring that the image's color statistical characteristics are consistent with the reference image, thereby eliminating color deviations caused by differences in lighting or equipment. After color normalization, the Sobel operator is used to calculate the gradient of the image in the horizontal and vertical directions, generating an edge magnitude map. Combined with non-maximum suppression and double thresholding, the contour information of structural regions such as leaf edges and tips is further enhanced. Based on this, medium-sensitivity filtering is applied to remove salt-and-pepper noise from the image. By extracting a neighborhood window centered on a pixel and calculating its median to replace the original value, local abrupt changes are suppressed while preserving edge details. For smooth regions in the image, a bilateral filtering method is introduced, which combines the spatial distance between pixels and the gray-level difference for weighted averaging, further reducing high-frequency noise interference while preserving detailed textures.

[0075] Step S2: The frequency domain tree decomposition method based on wavelet transform and discrete cosine transform is used to extract frequency domain features from the preprocessed image to obtain multiple frequency domain sub-images. Wavelet transform is used to extract high-frequency texture features, and discrete cosine transform is used to extract low-frequency structural features.

[0076] Frequency domain tree decomposition methods specifically include:

[0077] A two-dimensional discrete wavelet transform is performed on the input image to decompose the image into a low-frequency part and three high-frequency parts, which correspond to the changes in the image in the horizontal, vertical and diagonal directions, respectively. The high-frequency part contains the texture and edge detail information in the image, which is used to extract the structural features of the high-frequency region of the leaf tip and serrated edge.

[0078] A two-dimensional discrete cosine transform is further applied to the low-frequency sub-band after wavelet decomposition to extract the low-frequency features of the energy concentration region in the image, which are used to model the overall outline of the blade and the global structural information of the main vein.

[0079] By combining wavelet transform and discrete cosine transform, a tree-structured frequency domain decomposition representation is formed, in which the high-frequency branch captures edge and texture details, while the low-frequency branch represents the overall morphological structure. The two complement each other in terms of features through the coupling of scale and frequency dimensions.

[0080] For example, firstly, the input image Perform a two-dimensional discrete wavelet transform to decompose the image into a low-frequency component. and three high-frequency components These correspond to changes in the image in the horizontal, vertical, and diagonal directions, respectively:

[0081] (1)

[0082] Among them, the high-frequency part It contains detailed information such as texture and edges in the image, which can be used to extract structural features of high-frequency regions such as leaf tips and serrated edges. By analyzing the coefficients of these high-frequency subbands, it is possible to effectively capture areas with significant changes in the image and improve the model's ability to recognize details.

[0083] Subsequently, the low-frequency part The input is fed into a two-dimensional discrete cosine transform to perform frequency modeling of the overall structure. The calculation method is as follows:

[0084] (2)

[0085] in, These are frequency domain coefficients. This refers to the image size. Discrete cosine transform extracts low-frequency features from energy-concentrated regions in the image, which are used to model global structural information such as the overall blade outline and main vein.

[0086] Through the combination of wavelet and discrete cosine transform, a tree-structured frequency domain decomposition representation is formed. The high-frequency branch captures edges and textures, while the low-frequency branch represents the overall shape. The two complement each other in terms of structure through the coupling of scale and frequency dimensions.

[0087] Step S3: Input the frequency domain subgraph into a deep neural network containing a long-short-range dependency modeling module and a residual convolution module to extract high-order semantic features containing structural dependencies. The long-short-range dependency modeling module is used to model long-distance structural dependencies, and the residual convolution module is used to extract local textures and spatial details.

[0088] Deep neural networks specifically include:

[0089] Long-range and short-range dependency modeling module: Based on the state-space model, it realizes the modeling of dependencies between distant structures in the image by dynamically modeling the state transition process, and captures the dependencies between distant structures in the image;

[0090] Residual Convolution Module: Employs local convolution operations to extract local detail features of image edges, textures, and contours. Its structure includes standard convolutional layers and a residual connection mechanism, which maintains stable feature transfer and gradient flow through residual connections.

[0091] Feature fusion module: It combines the global features output by the long-range and short-range dependency modeling module with the local features extracted by the residual convolution module to form a multi-level image representation that has both long-range dependency modeling capability and local structure perception capability.

[0092] For example, the deep modeling module converts the data into an initial feature representation using an encoder. ,in Indicates batch size. Indicates the number of locations in the image. The feature dimension for each location.

[0093] This feature is first input into the long-short-range dependency modeling module, which is based on a state-space model to capture the dependencies between distant structures in an image. Unlike traditional convolution or self-attention, the long-short-range dependency modeling module achieves efficient association modeling of distant features by dynamically modeling the state transition process. Its computation process can be represented as follows:

[0094] (3)

[0095] Among them, matrix Indicates the state transition weights. For input bias terms, The operation represents linear recursive propagation over the entire sequence. In this way, the long-range and short-range dependency modeling module can perceive spatially distant but semantically related regions in the image, such as "midrib-leaf tip" or "symmetrical leaf," and achieve the ability to model the global structure.

[0096] Subsequently, the output features of the long-short-range dependency modeling module are... Compared with the original input features The data is then fused and fed into the residual convolution module. This module employs local convolution operations, focusing on extracting local detail features such as edges, textures, and contours from the image. Its structure includes a standard 3×3 convolutional layer and a residual connection mechanism, calculated as follows:

[0097] (4)

[0098] in, Indicates the feature Apply convolution operations to extract local features. Adding the residual path directly to the convolution result helps to stably propagate features, accelerates convergence, and prevents gradient vanishing.

[0099] Finally, the global features output by the long-range and short-range dependency modeling module are... Local features extracted with the ResConv module The fusion process can be performed by concatenating the features to obtain the final feature representation.

[0100] (5)

[0101] The fused feature F possesses both long-distance dependency modeling capability and local structure perception capability, forming a multi-level image representation with rich semantic expression capabilities.

[0102] Step S4: By constructing a tree-shaped topological attention path that simulates the spatial hierarchy of bud-leaf-vein, a structural association graph is established, and a graph neural network is used to aggregate and propagate structural information;

[0103] The construction of tree-based topology attention paths specifically includes:

[0104] Structural node extraction: Identify and extract key regions of buds, leaves and veins from the image, set the buds as root nodes, the leaves as intermediate nodes, and the veins as terminal nodes to form a structural representation with growth hierarchy;

[0105] Hierarchical connection relationship construction: Based on the spatial dependence order of leaf veins pointing to leaves and leaves pointing to buds, multi-layered directed connections are established in a bottom-up manner to form a tree-like topology structure that conforms to the natural growth law of plants.

[0106] Attention path formation: A learnable attention mechanism is introduced into each directed edge. After mapping node features to a unified space through linear transformation, the features are concatenated and attention weights are calculated through a scoring function. This allows feature information to flow along the biological structural path and dynamically adjusts the transmission weights between different nodes.

[0107] The construction of the structural association map specifically includes:

[0108] Node representation: Representative structural units such as buds, leaf edges, and midribs are extracted as graph nodes, and each node is represented by its local image feature vector;

[0109] Edge connection construction: Based on the spatial layout and physiological relationship between structural parts, construct connecting edges between nodes to form a preliminary graph structure;

[0110] Attention weight introduction: Learnable attention weights are introduced on each edge to reflect the importance of information transfer between different structures;

[0111] Feature propagation and aggregation: Graph neural networks are used to perform multiple rounds of feature propagation and aggregation operations, enabling each node to fuse information from its adjacency structure and update it into a global structure-aware representation that includes upstream and downstream semantics.

[0112] For example, the tree-structured topology attention path module first performs structural analysis on the input tea leaf image, identifying key regions such as buds, leaves, and veins, and designating them as root nodes, intermediate nodes, and terminal nodes, representing the upper, middle, and lower layers of the tea leaf structure, respectively. Based on this structural division, following the biological structural logic of "veins connecting leaves, leaves connecting buds," a hierarchical and directional directed graph structure is constructed. This graph structure starts from the most detailed veins, points layer by layer towards the leaves, and finally converges at the bud node, conforming to the natural growth sequence of plants from bottom to top, forming a tree-structured topology.

[0113] In this directed tree graph, a learnable attention mechanism is introduced for each edge to measure the importance of information transfer between nodes with different structures. Specifically, consider two nodes... and These represent the lower and upper layers of the structure, respectively, and their corresponding feature vectors are: and Then through linear transformation After mapping both to a unified space, they are concatenated, and attention weights are calculated using a scoring function. The calculation process can be expressed as follows:

[0114] (6)

[0115] in, For learnable weight vectors, Represents all nodes A set of connected lower-level nodes. This allows for the adaptive assignment of different weights to each edge based on the correlation between node features, making the propagation of structural information between nodes more accurate and effective.

[0116] The way information is passed from bottom to top in a structural path can be represented as follows:

[0117] (7)

[0118] in, Indicates the first Layer nodes Update features, For learnable linear transformation weights, is the activation function. In the entire attention flow graph structure, information starts from the veins, is weighted and aggregated, and then passed down to the leaves and buds, enabling the model to perceive the overall structural relationships along the topological path and dynamically adjust the semantic contribution of each node in the whole tree.

[0119] The structural association graph module first extracts representative structural units such as buds, leaf edges, and midribs as graph nodes, each represented by a local image feature vector. Each node is represented by a feature vector reflecting the image features of its local region. Based on the spatial location and physiological connections between structural parts, an edge set of the graph is constructed to form the structural graph. Attention weights are introduced on each edge to measure the strength of information transfer between structures. Consider two connected nodes... and The features are represented as and First, the original features are mapped to a uniform dimension through a linear transformation:

[0120] (8)

[0121] in, This is the node feature transformation matrix. An attention mechanism is used to ensure that each structural node focuses on its stronger structural relationships with its neighbors during updates. In the feature propagation phase, the graph neural network weights and aggregates the information from neighboring nodes according to attention weights to update the feature representation of the current node.

[0122] (9)

[0123] in, The updated node features are then used. Through multiple rounds of propagation and updates, the node features can gradually integrate information from its adjacent structural nodes, enabling the modeling and representation of the complex relationships between the structures of fresh tea leaves.

[0124] Step S5: Based on the structure map, the tree structure perception classification function module is used to integrate the context information between structure nodes to achieve fine-grained discrimination of single bud, one bud and one leaf, one bud and two leaves, and one bud and multiple leaves.

[0125] The classification step in step S5 specifically includes:

[0126] Node feature extraction: Extract feature representations of each structural node from the structural association map, including the location features of different levels of buds, leaves, and leaf veins;

[0127] Clear topological connections: Clearly define the topological connections between nodes and construct the structural path of bud-leaf-vein;

[0128] Structure-aware attention weighted: For each structural path, a structure-aware attention mechanism is introduced to weight and fuse the node features in the path to generate a global representation with context awareness.

[0129] Tree structure perception classification function: Based on the hierarchical position information in the structural path, it performs discriminative modeling of different structural combinations, calculates the classification probability, and realizes fine-grained tea leaf category discrimination.

[0130] For example, the tree structure-aware classification function module first extracts feature representations of each structural node from step 4, including different levels of parts such as buds, leaves, and veins, and clarifies the topological connections between them. Using these nodes and their connections as input, a "bud-leaf-vein" structural path is constructed to reflect the hierarchical composition of fresh tea leaves. Next, for each structural path, a structure-aware attention mechanism is introduced to perform weighted fusion of the node features in the path. Assume the path contains nodes... The feature representation of each node is as follows: The global representation of all node features is calculated using attention weighting:

[0131] (10)

[0132] Among them, weight Weights are dynamically generated based on a node's position and feature importance within the structural path, reflecting its contribution to the overall classification. Weight calculation can be performed using a learnable scoring function, such as:

[0133] (11)

[0134] in These are learnable parameter vectors. The fused feature representation. As the final classification input, it is fed into the tree structure-aware classification function module. This module does not classify the entire image uniformly, but rather processes different structural combinations differently based on their hierarchical position within the structural path. The calculation of classification probabilities considers not only a single local feature in the image, but also the information from the entire structural path, making a comprehensive judgment at the semantic level.

[0135] Softmax output is implemented using a structure-aware approach. Let the set of output categories be... Then the score for each category is:

[0136] (12)

[0137] in and These are the weights and biases corresponding to this category. The final classification probability is calculated using the standard Softmax function:

[0138] (13)

[0139] The classification module maintains sensitivity to structural hierarchy and context throughout the feature fusion and prediction process, enabling the model to accurately distinguish between categories that are similar in appearance but different in structure, such as "single bud", "one bud and one leaf", "one bud and two leaves", and "one bud and multiple leaves".

[0140] Further steps include model training:

[0141] Use a dataset of fresh tea leaf images with standard labels for single bud, one bud and one leaf, one bud and two leaves, and one bud and multiple leaves;

[0142] The cross-entropy loss function is used as the objective function to measure the difference between the predicted results and the true labels, and the backpropagation algorithm guides the iterative update of the model parameters.

[0143] Combine data augmentation strategies, including rotation, scaling, brightness and color saturation adjustment, and noise addition, to improve the model's adaptability to different shooting angles and lighting conditions;

[0144] Regularization strategies are introduced, including applying L2 regularization terms to the weight parameters and setting a random deactivation mechanism in the network, to suppress overfitting and improve the model's generalization ability and robustness.

[0145] For example, the collected tea leaf image dataset is labeled with standard labels. The labels corresponding to the image samples reflect their true classification in fine-grained categories such as "single bud", "one bud and one leaf", "one bud and two leaves", and "one bud and multiple leaves". The images are input into the model, and after feature extraction and structural modeling modules, the corresponding classification probability output is obtained.

[0146] During training, the cross-entropy loss function is used as the objective function to measure the difference between the model's predictions and the true labels. Let the predicted probability output by the model be... The corresponding category label is The loss function is then defined as:

[0147] (14)

[0148] in This represents the total number of categories. This loss value is passed to each module via the backpropagation algorithm to guide the iterative update of the model parameters.

[0149] To enhance the model's ability to recognize samples under different shooting environments, various data augmentation processes were performed on the original images before training. Augmentation methods included rotating by a certain angle, scaling to different sizes, adjusting brightness and color saturation, and adding noise, thereby constructing diverse representations of the image under different viewing angles and lighting conditions, and improving the model's adaptability to real-world environments.

[0150] Regularization strategies are also introduced during model training to suppress overfitting of the model to the training data. Specifically, this includes applying L2 regularization terms to the weight parameters and implementing a random deactivation mechanism in some layers of the network, which randomly discards neuron outputs with a certain probability, allowing the network to maintain its generalization ability during training. The entire training process, through the combined effects of supervisory signals, data perturbation, and regularization constraints, guides the model to achieve a balance between accuracy and stability, enabling it to exhibit good convergence on standard image datasets while also possessing the ability to generalize to new samples.

[0151] Example 2

[0152] A computer device includes a processor, a memory, and a communication bus. The memory stores a computer program, and the processor executes the program to implement the method mentioned in Embodiment 1, specifically including:

[0153] Control the image acquisition device to acquire raw images of fresh tea leaves;

[0154] The image preprocessing module is invoked to perform color normalization, edge enhancement, and noise suppression operations.

[0155] The frequency domain decomposition module is invoked to perform wavelet transform and discrete cosine transform to extract structural features of different frequency bands;

[0156] The deep modeling module is invoked to input image features into a neural network containing a long-short-range dependency modeling module and a residual convolution module, extracting and fusing global dependency and local texture information;

[0157] The structure graphing module is invoked to construct tree-like topological paths and generate a structure graph. An attention mechanism is introduced to model the information flow between structures.

[0158] The classification module is invoked, and the tree structure-aware classification function is executed to perform classification operations based on the hierarchical information of the structure graph.

[0159] During training, the cross-entropy loss function is used to optimize the model, and data augmentation and regularization strategies are combined to improve model performance.

[0160] Complete model training, package and save the data, and deploy and run it via storage or remote means.

[0161] Example 3

[0162] A computer-readable storage medium having a computer program stored thereon, the program, when executed by a processor, implements the method mentioned in Embodiment 1, comprising:

[0163] Image acquisition and preprocessing, frequency domain decomposition, depth modeling, topology construction, classification and judgment, and model packaging and deployment steps;

[0164] The program can be loaded onto a processor for execution, or stored in a computer-readable storage medium and invoked.

[0165] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for sorting tea fresh leaves based on a frequency domain tree topology network, characterized in that, The method includes the following steps: Step S1: Under a standardized acquisition environment, high-resolution imaging equipment is used to acquire images of multiple batches of fresh tea leaves of the same variety and at different picking stages, construct a tea leaf image dataset, and perform image preprocessing, including color normalization, edge enhancement, and noise suppression. Step S2: The frequency domain tree decomposition method based on wavelet transform and discrete cosine transform is used to extract frequency domain features from the preprocessed image to obtain multiple frequency domain sub-images. Wavelet transform is used to extract high-frequency texture features, and discrete cosine transform is used to extract low-frequency structural features. Step S3: Input the frequency domain subgraph into a deep neural network containing a long-short-range dependency modeling module and a residual convolution module to extract high-order semantic features containing structural dependencies. The long-short-range dependency modeling module is used to model long-distance structural dependencies, and the residual convolution module is used to extract local textures and spatial details. Step S4: By constructing a tree-shaped topological attention path that simulates the spatial hierarchy of bud-leaf-vein, a structural association graph is established, and a graph neural network is used to aggregate and propagate structural information; Step S5: Based on the structure map, the tree structure perception classification function module is used to integrate the context information between structure nodes to achieve fine-grained discrimination of single bud, one bud and one leaf, one bud and two leaves, and one bud and multiple leaves.

2. The method of claim 1, wherein, The image preprocessing in step S1 specifically includes: Color normalization processing: The image is converted from the RGB color space to the Lab color space of lightness-red-green-yellow-blue. The pixel distribution characteristics of each channel are extracted. With reference to the mean and standard deviation of the standard image in the Lab space, a linear transformation is used to adjust the lightness channel L, red-green component channel a, and yellow-blue component channel b to make the color statistical characteristics of the image consistent with the reference image and eliminate color deviation caused by changes in lighting or device differences. Edge enhancement processing: The Sobel operator is used to calculate the gradient of the image in the horizontal and vertical directions to generate an edge magnitude map. Combined with non-maximum suppression and double thresholding, the contour information of structural regions such as leaf edges and leaf tips is enhanced. Noise suppression processing: The application of medium-medium filtering removes salt-and-pepper noise from the image. By extracting a neighborhood window centered on a pixel and calculating the median to replace the original value, local abrupt changes are suppressed while edge details are preserved. For smooth areas in the image, a bilateral filtering method is introduced, which combines the spatial distance between pixels and the gray-level difference for weighted averaging to reduce high-frequency noise interference while preserving detailed textures.

3. The method of claim 1, wherein, The frequency domain tree decomposition method in step S2 specifically includes: A two-dimensional discrete wavelet transform is performed on the input image to decompose the image into a low-frequency part and three high-frequency parts, which correspond to the changes in the image in the horizontal, vertical and diagonal directions, respectively. The high-frequency part contains the texture and edge detail information in the image, which is used to extract the structural features of the high-frequency region of the leaf tip and serrated edge. A two-dimensional discrete cosine transform is further applied to the low-frequency sub-band after wavelet decomposition to extract the low-frequency features of the energy concentration region in the image, which are used to model the overall outline of the blade and the global structural information of the main vein. By combining wavelet transform and discrete cosine transform, a tree-structured frequency domain decomposition representation is formed, in which the high-frequency branch captures edge and texture details, while the low-frequency branch represents the overall morphological structure. The two complement each other in terms of features through the coupling of scale and frequency dimensions.

4. The method of claim 1, wherein, The deep neural network in step S3 specifically includes: Long-range and short-range dependency modeling module: Based on the state-space model, it realizes the dependency modeling between distant structures in the image by dynamically modeling the state transition process, and captures the dependency between distant structures in the image; Residual Convolution Module: Employs local convolution operations to extract local detail features of image edges, textures, and contours. Its structure includes standard convolutional layers and a residual connection mechanism, which maintains stable feature transfer and gradient flow through residual connections. Feature fusion module: It combines the global features output by the long-range and short-range dependency modeling module with the local features extracted by the residual convolution module to form a multi-level image representation that has both long-range dependency modeling capability and local structure perception capability.

5. The method of claim 1, wherein, The construction of the tree-based topology attention path in step S4 specifically includes: Structural node extraction: Identify and extract key regions of buds, leaves and veins from the image, set the buds as root nodes, the leaves as intermediate nodes, and the veins as terminal nodes to form a structural representation with growth hierarchy; Hierarchical connection relationship construction: Based on the spatial dependence order of leaf veins pointing to leaves and leaves pointing to buds, multi-layered directed connections are established in a bottom-up manner to form a tree-like topology structure that conforms to the natural growth law of plants. Attention path formation: A learnable attention mechanism is introduced on each directed edge. After mapping node features to a unified space through linear transformation, the features are concatenated and attention weights are calculated through a scoring function. This allows feature information to flow along the biological structural path and dynamically adjusts the transmission weights between different nodes.

6. The method of claim 1, wherein, The construction of the structural association map in step S4 specifically includes: Node representation: Representative structural units such as buds, leaf edges, and midribs are extracted as graph nodes, and each node is represented by its local image feature vector; Edge connection construction: Based on the spatial layout and physiological relationship between structural parts, construct connecting edges between nodes to form a preliminary graph structure; Attention weight introduction: Learnable attention weights are introduced on each edge to reflect the importance of information transfer between different structures; Feature propagation and aggregation: Graph neural networks are used to perform multiple rounds of feature propagation and aggregation operations, enabling each node to fuse information from its adjacency structure and update it into a global structure-aware representation that includes upstream and downstream semantics.

7. The method according to claim 1, characterized in that, The classification step in step S5 specifically includes: Node feature extraction: Extract feature representations of each structural node from the structural association map, including the location features of different levels of buds, leaves, and leaf veins; Clear topological connections: Clearly define the topological connections between nodes and construct the structural path of bud-leaf-vein; Structure-aware attention weighted: For each structural path, a structure-aware attention mechanism is introduced to weight and fuse the node features in the path to generate a global representation with context awareness. Tree structure perception classification function: Based on the hierarchical position information in the structural path, it performs discriminative modeling of different structural combinations, calculates the classification probability, and realizes fine-grained tea leaf category discrimination.

8. The method according to claim 1, characterized in that, Further steps include model training: Use a dataset of fresh tea leaf images with standard labels for single bud, one bud and one leaf, one bud and two leaves, and one bud and multiple leaves; The cross-entropy loss function is used as the objective function to measure the difference between the predicted results and the true labels, and the backpropagation algorithm guides the iterative update of the model parameters. Combine data augmentation strategies, including rotation, scaling, brightness and color saturation adjustment, and noise addition, to improve the model's adaptability to different shooting angles and lighting conditions; Regularization strategies are introduced, including applying L2 regularization terms to the weight parameters and setting a random deactivation mechanism in the network, to suppress overfitting and improve the model's generalization ability and robustness.

9. A computer device, comprising a processor, a memory, and a communication bus, wherein the memory stores a computer program, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 8, specifically including: Control the image acquisition device to acquire raw images of fresh tea leaves; The image preprocessing module is invoked to perform color normalization, edge enhancement, and noise suppression operations. The frequency domain decomposition module is invoked to perform wavelet transform and discrete cosine transform to extract structural features of different frequency bands; The deep modeling module is invoked to input image features into a neural network containing a long-short-range dependency modeling module and a residual convolution module, extracting and fusing global dependency and local texture information; The structure graphing module is invoked to construct tree-like topological paths and generate a structure graph. An attention mechanism is introduced to model the information flow between structures. The classification module is invoked, and the tree structure-aware classification function is executed to perform classification operations based on the hierarchical information of the structure graph. During training, the cross-entropy loss function is used to optimize the model, and data augmentation and regularization strategies are combined to improve model performance. Complete model training, package and save the data, and deploy and run it via storage or remote means.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 8, including: Image acquisition and preprocessing, frequency domain decomposition, depth modeling, topology construction, classification and judgment, and model packaging and deployment steps; The program can be loaded onto a processor for execution, or stored in a computer-readable storage medium and invoked.