A method, system, device, and storage medium for identifying the degree of tea fermentation.
By strengthening image edge and texture detail features and establishing a lightweight convolutional neural network with global contextual dependencies, the shortcomings of existing tea fermentation degree recognition methods in taking into account both local details and global context are solved, and high-precision fermentation degree recognition is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CENT SOUTH UNIV
- Filing Date
- 2026-02-28
- Publication Date
- 2026-05-05
AI Technical Summary
Existing methods for identifying the degree of tea fermentation rely on manual feature design, which makes it difficult to capture the complex and non-linear color and texture evolution during fermentation. They also have weak generalization ability and struggle to balance local details with global context, resulting in insufficient recognition accuracy.
By enhancing the recognition of image edge and texture detail features and establishing cross-regional global contextual dependencies, a lightweight convolutional neural network is used for multi-scale processing and edge enhancement. Combined with global dependency modeling, this enables the collaborative perception of local micro-changes and overall uniformity during fermentation.
It improves the accuracy and robustness of tea fermentation degree identification, and can efficiently identify subtle changes in the tea fermentation process to meet the needs of large-scale continuous production.
Smart Images

Figure CN121746824B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of tea fermentation identification technology, and in particular to a method, system, device and storage medium for identifying the degree of tea fermentation. Background Technology
[0002] Tea fermentation is the core process that determines the quality and flavor of tea. The unique color, aroma, and taste of various fermented teas, such as black tea and oolong tea, are all formed during the fermentation stage. During this process, the polyphenols in the tea leaves dynamically transform into key components such as theaflavins and thearubigins, directly determining the final value of the product. Therefore, accurately and in real-time identifying the degree of tea fermentation is a key technological support for achieving intelligent and standardized tea processing, ensuring consistent product quality, and meeting the needs of large-scale continuous production. It is of great significance for promoting the transformation of the traditional tea processing industry into smart agriculture.
[0003] However, current methods for identifying the degree of tea fermentation rely on manual feature design, which has limited feature representation capabilities. They struggle to capture the complex and non-linear color and texture evolution during fermentation, have weak generalization ability, and are not sensitive to subtle and continuous changes in fermentation features. They also fail to take into account both local details and global context, resulting in insufficient accuracy in identifying the degree of tea fermentation. Summary of the Invention
[0004] The following is an overview of the subject matter described in detail herein. This overview is not intended to limit the scope of the claims.
[0005] The main objective of this disclosure is to propose a method, system, device, and storage medium for identifying the degree of tea fermentation. By enhancing the identification of image edge and texture detail features and establishing cross-regional global contextual dependencies, it can achieve collaborative perception of local microscopic changes and overall uniformity during the fermentation process, thereby improving the accuracy of tea fermentation degree identification.
[0006] A first aspect of this application provides a method for identifying the degree of tea fermentation, applied to an electronic device. The electronic device integrates a tea fermentation identification network, which includes a first processing layer, an edge analysis and enhancement module layer, a second processing layer, and a classification decision layer. The method includes:
[0007] The tea fermentation image to be identified is input into the tea fermentation recognition network. The first processing layer extracts features from the tea fermentation image to be identified to obtain a first semantic feature map. The edge analysis and enhancement module layer performs multi-scale processing and edge enhancement processing on the tea fermentation image to be identified to obtain a detail feature map.
[0008] Based on the first semantic feature map and the detail feature map, a second semantic feature map is obtained by performing global dependency modeling through the second processing layer.
[0009] The classification decision layer classifies and identifies the second semantic feature map to obtain the fermentation degree identification result of the tea fermentation image to be identified.
[0010] In some embodiments of this application, the first processing layer includes a first processing unit and a second processing unit; the step of extracting features from the tea fermentation image to be identified through the first processing layer to obtain a first semantic feature map includes:
[0011] The first processing unit performs downsampling processing on the tea fermentation image to be identified to obtain a low-level feature map of the tea fermentation image to be identified.
[0012] Based on the dimension of the low-level feature map, the low-level feature map is divided into a first sub-feature map and a second sub-feature map;
[0013] Spatial features are extracted from the first sub-feature map through the first branch in the second processing unit to obtain the first sub-semantic feature map;
[0014] The second sub-semantic feature map is obtained by performing an identity mapping on the second sub-feature map through the second branch in the second processing unit;
[0015] The first sub-semantic feature map and the second sub-semantic feature map are concatenated to obtain the first semantic feature map.
[0016] In some embodiments of this application, the edge analysis and enhancement module layer includes an initial convolutional unit, a multi-level recurrent enhancement unit, and a fusion output unit; the step of performing multi-scale processing and edge enhancement processing on the tea fermentation image to be identified through the edge analysis and enhancement module layer to obtain a detail feature map includes:
[0017] The initial convolutional unit is used to perform convolutional downsampling and channel expansion processing on the tea fermentation image to be identified to obtain a first feature map.
[0018] The first feature map is processed through multi-level cyclic enhancement units to obtain multi-scale fused features.
[0019] The multi-scale fusion features are processed by channel fusion and dimensionality reduction through the fusion output unit to obtain the detail feature map.
[0020] In some embodiments of this application, the step of performing multi-level cyclic processing on the first feature map through the multi-level cyclic enhancement unit to obtain multi-scale fused features includes:
[0021] The multi-level cyclic enhancement unit iterates over the image features of the first feature map until the iteration stop condition is met, resulting in multiple enhanced features. These enhanced features are then concatenated with the image features of the first feature map to obtain the multi-scale fusion feature. Each iteration includes:
[0022] An average pooling operation is performed on the image features of the first feature map to calculate the difference between the image features and the local average value of the image features, thereby obtaining the edge response features;
[0023] The edge response features are convolutionally and activated to obtain adaptive edge enhancement weights;
[0024] The edge response features are weighted with the adaptive edge enhancement weights, and then added back to the image features as residuals to obtain the enhanced features.
[0025] In some embodiments of this application, the second processing layer includes a feature fusion unit, a downsampling unit, and a global context modeling unit; the step of obtaining a second semantic feature map by performing global dependency modeling processing through the second processing layer based on the first semantic feature map and the detail feature map includes:
[0026] The first semantic feature map and the detail feature map are concatenated and fused along the channel dimension by the feature fusion unit to obtain a fused feature map.
[0027] The fused feature map is spatially downsampled and channel expanded using the downsampling unit to obtain a second feature map.
[0028] The second semantic feature map is obtained by performing global context modeling on the second feature map through the global context modeling unit.
[0029] In some embodiments of this application, the step of performing global context modeling on the second feature map through the global context modeling unit to obtain the second semantic feature map includes:
[0030] The second feature map is subjected to depthwise separable convolution and weighted fusion to obtain the first intermediate feature map;
[0031] Global information enhancement is performed on the first intermediate feature map to obtain the second intermediate feature map;
[0032] The first intermediate feature map and the second intermediate feature map are fused to obtain the third intermediate feature map;
[0033] Based on a preset activation function, the third intermediate feature map is subjected to multiple convolutional processes and residual fusion to obtain a modeling feature map.
[0034] The modeling feature map is refined to obtain a refined feature map;
[0035] The second semantic feature map is obtained based on the refined feature map.
[0036] In some embodiments of this application, the step of classifying and recognizing the second semantic feature map through the classification decision layer to obtain the fermentation degree recognition result of the tea fermentation image to be identified includes:
[0037] A global average pooling operation is performed on the second semantic feature map to map the two-dimensional feature of each channel in the second semantic feature map to a scalar value, resulting in a one-dimensional feature vector;
[0038] The one-dimensional feature vector is mapped to a number of classification score vectors corresponding to a preset fermentation degree category;
[0039] The classification score vector is processed by a normalized exponential function to obtain the predicted probability of each preset fermentation degree category;
[0040] The fermentation degree category corresponding to the maximum predicted probability among the predicted probabilities of each preset fermentation degree category is determined as the fermentation degree recognition result of the tea fermentation image to be identified.
[0041] The first aspect of this application provides a method for identifying the degree of tea fermentation. This method involves inputting a tea fermentation image to be identified into a tea fermentation identification network. A first processing layer extracts features from the tea fermentation image to obtain a first semantic feature map. An edge analysis and enhancement module layer then performs multi-scale processing and edge enhancement on the tea fermentation image to obtain a detail feature map. Based on the first semantic feature map and the detail feature map, a second processing layer performs global dependency modeling to obtain a second semantic feature map. A classification decision layer then classifies and identifies the second semantic feature map to obtain the degree of fermentation identification result for the tea fermentation image. This method enhances the identification of image edges and texture details and establishes cross-regional global contextual dependencies, enabling collaborative perception of local micro-changes and overall uniformity during fermentation, thereby improving the accuracy of tea fermentation degree identification.
[0042] To achieve the above objectives, a second aspect of the present invention provides a tea fermentation degree recognition system applied to an electronic device. The electronic device integrates a tea fermentation recognition network, which includes a first processing layer, an edge analysis and enhancement module layer, a second processing layer, and a classification decision layer. The system includes:
[0043] The first module is used to input the tea fermentation image to be identified into the tea fermentation identification network, extract features from the tea fermentation image to be identified through the first processing layer to obtain a first semantic feature map, and perform multi-scale processing and edge enhancement processing on the tea fermentation image to be identified through the edge analysis and enhancement module layer to obtain a detail feature map.
[0044] The second module is used to perform global dependency modeling processing on the first semantic feature map and the detail feature map through the second processing layer to obtain the second semantic feature map.
[0045] The third module is used to classify and identify the second semantic feature map through the classification decision layer to obtain the fermentation degree identification result of the tea fermentation image to be identified.
[0046] To achieve the above objectives, a third aspect of the present invention provides a tea fermentation degree identification device, comprising: at least one control processor and a memory for communicatively connecting to the at least one control processor; the memory stores instructions executable by the at least one control processor, the instructions being executed by the at least one control processor to enable the at least one control processor to perform the above-described tea fermentation degree identification method.
[0047] To achieve the above objectives, a fourth aspect of the present invention provides a computer-readable storage medium storing computer-executable instructions for causing a computer to execute the above-described method for identifying the degree of tea fermentation.
[0048] It is understood that the beneficial effects of the second to fourth aspects compared with the related technologies are the same as the beneficial effects of the first aspect compared with the related technologies. Please refer to the relevant description in the first aspect above, which will not be repeated here. Attached Figure Description
[0049] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0050] Figure 1 This is a flowchart illustrating a method for identifying the degree of tea fermentation provided in an embodiment of this application;
[0051] Figure 2 This is a schematic diagram of the process of identifying the degree of tea fermentation using the tea fermentation identification network provided in this application embodiment;
[0052] Figure 3 This is a schematic diagram of the edge analysis and enhancement module layer provided in an embodiment of this application;
[0053] Figure 4 This is a schematic diagram of the structure of a tea fermentation degree identification system provided in an embodiment of this application;
[0054] Figure 5 This is a schematic diagram of the hardware structure of the tea fermentation degree identification device provided in the embodiments of this application. Detailed Implementation
[0055] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0056] In the description of this application, the use of terms such as "first," "second," etc., is for the purpose of distinguishing technical features only and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated or the order of the technical features indicated.
[0057] In the description of this application, it should be understood that the orientation descriptions, such as up, down, etc., are based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.
[0058] In the description of this application, it should be noted that, unless otherwise explicitly defined, terms such as "setup," "installation," and "connection" should be interpreted broadly, and those skilled in the art can reasonably determine the specific meaning of the above terms in this application in conjunction with the specific content of the technical solution.
[0059] As one of the most widely consumed teas globally, black tea's unique color, aroma, and flavor are fundamentally determined by its fermentation process. Fermentation is a dynamic, enzymatic oxidation process during which polyphenols in tea leaves are transformed into key components such as theaflavins and thearubigins, directly determining the flavor and value of black tea. Therefore, accurate and real-time identification and assessment of the degree of fermentation are crucial technological steps for achieving intelligent and standardized black tea processing and improving product quality consistency.
[0060] Currently, the determination of the fermentation level in the black tea industry mainly relies on the sensory experience of tea masters, who make judgments based on "observation of color, smell of aroma, and touch." Although this method is simple and direct, it has inherent and insurmountable defects: First, it is highly subjective and lacks quantitative standards. The judgment results are easily affected by personal experience, physiological state, and environmental factors, leading to inconsistent final quality of black tea and making it impossible to form stable and replicable process standards. Second, this method is labor-intensive and inefficient, making it difficult to meet the needs of large-scale and continuous production, which seriously restricts the stable production of high-quality black tea and the upgrading of the industry.
[0061] With the rapid development of agricultural technology, intelligent and automated technologies are gradually being integrated into modern agricultural production systems, driving the transformation of traditional agriculture into smart agriculture. This has also led to the emergence of many methods combining machine or chemical approaches to identify the degree of fermentation in black tea. For example, chemical analysis methods, such as high-performance liquid chromatography (HPLC), can accurately quantify the internal components of black tea during fermentation, thereby determining its degree of fermentation. However, these methods are time-consuming and costly, only suitable for offline sampling and not for real-time process control on production lines. Methods based on traditional machine vision and manual features mainly involve collecting tea color and texture features using ordinary cameras and combining them with algorithms such as Support Vector Machines (SVM) and Random Forests (RF) to build discriminative models. However, these methods rely on the design and selection of manual features, resulting in limited feature representation capabilities and making it difficult to fully capture the complex and non-linear color and texture evolution patterns during fermentation. Especially for whole-leaf fermentation scenarios like Yingjiu black tea, the differences in inter-class features are subtle, and the manual feature discrimination is insufficient, resulting in weak model generalization ability and recognition accuracy that fails to meet practical requirements. Methods based on spectral imaging sensing technology mainly utilize near-infrared spectroscopy, hyperspectral imaging, terahertz spectroscopy, and multispectral imaging to capture the spectral fingerprint information of tea leaves, deeply correlating it with their internal chemical components. However, the specialized sensing equipment required for this method (such as hyperspectral cameras and terahertz spectrometers) is expensive and complex to operate and maintain, making widespread deployment on production lines difficult. Furthermore, spectral signals are highly susceptible to interference from changes in environmental temperature and humidity, sample surface condition, and lighting conditions, affecting the judgment of the degree of black tea fermentation.
[0062] The emergence of deep learning has brought revolutionary changes to the field of smart agriculture. Deep learning models such as convolutional neural networks (CNNs) can automatically learn deep features, and their superior speed and accuracy have demonstrated excellent performance in agricultural applications. For example, a lightweight CNN structure using knowledge distillation to accurately detect the fermentation level of black tea has been proposed. Kimu Tai et al. released a dataset specifically for black tea fermentation classification and developed an optimized deep convolutional neural network model, TeaNet. Although existing black tea fermentation classification models have made great progress, directly applying existing models to intelligently identify the degree of black tea fermentation still faces significant challenges. First, black tea fermentation is a continuous process with blurred boundaries between stages. Existing model architectures are poorly adapted to complex scenarios, making it difficult to balance local details with global context, and they are not sensitive to capturing subtle and continuous feature changes during whole-leaf fermentation. At the same time, large and complex models designed for high accuracy (such as deep CNNs and Transformers) have many parameters and high computational cost, which cannot meet the real-time processing requirements on edge computing devices (such as industrial control computers and embedded systems) on the production line.
[0063] Based on this, embodiments of this application provide a method, system, device, and storage medium for identifying the degree of tea fermentation. The aim is to enhance the recognition of image edge and texture detail features and establish cross-regional global contextual dependencies to achieve collaborative perception of local micro-changes and overall uniformity during the fermentation process, thereby improving the accuracy of tea fermentation degree identification.
[0064] The tea fermentation degree identification method, system, device and storage medium provided in this application are specifically described through the following embodiments. First, the tea fermentation degree identification method in this application embodiment is described.
[0065] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0066] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0067] The tea fermentation degree identification method provided in this application relates to the field of tea fermentation identification technology. This method can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the tea fermentation degree identification method, but is not limited to the above forms.
[0068] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0069] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirection to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data required for the proper functioning of these embodiments acquired.
[0070] Therefore, referring to Figure 1This application provides a method for identifying the degree of tea fermentation. This application is applied to an electronic device. The electronic device integrates a tea fermentation identification network. The tea fermentation identification network includes a first processing layer, an edge analysis and enhancement module layer, a second processing layer, and a classification decision layer. The method includes the following steps S110 to S130.
[0071] Step S110: Input the tea fermentation image to be identified into the tea fermentation recognition network. The first processing layer extracts features from the tea fermentation image to be identified to obtain the first semantic feature map. The edge analysis and enhancement module layer performs multi-scale processing and edge enhancement processing on the tea fermentation image to be identified to obtain the detail feature map.
[0072] Step S120: Based on the first semantic feature map and the detail feature map, perform global dependency modeling processing through the second processing layer to obtain the second semantic feature map;
[0073] Step S130: Classify and identify the second semantic feature map through the classification decision layer to obtain the fermentation degree identification result of the tea fermentation image to be identified.
[0074] In this step, the tea fermentation image to be identified can be a tea fermentation image at any fermentation stage. Specifically, firstly, an initial tea fermentation image is obtained, and then the size of the initial tea fermentation image is uniformly adjusted to 224 pixels × 224 pixels. Then, normalization processing is performed to eliminate illumination differences and accelerate model convergence. At the same time, the image is converted into a tensor format that can be processed by the deep learning framework to obtain a tea fermentation image to be identified that can be directly input into the network.
[0075] like Figure 2 As shown, the tea fermentation recognition network can be constructed based on a lightweight convolutional neural network (such as ShuffleNetV2), which includes a first processing layer, an edge analysis and enhancement module layer, a second processing layer, and a classification decision layer. Specifically, the first processing layer includes a first processing unit and a second processing unit, preferably employing a feature extraction structure constructed using multi-level convolution and pooling operations, to capture basic semantic information such as color distribution and texture direction in the tea fermentation image, enabling the extraction and preliminary structuring of low-level semantic features of the image.
[0076] The first processing unit may include multiple convolutional layers. Specifically, it uses a 3x3 convolutional layer (with a stride of 2 and padding of 1) on the image input to the first processing unit, followed by a batch normalization (BN) operation and a ReLU (Rectified Linear Unit) activation function to achieve fast downsampling and extract preliminary low-level features of the image (such as edges and colors).
[0077] The second processing unit may include multiple basic units. Preferably, the second processing unit uniformly divides the feature map input to the second processing unit into two sub-feature maps along the channel dimension. It then gradually increases the number of channels while halving the spatial size using two basic units with a stride of 1 (each unit includes channel shuffling and depthwise separable convolution to promote inter-group information exchange). Specifically, each basic unit operates as follows: the first basic unit outputs the input sub-feature map as an identity mapping; the second basic unit uses a 1×1 convolution to reduce the channel dimension (dimensionality reduction), followed by batch normalization and ReLU activation; then, a 3×3 depthwise separable convolution is used for spatial feature extraction, which includes two steps: depthwise convolution and pointwise convolution to efficiently utilize parameters; finally, another 1×1 convolution is used to restore the channel dimension (dimensionality increase), followed by batch normalization and ReLU activation, outputting the processed sub-feature map.
[0078] Furthermore, the second processing unit concatenates the outputs of the first BasicUnit unit and the second BasicUnit unit along the channel dimension. After concatenation, a "channel shuffling" operation is performed on the concatenated feature map to rearrange and mix the channel information generated by different units, thereby promoting cross-branch information exchange and enhancing feature representation capabilities.
[0079] The edge analysis and enhancement module layer can be a processing unit that integrates multi-scale edge detection operators and contrast enhancement mechanisms. It is used to generate detail feature maps by calculating edge responses at different scales on the image and enhancing microstructural details such as contours and leaf vein cracks. Preferably, such as Figure 3 As shown, the edge analysis and enhancement module layer includes an initial convolutional unit, a multi-level recurrent enhancement unit, and a fusion output unit. The initial convolutional unit includes a 3x3 convolution (stride 4) and a 3×3 convolutional kernel (padded with 1).
[0080] Specifically, the edge analysis and enhancement module layer performs the following steps on the input image: First, the input image is downsampled by a 3x3 convolution (stride 4) of the initial convolutional unit. Then, the number of channels is increased by a 3×3 convolutional kernel (padded to 1) of the initial convolutional unit. Batch Normalization (BN) and ReLU activation are then performed to output the initial feature map. The initial feature map is then input to a multi-level recurrent enhancement unit for iterative processing. In each iteration, the features in the initial feature map undergo average pooling and convolutional activation to generate attention weights. Finally, the core is processed by an edge enhancer to obtain enhanced features.
[0081] The edge enhancer first calculates the local average features of the initial features input to the edge enhancer through 3×3 average pooling. Then, it subtracts the local average features from the initial features to obtain the preliminary edge response. The preliminary edge response is then subjected to 1×1 convolution, batch normalization, and Sigmoid activation to generate adaptive weights. Finally, the weighted edge information is added back to the initial features as a residual to achieve edge enhancement. Therefore, each loop outputs an enhanced feature.
[0082] Furthermore, the multiple enhanced features generated in the loop step are concatenated with the original features along the channel dimension by the fusion output unit to obtain a fused feature map. Finally, the concatenated features are channel-fused and dimension-reduced through a 1×1 convolutional layer to compress the number of channels. Then, after batch normalization and ReLU activation function, a detail-enhanced feature map is obtained.
[0083] The second processing layer can be a processing structure with feature fusion and global context modeling capabilities, used to integrate semantic and detailed features, and establish dependency relationships between distant regions in the feature map to generate a more comprehensive semantic feature map. Preferably, the second processing layer includes a feature fusion unit, a downsampling unit, and a global context modeling unit.
[0084] The feature fusion unit is used to fuse the output image of the first processing layer and the output image of the edge analysis and enhancement module layer. Specifically, it concatenates the output image of the first processing layer and the detail enhancement feature map in the channel dimension, so as to reduce the number of channels through a 1x1 convolutional layer, thereby achieving feature fusion and obtaining a feature map that contains both semantic information and rich details.
[0085] Furthermore, the feature map output by the feature fusion unit is downsampled using a BasicUnit unit with a stride of 2 through the downsampling unit to double the number of channels. The feature map processed by the downsampling unit is then input into the global context modeling unit for further processing.
[0086] Specifically, the global context modeling unit includes a global context modeling module and a basic unit with a stride of 1. The global context modeling module obtains the first intermediate feature by performing a 3×3 depthwise separable convolution on the input feature map. Then, it fuses the input feature map with the first intermediate feature through a residual connection with learnable weight parameters (initialized to 0.1). This results in the second intermediate feature, which is then reshaped into a sequence and subjected to layer normalization. Relevant parameters are generated through linear projection, and the global hidden state of the sequence is calculated through discretization and depthwise convolution. The global hidden state is then modulated by a mixer consisting of a sigmoid gate and linear projection. Finally, it is added to the flattened input sequence through a residual connection to enhance global information. The enhanced sequence features are then reassembled... The third intermediate feature is obtained by reshaping back to the two-dimensional spatial dimension. It is then fused with the residual of the second intermediate feature to obtain the fourth intermediate feature. The fourth intermediate feature is then subjected to a 3×3 depthwise separable convolution to obtain the fifth intermediate feature. After residual fusion, the sixth intermediate feature is obtained. The sixth intermediate feature is then extracted using 1×1, 3×3, and 5×5 convolution kernels in parallel. The outputs of each branch are concatenated and then fused with a 1×1 convolution to obtain the seventh intermediate feature. The number of channels of the seventh intermediate feature is increased by a 1×1 convolution, and a non-linear feature is introduced by a preset activation function (such as the Mish activation function). The number of channels is then reduced by a 1×1 convolution to obtain the eighth intermediate feature. Finally, the eighth intermediate feature is fused with the residual of the sixth intermediate feature to obtain the output feature map of the first processing by the global context modeling module.
[0087] Furthermore, the output feature map from the first global context modeling module undergoes the same global context modeling process as the first, with the second process being identical to the first, to deepen the extraction of global correlation information of features, resulting in a feature map after two adaptive global context modeling processes. Then, using a basic unit with a stride of 1, the feature map after the two adaptive global context modeling processes is refined through a series of operations including channel segmentation, depthwise separable convolution, channel concatenation, and channel shuffling, completing feature refinement and outputting the processed feature map.
[0088] The classification decision layer can be an output module composed of global feature aggregation and category discrimination units, used to map fused features to a preset fermentation level and output the final recognition conclusion. Preferably, the classification decision layer first performs a global average pooling operation on the input feature map input to the classification decision layer, calculating the average of all elements of the two-dimensional feature matrix of each channel, thereby compressing the feature information of that channel into a scalar value, obtaining a one-dimensional feature vector whose dimension is consistent with the number of channels of the input feature map, thus realizing the transformation from spatial features to compact vector representation, while preserving the high-level semantic information carried by each channel.
[0089] Furthermore, the one-dimensional feature vector is mapped to a low-dimensional space equal to the number of preset categories (e.g., mapped to 4 dimensions, corresponding to the four categories of "just beginning fermentation", "light fermentation", "medium fermentation", and "moderate fermentation") using a weight matrix and bias term, obtaining the predicted score for each preset category. The predicted scores for each preset category are then input into the Softmax activation function, and exponential normalization is used to convert the predicted scores of each preset category into a probability distribution, ensuring that the sum of the probabilities of all categories is 1. Finally, the category with the highest probability value is selected as the prediction result, and the corresponding fermentation degree identification label is output (e.g., 0, 1, 2, and 3 represent the four fermentation stages, respectively). This completes the end-to-end mapping from high-level semantic features to specific category decisions, providing reliable and interpretable output results for the intelligent identification of tea fermentation degree.
[0090] In this step, the tea fermentation image to be identified is first input into the tea fermentation recognition network. The first processing layer extracts basic semantic features from the image to obtain a first semantic feature map. Then, the edge analysis and enhancement module layer performs multi-scale feature extraction and edge feature enhancement processing on the first semantic feature map to obtain a detail feature map. Next, the extracted first semantic feature map and detail feature map are input into the second processing layer. The second processing layer performs global dependency modeling on the two types of features, integrates local details and global context information, and establishes feature associations across regions of the image to obtain a second semantic feature map that integrates multi-dimensional information. Finally, the classification decision layer performs classification and recognition processing on the second semantic feature map, such as feature compression, category mapping, and probability transformation, and outputs the fermentation degree recognition result corresponding to the tea fermentation image to be identified. Thus, by constructing a hierarchical recognition network that coordinates "detail enhancement-global perception", it achieves high sensitivity to subtle color and texture changes of tea during the fermentation stage and the overall evaluation capability of the fermentation state of the whole image, thereby achieving high-precision and high-robust intelligent recognition of tea fermentation degree.
[0091] In some embodiments, in step S110, the tea fermentation image to be identified is subjected to feature extraction through the first processing layer to obtain a first semantic feature map, including the following steps S210 to S250:
[0092] Step S210: The first processing unit performs downsampling processing on the tea fermentation image to be identified to obtain a low-level feature map of the tea fermentation image to be identified.
[0093] Step S220: Divide the low-level feature map into a first sub-feature map and a second sub-feature map according to the dimension of the low-level feature map;
[0094] Step S230: Spatial feature extraction is performed on the first sub-feature map through the first branch in the second processing unit to obtain the first sub-semantic feature map;
[0095] Step S240: Perform an identity mapping on the second sub-feature map through the second branch in the second processing unit to obtain the second sub-semantic feature map;
[0096] Step S250: Concatenate the first sub-semantic feature map and the second sub-semantic feature map to obtain the first semantic feature map.
[0097] In this embodiment, the first processing layer includes a first processing unit and a second processing unit. The first processing unit is a network unit that implements image downsampling and basic visual feature extraction. The second processing unit is a semantic feature extraction unit with channel segmentation, dual-branch parallel processing and feature concatenation functions. The first sub-feature map and the second sub-feature map are feature maps of the same specification after the low-level feature map is evenly divided along the channel dimension. The first branch is a spatial feature extraction branch with convolution operation, and the second branch is an identity mapping branch without feature transformation.
[0098] Specifically, firstly, the input tea fermentation image to be identified is subjected to basic feature extraction by the first processing unit. The first processing unit includes a 3×3 convolutional layer with a stride of 2 to achieve spatial downsampling, halving the image size. At the same time, the channel dimension is expanded by increasing the number of convolutional kernels (e.g., from 3 channels to 24 channels). Then, batch normalization and ReLU activation function processing are performed sequentially to stabilize the data distribution and introduce nonlinearity, thereby obtaining a low-level feature map that retains primary visual information such as edges and colors.
[0099] Furthermore, based on the channel dimension of the low-level feature map, it is uniformly divided into two parts along the channel direction to obtain a first sub-feature map and a second sub-feature map. The first sub-feature map is then input into the first branch of the second processing unit, and the second sub-feature map is input into the second branch of the second processing unit.
[0100] The first branch of the second processing unit is a lightweight feature transformation path, which performs the following operations on the first sub-feature map in sequence: first, it performs channel dimensionality reduction through a 1×1 convolution and combines it with batch normalization and ReLU activation; then, it uses a 3×3 depthwise separable convolution to extract spatial features in order to efficiently capture local texture and structural information; finally, it restores the channel dimension through a 1×1 convolution and performs batch normalization and ReLU activation in the same way to obtain the first sub-semantic feature map that carries the deep processing and enhanced semantic information.
[0101] The second branch of the second processing unit does not perform any convolutional transformations, but only performs identity mapping, that is, it directly uses the second sub-feature map as the output to obtain the second sub-semantic feature map. This aims to completely preserve the original information of the input features, avoid information loss caused by transformation, and provide a smooth gradient propagation path for the network.
[0102] Furthermore, the first sub-semantic feature map output from the first branch of the second processing unit and the second sub-semantic feature map output from the second branch of the second processing unit are concatenated along the channel dimension to obtain a concatenated feature map. Then, a channel shuffling operation is performed to rearrange the channel order, promoting full interaction and fusion of information from the two branches between channels, resulting in a first semantic feature map. This first semantic feature map simultaneously contains the enhanced semantic information extracted by the first branch and the original feature information retained by the second branch, forming a mid-level feature representation that combines expressive power and information integrity. Ultimately, this achieves an efficient and lightweight conversion from the original image to a feature map with rich semantic information, providing a high-quality input foundation for subsequent detail enhancement and global modeling.
[0103] In some embodiments, in step S110, the tea fermentation image to be identified is subjected to multi-scale processing and edge enhancement processing through the edge analysis and enhancement module layer to obtain a detailed feature map, including the following steps S310 to S330:
[0104] Step S310: Perform convolution downsampling and channel expansion processing on the tea fermentation image to be identified through the initial convolution unit to obtain the first feature map;
[0105] Step S320: Perform multi-level cyclic processing on the first feature map through a multi-level cyclic enhancement unit to obtain multi-scale fused features;
[0106] Step S330: Perform channel fusion and dimensionality reduction on the multi-scale fusion features through the fusion output unit to obtain the detail feature map.
[0107] In this embodiment, the edge analysis and enhancement module layer includes an initial convolutional unit, a multi-level recurrent enhancement unit, and a fusion output unit. Specifically, the input tea fermentation image to be identified is first processed by the initial convolutional unit. This initial convolutional unit includes a 3×3 convolutional kernel with a stride of 4. Its function is to quickly downsample the original high-resolution image (e.g., 224×224×3), significantly reducing the spatial size (e.g., to 56×56). At the same time, the number of feature channels is expanded by increasing the number of convolutional kernels (e.g., from 3 channels to 64 channels). Then, a 3×3 convolution can be further used in conjunction with batch normalization (BN) and the ReLU activation function to perform channel expansion and preliminary feature extraction, outputting a first feature map with rich basic features, providing a feature representation of moderate size and higher information density for subsequent detailed analysis.
[0108] Furthermore, the obtained first feature map is input into a multi-level recurrent enhancement unit, which employs an iterative processing structure (e.g., a four-level loop), performing the same core operation sequence in each loop level. The specific steps are as follows:
[0109] First, the input feature map is subjected to 3×3 average pooling to smooth the features and expand the receptive field. Then, the difference between the original feature and its local mean is calculated to obtain the edge response features representing texture abrupt changes and contour information. Next, a 1×1 convolution, batch normalization, and sigmoid activation function are applied to the edge response features to generate a spatially adaptive edge enhancement weight map. The edge enhancement weight map is then multiplied element-wise with the edge response features, and the weighted result is added back to the input features of this level of loop as a residual. This achieves targeted enhancement of edges and details at this scale, as expressed below:
[0110] ;
[0111] ;
[0112] ;
[0113] in, For edge response maps, For the first The scale feature map, P3×3, uses 3×3 average pooling to calculate local averages. It is the Sigmoid activation function. For batch normalization, To enhance the weights at the edges, For element-wise multiplication, This is the feature map after edge enhancement.
[0114] Furthermore, each iteration uses the output of the previous iteration as input, thereby progressively constructing a pyramid composed of augmented features at different scales, as shown in the following expression:
[0115] ;
[0116] in, For the first Scale feature map This is a 3×3 average pooling operation.
[0117] After the loop ends, the enhanced features from each output stage are concatenated with the initial input features (first feature map) along the channel dimension to form a multi-scale fusion feature that incorporates multi-scale edge information, as expressed below:
[0118] ;
[0119] in, This indicates concatenation along the channel dimension. This represents a 1×1 fused convolution. This indicates the output of multi-scale edge enhancement features.
[0120] Furthermore, the generated multi-scale fused features are input into the fusion output unit, which includes a 1×1 convolutional layer for cross-channel information fusion and integration from channels at different cyclic scales. The higher number of channels after concatenation is compressed and reduced in dimensionality (e.g., from 128 channels to 64 channels) to control subsequent computational load. Simultaneously, batch normalization and ReLU activation functions can be applied after this convolutional layer to ensure numerical stability and introduce nonlinearity, ultimately yielding a detail feature map that is both rich in multi-scale edge details and meets lightweight requirements.
[0121] Ultimately, the edge analysis and enhancement module layer systematically extracts and enhances the microscopic textures and color gradient changes closely related to tea fermentation from the original image through a progressive processing flow of "downsampling initialization → multi-scale cyclic edge enhancement → fusion dimensionality reduction". This significantly improves the model's ability to perceive subtle visual cues such as the early stage of fermentation and local uneven areas.
[0122] In some embodiments, in step S320, the first feature map is subjected to multi-level cyclic processing by a multi-level cyclic enhancement unit to obtain multi-scale fused features, including the following step S410:
[0123] Step S410: Through a multi-level cyclic enhancement unit, iterative operations are performed on the image features of the first feature map until the iteration stopping condition is met, resulting in multiple enhanced features. These multiple enhanced features are then concatenated with the image features of the first feature map to obtain multi-scale fusion features. Each iteration operation includes:
[0124] Average pooling is performed on the image features of the first feature map to calculate the difference between the image features and the local average values of the image features, thereby obtaining the edge response features;
[0125] By performing convolution and activation processing on the edge response features, adaptive edge enhancement weights are obtained;
[0126] The edge response features are weighted with adaptive edge enhancement weights and then added back to the image features as residuals to obtain the enhanced features.
[0127] In this embodiment, a multi-level cyclic enhancement unit performs multiple iterative processes on the image features carried by the first feature map until a preset number of iterations is reached (i.e., an iteration stopping condition, such as a four-level loop). In each iteration, the following standardized operation sequence is executed:
[0128] First, a 3×3 average pooling operation is performed on the input feature of the current iteration (the first feature map is the input for the first iteration) to obtain a locally smoothed representation of the feature. Then, the difference between the input feature and its local mean is calculated; this difference represents the edge response feature, which characterizes high-frequency changes such as edges and textures at this scale. Next, this edge response feature is processed sequentially with 1×1 convolution, batch normalization, and a sigmoid activation function to generate a spatially adaptive edge enhancement weight map with values between 0 and 1. This weight adaptively emphasizes significant edge regions. Finally, the edge response feature and the edge enhancement weight map are multiplied element-wise to obtain weighted edge information. This information is then added back to the input feature of the current iteration by summing the residuals, thus outputting the enhanced feature for the current iteration. This enhanced feature is then used as the input feature for the next iteration to continue processing at subsequent scales.
[0129] After the loop ends, the multiple enhanced features output from each iteration are concatenated with the initial first feature map in the channel dimension to construct a multi-scale fusion feature that integrates edge information from different scales, from fine to coarse. This enables the model to gradually perceive and enhance fermentation-related details in different spatial ranges through iterative edge extraction and adaptive weighted enhancement, thereby significantly improving the ability to represent complex textures and color gradations in tea images.
[0130] In some embodiments, in step S120, a second semantic feature map is obtained by performing global dependency modeling processing through a second processing layer based on the first semantic feature map and the detail feature map, including the following steps S510 to S530:
[0131] Step S510: The first semantic feature map and the detail feature map are concatenated and fused along the channel dimension by the feature fusion unit to obtain the fused feature map;
[0132] Step S520: Spatial downsampling and channel expansion processing are performed on the fused feature map through the downsampling unit to obtain the second feature map;
[0133] Step S530: Perform global context modeling on the second feature map using the global context modeling unit to obtain the second semantic feature map.
[0134] In this embodiment, the second processing layer includes a feature fusion unit, a downsampling unit, and a global context modeling unit. Preferably, the feature fusion unit first concatenates the first semantic feature map from the first processing layer with the detail feature map from the edge analysis and enhancement module layer along the channel dimension. Since both have the same spatial size (e.g., 56×56), the concatenation operation directly superimposes their features along the channel direction, forming an intermediate feature representation with a significantly increased number of channels (e.g., concatenating 116 channels and 64 channels into 180 channels).
[0135] Furthermore, a lightweight 1×1 convolutional layer is used to integrate cross-channel information and regularize the dimensions of the concatenated features. For example, the number of channels is reduced to a dimension that matches the backbone network (such as 116 channels), thereby outputting a fused feature map that contains both high-level semantic information and low-level details. This achieves the first intersection of semantic and detailed information, providing a feature foundation for subsequent global understanding.
[0136] Furthermore, the fused feature map is processed by a downsampling unit, which includes a depthwise separable convolution with a stride of 2 or a dedicated downsampling building block (such as a BasicUnit with a stride of 2). Its function is to halve the spatial size of the feature map (e.g., from 56×56 to 28×28) while preserving key information, and at the same time double the number of channels (e.g., from 116 channels to 232 channels) to obtain a second feature map. This reduces the computational complexity of subsequent steps, expands the effective receptive field of each position in the feature map, and enhances the expressive power of the features by increasing the channel dimension, making them more suitable for deep global relationship modeling.
[0137] Furthermore, the second feature map is input into the global context modeling unit. This unit includes a processing module built upon a state-space model (such as AGCM-Block). Specifically, the processing module reshapes the two-dimensional spatial features into a one-dimensional sequence, generates dynamic system parameters through linear projection and discretization, and uses these parameters to calculate a compact global hidden state to aggregate information from the entire image. Then, a gating mechanism adaptively fuses this global context information back to each position in the sequence. Finally, the sequence is restructured into a two-dimensional feature map and fused with the module input through residual connections to obtain a second semantic feature map rich in global semantic information. This enables the network to establish long-range dependencies between any two regions in the image with approximately linear computational complexity, allowing the network to understand the correlation between local fermentation features and the overall fermentation state, such as evaluating the uniformity of tea color and texture distribution in the entire image.
[0138] Therefore, this embodiment effectively integrates local details with semantic information through a progressive processing of "feature splicing → downsampling and condensation → global modeling", and establishes a structured understanding of the global context of the image in the high-level feature space, thereby significantly improving the recognition network's ability to distinguish the overall state and uniformity of black tea fermentation.
[0139] In some embodiments, in step S530, global context modeling is performed on the second feature map by the global context modeling unit to obtain the second semantic feature map, including the following steps S610 to S660:
[0140] Step S610: Perform depthwise separable convolution and weighted fusion on the second feature map to obtain the first intermediate feature map;
[0141] Step S620: Perform global information enhancement on the first intermediate feature map to obtain the second intermediate feature map;
[0142] Step S630: Merge the first intermediate feature map and the second intermediate feature map to obtain the third intermediate feature map;
[0143] Step S640: Based on the preset activation function, perform multiple convolution processes and residual fusion on the third intermediate feature map to obtain the modeling feature map;
[0144] Step S650: Refine the modeling feature map to obtain a refined feature map;
[0145] Step S660: Obtain the second semantic feature map based on the refined feature map.
[0146] In this embodiment, the input second feature map is first processed using a global context modeling unit. Specifically, a 3×3 depthwise separable convolution is first performed on the second feature map to extract local spatial features, resulting in a preliminary local feature representation. Then, the original input features and this local feature are weighted and fused through a residual connection with learnable weights. This process preserves the original information of the input while injecting filtered local structures, resulting in a first intermediate feature map that combines original information with local details. This lays a stable feature foundation for subsequent global modeling.
[0147] Furthermore, the first intermediate feature map is reshaped from a two-dimensional spatial structure into a one-dimensional feature sequence, and layer normalization is performed to stabilize the data distribution. Then, parameters are generated through linear projection, and the global hidden state of the entire sequence is calculated based on an efficient mechanism in the State-Space Model (SSM) (such as HSM-SSD). The global hidden state aggregates information from all locations in the image.
[0148] Furthermore, a mixer consisting of a Sigmoid gate and a linear projection is used to modulate the global hidden state, and then its information is injected into the flattened input sequence through residual connections, so that the token at each position in the sequence can perceive the global context. In this way, the enhanced sequence is reshaped back into a two-dimensional spatial format to obtain the second intermediate feature map modulated by global information.
[0149] Furthermore, residual fusion is performed by adding the second intermediate feature map to the first intermediate feature map element by element. This allows for the direct integration of the high-level semantic information after global modulation with the original intermediate features rich in local details. This ensures that the global context enhances the features without losing the valuable local information extracted earlier, thereby outputting a third intermediate feature map with a richer information hierarchy.
[0150] Furthermore, deep feature extraction is performed on the third intermediate feature map. Specifically, a 3×3 depthwise separable convolution is first performed on the third intermediate feature map again to further extract features, and then the features are fused with the input through residual connections to obtain the output result. Finally, a multi-scale feature fusion mechanism is used to process the output result.
[0151] The multi-scale feature fusion mechanism includes: using three different scale convolution kernels of 1×1, 3×3 and 5×5 in parallel to capture feature patterns under different receptive fields, concatenating the outputs of the three branches and fusing them through 1×1 convolution, and then using 1×1 convolution to significantly increase the number of channels of the fused features (e.g., to 4 times the original dimension), then applying a smooth Mish activation function to introduce strong non-linear expressive power, and finally using 1×1 convolution to compress the number of channels back to the original dimension to obtain a deeply refined modeling feature map to achieve non-linear capacity expansion.
[0152] In one implementation of this embodiment, the global context modeling unit performs global context modeling processing on the input second feature map through the following steps:
[0153] Step 1: Depthwise separable convolution and residual fusion:
[0154] Specifically, regarding the input (Second feature map) First, depthwise separable convolution is performed, the expression of which is as follows:
[0155] ;
[0156] in, This represents the second feature map. express Depthwise separable convolution operations This represents local features.
[0157] Furthermore, a residual connection with learnable weights is performed, expressed as follows:
[0158] ;
[0159] in, This is a learnable scaling factor, initially set to 0.1. For local feature representation, This is the first intermediate feature map, and its output dimension is... .
[0160] Step 2, Serialization and Global Modeling:
[0161] Specifically, serialization and layer normalization operations are performed on the first intermediate feature map, and the expression is as follows:
[0162] ;
[0163] ;
[0164] in, This represents the operation of converting a two-dimensional feature map into a one-dimensional sequence. For layer normalization operation, For learnable scaling factor, This is the first intermediate feature map. This is a one-dimensional feature sequence of the first intermediate feature map. The one-dimensional feature sequence after layer normalization. Indicates the sequence length.
[0165] Furthermore, the parameter generation and discretization operations are performed, and their expressions are as follows:
[0166] ;
[0167] in, and These are the projection matrix parameters, , For discretization parameters, , To hide the state dimension.
[0168] Further, depthwise convolution is performed, with the following expression:
[0169] ;
[0170] ;
[0171] in, and These are the projection matrix parameters after depthwise convolution.
[0172] Furthermore, discretization and hidden state computation are performed, and their expressions are as follows:
[0173] ;
[0174] ;
[0175] in, This is the importance weight matrix. This is a matrix transpose operation. It is in a globally hidden state. This represents the learnable parameters.
[0176] Furthermore, the hidden state mixer is executed, with the following expression:
[0177] ;
[0178] ;
[0179] ;
[0180] in, For gating signals, For gating weights, For gated activation functions, This is the adjusted hidden state.
[0181] Furthermore, residual joins and reshaping are performed, expressed as follows:
[0182] ;
[0183] ;
[0184] in, This is the enhanced sequence map. This is the intermediate feature map corresponding to the current step. The reshaping operation restores the sequence to a spatial feature map.
[0185] Step 3: Feature Fusion and Secondary Residual Connection
[0186] Specifically, residual fusion is performed, and its expression is as follows:
[0187] ;
[0188] in, For learnable scaling factor, This is the intermediate feature map corresponding to the current step. This is the first intermediate feature map. The output dimension is the fused feature map corresponding to the current step. .
[0189] Step 4: Depthwise separable convolution and residual fusion:
[0190] Specifically, first, a depthwise separable convolution is performed, with the following expression:
[0191] ;
[0192] in, This is the intermediate feature map corresponding to the current step. This is the fused feature map corresponding to the current step.
[0193] Furthermore, residual fusion is performed, and its expression is as follows:
[0194] ;
[0195] in, For learnable scaling factor, The output dimension is the fused feature map corresponding to the current step. .
[0196] Step 5: Multi-scale feature fusion:
[0197] Specifically, first, a three-way parallel convolution is performed, the expression of which is as follows:
[0198] ;
[0199] ;
[0200] ;
[0201] Each convolution operation includes appropriate padding to maintain spatial dimensions. These are the outputs of the corresponding convolution processes.
[0202] Furthermore, feature concatenation and fusion operations are performed, expressed as follows:
[0203] ;
[0204] ;
[0205] in, The spliced multi-scale features This indicates a splicing operation. This is the intermediate feature map corresponding to the current step.
[0206] Step 6, FFN feedforward network:
[0207] Specifically, the dimensionality increase and Mish activation are performed first, and their expressions are as follows:
[0208] ;
[0209] ;
[0210] ;
[0211] in, Features after dimensional upgrading This is the result after processing with the Mish activation function.
[0212] Furthermore, the dimensionality reduction operation is performed, and its expression is as follows:
[0213] ;
[0214] in, The intermediate feature map corresponding to the current step.
[0215] Step 7: Final Residual Fusion
[0216] Specifically, the output features are calculated, and their expression is as follows:
[0217] ;
[0218] in, For learnable scaling factor, For output features, its output dimension .
[0219] Furthermore, the global context modeling unit performs global context modeling processing on the modeled feature map again, with the same process as the first global context modeling process, to further deepen and consolidate the effect of global context modeling. Then, a basic unit with a step size of 1 is used to perform lightweight local optimization and channel information reorganization on the features, achieving final feature refinement and obtaining a purer and more discriminative refined feature map.
[0220] Furthermore, downsampling and advanced semantic abstraction are performed on the refined feature map. Specifically, the spatial resolution of the feature map is gradually reduced through a series of basic units involving spatial downsampling, while the number of channels is continuously increased. This condenses the features into a highly abstract semantic representation, resulting in a second semantic feature map that contains both local details and global context, and has undergone high abstraction and condensation.
[0221] Therefore, this embodiment enables the network to efficiently establish long-range dependencies and deeply understand the complex relationship between the overall situation and local changes of tea images during the fermentation process through a series of precise and coordinated operations such as "local-global fusion, sequential modeling, multi-scale refinement, iterative refinement, and high-order abstraction". This provides the most critical high-level semantic features for the final accurate classification.
[0222] In some embodiments, in step S130, the second semantic feature map is classified and identified by a classification decision layer to obtain the fermentation degree identification result of the tea fermentation image to be identified, including the following steps S710 to S740:
[0223] Step S710: Perform global average pooling on the second semantic feature map to map the two-dimensional features of each channel in the second semantic feature map to a scalar value, and obtain a one-dimensional feature vector.
[0224] Step S720: Map the one-dimensional feature vector to a number of classification score vectors corresponding to the preset fermentation degree category;
[0225] Step S730: Normalize the classification score vector using an exponential function to obtain the predicted probability of each preset fermentation level category;
[0226] Step S750: Determine the fermentation degree category corresponding to the maximum predicted probability among the predicted probabilities of each preset fermentation degree category as the fermentation degree recognition result of the tea fermentation image to be identified.
[0227] In this embodiment, a global average pooling operation is first performed on the input second semantic feature map. Specifically, for each channel of the feature map, the average value of the feature values at all spatial locations (e.g., a 7×7 two-dimensional matrix) is calculated, thereby condensing the global spatial information of that channel into a single scalar. The scalar values of all channels are then concatenated to form a compact one-dimensional feature vector, thus eliminating the spatial dimension of the features and transforming the highly abstract feature map into a vector form suitable for traditional classifiers. This approach also possesses translation invariance and effectively reduces network parameters.
[0228] Furthermore, the obtained one-dimensional feature vector is input into a fully connected layer. This fully connected layer linearly projects the high-dimensional feature vector into a low-dimensional space through a weight matrix and a bias term. The dimension of the low-dimensional space strictly corresponds to the number of preset fermentation level categories (for example, it is mapped to a 4-dimensional vector, representing "unfermented", "lightly fermented", "mediumly fermented" and "moderately fermented" respectively), so as to obtain the value of each dimension, which represents the original classification score initially calculated by the network for the corresponding category.
[0229] Furthermore, the classification score vector output by the fully connected layer is input into the Softmax function (i.e., the normalized exponential function). Through exponential operation and normalization, the original scores of each category are converted into a probability distribution to ensure that the output value of each category falls within the (0,1) interval and the sum of the probabilities of all categories is 1, thereby obtaining a clear and interpretable prediction probability.
[0230] Finally, by using preset screening criteria (e.g., selecting the maximum value from the predicted probabilities of all preset categories), the fermentation degree category that meets the preset screening criteria is selected from the predicted probabilities of all preset categories, which is the final fermentation degree recognition result of the tea fermentation image to be identified.
[0231] Thus, this embodiment completes the key transformation from complex features to clear categories through "spatial aggregation → linear discrimination → probability normalization → decision output". This not only ensures the mathematical rigor and interpretability of the discrimination process, but its lightweight structure also facilitates efficient deployment and real-time inference in industrial embedded systems.
[0232] like Figure 4As shown in some embodiments of this application, a tea fermentation degree recognition system is provided for use in electronic devices. The electronic devices integrate a tea fermentation recognition network, which includes a first processing layer, an edge analysis and enhancement module layer, a second processing layer, and a classification decision layer. The system includes a first module 410, a second module 420, and a third module 430. Specifically:
[0233] The first module 410 is used to input the tea fermentation image to be identified into the tea fermentation recognition network, extract features from the tea fermentation image to be identified through the first processing layer to obtain the first semantic feature map, and perform multi-scale processing and edge enhancement processing on the tea fermentation image to be identified through the edge analysis and enhancement module layer to obtain the detail feature map.
[0234] The second module 420 is used to perform global dependency modeling processing on the first semantic feature map and the detail feature map through the second processing layer to obtain the second semantic feature map.
[0235] The third module 430 is used to classify and recognize the second semantic feature map through the classification decision layer to obtain the fermentation degree recognition result of the tea fermentation image to be identified.
[0236] It should be noted that the tea fermentation degree identification system provided in this embodiment is based on the same inventive concept as the tea fermentation degree identification method described above. Therefore, the relevant content of the tea fermentation degree identification method described above also applies to the content of the tea fermentation degree identification system, and will not be repeated here.
[0237] This application embodiment also provides a tea fermentation degree identification device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-mentioned tea fermentation degree identification method.
[0238] like Figure 5 , Figure 5 This is a schematic diagram of the hardware structure of the tea fermentation degree identification device provided in this application embodiment. The tea fermentation degree identification device includes:
[0239] At least one battery;
[0240] At least one memory;
[0241] At least one processor;
[0242] At least one program;
[0243] The program is stored in memory, and the processor executes at least one program to implement the tea fermentation degree identification method described above in this disclosure.
[0244] This tea fermentation degree recognition device can be used on any smart terminal, including mobile phones, tablets, personal digital assistants (PDAs), and in-vehicle computers.
[0245] The tea fermentation degree identification device according to the embodiments of this application will be described in detail below.
[0246] The processor 1600 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this disclosure.
[0247] The memory 1700 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 1700 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1700 and is called and executed by the processor 1600 to perform a tea fermentation degree identification method according to an embodiment of this disclosure.
[0248] The input / output interface 1800 is used to implement information input and output.
[0249] The communication interface 1900 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0250] Bus 2000 transmits information between various components of the device (e.g., processor 1600, memory 1700, input / output interface 1800, and communication interface 1900);
[0251] The processor 1600, memory 1700, input / output interface 1800 and communication interface 1900 are connected to each other within the device via bus 2000.
[0252] This disclosure also provides a storage medium, which is a computer-readable storage medium storing computer-executable instructions for causing a computer to execute the above-described method for identifying the degree of tea fermentation.
[0253] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0254] The embodiments described in this disclosure are for the purpose of more clearly illustrating the technical solutions of this disclosure and do not constitute a limitation on the technical solutions provided by this disclosure. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by this disclosure are also applicable to similar technical problems.
[0255] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this disclosure, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0256] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0257] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0258] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any related variations, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0259] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0260] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0261] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0262] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0263] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0264] The above is a detailed description of the preferred embodiments of this application. However, the embodiments of this application are not limited to the above-described implementation methods. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the embodiments of this application. All such equivalent modifications or substitutions are included within the scope defined by the claims of the embodiments of this application.
[0265] The embodiments of this application have been described in detail above with reference to the accompanying drawings. However, this application is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of this application.
Claims
1. A method for identifying the degree of tea fermentation, characterized in that, The method is applied to an electronic device that integrates a tea fermentation recognition network, the tea fermentation recognition network comprising a first processing layer, an edge analysis and enhancement module layer, a second processing layer, and a classification decision layer; the method includes: The tea fermentation image to be identified is input into the tea fermentation recognition network. The first processing layer extracts features from the tea fermentation image to be identified to obtain a first semantic feature map. The edge analysis and enhancement module layer performs multi-scale processing and edge enhancement processing on the tea fermentation image to be identified to obtain a detail feature map. Based on the first semantic feature map and the detail feature map, a second semantic feature map is obtained by performing global dependency modeling through the second processing layer. The classification decision layer classifies and identifies the second semantic feature map to obtain the fermentation degree identification result of the tea fermentation image to be identified. The edge analysis and enhancement module layer includes an initial convolutional unit, a multi-level recurrent enhancement unit, and a fusion output unit; the multi-scale processing and edge enhancement processing of the tea fermentation image to be identified through the edge analysis and enhancement module layer to obtain a detailed feature map includes: The initial convolutional unit is used to perform convolutional downsampling and channel expansion processing on the tea fermentation image to be identified to obtain a first feature map. The first feature map is processed through multi-level cyclic enhancement units to obtain multi-scale fused features. The multi-scale fusion features are processed by channel fusion and dimensionality reduction through the fusion output unit to obtain the detail feature map. The process of performing multi-level cyclic processing on the first feature map through the multi-level cyclic enhancement unit to obtain multi-scale fused features includes: The multi-level cyclic enhancement unit iterates over the image features of the first feature map until the iteration stop condition is met, resulting in multiple enhanced features. These enhanced features are then concatenated with the image features of the first feature map to obtain the multi-scale fusion feature. Each iteration includes: An average pooling operation is performed on the image features of the first feature map to calculate the difference between the image features and the local average value of the image features, thereby obtaining the edge response features; The edge response features are convolutionally and activated to obtain adaptive edge enhancement weights; The edge response features are weighted with the adaptive edge enhancement weights, and then added back to the image features as residuals to obtain the enhancement features; The second processing layer includes a feature fusion unit, a downsampling unit, and a global context modeling unit.
2. The method for identifying the degree of tea fermentation according to claim 1, characterized in that, The first processing layer includes a first processing unit and a second processing unit; the step of extracting features from the tea fermentation image to be identified through the first processing layer to obtain a first semantic feature map includes: The first processing unit performs downsampling processing on the tea fermentation image to be identified to obtain a low-level feature map of the tea fermentation image to be identified. Based on the dimension of the low-level feature map, the low-level feature map is divided into a first sub-feature map and a second sub-feature map; Spatial features are extracted from the first sub-feature map through the first branch in the second processing unit to obtain the first sub-semantic feature map; The second sub-semantic feature map is obtained by performing an identity mapping on the second sub-feature map through the second branch in the second processing unit; The first sub-semantic feature map and the second sub-semantic feature map are concatenated to obtain the first semantic feature map.
3. The method for identifying the degree of tea fermentation according to claim 1, characterized in that, The step of obtaining a second semantic feature map by performing global dependency modeling through the second processing layer based on the first semantic feature map and the detail feature map includes: The first semantic feature map and the detail feature map are concatenated and fused along the channel dimension by the feature fusion unit to obtain a fused feature map. The fused feature map is spatially downsampled and channel expanded using the downsampling unit to obtain a second feature map. The second semantic feature map is obtained by performing global context modeling on the second feature map through the global context modeling unit.
4. The method for identifying the degree of tea fermentation according to claim 3, characterized in that, The step of performing global context modeling on the second feature map through the global context modeling unit to obtain the second semantic feature map includes: The second feature map is subjected to depthwise separable convolution and weighted fusion to obtain the first intermediate feature map; Global information enhancement is performed on the first intermediate feature map to obtain the second intermediate feature map; The first intermediate feature map and the second intermediate feature map are fused to obtain the third intermediate feature map; Based on a preset activation function, the third intermediate feature map is subjected to multiple convolutional processes and residual fusion to obtain a modeling feature map. The modeling feature map is refined to obtain a refined feature map; The second semantic feature map is obtained based on the refined feature map.
5. The method for identifying the degree of tea fermentation according to claim 1, characterized in that, The step of classifying and recognizing the second semantic feature map through the classification decision layer to obtain the fermentation degree recognition result of the tea fermentation image to be identified includes: A global average pooling operation is performed on the second semantic feature map to map the two-dimensional feature of each channel in the second semantic feature map to a scalar value, resulting in a one-dimensional feature vector; The one-dimensional feature vector is mapped to a number of classification score vectors corresponding to a preset fermentation degree category; The classification score vector is processed by a normalized exponential function to obtain the predicted probability of each preset fermentation degree category; The fermentation degree category corresponding to the maximum predicted probability among the predicted probabilities of each preset fermentation degree category is determined as the fermentation degree recognition result of the tea fermentation image to be identified.
6. A tea fermentation degree identification system, characterized in that, The system is applied to electronic devices, which integrate a tea fermentation recognition network. The tea fermentation recognition network includes a first processing layer, an edge analysis and enhancement module layer, a second processing layer, and a classification decision layer. The system comprises: The first module is used to input the tea fermentation image to be identified into the tea fermentation identification network, extract features from the tea fermentation image to be identified through the first processing layer to obtain a first semantic feature map, and perform multi-scale processing and edge enhancement processing on the tea fermentation image to be identified through the edge analysis and enhancement module layer to obtain a detail feature map. The second module is used to perform global dependency modeling processing on the first semantic feature map and the detail feature map through the second processing layer to obtain the second semantic feature map. The third module is used to classify and identify the second semantic feature map through the classification decision layer to obtain the fermentation degree identification result of the tea fermentation image to be identified; The edge analysis and enhancement module layer includes an initial convolutional unit, a multi-level recurrent enhancement unit, and a fusion output unit; the multi-scale processing and edge enhancement processing of the tea fermentation image to be identified through the edge analysis and enhancement module layer to obtain a detailed feature map includes: The initial convolutional unit is used to perform convolutional downsampling and channel expansion processing on the tea fermentation image to be identified to obtain a first feature map. The first feature map is processed through multi-level cyclic enhancement units to obtain multi-scale fused features. The multi-scale fusion features are processed by channel fusion and dimensionality reduction through the fusion output unit to obtain the detail feature map. The process of performing multi-level cyclic processing on the first feature map through the multi-level cyclic enhancement unit to obtain multi-scale fused features includes: The multi-level cyclic enhancement unit iterates over the image features of the first feature map until the iteration stop condition is met, resulting in multiple enhanced features. These enhanced features are then concatenated with the image features of the first feature map to obtain the multi-scale fusion feature. Each iteration includes: An average pooling operation is performed on the image features of the first feature map to calculate the difference between the image features and the local average value of the image features, thereby obtaining the edge response features; The edge response features are convolutionally and activated to obtain adaptive edge enhancement weights; The edge response features are weighted with the adaptive edge enhancement weights, and then added back to the image features as residuals to obtain the enhancement features; The second processing layer includes a feature fusion unit, a downsampling unit, and a global context modeling unit.
7. A device for identifying the degree of tea fermentation, characterized in that, The device includes at least one control processor and a memory for communicatively connecting to the at least one control processor; the memory stores instructions executable by the at least one control processor, which, when executed by the at least one control processor, enable the at least one control processor to perform a method for identifying the degree of tea fermentation as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform a method for identifying the degree of tea fermentation as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Remote sensing image semantic segmentation method based on local feature enhancement
CN121147512A
Creation method and apparatus for tea leaf disease recognition model, and device and storage medium
WO2025255986A1