A rice leaf disease detection method and system based on an improved RT-DETR model

CN122550899APending Publication Date: 2026-08-11ANHUI UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-13
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0005]本发明所要解决的技术问题在于:如何解决水稻叶片相似病害区分难、小目标易漏检、计算冗余及背景干扰等问题,实现在复杂田间环境下对水稻叶片病害的智能化、精准化实时检测,提供了一种基于改进RT-DETR模型的水稻叶片病害检测方法

Benefits of technology

[0045]1、本发明在RT-DETR模型的颈部网络嵌入坐标注意力机制CA,通过水平和垂直双维度坐标编码与特征重加权,实现了病斑的精准定位,有效抑制了田间复杂背景的干扰,提升了模型对相似病害的特征区分能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122550899A_ABST
    Figure CN122550899A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for detecting rice leaf diseases based on an improved RT-DETR model, belonging to the field of computer vision and smart agriculture technology. This invention embeds a coordinate attention mechanism (CA) into the neck network of the RT-DETR model, achieving precise lesion localization through horizontal and vertical dual-dimensional coordinate encoding and feature reweighting. This effectively suppresses interference from complex field backgrounds and improves the model's ability to distinguish features of similar diseases. The VoV-GSCSP module used in this invention employs a single-pass cross-layer feature fusion strategy, optimizing the feature fusion process and effectively reducing the number of model parameters and computational complexity. The SEAM module used in this invention enhances the feature response of small lesions, compensates for the response loss of occluded lesions, significantly improves the model's ability to detect small-area diseases, and effectively solves the problems of missed and false detections of small-scale diseases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer vision and smart agriculture technology, specifically to a method and system for detecting rice leaf diseases based on an improved RT-DETR model. Background Technology

[0002] Rice is an important food crop in my country. Diseases that occur during its growth can seriously affect yield and quality, threatening food security. Therefore, early identification of diseases is crucial to ensuring food security. However, due to the large scale and wide distribution of rice-growing areas, and the variety of diseases, relying solely on agricultural experts for diagnosis is inefficient, costly, and subjective, making it difficult to meet the testing needs of such a large-scale rice-growing region.

[0003] With the development of computer vision and deep learning technologies, image-based automatic crop disease identification methods have gradually become a research hotspot. Existing methods mainly include traditional machine learning methods and deep learning methods. Traditional methods usually rely on manually designed features, such as color, texture, and shape, and then use a classifier for disease identification. However, these methods are sensitive to changes in lighting, shooting angle, and leaf posture, and have limited generalization ability.

[0004] Deep learning methods, especially object detection techniques based on convolutional neural networks (CNNs), can automatically learn effective features from large-scale disease images to achieve accurate localization and classification of lesions. For example, Faster R-CNN and YOLO series models have achieved certain results in crop disease detection, but they suffer from problems such as slow inference speed, high computational resource consumption, or insufficient accuracy in detecting small target lesions, making them unsuitable for agricultural field applications with high real-time requirements. Therefore, this invention proposes a method and system for detecting rice leaf diseases based on an improved RT-DETR model. Summary of the Invention

[0005] The technical problem to be solved by this invention is: how to solve the problems of difficulty in distinguishing similar diseases of rice leaves, easy to miss small targets, computational redundancy and background interference, and realize intelligent, accurate and real-time detection of rice leaf diseases in complex field environment. This invention provides a method for detecting rice leaf diseases based on an improved RT-DETR model.

[0006] The present invention solves the above-mentioned technical problems through the following technical solution, and the present invention includes the following steps:

[0007] S1: Dataset Construction

[0008] Acquire image data of rice leaf diseases and construct a rice leaf disease dataset;

[0009] S2: Dataset Partitioning

[0010] The rice leaf disease dataset was divided into a training set, a validation set, and a test set. There were no overlapping samples between the training set and the test set. Data augmentation methods were used to expand the training set.

[0011] S3: Model Improvement

[0012] Based on the RT-DETR model, the coordinate attention module CA, the VOV-GSCSP module, and the separation and enhancement attention module SEAM are introduced to improve the RT-DETR model, resulting in the improved RT-DETR model.

[0013] S4: Model Training

