A tea disease detection method based on an attention mechanism

By improving the YOLOv5 model to YOLOv5-SE and introducing the SE attention mechanism and multi-scale feature fusion module, the problem of insufficient feature representation in tea disease detection is solved, and more efficient and accurate disease identification is achieved.

CN119579527BActive Publication Date: 2026-03-31YUNNAN MINZU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing tea disease detection methods suffer from insufficient model feature representation capabilities, inadequate feature selection, and weak response to fine-grained features, resulting in low detection accuracy and efficiency.

Method used

The YOLOv5-SE model is adopted. The C3 module is replaced with the seC3 module which integrates the SE attention mechanism, and a coordinate attention mechanism is added at the end of the model. Combined with the multi-scale feature fusion module, the feature extraction and response capabilities are optimized.

Benefits of technology

It improves the accuracy and robustness of tea disease detection, enabling more accurate identification of disease areas and categories, and enhancing the model's detection performance in complex backgrounds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119579527B_ABST
    Figure CN119579527B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of computer vision and agricultural information technology, and specifically relates to a tea disease detection method based on an attention mechanism. The detection method comprises: using an improved YOLOv5s model as a basic model; introducing an SE attention mechanism into the YOLOv5s model backbone network, and replacing the original C3 module with an seC3 module; adding a coordinate attention mechanism at the end of the backbone network; collecting tea disease image data, and preprocessing the collected tea disease image data; using a labeling tool to label the disease area of the preprocessed tea disease image data to generate a labeled data set; training the constructed YOLOv5-SE model using the labeled data set to obtain the model weight after training; and applying the trained YOLOv5-SE model to unlabeled tea disease images for disease detection and identification. This method can better capture and represent the key features in the tea disease image, thereby improving the accuracy and reliability of disease detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of computer vision and agricultural information technology, specifically relating to a method for detecting tea diseases based on an attention mechanism. Background Technology

[0002] Timely detection and identification of tea diseases are crucial for pest and disease control, providing a basis for developing appropriate control measures. Traditional methods of tea disease identification rely primarily on manual observation and experience, resulting in low accuracy and efficiency, and a high risk of misdiagnosis and missed diagnosis. While professional diagnosis can improve accuracy, it increases production costs, and the limited number of professionals makes it impossible to conduct on-site inspections in all tea gardens. With the development of automation technology, multi-sensor fusion methods for disease detection have long been applied in practice, involving model building, information collection, feature extraction, information fusion, and detection and discrimination to identify crop pests and diseases. Drones are also frequently used in pest and disease monitoring, providing efficient, accurate, and comprehensive monitoring capabilities. However, the images and information acquired by these methods are still too complex, and there are still gaps in achieving accurate and efficient identification of crop pests and diseases.

[0003] Currently, with the development of computer vision and deep learning technologies, using these technologies to detect and identify tea diseases has become a new trend. By using deep learning models, features can be automatically extracted from images of tea diseases, enabling disease classification and localization, and improving the accuracy and efficiency of detection and identification. Li Wujie et al. used an improved YOLOv5s model with an added Van Block module to detect citrus pests and diseases. Compared to the original model, its detection accuracy was improved while controlling the model size well. However, the model covers a relatively small sample size, and diseases outside the sample still require manual identification. Chen Yu et al. proposed a YOLOv5-CBM model based on improved YOLOv5s. This method improves detection speed while optimizing model size and reducing computer costs. It also optimizes feature extraction, feature fusion, and small target detection. However, this model still has shortcomings in detection speed and real-time performance. Yang Xiaowei et al. proposed a tea disease identification system based on convolutional neural networks. This system can detect 18 diseases in tea images and can effectively help tea farmers quickly identify tea diseases. However, it places excessive demands on the computing power of the equipment. The aforementioned deep learning models cannot accurately extract key information for detecting and identifying tea diseases when faced with massive amounts of information, leading to information overload and affecting the accuracy and efficiency of identification. Furthermore, due to the complex background of tea disease data, traditional CNN networks cannot efficiently perform identification. Summary of the Invention

[0004] (a) Technical problems to be solved