[0014] The improved RT-DETR model was trained, and the model parameters that met the performance indicators were saved to obtain the rice leaf disease detection model.

[0015] S5: Detection of Rice Leaf Diseases

[0016] The rice leaf disease detection model is used to infer the results from the input image and generate a visualization of the rice leaf disease detection.

[0017] Furthermore, in step S1, rice leaf disease samples are obtained from the Kaggle and PlantVillage agricultural disease image databases to construct a rice leaf disease dataset. The disease categories of the samples include bacterial blight, sheath blight, and leaf streak, and also include images of healthy rice leaves as control data.

[0018] Furthermore, in step S2, the data augmentation method includes horizontal or vertical flipping, random rotation, and brightness adjustment, etc., to simulate different shooting angles and lighting conditions, so as to enhance the diversity of training data.

[0019] Furthermore, in step S3, the specific operations for model improvement are as follows:

[0020] S31: In the neck network of the RT-DETR model, after the second cross-channel splicing operation is completed between the bottom-level features and the upsampled features of the backbone, a coordinate attention module (CA) is embedded to enhance the localization ability of rice leaf lesions and suppress background interference.

[0021] S32: In the neck network of the RT-DETR model, the VOV-GSCSP module is used instead of the RepC3 module. Through a single cross-layer feature fusion strategy, shallow and deep features from different layers are aggregated at once, which enhances the multi-scale feature fusion capability and reduces computational complexity.

[0022] S33: After the three final effective detection feature branches output by the neck network and before the detection head network, the Separation and Enhancement Attention Module (SEAM) is introduced to enhance feature perception and expression capabilities through multi-scale feature interaction.

[0023] Furthermore, in step S31, the specific processing procedure of the coordinate attention module (CA) is as follows:

[0024] S311: Pool the input feature map along both the horizontal and vertical coordinate directions to generate feature vectors that are perceptual in both directions. and ,in, and These are the feature vectors of the c-th channel along the horizontal and vertical directions, respectively;

[0025] S312: Feature vectors sensed from two directions and The features are stitched together along the spatial dimension and an intermediate feature map f is generated by a shared 1×1 convolutional transformation function F1 and a nonlinear activation function δ.

[0026] S313: Split the intermediate feature map f into horizontal attention weight maps along the spatial dimension. and vertical attention weight map And respectively through the convolution transformation function F h F w and the Sigmoid function The attention weight g is obtained. h and g w ;

[0027] S314: Finally, the attention weight g h and g w The feature map is multiplied element-wise with the original input feature map to output the feature y. c .

[0028] Furthermore, in step S32, the specific processing procedure of the VOV-GSCSP module is as follows:

[0029] S321: The input features are first compressed through a 1×1 convolution to obtain shallow features;

[0030] S322: Then enter the GS bottleneck module to extract deep features;

[0031] S323: The deep features output by the GS bottleneck module are concatenated with the shallow features output by the 1×1 convolution along the channel dimension. Multi-scale feature fusion is achieved through convolution and the features are output.

[0032] Furthermore, in step S322, the GSbottleneck module includes two parallel branches. One branch is a 1×1 convolution for channel adjustment, and the other branch consists of two GSConv modules for feature extraction. The first GSConv module splits the input feature map into two feature subsets with the same number of channels along the channel dimension. The first feature subset is retained as sparse features, and the second feature subset is processed by depthwise separable convolution and standard convolution to generate dense features. Then, these two sets of features are concatenated and rearranged to achieve a full mixture of dense and sparse features. The second GSConv module uses depthwise separable convolution to reorganize features along the channel dimension, capturing the detailed texture and global semantic information of lesions.

[0033] Furthermore, in step S33, the specific processing procedure for separating and enhancing the attention module SEAM is as follows:

[0034] S331: The input feature map is first fed into the channel and spatial mixing modules of different patch sizes to achieve multi-scale feature fusion;

[0035] S332: Then, the output features of each channel and the spatial mixing module are added together and aggregated by average pooling to obtain the channel dimension feature vector. The channel dimension feature vector is input into a two-layer fully connected network to strengthen the correlation between channels and initially output the channel attention intermediate vector. Then, the weight value range is expanded from [0,1] to [1,e] using the exponential mapping function to complete the generation of channel attention weights.