[0005] This invention addresses the above-mentioned problems by proposing an attention-based method for detecting tea diseases. The aim is to solve technical issues such as insufficient model feature representation capabilities, inadequate feature selection, and weak response to fine-grained features, thereby improving the overall performance of the tea disease detection model.

[0006] (II) Technical Solution

[0007] To achieve the above objectives, the first aspect of the present invention provides a tea disease detection method based on an attention mechanism, which uses the YOLOv5-SE model to detect tea diseases. The method for constructing the YOLOv5-SE model includes: replacing the C3 module in the YOLOv5 model with a seC3 module that incorporates the SE attention mechanism; and adding a coordinate attention mechanism at the end of the YOLOv5 model.

[0008] The SE attention mechanism includes the following steps:

[0009] Convolution is performed on a given feature map to form a new feature map;

[0010] Perform global average pooling on the feature map to generate a feature vector;

[0011] The feature vector is processed through two fully connected layers and a nonlinear activation function to generate channel weight values.

[0012] The channel weight values ​​are applied to each channel of the original feature map to perform feature weighting.

[0013] The detection method includes:

[0014] Collect image data of tea diseases and preprocess the collected image data of tea diseases;

[0015] The annotation tool was used to identify the diseased areas in the preprocessed tea disease image data, generating an annotated dataset.

[0016] The constructed YOLOv5-SE model was trained using the labeled dataset to obtain the trained model weights;

[0017] The trained YOLOv5-SE model was applied to unlabeled tea disease images for disease detection and identification.

[0018] Furthermore, convolution is performed on the given feature map to form the feature map calculation formula:

[0019]

[0020] In the formula, * represents the convolution operation, U c Given a feature map X, convolution Frt The feature map obtained by global average pooling; V c V represents a single filter used in a convolution operation; X represents a set of filters; c s represents a channel of the original input feature map; s and c′ represent the range markers for the summation operation, indicating the summation range;

[0021] The formula for calculating a feature vector by performing global average pooling on the output feature map is as follows:

[0022]

[0023] In the formula, Z c F represents the feature vector obtained after global average pooling; sq H and W represent the height and width of the feature maps, respectively; U(i,j) represents the feature map U. c The pixel value at position (i,j);

[0024] The feature vector is processed by two fully connected layers and a nonlinear activation function. The formula for calculating the channel weights is as follows:

[0025] s = F ex (z,W)=σ(g(z,W))=σW2δ(W1z);

[0026] In the formula, s represents the channel weight value obtained after processing the feature vector Z by two fully connected layers W1 and W2 and the activation function; z is the obtained feature vector Z. c ; δ represents the ReLU activation function; σ represents the Sigmoid activation function; F ex Indicates the convolution operation;

[0027] The formula for calculating the feature weighting process, which applies channel weights to each channel of the original feature map, is as follows:

[0028] X~ c =F scale (U c ,s c ) = s c U c ;

[0029] In the formula, X~ c For the obtained feature set; F scale For convolution operation; s c This is the calculated weight vector.

[0030] Furthermore, the steps for integrating the SE module into specific layers of YOLOv5 include:

[0031] A target detection model using the SE attention mechanism is provided, comprising a backbone network, a neck network, and a head network;

[0032] At least one convolutional layer is selected in the backbone network for feature extraction;

[0033] An SE module is integrated after the selected convolutional layer. The SE module includes a squeezing step and an excitation step.

[0034] The compression step is performed, which compresses the feature map output by the convolutional layer through global average pooling to form a global feature descriptor;

[0035] The activation step involves processing the global feature descriptor using two fully connected layers to generate weights for each channel.

[0036] The generated weights are applied to the feature map output by the convolutional layer to adjust the feature response of each channel, forming a weighted feature map;

[0037] The weighted feature maps are passed to the neck network for feature fusion and scale adjustment.

[0038] The feature map, after feature fusion and scale adjustment, is output to the head network for object detection and classification.

[0039] Furthermore, the detection method also includes adding a multi-scale feature fusion module between the backbone network and the neck network of the YOLOv5 model; the multi-scale feature fusion module includes the following steps:

[0040] Upsample and downsample feature maps of different scales to generate feature maps of the same scale;