[0036] S333: Finally, the generated attention weights are multiplied with the original input feature map to enhance the diseased area and output the fused feature map.

[0037] Furthermore, in step S5, the reasoning process is as follows: feature extraction and classification are performed on each pixel or target region in the image to generate a prediction box and corresponding confidence level for each leaf disease category, and the annotation box, disease category label and confidence level information are superimposed on the original image to form a visualized detection result image.

[0038] This invention also provides a rice leaf disease detection system based on an improved RT-DETR model, applied to the above-mentioned method, comprising:

[0039] The dataset construction module is used to acquire image data of rice leaf diseases and construct a rice leaf disease dataset.

[0040] The dataset partitioning module is used to divide the rice leaf disease dataset into training, validation, and test sets, where there are no overlapping samples between the training and test sets, and data augmentation methods are used to expand the training set.

[0041] The model improvement module is used to improve the RT-DETR model by introducing the coordinate attention module CA, the VOV-GSCSP module, and the separation and enhancement attention module SEAM, based on the RT-DETR model, to obtain the improved RT-DETR model.

[0042] The model training module is used to train the improved RT-DETR model, save the model parameters that meet the performance indicators, and obtain the rice leaf disease detection model.

[0043] The disease detection module is used to infer the input image using a rice leaf disease detection model and generate a visualization result of rice leaf disease detection.

[0044] The present invention has the following advantages over the prior art:

[0045] 1. This invention embeds a coordinate attention mechanism (CA) into the neck network of the RT-DETR model. Through horizontal and vertical dual-dimensional coordinate encoding and feature reweighting, it achieves accurate localization of lesions, effectively suppresses interference from complex field backgrounds, and improves the model's ability to distinguish features of similar diseases.

[0046] 2. The VoV-GSCSP module used in this invention adopts a single-pass cross-layer feature fusion strategy, which optimizes the feature fusion process and effectively reduces the number of model parameters and computational complexity.

[0047] 3. The SEAM module used in this invention can enhance the feature response of small lesions, compensate for the response loss of occluded lesions, significantly improve the model's ability to detect small-area diseases, and effectively solve the problems of missed detection and false detection of small-scale diseases.

[0048] 4. The detection method of the present invention does not require frequent manual parameter adjustment, achieves end-to-end non-repeating prediction, has high detection accuracy, and can be applied to the deployment of portable detection equipment, providing an effective solution for the intelligent, precise and portable detection of rice diseases. Attached Figure Description

[0049] Figure 1 This is a schematic flowchart of the rice leaf disease detection method based on the improved RT-DETR model in an embodiment of the present invention;

[0050] Figure 2 This is a schematic diagram of the coordinate attention mechanism (CA) in an embodiment of the present invention;

[0051] Figure 3 This is a schematic diagram of the VOV-GSCSP module in an embodiment of the present invention;

[0052] Figure 4 This is a schematic diagram of the GSconv module in an embodiment of the present invention;

[0053] Figure 5 This is a schematic diagram of the SEAM module in an embodiment of the present invention;

[0054] Figure 6 This is a graph showing the change in performance indicators of the improved model in this embodiment of the invention.

[0055] Figure 7 This is a schematic diagram of the overall structure of the improved model in an embodiment of the present invention. Detailed Implementation

[0056] The embodiments of the present invention are described in detail below. These embodiments are implemented based on the technical solution of the present invention, and provide detailed implementation methods and specific operation processes. However, the scope of protection of the present invention is not limited to the following embodiments.

[0057] Example 1

[0058] like Figure 1 As shown, this embodiment provides a technical solution: a method for detecting rice leaf diseases based on an improved RT-DETR model, comprising the following steps:

[0059] Step S1: Data collection. The dataset used in this embodiment comes from the Kaggle and PlantVillage agricultural disease image databases. Samples with clear disease characteristics, no blurring or occlusion, are selected from these two databases, including images of healthy rice leaves and images of three common rice diseases: bacterial blight, sheath blight, and leaf streak, to construct a rice leaf disease dataset.

[0060] Step S2: Dataset partitioning and preprocessing. The rice leaf disease dataset is divided into training, validation, and test sets in a 7:2:1 ratio. Data augmentation methods such as horizontal or vertical flipping, random rotation, and brightness adjustment are used to simulate different shooting angles and lighting conditions to augment the training set and enhance the diversity of training data.

[0061] Step S3: Improve the construction and module implementation of the RT-DETR model;

[0062] 3-1. Configure the environment required for the RT-DETR model in Python: First, install the libraries required for deep learning, including pyTorch, OpenCV, etc., and ensure that the CUDA environment is configured correctly to support GPU-accelerated training;

[0063] 3-2. Loading the RT-DETR model: This model includes a backbone network, a neck network, and a detection head network. The backbone network consists of HG stem, HG block, and DW conv modules, used to extract features from the input image and generate feature maps at different scales. The hybrid encoder includes an attention-based intra-scale feature interaction (AIFI) module and a CNN-based cross-scale feature fusion (CCFM) module. AIFI enhances feature representation by allowing the model to consider both detailed and global information through intra-scale feature interaction; CCFM fuses the multi-layer features processed by AIFI to generate higher-order semantic features.

[0064] 3-3. Modify the model structure: Embed a coordinate attention mechanism (CA) in the neck network, such as... Figure 2 As shown, by encoding with horizontal and vertical dual-dimensional coordinates and reweighting features, the ability to locate lesions is enhanced and background interference is suppressed.

[0065] The specific processing steps of the coordinate attention mechanism (CA) are as follows:

[0066] The extracted feature map is pooled along both the horizontal and vertical axes to generate feature vectors that are perceptual in both directions. and :

[0067]

[0068]

[0069] Wherein, the input feature X (i.e., the feature map x in the formula, X∈R) C×H×W The feature map consists of a convolutional layer with a fixed kernel size, where C, H, and W represent the number of channels, height, and width of the feature map, respectively. c This represents the output feature of the c-th channel, where h is a fixed row position number in the height dimension, w is a fixed column position number in the width dimension, and i and j are the traversal indices in the width and height directions, respectively. and These are the feature vectors obtained by pooling the c-th channel along the width and height dimensions, respectively.

[0070] The feature vectors from the two directions are concatenated along the spatial dimension, and an intermediate feature map f is generated using a shared 1×1 convolutional transformation function F1 and a nonlinear activation function δ.

[0071] ]))

[0072] The intermediate feature map is split into horizontal attention weight maps along the spatial dimension. and vertical attention weight map And respectively through the convolution transformation function F h F w and the Sigmoid function The attention weight g is obtained. h and g w :

[0073]

[0074]

[0075] Finally, the attention weights are multiplied element-wise with the original input feature map to obtain the output feature y of the coordinate attention module (coordinate attention mechanism CA). c :

[0076]

[0077] 3-4. The VOV-GSCSP module is used instead of the RepC3 module. Through a single cross-layer feature fusion strategy, shallow detail features and deep semantic features from different layers are aggregated at once, which enhances the multi-scale feature fusion capability and reduces computational complexity.

[0078] like Figure 3 As shown, the VoV-GSCSP module includes the GSbottleneck module, the conv module, and the concat module. Its implementation process is as follows: the input features are first compressed by a 1×1 convolution to obtain shallow detail information, and then enter the GSbottleneck module to extract deep semantic features. The deep features output by the GSbottleneck module are concatenated with the shallow features output by the 1×1 convolution along the channel dimension. Multi-scale feature fusion is achieved through convolution and the features are output.

[0079] The GSbottleneck module comprises two parallel branches: one branch uses a 1×1 convolution for channel adjustment, and the other branch consists of two GSConv modules for feature extraction. The first GSConv module splits the input feature map into two feature subsets with the same number of channels along the channel dimension. The first feature subset is retained as sparse features, while the second feature subset is processed sequentially through depthwise separable convolution and standard convolution to generate dense features. Subsequently, these two sets of features are concatenated and rearranged to achieve a thorough mixing of dense and sparse features. The second GSConv module utilizes depthwise separable convolution to efficiently reorganize features along the channel dimension, capturing the detailed texture and global semantic information of lesions.