[0041] Feature maps of the same scale are summed element by element to form a fused feature map;

[0042] Perform a convolution operation on the fused feature map to generate a new feature map.

[0043] Furthermore, the steps of upsampling feature maps at different scales include:

[0044] Obtain the original feature map from the input feature map;

[0045] The original feature map is enlarged using bilinear interpolation to generate a feature map with the same scale as the target.

[0046] Perform convolution on the magnified feature map to generate a new feature map;

[0047] The steps for downsampling feature maps at different scales include:

[0048] Obtain the original feature map from the input feature map;

[0049] The original feature map is reduced in size by average pooling to generate a feature map with the same scale as the target.

[0050] The reduced feature map is convolved to generate a new feature map.

[0051] Furthermore, during the model evaluation process, four metrics—precision, recall, F1 score, and mean precision—were used to evaluate the model's performance.

[0052] Furthermore, the dataset includes 6,558 images containing eight different types of tea diseases: tea leaves damaged by tea gnats, tea leaves damaged by spider mites, tea sooty mold, tea rust, tea white spot, algal leaf spot, gray blight, and brown blight.

[0053] Furthermore, the acquired images are preprocessed, including cropping, rotating, stretching, and adjusting contrast and brightness.

[0054] Furthermore, the preprocessed images were labeled using a labeling tool and divided into training, validation, and test sets in a 6:3:1 ratio.

[0055] Furthermore, the training process of the YOLOv5-SE model includes training the dataset using initial training weights, iterating the training 150 times, so that the training accuracy of the model reaches 90.4%, the recall rate reaches 92.1%, and the mean precision reaches 87.6%.

[0056] (III) Beneficial Effects

[0057] Compared with existing technologies, this invention provides a tea disease detection method based on an attention mechanism. By introducing the Squeeze-and-Excitation (SE) attention mechanism, each channel of the feature map is weighted to enhance important features and suppress unimportant ones. This process helps the model better capture and represent key features in tea disease images, thereby improving the accuracy and reliability of disease detection. The SE attention mechanism generates a global feature vector through global average pooling, and then generates channel weight values ​​through two fully connected layers and a nonlinear activation function. This process effectively selects the most useful feature channels for disease detection, thereby optimizing the model's feature selection ability and improving its robustness in complex backgrounds. By weighting the feature map, the model can dynamically adjust its response to different features, enabling more accurate identification of disease regions and categories in tea disease detection. This dynamic weighting method significantly improves the model's ability to capture fine-grained features, thus enhancing detection performance. Attached Figure Description

[0058] Figure 1 This is a structural diagram of an SE attention mechanism disclosed in this application.

[0059] Figure 2 This application discloses a SE attention mechanism process.

[0060] Figure 3 This is a structural diagram of a YOLOv5-SE disclosed in this application.

[0061] Figure 4 This is a distribution map of the number of disease images disclosed in this application.

[0062] Figure 5 This is an example image of a single sample of a different disease disclosed in this application.

[0063] Figure 6 This application discloses a graph showing the mean changes in training result precision, recall, F1 score, and average precision.

[0064] Figure 7 This is a loss change curve disclosed in this application.

[0065] Figure 8 This is an average F1 variation curve disclosed in this application.

[0066] Figure 9 This is a PR curve diagram disclosed in this application. Detailed Implementation

[0067] The present invention will now be described in detail with reference to the accompanying drawings, and the technical solutions in the embodiments of the present invention will be clearly and completely described. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0068] The YOLOv5 network structure mainly consists of a backbone network and several detection heads. Its backbone network uses the CSPDarknet structure based on the Darknet extractor. YOLOv5 employs an anchor-free detection method, reducing the number of visible boxes and computational cost. Furthermore, its feature fusion mechanism allows it to adjust based on image features, better adapting to size variations. The main components of the YOLOv5 model include: a backbone network, a neck network, and a head network.

[0069] Background Network: A pre-trained network used to extract rich feature representations for images. It helps reduce the spatial resolution of images and increase their feature (channel) resolution. YOLOv5 uses CSP-Darknet53 as its background network. CSP-Darknet53 is a convolutional network of Darknet53 used as the background network in YOLOv3, on which the Cross Stage Partial (CSP) network strategy is applied.