[0080] like Figure 4 As shown, the implementation process of the GSConv module is as follows: the input features are initially extracted using standard convolution (SC); then feature transformation is performed using depthwise separable convolution (DSC) to reduce computational complexity; the results of standard convolution and depthwise separable convolution are concatenated, and information interaction is achieved through channel shuffle to output the fused features.

[0081] 3-5: Add the Separation and Enhanced Attention (SEAM) module to enhance the perception and expression of small-area disease features through multi-scale feature interaction. Small-area disease features refer to the dot-like or pinpoint-like spots that appear in the early stage of disease. At this stage, the lesions have not yet merged, and their edge information is easily blurred in the high-level feature map.

[0082] like Figure 5 As shown, the working steps of the Separate and Enhanced Attention Module (SEAM) are as follows: The input feature map is first fed into Channel and Spatial Mixing Modules (CSMM) of different patch sizes to achieve multi-scale feature fusion; then the output features of each CSMM module are added together and aggregated by average pooling to obtain the channel dimension feature vector; this feature vector is input into a two-layer fully connected network to strengthen the correlation between channels and initially output the channel attention intermediate vector; then the weight value range is expanded from [0,1] to [1,e] using the exponential mapping function, while improving the fault tolerance of the result to positional errors; finally, the generated attention weights are multiplied with the original features to enhance the diseased area and output the fused feature map.

[0083] Within the CSMM module, the input features are first divided into several local regions according to a set patch size through block embedding, and then linearly mapped. Subsequently, the features undergo GELU activation and batch normalization to enhance the network's non-linear expressive power and improve training stability. Next, depthwise convolution is used for feature extraction, where it extracts spatial features within a single channel, enhancing the modeling ability of local structural information. The features output from the depthwise convolution are then calibrated again using GELU activation and batch normalization, and then fed into pointwise convolution to complete cross-channel dimensional feature interaction and channel information recombination. The output of the pointwise convolution is then added to the features after the first GELU activation and batch normalization process, mitigating network degradation. Finally, the fused features undergo GELU activation and batch normalization again, outputting the channel and spatial depth-optimized feature result at this scale, which is then fed into subsequent multi-scale feature fusion stages.

[0084] Step S4: Model training;

[0085] 4-1. The input image is first processed by the RT-DETR backbone network for feature extraction. The backbone network learns the texture, color and shape information in the image layer by layer through multi-layer convolution operations, extracts feature maps at different semantic levels, and obtains multi-scale feature representations containing rich spatial and semantic information.

[0086] 4-2. The extracted multi-scale features are passed to the improved neck network for feature fusion processing. The neck network strengthens the association between high-level semantic features and low-level detailed features through multi-scale feature interaction and information integration mechanism, so as to enhance the model's ability to perceive lesions at different scales.

[0087] 4-3. The feature map fused by the neck network is passed to the decoder network and the detection head. The workflow is as follows: First, an initial query vector highly correlated with real targets such as rice lesions is selected from the potential target query set through an uncertainty minimization strategy. Then, a cross-scale high-order feature map that integrates shallow details and deep semantics is received from the hybrid encoder to provide rich contextual information for query optimization. The initial query vector is iteratively optimized in multiple rounds based on the Transformer attention mechanism. First, the information interaction between query vectors is realized through the self-attention mechanism to correct redundant biases. Then, the query vector is accurately matched with the feature map through the cross-attention mechanism to capture detailed features such as lesion location and texture. After multiple rounds of iteration, the finally optimized query vector is directly mapped to the target bounding box and category confidence of rice diseases through the prediction head.

[0088] Step S5: Perform performance testing on the model;

[0089] 5-1. Test the trained model using the test set and output a series of evaluation parameters, including precision (P), recall (R), mean average precision (mAP), number of parameters, and floating-point operations per second (GFLOPs).

[0090] Evaluation indicator calculation formula:

[0091]

[0092]

[0093]

[0094]

[0095] Where TP is the number of samples that the model predicted as positive and which were actually positive; FP is the number of samples that the model predicted as positive but were actually negative; TN is the number of samples that the model predicted as negative and which were actually negative; FN is the number of samples that the model predicted as negative but were actually positive; and N is the total number of categories.

[0096] Evaluation results Figure 6 Figures (a), (b), and (c) show the curves of precision, recall, and mean precision as a function of training epochs, respectively. These curves, with training epochs on the x-axis and precision, recall, and mAP50 on the y-axis, comprehensively reflect the convergence characteristics and detection performance of the model during training by recording the changes in various indicators at different iteration stages. For the improved RT-DETR method applied to rice leaf disease detection, the performance curves show that all indicators rise rapidly and then stabilize, ultimately remaining at a high level. This indicates that the method has strong feature learning capabilities and good detection accuracy in rice disease identification.

[0097] Step S6: Use the trained model to perform inference on the input image, as follows:

[0098] Images of rice bacterial blight, sheath blight, and leaf streak were selected as test samples, and an improved model (such as...) was used. Figure 7 (As shown) Images of bacterial blight, sheath blight, and leaf streak disease are predicted and input into a trained improved model for forward inference calculation. The model first extracts and fuses features from the input images, then outputs the bounding box coordinates, disease category, and corresponding confidence score of each candidate target through the target detection head. The model output is post-processed, including confidence threshold filtering and duplicate detection box suppression, to remove low-confidence prediction boxes and redundant boxes. Then, based on the final retained detection results, target bounding boxes are drawn on the original image, and the disease category name and confidence value are labeled at the corresponding positions. The labeled image is then used to generate a visualization result of rice leaf disease detection.

[0099] Example 2

[0100] To further verify the effectiveness of each improved module in enhancing model performance, this embodiment conducted an ablation experiment on a rice leaf disease dataset. The experimental results are shown in Table 1. Based on the RT-DETR model, after adding the CA attention mechanism to the neck network, the model's precision, recall, and mAP50 improved by 0.4%, 0.8%, and 0.7%, respectively; the number of parameters increased by only 0.02M, and the computational cost remained essentially constant, indicating that the CA attention mechanism enhances the model's ability to locate key lesion regions by fusing channel and spatial location information. Using only the VOV-GSCSP module, the model's precision, recall, and mAP50 improved by 0.7%, 0.7%, and 0.9%, respectively; the number of parameters decreased by 7.37M, and the computational cost decreased by 39.8 GFLOPs, indicating that the VOV-GSCSP module enhances multi-scale feature interaction capabilities through an efficient cross-layer feature fusion mechanism, while effectively compressing the model's parameter count and computational overhead. Introducing only the SEAM module improved the model's precision, recall, and mAP50 by 0.8%, 1.0%, and 1.0%, respectively; while increasing the number of parameters and computational cost by 0.23M and 1.2GFLOPs, respectively. This indicates that the SEAM module enhances the model's detection performance by strengthening contextual semantic information, despite a slight increase in computational overhead.

[0101] Table 1. Impact of different modules on model performance

[0102]

[0103] Adding both CA and VOV-GSCSP modules to the baseline model simultaneously improved precision, recall, and mAP50 by 1.5%, 1.6%, and 1.6%, respectively; the number of parameters decreased by 7.29M, and the computational cost decreased by 39 GFLOPs, indicating that the combination of the two modules achieved performance and efficiency improvements. Introducing CA and SEAM modules to the baseline model improved precision, recall, and mAP50 by 1.4%, 1.8%, and 1.7%, respectively; the number of parameters and computational cost increased by only 0.25M and 1.2 GFLOPs, respectively, indicating good complementarity between the attention mechanism and the contextual modeling method. With the combination of VOV-GSCSP and SEAM modules, the model precision, recall, and mAP50 improved by 1.0%, 2.3%, and 1.9%, respectively; the number of parameters decreased by 7.14M, and the computational cost decreased by 38.7 GFLOPs, indicating that introducing contextual information modeling based on optimized feature fusion structure improved the detection capability of occluded lesions. When the CA, SEAM, and VOV-GSCSP modules are added simultaneously, the model's detection performance reaches its optimal level, with precision, recall, and mAP50 improving by 1.8%, 3%, and 3.1%, respectively. The number of parameters is reduced by 7.06M, and the computational cost is reduced by 37.8GFLOPs, indicating that each improved module enhances the model's feature representation and target discrimination capabilities from different perspectives, thereby optimizing the overall detection performance of the model.

[0104] Table 2 Performance Comparison Results of Different Models