[0070] The Neck network is used to extract the feature pyramid. It helps the model generalize well to objects of different sizes and scales. YOLOv5's Neck network combines the architecture of Feature Pyramid Networks (FPNs) and Pixel Aggregation Networks (PANs), essentially extending the concepts of feature pyramids and pixel aggregation.

[0071] Head Network: The head network performs the final stage operations. It applies anchor boxes to the feature maps and presents the final output: class, object score, and bounding box. YOLOv5 uses the same head network as YOLOv3 and YOLOv4. It consists of three convolutional layers that predict the bounding box location (x, y, height, width), score, and object class. The YOLOv5 model has four main versions: Small(s), Medium(m), Large(l), and Extra(x), with different sizes and performance metrics. The method in this embodiment improves upon YOLOv5s, making it more convenient, faster, and real-time compared to other versions, facilitating future deployment on mobile devices such as smartphones for detection.

[0072] To achieve more efficient and accurate tea disease localization, this embodiment improves the backbone network of the YOLOv5 model, constructing a YOLOv5-SE model. First, all C3 modules in the backbone network are replaced with seC3 modules that incorporate the SE attention mechanism. Then, coordinate attention is added at the ends. The improved structural model is shown below. Figure 3 As shown.

[0073] Attention mechanisms mimic human attention characteristics to achieve more efficient resource allocation. By introducing attention mechanisms, deep learning networks can focus on important information, which helps improve network performance and is now widely used in computer vision. SE attention mechanism is an attention mechanism introduced in convolutional neural networks (CNNs) (see...). Figure 1 The SE module uses a weight matrix to assign different weights to channels at different locations in the image, thereby enabling the extraction of important feature information.

[0074] The main operations of the SE module include squeezing and excitation. Squeezing compresses the feature map into a single feature vector using global average pooling. The excitation mechanism learns and generates a channel weight vector through two fully connected layers and a non-linear activation function. This weight vector is applied to each channel of the original feature map for feature weighting. For a detailed explanation of the SE attention mechanism's structure, see [link to documentation]. Figure 2 The flowchart is shown as follows Figure 3 The specific implementation steps are as follows:

[0075] 1) Given a feature map X (of size X×W×C), pass it through the convolution operator F. rt Global average pooling is used to form the feature map U:

[0076]

[0077] In the formula, * represents the convolution operation, U c Given a feature map X, convolution F rt The feature map obtained by global average pooling; V c V represents a single filter used in a convolution operation; X represents a set of filters; c represents a channel of the original input feature map; s and c′ represent the range markers for the summation operation, indicating the summation range.

[0078] 2) Further perform global average pooling on the feature map U to generate a 1×1×C feature vector Z. c This is done to obtain a value with a global receptive field of channel C; in other words, it compresses the information of each channel into a single value, thus extracting the global information of the entire image.

[0079]

[0080] In the formula, Z c F represents the feature vector obtained after global average pooling; sq H and W represent the height and width of the feature maps, respectively; U(i,j) represents the feature map U. c The pixel value at position (i,j).

[0081] 3) Apply the vector Z obtained in the previous step through two fully connected layers W1 and W2. c Further processing yields the required channel weight values ​​s. Specifically, firstly, the first fully connected layer W1 maps U to a low-dimensional space, then ReLU activation is applied, and finally, the second fully connected layer W2 maps it back to its original size. This process generates a new channel weight vector s.

[0082] s = F ex (z,W)=σ(g(z,W))=σW2δ(W1z)

[0083] In the formula, s represents the channel weight value obtained after processing the feature vector Z by two fully connected layers W1 and W2 and the activation function; z is the obtained feature vector Z. c ; δ represents the ReLU activation function; σ represents the Sigmoid activation function; F ex This indicates a convolution operation.

[0084] 4) Assign weights to the feature map U using the weight vector s generated in the previous step to obtain the desired feature map, whose size is exactly the same as the original feature map. In this way, by adjusting the importance of each channel, key features are strengthened while unimportant features are suppressed.

[0085] X~ c =F scale (U c ,s c ) = s c U c

[0086] In the formula, X~ c For the obtained feature set; F scale For convolution operation; s c This is the calculated weight vector.

[0087] Through these improvements, the YOLOv5-SE model can more effectively perform the detection of tea diseases. The detection methods include:

[0088] Collect image data of tea diseases and preprocess the collected image data of tea diseases;

[0089] The annotation tool was used to identify the diseased areas in the preprocessed tea disease image data, generating an annotated dataset.

[0090] The constructed YOLOv5-SE model was trained using the labeled dataset to obtain the trained model weights;

[0091] The trained YOLOv5-SE model was applied to unlabeled tea disease images for disease detection and identification.

[0092] In a preferred embodiment, the steps of integrating the SE module into a specific layer of YOLOv5 include:

[0093] This technical solution describes an object detection model using the SE attention mechanism, comprising a backbone network, a neck network, and a head network. First, at least one convolutional layer for feature extraction is selected in the backbone network, followed by an SE module. The SE module includes two steps: a squeezing step and an activation step. The squeezing step compresses the feature maps output by the convolutional layers using global average pooling to form a global feature descriptor. The activation step processes this feature descriptor using two fully connected layers to generate weights for each channel. These weights are applied to the feature maps output by the convolutional layers to adjust the feature responses of each channel, forming a weighted feature map. Then, the weighted feature map is passed to the neck network for feature fusion and scaling, and finally, the adjusted feature map is output to the head network for object detection and classification. This entire process enhances the model's focus on important features, improving the accuracy and efficiency of object detection.

[0094] In the attention-based tea disease detection method, a multi-scale feature fusion module is added between the backbone and neck network of the YOLOv5 model to further enhance the model's ability to detect disease features at different scales. Specifically, this module first upsamples and downsamples feature maps at different scales, adjusting them to the same scale to effectively fuse features at different levels. Then, these feature maps at the same scale are added element-wise to form a fused feature map, enhancing the diversity and robustness of feature representation. Finally, a convolution operation is performed on the fused feature map to generate a new feature map, which helps to extract richer and more accurate features. This process enables the model to better capture and identify the multi-scale features of tea diseases, improving detection accuracy and stability.

[0095] The upsampling and downsampling processes are as follows:

[0096] The upsampling step enlarges the original feature map using bilinear interpolation and generates a new feature map through convolution, ensuring that important details and semantic features are preserved during the enlargement process. The downsampling step shrinks the original feature map using average pooling and generates a new feature map through convolution, ensuring minimal information loss and extraction of useful features during the shrinking process. Through these specific steps, the multi-scale feature fusion module effectively adjusts feature maps of different scales to the same scale, thereby achieving effective fusion of multi-scale features, enhancing the model's ability to detect disease features at different scales, and improving detection accuracy and robustness.

[0097] The above scheme can be explained and illustrated with a specific example below:

[0098] Specifically, data can be collected through Google Image Search. For example, a total of 6,558 images were found, including images of eight diseases: tea leaves infested by tea mosquito bugs, tea leaves infested by red spider mites, black rot of tea, tea leaf rust, white spot of tea, algal leaf spot, grey blight, and brown blight. See the detailed distribution below. Figure 4 See individual sample examples. Figure 5 .

[0099] The images were preprocessed and cropped to 256×256 pixels. Due to varying disease development, the number of photos, and different shooting angles, to avoid overfitting or underfitting and improve model detection accuracy, specific image operations were performed, including rotation, stretching, increasing contrast, and adjusting brightness. Diseases were then labeled using a labeling tool (LabelImg). The images were divided into training, validation, and test sets in a 6:3:1 ratio.

[0100] The following analysis and statistics will be based on an example:

[0101] The experimental setup uses a 64-bit Windows 11 operating system, an Intel Core i7-12700H processor, 16GB of RAM, and an RTX 3060 graphics card with 6GB of VRAM. The model uses Python version 3.11 and PyTorch version 2.2.1. Based on the hardware specifications, the parameters are shown in Table 1 below.

[0102] Table 1 Model Parameter Settings

[0103]