[0105] Table 2 shows the performance comparison results of the method of this invention with various existing target detection models, including Faster-RCNN, YOLOv5m, YOLOv6m, YOLOv9m, YOLOv10m, DETR, DINO, and the baseline RT-DETR model, on a rice leaf disease dataset. Experimental results show that the improved model proposed in this invention achieves superior detection performance compared to all the comparison models. Specifically, the precision, recall, and mAP50 of the method proposed in this invention reach 92.1%, 91.5%, and 95.3%, respectively, all higher than the comparison models.

[0106] The comparative analysis of various models is as follows: The Faster-RCNN model has 136.73M parameters and a computational cost of 369.8 GFLOPs, with an mAP50 of only 83.1%, indicating that it fails to fully leverage the advantages of high computational cost in complex field environments. YOLOv5m, YOLOv9m, and YOLOv10m have certain advantages in terms of model complexity, with precision all above 87% and mAP50 around 90%. However, there is still room for improvement in recall, indicating that these models may still experience missed detections in complex contexts, making it difficult to balance accuracy and completeness. Among Transformer-based models, DETR has relatively low detection performance, while the DINO model achieves an mAP50 of 91.2%, with overall accuracy slightly higher than the YOLO series models, but its parameter count and computational cost are also relatively large.

[0107] In contrast, the method of this invention, through optimization of the neck structure of the RT-DETR model, further enhances the model's feature representation ability and the ability to discriminate key lesion regions. It outperforms the comparative model in terms of precision, recall, and mAP50, while maintaining a low level of parameter and computational complexity, achieving a balance between detection accuracy and computational efficiency. These technical effects demonstrate that the method of this invention possesses good target recognition capabilities and stable detection performance, and can more effectively adapt to disease detection tasks in complex field environments.

[0108] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for detecting rice leaf diseases based on an improved RT-DETR model, characterized in that, Includes the following steps: S1: Dataset Construction Acquire image data of rice leaf diseases and construct a rice leaf disease dataset; S2: Dataset Partitioning The rice leaf disease dataset was divided into a training set, a validation set, and a test set. There were no overlapping samples between the training set and the test set. Data augmentation methods were used to expand the training set. S3: Model Improvement Based on the RT-DETR model, the coordinate attention module CA, the VOV-GSCSP module, and the separation and enhancement attention module SEAM are introduced to improve the RT-DETR model, resulting in the improved RT-DETR model. S4: Model Training The improved RT-DETR model was trained, and the model parameters that met the performance indicators were saved to obtain the rice leaf disease detection model. S5: Detection of Rice Leaf Diseases The rice leaf disease detection model is used to infer the results from the input image and generate a visualization of the rice leaf disease detection.

2. The method for detecting rice leaf diseases based on an improved RT-DETR model according to claim 1, characterized in that, In step S1, rice leaf disease samples are obtained from the Kaggle and PlantVillage agricultural disease image databases to construct a rice leaf disease dataset. The disease categories of the samples include bacterial blight, sheath blight, and leaf streak, and also include images of healthy rice leaves as control data.

3. The method for detecting rice leaf diseases based on an improved RT-DETR model according to claim 1, characterized in that, In step S2, the data augmentation method includes horizontal or vertical flipping, random rotation, and brightness adjustment, etc., to simulate different shooting angles and lighting conditions, so as to enhance the diversity of training data.

4. The method for detecting rice leaf diseases based on an improved RT-DETR model according to claim 1, characterized in that, In step S3, the specific operations for model improvement are as follows: S31: In the neck network of the RT-DETR model, after the second cross-channel splicing operation is completed between the bottom-level features and the upsampled features of the backbone, a coordinate attention module (CA) is embedded to enhance the localization ability of rice leaf lesions and suppress background interference. S32: In the neck network of the RT-DETR model, the VOV-GSCSP module is used instead of the RepC3 module. Through a single cross-layer feature fusion strategy, shallow and deep features from different layers are aggregated at once, which enhances the multi-scale feature fusion capability and reduces computational complexity. S33: After the three final effective detection feature branches output by the neck network and before the detection head network, the Separation and Enhancement Attention Module (SEAM) is introduced to enhance feature perception and expression capabilities through multi-scale feature interaction.