[0104] After the model is built and run, its performance is evaluated to measure its effectiveness. Based on the evaluation results, the model parameters can be optimized, its advantages and disadvantages analyzed, and different models compared. This paper uses four metrics to evaluate the model: precision, recall, F1 score, and mean average precision (mAP).

[0105] Precision: Also known as accuracy, it is the proportion of samples that were predicted to be positive but were actually positive. The formula for calculating precision is:

[0106]

[0107] Recall: Also known as the hit rate or recall rate, it represents the proportion of all positive samples that are correctly predicted. It reflects the model's detection coverage of positive samples. The formula for calculating recall is:

[0108]

[0109] In the formula, TP is the number of positive samples predicted as positive, FP is the number of negative samples predicted as positive, and FN is the number of positive samples predicted as negative.

[0110] F1 Score: The F1 score is the harmonic mean of precision and recall. It considers both the accuracy and coverage of the model's predictions of positive examples. The F1 score ranges from 0 to 1. A higher F1 score indicates a better classification performance. The formula for calculating the F1 score is:

[0111]

[0112] Mean Average Precision (mAP): This is the average of the average precision (AP) across all classes. AP is the area under the PR curve. The PR curve is a curve showing the ratio of precision to recall calculated based on different thresholds. mAP reflects the model's detection performance and generalization ability across different classes. A higher mAP indicates better detection performance. The calculation formula is as follows:

[0113]

[0114] In the formula, ρ is used to calculate the area enclosed by the PR curve and the coordinate axes, ρ(r) is the accuracy function of the PR curve, and dr is the differential element of the PR curve.

[0115] The training weights were initialized using YOLOv5, and the dataset was trained. The results are as follows: Figure 6 It indicates that the accuracy training performance is as follows: Figure 6The mean precision (mAP) of 0.5 represents the mAP when the intersection-over-union (IoU) between the ground truth bounding box and the predicted bounding box is 0.5. Observing the graph, we can see that the curve gradually flattens out as the number of iterations approaches 150, showing no signs of overfitting or underfitting. Ultimately, the model's training accuracy reached 90.4%, the recall was 92.1%, and the mAP_0.5 was 87.6%. Figure 7 The curves showing the changes in training and validation losses are displayed. The smaller the classification loss, the better the classification effect; the smaller the confidence loss, the more accurate the target judgment ability.

[0116] As can be seen from the figure, after 150 rounds of training, the loss tends to stabilize, with the loss value being below 0.05, indicating that the model has good classification and localization capabilities. Figure 8 The average F1 accuracy curve represents the model's prediction accuracy and coverage of positive examples. As can be seen from the table, the F1 accuracy tends to stabilize after 200 rounds, and the final F1 accuracy is close to 0.9, indicating that the model has a good classification effect. Figure 9 The curves are PR curves, which show that the area under the curves for different types of diseases is close to 1, indicating that the model has a good recognition effect.

[0117] To further evaluate the performance improvement effect of the SE attention mechanism on the model, a control experiment was conducted, and the results are shown in Table 2. The table shows that, compared with other models, the YOLOv5-SE model has higher mAP, recall, and precision, indicating that the YOLOv5-SE model performs better, especially compared to traditional CNN models.

[0118] Table 2 Comparison of the effects of different models

[0119]

[0120]

[0121] To address the challenges of identifying tea diseases and the resulting low detection efficiency in complex environments, a detection model based on the SE attention mechanism, improved upon YOLOv5, is proposed. Experiments demonstrate that this model effectively detects diseases. Adding the SE attention mechanism to the backbone network effectively suppresses irrelevant information and improves recognition accuracy. Furthermore, a multi-scale feature fusion module is added between the backbone and neck network of the YOLOv5 model. Through upsampling and downsampling steps, feature maps of different scales are adjusted to the same scale, followed by convolutional computation and fusion, which enhances the model's ability to detect disease features at different scales and improves overall detection accuracy. Compared to traditional neural models, the recognition accuracy is significantly improved.

[0122] Therefore, the embodiments should be considered exemplary and non-limiting in all respects. The scope of this application is defined by the appended claims rather than the foregoing description, and all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within this application. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in the apparatus claims may also be implemented by the same unit or device in software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any particular order.

[0123] The above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.

Claims

1. An attention mechanism-based tea disease detection method, using a YOLOv5-SE model to detect tea diseases, characterized in that: The construction method of the YOLOv5-SE model comprises: replacing a C3 module in a YOLOv5 model with an SEC3 module that fuses an SE attention mechanism; and adding a coordinate attention mechanism at the end of the YOLOv5 model; The SE attention mechanism comprises the following steps: performing convolution calculation on a given feature map to form a feature map; performing global average pooling on the feature map to generate a feature vector; processing the feature vector through two fully connected layers and a nonlinear activation function to generate channel weight values; applying the channel weight values to each channel on the original feature map to perform feature weighting processing; The detection method comprises: collecting tea disease image data, and preprocessing the collected tea disease image data; using a labeling tool to label the disease area of the preprocessed tea disease image data to generate a labeled data set; training the constructed YOLOv5-SE model using the labeled data set to obtain a trained model weight; applying the trained YOLOv5-SE model to unlabeled tea disease images to perform disease detection and identification; The step of replacing the C3 module in the YOLOv5 model with the SEC3 module that fuses the SE attention mechanism comprises: Providing a target detection model using an SE attention mechanism, comprising a backbone network, a neck network and a head network; selecting at least one convolution layer in the backbone network, which is used for feature extraction; integrating an SE module after the selected convolution layer, the SE module comprising a squeezing step and an excitation step; performing the squeezing step to compress the feature map output by the convolution layer through global average pooling to form a global feature descriptor; performing the excitation step to process the global feature descriptor using two fully connected layers to generate weights for each channel; applying the generated weights to the feature map output by the convolution layer to adjust the feature responses of the channels to form a weighted feature map; passing the weighted feature map to the neck network for feature fusion and scale adjustment; outputting the feature map after feature fusion and scale adjustment to the head network for target detection and classification; The detection method further comprises adding a multiscale feature fusion module between the backbone network and the neck network of the YOLOv5 model; the multiscale feature fusion module comprises the following steps: up-sampling and down-sampling feature maps of different scales to generate feature maps of the same scale; element-wise adding the feature maps of the same scale to form a fused feature map; performing convolution operation on the fused feature map to generate a new feature map.

2. The tea disease detection method based on attention mechanism according to claim 1, characterized in that, The step of up-sampling the feature maps of different scales comprises: obtaining an original feature map from an input feature map; enlarging the original feature map through bilinear interpolation to generate a feature map of the same target scale; performing convolution calculation on the enlarged feature map to generate a new feature map; The step of down-sampling the feature maps of different scales comprises: obtaining an original feature map from an input feature map; reducing the original feature map through average pooling operation to generate a feature map of the same target scale; The reduced feature map is subjected to convolution calculation to generate a new feature map.

3. The tea disease detection method based on attention mechanism according to claim 1, characterized in that, During the model evaluation process, the accuracy, recall rate, F1 score, and average precision mean are used to evaluate the model's effectiveness.

4. The tea disease detection method based on attention mechanism according to claim 1, characterized in that, The dataset includes 6558 images, containing eight different types of tea diseases: tea leaf eaten by tea mosquito, tea leaf eaten by red spider, tea black stem rot, tea leaf rust, tea white spot disease, algal leaf spot disease, gray blight, and brown blight.

5. The tea disease detection method based on attention mechanism according to claim 1, characterized in that, The acquired images are preprocessed, including cropping, rotating, stretching, adjusting contrast and brightness.

6. The tea disease detection method based on attention mechanism according to claim 1, characterized in that, The preprocessed images are labeled using a labeling tool, and divided into training set, validation set and test set in the ratio of 6:3:

1.

7. The tea disease detection method based on attention mechanism according to claim 1, characterized in that, The training process of the YOLOv5-SE model includes training the dataset using initial training weights, iterating the training number to 150 times, and making the model's training accuracy reach 90.4%, the recall rate reach 92.1%, and the average precision mean reach 87.6%.

Citation Information

Patent Citations

  • SAR image aircraft target detection method based on improved YOLOv5

    CN116630798A

  • Improved YOLOv7-based mango diseased leaf detection and identification method

    CN117671500A