5. The method for detecting rice leaf diseases based on an improved RT-DETR model according to claim 4, characterized in that, In step S31, the specific processing procedure of the coordinate attention module (CA) is as follows: S311: Pool the input feature map along both the horizontal and vertical coordinate directions to generate feature vectors that are perceptual in both directions. and ,in, and These are the feature vectors of the c-th channel along the horizontal and vertical directions, respectively; S312: Feature vectors sensed from two directions and The features are stitched together along the spatial dimension and an intermediate feature map f is generated by a shared 1×1 convolutional transformation function F1 and a nonlinear activation function δ. S313: Split the intermediate feature map f into horizontal attention weight maps along the spatial dimension. and vertical attention weight map And respectively through the convolution transformation function F h F w and the Sigmoid function The attention weight g is obtained. h and g w ; S314: Finally, the attention weight g h and g w The feature map is multiplied element-wise with the original input feature map to output the feature y. c .

6. The method for detecting rice leaf diseases based on an improved RT-DETR model according to claim 5, characterized in that, In step S32, the specific processing procedure of the VOV-GSCSP module is as follows: S321: The input features are first compressed through a 1×1 convolution to obtain shallow features; S322: Then enter the GS bottleneck module to extract deep features; S323: The deep features output by the GS bottleneck module are concatenated with the shallow features output by the 1×1 convolution along the channel dimension. Multi-scale feature fusion is achieved through convolution and the features are output.

7. The method for detecting rice leaf diseases based on an improved RT-DETR model according to claim 6, characterized in that, In step S322, the GSbottleneck module includes two parallel branches. One branch is a 1×1 convolution for channel adjustment, and the other branch is two GSConv modules for feature extraction. The first GSConv module splits the input feature map into two feature subsets with the same number of channels along the channel dimension. The first feature subset is retained as sparse features, and the second feature subset is processed by depthwise separable convolution and standard convolution to generate dense features. The two sets of features are then concatenated and rearranged to achieve a full blend of dense and sparse features. The second GSConv module uses depthwise separable convolution to reorganize features in the channel dimension, capturing the detailed texture and global semantic information of lesions.

8. The method for detecting rice leaf diseases based on an improved RT-DETR model according to claim 7, characterized in that, In step S33, the specific processing procedure for separating and enhancing the attention module SEAM is as follows: S331: The input feature map is first fed into the channel and spatial mixing modules of different patch sizes to achieve multi-scale feature fusion; S332: Then, the output features of each channel and the spatial mixing module are added together and aggregated by average pooling to obtain the channel dimension feature vector. The channel dimension feature vector is input into a two-layer fully connected network to strengthen the correlation between channels and initially output the channel attention intermediate vector. Then, the weight value range is expanded from [0,1] to [1,e] using the exponential mapping function to complete the generation of channel attention weights. S333: Finally, the generated attention weights are multiplied with the original input feature map to enhance the diseased area and output the fused feature map.

9. The method for detecting rice leaf diseases based on an improved RT-DETR model according to claim 1, characterized in that, In step S5, the reasoning process is as follows: feature extraction and classification are performed on each pixel or target region in the image to generate a prediction box and corresponding confidence level for each leaf disease category. The annotation box, disease category label and confidence level information are superimposed on the original image to form a visualized detection result image.

10. A rice leaf disease detection system based on an improved RT-DETR model, characterized in that, The method applied to any one of claims 1 to 9 includes: The dataset construction module is used to acquire image data of rice leaf diseases and construct a rice leaf disease dataset. The dataset partitioning module is used to divide the rice leaf disease dataset into training, validation, and test sets, where there are no overlapping samples between the training and test sets, and data augmentation methods are used to expand the training set. The model improvement module is used to improve the RT-DETR model by introducing the coordinate attention module CA, the VOV-GSCSP module, and the separation and enhancement attention module SEAM, based on the RT-DETR model, to obtain the improved RT-DETR model. The model training module is used to train the improved RT-DETR model, save the model parameters that meet the performance indicators, and obtain the rice leaf disease detection model. The disease detection module is used to infer the input image using a rice leaf disease detection model and generate a visualization result of rice leaf disease detection.