Lightweight rice leaf disease identification method based on YOLO target detection

By improving the Real-ESRGAN and YOLOv8n algorithms, combined with the C2f-Ghost module, HSFPN network, Phead detection head, and iEMA attention mechanism, the problems of unclear reconstruction details and high computing resources in rice leaf disease detection are solved, and efficient, real-time, and lightweight disease recognition is achieved.

CN120635014APending Publication Date: 2025-09-12JILIN UNIVERSITY
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202510730283.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-03
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

The existing Real-ESRGAN algorithm does not reconstruct details clearly enough in rice leaf disease detection, has visual artifacts, and has poor adaptability in complex environments. The YOLOv8n algorithm has high processing delays and energy consumption in agricultural scenarios, making it difficult to achieve real-time field monitoring.

Method used

The improved Real-ESRGAN algorithm is used for super-resolution reconstruction. Combined with the improved YOLOv8n target detection algorithm, the backbone network is optimized by introducing the C2f-Ghost module, the neck network is reconstructed by the HSFPN network, the detection head is optimized by the Phead detection head, and the iEMA attention mechanism and WIoU loss function are introduced to optimize the model structure and performance.

Benefits of technology

It achieves the goal of improving the accuracy and efficiency of rice leaf disease detection while keeping the model lightweight, adapting to complex environments, reducing computing resource requirements, and being suitable for real-time detection on mobile and embedded devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635014A_ABST
    Figure CN120635014A_ABST
Patent Text Reader

Abstract

The invention discloses a lightweight rice leaf disease identification method based on YOLO target detection. The method comprises the following steps: S1, inputting a rice leaf disease image; s2, carrying out super-resolution reconstruction on the image by using an improved Real-ESRGAN algorithm; s3, inputting the picture into an improved YOLOv8n target detection algorithm; s4, obtaining disease spot category and position information; and S5, visualizing the information on the image. The invention relates to the technical field of target detection, and has the beneficial effects that image super-resolution reconstruction is carried out aiming at the problems that a rice leaf scab target is relatively small and an image acquired in real time is relatively fuzzy, so that the resolution of the small target is improved, and the definition and texture features are improved. On the basis of a super-division model Real-ESRGAN, a group of residual dense modules containing five layers of cavity convolution layers are designed to help the network to acquire receptive fields and information of different scales.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of target detection, and in particular to a lightweight rice leaf disease recognition method based on YOLO target detection. Background Art

[0002] Real-ESRGAN is an image super-resolution reconstruction technology whose core mechanism leverages generative adversarial networks to enhance image resolution. This method is an optimization of the original ESRGAN. The Real-ESRGAN model operates on the principle that a generator reconstructs low-resolution images to generate high-resolution images, while a discriminator determines the authenticity of the input image. Using adversarial training, the generator is optimized to produce highly realistic images. During object detection model training, optimizing and normalizing input and output data helps improve the model's detection accuracy. Super-resolution reconstruction techniques are used to pre-process the input image to enhance the resolution of rice leaf disease images. This method effectively reduces the receptive field of small objects in the feature map, improving the network's ability to recognize small objects and ultimately enhancing the accuracy of rice leaf disease detection. Targeted optimizations have been made to address limitations of the Real-ESRGAN algorithm, including insufficiently clear reconstructed details, visual artifacts, deviations from the original image, and poor adaptability to complex real-world conditions such as occlusions and uneven light distribution. The optimized model was applied to reconstruct rice leaf disease images to obtain better subjective and objective evaluation results.

[0003] In the field of object detection, the YOLO (You Only Look Once) algorithm family has garnered significant attention for its unique single-stage detection architecture and high performance. This family of algorithms has undergone continuous iteration and optimization, consistently breaking through bottlenecks in accuracy and speed, providing strong technical support for numerous practical applications. YOLOv8 builds on the success of previous versions and offers further technical iteration and optimization. Through technologies such as Quantization-Aware Training (QAT) and knowledge distillation, it achieves efficient model compression and acceleration, making it particularly suitable for mobile and embedded devices. It also introduces more sophisticated feature fusion methods, such as the Bidirectional Feature Pyramid Network (BiFPN), enhancing the model's ability to understand complex scenes. Finally, by adding a wider range of data augmentation techniques and improved regularization, the model's performance on new data is further improved. The advanced nature of the YOLOv8 algorithm provides technical support for rice leaf disease detection.

[0004] (1) The limitations of the Real-ESRGAN algorithm include unclear reconstruction details, visual artifacts, deviations from the original image, and poor adaptability to complex situations such as occlusions and uneven light distribution in real environments.

[0005] (2) Although traditional target detection algorithms such as YOLOv8n can identify the location and category of lesions in rice leaf images, their complex model structure and inefficient computing characteristics require reliance on high-performance computing devices. In agricultural scenarios, they are limited by the hardware performance of end-side devices, and are prone to processing delays and excessive energy consumption, making it difficult to achieve real-time field monitoring. Summary of the Invention

[0006] The purpose of the present invention is to solve the above problems and design a lightweight rice leaf disease recognition method based on YOLO target detection.

[0007] To achieve the above-mentioned purpose, the technical solution of the present invention is a lightweight rice leaf disease recognition method based on YOLO target detection, which includes the following steps: Step S1: inputting a rice leaf disease image;

[0008] Step S2: Use the improved Real-ESRGAN algorithm to perform super-resolution reconstruction on the image;

[0009] Step S3: Input the image into the improved YOLOv8n target detection algorithm;

[0010] Step S4: obtaining the lesion type and location information;

[0011] Step S5: Visualizing the information on the image;

[0012] In step S2: based on the generator of Real-ESRGAN, a dense block HDC-DB consisting of 5 layers of dilated convolution is constructed, and the leaky ReLU function used in the activation layer of the generator and discriminator is replaced with the GELU function. Three HDC-DB modules are connected in series to form the HDC-RRDB module.

[0013] The backbone network in the YOLOv8 architecture in step S3 includes a CBS module, a C2f module, and an SPPF module. The CBS module is composed of a convolutional layer, a batch normalization layer, and a SiLU activation function. The operating mechanism of the C2f module is to receive the spliced ​​data as input.

[0014] The Bottleneck module of GhostNetV2 is introduced into the C2f module of the backbone network. The component is defined as the C2f-Ghost module. Within the C2f-Ghost module, the initial feature information must first be processed by the CBS module. Then, a slicing operation is performed, which evenly divides the number of channels of the original data into two equal parts. The final data segment will be sent to the GhostBottleneck module for conversion. Its output will be spliced ​​with the original sliced ​​input data in the channel dimension. After a CBS module integration, the final output data is formed.

[0015] The neck structure of the YOLOv8 architecture in step S3 is mainly composed of the CBS module and the C2f module. In the neck structure, the High-level Screening-feature Pyramid Networks (HSFPN) are referenced. The HSFPN consists of two core components: the Channel Attention (CA) module, which is responsible for screening feature maps of different scales, and the Selective Feature Fusion (SFF) module, which is responsible for effectively integrating high-level and low-level information in the feature maps.

[0016] The YOLOv8n model in step S3 uses a Phead detection head, which includes a single detection head consisting of two parts: module a and module b. Module a is a 3×3 PConv convolution, and module b is a 1×1 CBS module.

[0017] The step S4 includes the EW-MHSA framework, introduces the iRMB module and the EMA module, and uses the EMA attention mechanism to optimize the EW-MHSA. The operation process of the iRMB module includes the expansion and compression of the channel, interspersed with layer-by-layer convolution, and the iRMB module introduces the EMA module.

[0018] In step S4, the WR-YOLO model adopts the WIoU metric method to improve the performance of the loss function, thereby optimizing the WR-YOLO model training process.

[0019] This invention utilizes the technical solution of YOLO object detection to develop a lightweight rice leaf disease recognition method. The C2f-Ghost module is proposed to optimize the feature extraction module C2f of the backbone network, achieving lightweighting of the YOLOv8n algorithm's backbone network. The HSFPN network is used to reconstruct the model's neck network, reducing parameter complexity while improving the efficiency of information exchange among multi-scale features. A weighted reuse mechanism is employed to optimize the YOLOv8n detection head, constructing the Phead detection head to reduce model parameters and computational complexity and improve model inference speed. To address the accuracy loss caused by lightweighting strategies, this patent designs an optimization method to improve model detection accuracy while maintaining the model size of the lightweight object detection algorithm. This patent combines the inverse residual attention module (iRMB) with the EMA attention mechanism to propose the iEMA attention module, which is added to the end of the feature extraction module C2f of the neck network to enhance the model's ability to extract multi-scale features and optimize detection performance. Furthermore, the WIoU optimization training loss function is introduced to further improve model detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is the lightweight rice leaf disease recognition method based on YOLO target detection described in the present invention Figure 1 Real-ESRGAN* network structure diagram;

[0021] LR represents low-resolution image, Conv represents convolutional layer, HDC-RRDB represents hybrid dilated convolution residual dense module, Interpolate represents linear interpolation, GELU represents Gaussian error linear unit activation layer, and SR represents high-resolution image;

[0022] Figure 2 Schematic diagram of the HDC-RRDB module of the lightweight rice leaf disease recognition method based on YOLO target detection according to the present invention;

[0023] HDC-DB represents hybrid dilated dense block, Dilated Conv represents dilated convolution, and β represents the residual coefficient;

[0024] Figure 3 This is a structural diagram of the C2f-Ghost module of the lightweight rice leaf disease recognition method based on YOLO target detection according to the present invention;

[0025] The CBS module consists of a convolutional layer, batch normalization, and SiLU activation function. Split represents the slicing operation, GhostBottleneck represents the Bottleneck module in the GhostNetv2 network, and Concat represents the concatenation operation. h represents the height of the input feature map, w represents the width of the input feature map, c_in represents the channel dimension of the input feature map, and c_out represents the channel dimension of the output feature map.

[0026] Figure 4 This is a HSFPN network structure diagram of the lightweight rice leaf disease recognition method based on YOLO target detection according to the present invention;

[0027] CA represents the feature selection module, Conv(1×1) represents the convolutional layer of size 1×1, and SFF represents the feature fusion module;

[0028] Figure 5 It is a detection head weight reuse of the lightweight rice leaf disease recognition method based on YOLO target detection described in the present invention;

[0029] X represents the input feature map, CBS(3×3) represents a convolutional layer of size 3×3, Bbox. represents positioning information, Cls. represents classification information, CIOU represents complete intersection-over-union loss, DFL represents distribution focus loss, and BCE represents binary cross entropy loss;

[0030] Figure 6 It is the Phead detection head of the lightweight rice leaf disease recognition method based on YOLO target detection described in the present invention;

[0031] PConv(3×3) represents a 3×3 partial convolution, and CBS(3×3) represents a 1×1 convolution layer.

[0032] Figure 7 It is the WR-YOLO network structure of the lightweight rice leaf disease recognition method based on YOLO target detection described in the present invention;

[0033] Backbone represents the backbone network, Neck represents the neck network, Head represents the detection head, SPPF represents the fast spatial feature pyramid pooling module, Max Pool represents the maximum pooling operation, multiply represents matrix multiplication, Transposed2d represents the transposition operation, and Add represents the addition operation;

[0034] Figure 8 This is a structural diagram of the iEMA attention mechanism of the lightweight rice leaf disease recognition method based on YOLO target detection described in the present invention;

[0035] Value represents the value matrix, DropPath represents the regularization technology, and the Has_Skip parameter indicates whether to perform skip connection;

[0036] Figure 9 This is a WR-YOLO structure diagram of the lightweight rice leaf disease recognition method based on YOLO target detection in the present invention, which adds the iEMA attention mechanism;

[0037] Figure 10 These are some sample images of the lightweight rice leaf disease recognition method based on YOLO target detection described in the present invention;

[0038] Figure 11 It is the super-resolution reconstruction visualization result of the lightweight rice leaf disease recognition method based on YOLO target detection described in the present invention;

[0039] Figure 12 This is a comparison chart of the YOLOv8n model and the WR-YOLO model of the lightweight rice leaf disease recognition method based on YOLO target detection described in the present invention;

[0040] Figure 13 This is a heat map comparison of different models of the lightweight rice leaf disease recognition method based on YOLO target detection according to the present invention;

[0041] Figure 14 3 is a comparison chart of different loss functions of the lightweight rice leaf disease recognition method based on YOLO target detection according to the present invention;

[0042] Figure 15 This is a flow chart of the lightweight rice leaf disease identification method based on YOLO target detection described in the present invention. DETAILED DESCRIPTION

[0043] The present invention will be described in detail below with reference to the accompanying drawings. Figure 1-14 As shown in the figure, the lightweight rice leaf disease recognition method based on YOLO target detection reduces the complexity of the model while maintaining its detection accuracy of rice leaf spots as much as possible.

[0044] To better achieve super-resolution reconstruction of rice leaf disease images, a new super-resolution reconstruction model with better visual effects, the Real-ESRGAN* model, was proposed to address the shortcomings of the Real-ESRGAN algorithm, such as blurred textures, artifacts, and inconsistency with actual content, as well as limited generalization capabilities for complex conditions such as uneven lighting and occlusion interference in real scenes.

[0045] Based on the generator of Real-ESRGAN, a dense block HDC-DB consisting of 5 layers of dilated convolution is proposed to obtain receptive fields and information of different scales; and the leaky ReLU function used in the activation layer of the generator and discriminator is replaced with the GELU function to improve the network's ability to fit complex nonlinear relationships. The Real-ESRGAN* model structure is as follows Figure 1 As shown, the HDC-RRDB module is composed of three HDC-DB modules in series. The HDC-RRDB module structure is as follows: Figure 2 This model can effectively extract more feature information while keeping the number of parameters basically unchanged.

[0046] LR represents low-resolution image, Conv represents convolutional layer, HDC-RRDB represents hybrid dilated convolution residual dense module, Interpolate represents linear interpolation, GELU represents Gaussian error linear unit activation layer, and SR represents high-resolution image.

[0047] HDC-DB stands for Hybrid Dilated Dense Block, Dilated Conv stands for Dilated Convolution, and β stands for Residual Coefficient.

[0048] In the composition of the model structure, the backbone network far exceeds the neck network and the detection head in terms of parameter volume. Therefore, this patent takes the lightweight improvement of the backbone network as the first step to improve the model architecture. In the YOLOv8 architecture, the backbone network mainly includes the CBS module, the C2f module and the SPPF module. The CBS module consists of a convolutional layer, batch normalization and SiLU activation function. The operating mechanism of the C2f module is to receive the spliced ​​data as input, and then the module integrates the input information and passes the output information to the next layer. Compared with the CBS module, the C2f module exhibits higher complexity in architecture, so it is particularly important to perform targeted optimization of the C2f module. By improving the feature extraction capability of the C2f module while keeping the model lightweight, the performance of the model can be effectively enhanced.

[0049] This patent adjusts the structure of the C2f module of the backbone network of the original YOLOv8n algorithm by introducing the Bottleneck module of GhostNetV2 to replace the original Bottleneck module. The replaced component is defined as the C2f-Ghost module. The specific structure is as follows Figure 3This modification aims to optimize feature extraction efficiency and the model's lightweight performance. Within the C2f-Ghost module, the initial feature information is first processed by the CBS module. This is followed by a slicing operation, which evenly divides the number of channels of the original data into two equal parts. The final segment of data is then fed into the Ghost Bottleneck module for conversion. Its output is concatenated with the original sliced ​​input data along the channel dimension, and then integrated by the CBS module to form the final output data.

[0050] Compared to the Bottleneck module in the C2f module, the Bottleneck module in GhostNetV2, while containing two Ghost modules, can capture more features of rice leaf lesions with fewer parameters than traditional convolution. The Bottleneck component in the C2f module, however, contains two CBS modules with a 3×3 kernel size, significantly increasing the overall processing time. In summary, the Bottleneck module in the GhostNetV2 architecture significantly reduces the number of floating-point operations and improves inference speed by streamlining convolution operations. By introducing the DFC attention mechanism to enhance the output features of the Ghost module, it can effectively capture long-range dependencies between pixels in different spatial regions of rice leaf images.

[0051] The CBS module consists of a convolutional layer, batch normalization, and the SiLU activation function. Split represents a slicing operation, GhostBottleneck represents the Bottleneck module in the GhostNetv2 network, and Concat represents a concatenation operation. h represents the height of the input feature map, w represents the width of the input feature map, cin represents the channel dimension of the input feature map, and cout represents the channel dimension of the output feature map.

[0052] The neck, as the key component connecting the backbone network and the detection head, is primarily responsible for feature fusion, thereby improving the model's detection accuracy and efficiency. In YOLOv8, the neck structure is primarily composed of the CBS module and the C2f module. The C2f module processes the concatenated information and passes the processed features to the detection head. In the YOLOv8 model, the core components of the neck network include the C2f module and the CBS module. These two components work together to integrate and optimize low-level feature information. The C2f module is responsible for receiving the concatenated information and then accurately passing the processed information to the detection head.

[0053] This paper will reconstruct the YOLOv8n neck network and use the High-level Screening-feature Pyramid Network (HSFPN) to achieve multi-scale feature fusion. In addition, the simple structure of HSFPN significantly reduces computational redundancy, making the model size smaller, which provides guidance for the lightweight improvement of this paper. Its network structure is as follows Figure 4 shown.

[0054] The HSFPN uses high-level features to guide the selection of low-level features and fuses this information with high-level features to enhance the model's feature representation capabilities. Compared to the Path Aggregation Network (PANet), the HSFPN offers greater feature selection flexibility and stronger feature representation capabilities. The HSFPN utilizes high-level features to construct a weight matrix to select and optimize low-level features. This optimized information is then fused with high-level features, significantly improving the model's feature representation capabilities. The HSFPN network consists of two core components: a feature selection module (Channel Attention (CA)) responsible for selecting feature maps of different scales, and a feature fusion module (Selective Feature Fusion (SFF)) responsible for effectively integrating high- and low-level information within the feature maps. This fusion approach generates features rich in semantic information, which is particularly critical for extracting subtle features of rice leaf lesions, significantly improving the model's detection performance. Furthermore, the HSFPN's simple structure significantly reduces computational redundancy, resulting in a smaller model size. CA denotes the feature selection module, Conv(1×1) denotes a 1×1 convolutional layer, and SFF denotes the feature fusion module.

[0055] The YOLOv8n model utilizes a split detection head architecture. This split detection head divides the raw data it receives into two independent data streams, each processed by two identical parallel units. These units consist of two 3×3 CBS modules and a 1×1 convolutional module. After processing by these parallel units, the model accurately generates regression values ​​and classification labels. The split detection head design in the YOLOv8n model facilitates refined feature processing and reduces the interaction between classification and localization tasks, thereby optimizing the model's overall performance and accuracy. However, this inevitably results in a surge in the number of parameters and a reduction in inference execution efficiency.

[0056] After a comprehensive analysis and comparison of the advantages and disadvantages of separate detection heads and integrated detection heads, a Phead detection head based on a weight reuse mechanism is designed to reduce the computational complexity of the detection head. Figure 5As shown in the figure, Phead implements a delayed splitting strategy. Path splitting is not performed when data flows through the two pre-defined CBS modules; splitting is performed only after the convolution module completes processing. This strategy initially uses tight coupling to achieve weight reuse, and later adopts loose coupling to promote efficient data distribution and processing.

[0057] like Figure 5 As shown in the figure, this paper uses a weight reuse mechanism to integrate the YOLOv8n detection head into a single detection head consisting of two modules (a and b), thereby reducing the detection head parameters. To further reduce the detection head parameter complexity, this study updates module a to a 3×3 PConv convolution and replaces module b with a 1×1 CBS module.

[0058] PConv convolution improves the ability to obtain spatial feature information by simplifying the calculation steps and optimizing memory interaction. It overcomes the shortcomings of traditional standard convolution and depth convolution in high-frequency access delay, thereby improving computational efficiency. After introducing PConv convolution in the detection head, the output data will pass through a 1×1 CBS module to reduce the number of parameters and improve inference efficiency. The Phead detection head structure is as follows Figure 6 As shown in Figure 3, this design aims to ensure accurate extraction of spatial features in rice leaf disease images and achieve lightweight structure.

[0059] X represents the input feature map, CBS(3×3) represents the convolutional layer of size 3×3, Bbox. represents the positioning information, Cls. represents the classification information, CIOU represents the complete intersection-over-union loss, DFL represents the distribution focus loss, and BCE represents the binary cross entropy loss.

[0060] PConv(3×3) represents a partial convolution of size 3×3, and CBS(3×3) represents a convolution layer of size 1×1.

[0061] In summary, this patent uses a lightweight method to improve the network structure of the YOLOv8n model. The structure of the optimized WR-YOLO (Weight Reduction YOLOv8n) model is as follows: Figure 7 shown. Figure 7In this patent, the Bottleneck module in the backbone network C2f module is replaced with the Bottleneck module of GhostNetV2, the neck feature fusion portion is reconstructed using the HSFPN network, and the Phead detection head is designed, ultimately constructing the WR-YOLO network. These improvements all adhere to the core principle of reducing the number of model parameters and computational requirements. Backbone represents the backbone network, Neck represents the neck network, Head represents the detection head, SPPF represents the fast spatial feature pyramid pooling module, Max Pool represents the maximum pooling operation, multiply represents matrix multiplication, Transposed2d represents the transposition operation, and Add represents the addition operation.

[0062] An image typically contains multiple targets and complex background elements, which significantly impact the accuracy of target detection models in identifying specific objects. The introduction of an attention mechanism aims to mitigate the interference of irrelevant background information on target detection tasks, allowing the model to focus on extracting target object features and effectively filtering out redundant information. For rice leaf disease detection, the target detection model incorporating an attention mechanism can precisely focus on key lesion information.

[0063] In rice leaf disease detection, when faced with complex and ever-changing environmental backgrounds, leaf occlusion, and diverse and complex lesion morphologies, feature extraction methods often lack sufficient features and accuracy, which directly affects detection accuracy. This patent innovatively integrates the iRMB module and the EMA module to propose an attention module called iEMA.

[0064] The iRMB module's operational process involves channel expansion and compression, interspersed with layer-by-layer convolutions. Relying on deep convolutions in high-dimensional feature spaces, it achieves excellent performance. Due to its high computational efficiency, the iRMB module has been widely used in mobile network architectures. However, iRMB is often used for long-range feature interaction, while rice leaf spot detection is often short-range, resulting in a waste of resources. While the iRMB module can capture complex features to a certain extent, it may also lose necessary information during the information compression process. Therefore, an EMA attention mechanism is introduced before channel compression. The EMA mechanism dynamically adjusts the weights in the feature image based on the importance of each region. This approach helps preserve channel information while minimizing computational overhead.

[0065] Therefore, this patent reconstructs the EW-MHSA framework and proposes a new attention mechanism iEMA. Figure 8The architecture of the iEMA attention module is described. The EMA attention mechanism is used to optimize EW-MHSA, while a cross-spatial learning strategy is adopted to effectively fuse feature data from various spatial regions. Compared to EW-MHSA, EMA significantly reduces the computational resource requirements and parameter size while still accurately capturing key feature information. This not only enhances the overall performance of the model but also makes it more suitable for real-time operation scenarios. The calculation formula is as follows:

[0066] (1)

[0067] (2)

[0068] (3)

[0069] (4)

[0070] Represent the query matrix, key matrix, and value matrix respectively, represents the EMA attention mechanism, represents depthwise separable convolution, Represents the convolution operation, and out represents the output feature map.

[0071] By introducing the EMA attention mechanism, the iRMB structure can more effectively mine useful information from input features while ignoring unimportant parts. This can significantly improve feature extraction and make the model more robust when dealing with complex data distributions. Furthermore, the iEMA structure can enhance information extraction capabilities while maintaining high computational efficiency, thereby improving model performance while better meeting real-time requirements. Finally, the skip connections in the iRMB module effectively prevent the vanishing gradient phenomenon, while the EMA attention mechanism weights information at the fine-grained level of the feature map, providing more refined gradient information and helping to improve network training. This combination enhances the trainability of the model and accelerates convergence.

[0072] Value represents the value matrix, DropPath represents the regularization technology, and the Has_Skip parameter indicates whether to perform skip connection.

[0073] This patent adds iEMA attention mechanism to the tail end of the three C2f modules of the lightweight and improved neck feature fusion network HSFPN to optimize the model detection performance. The WR-YOLO structure with iEMA attention mechanism is as follows: Figure 9 shown.

[0074] The core function of the loss function is to measure the degree of deviation between the model's predicted output and the real data, and use this as a basis for updating the model parameters to ensure that the prediction results are as close to the actual situation as possible. Once the loss function converges to a stable state, it indicates that the network has been fully trained under the current conditions, and the model at this point is the final optimized model. Because the YOLO series of object detection algorithms output multiple results: the target category label, the target's location information in the image, and the confidence of the prediction, the loss function is also divided into three parts: classification loss, bounding box loss, and confidence loss. The classification loss uses the classic cross-entropy loss, while the bounding box loss is calculated using the Distribution Focal Loss (DFL) and Complete Intersection over Union (CIoU) methods.

[0075] In this patent, the bounding box loss of the WR-YOLO model is optimized by replacing CIoU with the WIoU (Wise IoU) metric. This replacement strategy aims to improve the performance of the loss function and thus optimize the WR-YOLO model training process.

[0076] WIoU points out that existing metrics often assume that all examples in the training set are high-quality data, and therefore introduce additional penalty mechanisms. However, these mechanisms may hinder the model's ability to absorb low-quality examples, causing the model to favor learning from low-quality data, thereby weakening its generalization ability. Based on this, the WIoU loss was developed to enhance the model's generalization ability on the majority of examples and promote effective learning. The WIoU loss v3 version was used to optimize the loss function of the WR-YOLO algorithm to improve model performance.

[0077] This implementation is characterized by designing a set of residual dense modules consisting of five layers of dilated convolutional layers based on the super-resolution model Real-ESRGAN, and replacing the leaky ReLU functions used in the generator and discriminator activation layers with GELU functions. A lightweight strategy is used to improve the network structure of the YOLOv8n algorithm. The C2f-Ghost module is proposed to optimize the feature extraction module C2f of the backbone network; the HSFPN network is used to reconstruct the neck network of the model; and a weight reuse mechanism is used to optimize the YOLOv8n detection head to construct the Phead detection head. To address the accuracy loss caused by the lightweight strategy, this patent designs an optimization method to improve model detection accuracy while maintaining the size of the lightweight model essentially unchanged. This patent combines the inverse residual attention module (iRMB) with the EMA attention mechanism to propose the iEMA attention module; and also introduces the WIoU optimization training loss function.

[0078] In this implementation, the dataset is composed of publicly available images of rice leaf diseases collected under natural conditions. During the construction process, plant experts further screened and annotated the dataset, resulting in high diversity and practicality. The dataset was collected at different time periods, subject to complex environmental interference (such as light and dew). Furthermore, due to the spatial structure of rice plants, the distance between rice leaves and the camera inevitably varies. This results in a dataset with varying object scales, further increasing the diversity of the target data and the generalization capabilities of the model.

[0079] Table 1. Introduction to the number of samples in the rice disease dataset;

[0080]

[0081] Table 1 shows the distribution of samples of each rice leaf disease and healthy leaf in the training, validation, and test sets, respectively. This dataset consists of 6,046 images, comprehensively covering the four main types of rice leaf diseases. Specifically, there are 1,053 images of rice blast, 1,046 images of bacterial blight, 823 images of sheath blight, 1,542 images of rice brown spot, and 1,582 images of healthy leaves as controls, providing ample samples for each category. This study selected 4,710 and 596 images from different scenes with low similarity and high dissimilarity as the training and validation sets, respectively, and used the remaining 582 images for testing, resulting in a training, validation, and test set ratio of approximately 8:1:1. Figure 10 Some sample images are shown.

[0082] As shown in Table 2, after introducing the hybrid dilated convolution residual dense module HDC-RRDB based on Real-ESRGAN, the PSNR slightly decreases to 31.87 dB, while the SSIM improves to 0.8808. This demonstrates that the hybrid dilated convolution residual dense module helps improve the structural similarity of images, albeit at the expense of a slight peak signal-to-noise ratio. When the GELU activation function is added alone, the PSNR increases to 32.51 dB and the SSIM increases to 0.8816. This demonstrates that the GELU activation function further improves model performance, particularly by significantly increasing the SSIM value while maintaining a high PSNR. Finally, when both improvements are used simultaneously, the PSNR reaches 32.64 dB and the SSIM reaches 0.8827. The improved Real-ESRGAN* model significantly outperforms the original model in both metrics. This demonstrates that Real-ESRGAN* not only achieves a relatively superior signal-to-noise ratio in the reconstructed image, but also better preserves image structure and details, resulting in a higher similarity to the original image, validating the effectiveness of the improved approach.

[0083] Table 2 Super-resolution network optimization ablation experiment;

[0084]

[0085] To validate the advantages of the proposed algorithm, a comparative analysis was conducted with mainstream algorithms on a rice leaf disease dataset. Table 3 lists the reconstruction metrics of each algorithm. Experiments show that the Bicubic and SRCNN algorithms achieve lower PSNR and SSIM values ​​on the rice leaf disease dataset. The key factor contributing to this phenomenon is that these methods commonly use mean squared error as the loss target, which inevitably results in significant differences between the reconstructed images and the original images in terms of detail and realism. In summary, the ESRGAN, Real-ESRGAN, and SRGAN algorithms based on generative adversarial networks (GANs) achieve significantly better reconstruction results and performance in image super-resolution tasks than traditional interpolation techniques. The proposed Real-ESRGAN* algorithm achieves the highest PSNR and SSIM values, with PSNR improvements of 1.37, 1.34, and 0.39, respectively, and SSIM improvements of 0.0072, 0.0001, and 0.0099, respectively, over SRGAN, ESRGAN, and Real-ESRGAN. This is due to the fact that the HDC-RRDB module, introduced into the generator, effectively extracts information at different scales from rice leaf disease images. Replacing the Leaky ReLU function used in the activation layers of the generator and discriminator with the GELU function improves the network's ability to fit complex nonlinear relationships. Comprehensive experimental results demonstrate that the proposed Real-ESRGAN* algorithm demonstrates superior performance in super-resolution reconstruction of rice leaf disease images. By optimizing the network structure and training strategy, the model's reconstruction quality and efficiency can be further improved, providing strong technical support for practical applications.

[0086] Table 3. Comparative experiments of super-resolution networks;

[0087]

[0088] like Figure 11As shown in the figure, a 300×400 original image of each disease category was selected to verify the reconstruction visualization results of each algorithm. The image was then magnified 4x to output a 1200×1600 image. The visualization results show that the images reconstructed by the Bicubic and SRCNN algorithms exhibit poor visual quality, with common issues of blurred texture and loss of detail. In contrast, the SRGAN, ESRGAN, and Real-ESRGAN algorithms based on GAN networks demonstrate significant advantages in detail restoration. However, the proposed Real-ESRGAN* algorithm reconstructs rice leaf disease images with superior visual performance, more comprehensive detailed features, and effective artifact elimination. It also outperforms other algorithms in terms of texture and clarity, validating the effectiveness of the improvements presented in this chapter. The improved network focuses more closely on key features in the image, achieving selective attention to features in different regions and more effectively extracting local and global correlation information, resulting in significant improvements in accuracy and visual clarity in super-resolution reconstruction tasks.

[0089] After the super-resolution preprocessing stage, this patent obtains the original dataset and the super-resolution dataset. To verify the effectiveness of the super-resolution preprocessing method, this patent uses the mF1 and mAP metrics to evaluate the detection accuracy of three models, YOLOv8n, YOLOv7-tiny, and Faster R-CNN, on the original low-resolution dataset and the super-resolution reconstruction dataset, respectively. The comparative experimental results are shown in Table 4.

[0090] Table 4 shows that the detection accuracy of the YOLOv8n, YOLOv7-tiny, and Faster R-CNN models on the super-resolution reconstruction dataset is significantly better than their performance on the original low-resolution dataset, with some improvement in both mF1 and mAP values. Compared to their performance on the original low-resolution dataset, YOLOv8n's mF1 and mAP on the super-resolution reconstruction dataset increased by 0.6% and 0.5%, respectively. YOLOv7-tiny's mF1 and mAP on the super-resolution reconstruction dataset increased by 0.3% and 0.4%, respectively. Faster R-CNN's mF1 and mAP on the super-resolution reconstruction dataset increased by 0.7% and 0.5%, respectively, verifying the effectiveness and feasibility of the super-resolution preprocessing method.

[0091] Table 4. Comparative experiments on detection of original dataset and super-resolution dataset;

[0092]

[0093] We conducted ablation experiments on a rice leaf disease dataset using YOLOv8n and the three proposed optimization strategies. We also conducted statistical analysis on key metrics such as the model's inference time, FPS, number of parameters, FLOPs, and mAP to quantify the impact of each improvement individually and in combination on model performance. The experimental results are shown in Table 5.

[0094] Table 5: Lightweight ablation experiment based on YOLOv8n network;

[0095]

[0096] Compared to the original YOLOv8 model, optimizing the backbone network's C2f module using the C2f-Ghost module reduced the model's inference time by 37.74%, the number of parameters by 15.04%, and the number of floating-point operations by 16.05%. However, the mAP index decreased by 1%, reflecting that the C2f-Ghost module may sacrifice some detection accuracy while improving computational efficiency and reducing the number of parameters. A model that optimized the neck network using only the HSFPN structure reduced inference time by 41.51%, the number of parameters by 34.71%, and the number of floating-point operations by 14.81%, compared to YOLOv8n. However, the mAP index decreased by 0.7%, demonstrating that the HSFPN's feature fusion mechanism achieves lightweightness in the neck network, significantly reducing the model's parameter size, floating-point operation requirements, and inference time, but with the potential loss of some model accuracy. Optimizing the YOLOv8n detection head model using only the Phead detection head reduced inference time by 52.83%, the number of parameters by 19.48%, and the number of floating-point operations by 32.09%, while only causing a 0.2% decrease in mAP. This demonstrates that the Phead detection head can effectively reduce model weight and significantly improve model efficiency while maintaining performance.

[0097] When combining the two optimization strategies, YOLOv8n's lightweighting performance is even more pronounced. Compared to YOLOv8n, the model optimized with C2f-Ghost and HSFPN reduced inference time by 35.22%, model parameters by 49.75%, and floating-point operations by 29.63%, but its mAP decreased by 2.8%. The model optimized with C2f-Ghost and Phead reduced inference time by 47.17%, parameters by 34.53%, floating-point operations by 48.15%, and mAP by 1.4%. The model optimized with HSFPN and Phead also reduced inference time by 47.17%, parameters by 48.8%, floating-point operations by 43.21%, and mAP by 1.3%. The model optimized with C2f-Ghost and HSFPN achieved the best lightweighting results, but suffered the greatest reduction in mAP. Among the evaluated models, the solution optimized with C2f-Ghost and HSFPN achieved the highest lightweight effect, but the reduction in mAP was the most significant.

[0098] By using C2f-Ghost to optimize the backbone network structure, HSFPN to lightweight the neck network, and an improved Phead detection head, the resulting WR-YOLO model achieved optimal lightweighting, reducing inference time by 61%, parameter count by 63.85%, and floating-point operations by 59.26%, but with a 2.1% decrease in mAP. The collaborative optimization approach using C2f-Ghost, HSFPN, and Phead modules significantly reduced model parameter size and floating-point operation requirements while significantly shortening model execution time. This lightweighting benefit is even more significant than using any of these three modules individually or in combination. Consequently, the WR-YOLO model successfully achieved its lightweight optimization goal while maintaining a certain level of accuracy.

[0099] To more intuitively demonstrate the effectiveness of model lightweighting, this article conducts a comparative analysis of the YOLOv8n and WR-YOLO models, focusing on three key indicators: parameter count, floating-point operations (FLOPs), and inference time. For detailed comparison results, see Figure 12 For comparison purposes, the YOLOv8n metrics are normalized to a baseline value of 100% to highlight differences. It's important to note that this normalization effectively reduces data dimensionality interference, clearly reflecting the relative performance improvements of each metric. This also demonstrates the actual optimization benefits of lightweight improvements.

[0100] To comprehensively evaluate the performance advantages of the WR-YOLO model, this paper conducted a series of comparative experiments, selecting the YOLOv8n, YOLOv8s, Faster R-CNN, and RetinaNet-res50 models for comparison. The experimental results are detailed in Table 6.

[0101] Table 6. Results of multi-model comparison experiments;

[0102]

[0103] The experimental results in Table 6 show that the YOLOv8s model achieves the best performance in terms of accuracy. However, its large model size results in reduced inference efficiency, reaching only 62 FPS. The two-stage Faster R-CNN model faces challenges in achieving efficient object detection, primarily due to its large parameter size, high floating-point operation requirements, and relatively slow inference speed. RetinaNet-res50 surpasses Faster R-CNN in all these evaluation metrics, but Faster R-CNN still achieves a higher level of detection accuracy. The WR-YOLO model, with its minimal parameter size and floating-point operation requirements, as well as the fastest inference speed, demonstrates excellent lightweight characteristics. Although its detection accuracy does not reach the highest level, it successfully achieves an ideal balance between detection efficiency and accuracy.

[0104] The detection performance of the WR-YOLO model, WR-YOLO+EMA model, WR-YOLO+iRMB model and WR-YOLO+iEMA model is compared and analyzed.

[0105] As shown in Table 7, by introducing the EMA, iRMB, and iEMA attention mechanisms, the parameter size and floating-point operations of the WR-YOLO model show a slight increase, while its inference speed slows slightly. However, its detection accuracy shows varying degrees of improvement. Compared with the WR-YOLO model, the WR-YOLO+EMA model improves mF1 by 2% and mAP by 0.5%, with a parameter increase of only 0.013%. The number of floating-point operations remains essentially unchanged, while inference time increases by 22.58% and inference speed decreases by 18.75%. The WR-YOLO+iRMB model improves mF1 by 2%, mAP by 1.8%, and parameter increase by 4.85%. The number of floating-point operations increases by 48.48%, accompanied by a 29.03% increase in inference time and a 22.5% decrease in inference speed. The WR-YOLO+iEMA model achieved a 2.1% improvement in mF1 and a 2% improvement in mAP, demonstrating superior performance in optimizing detection accuracy compared to the WR-YOLO+EMA and WR-YOLO+iRMB models. While the number of parameters and floating-point operations increased by only 1.37% and 3.03%, the inference time increased by 20.96% and the speed decreased by 16.87%, maintaining a frame rate of 133 frames per second. This demonstrates that the model's accuracy has been improved while maintaining its lightweight nature.

[0106] In summary, introducing the EMA attention mechanism, the iRMB attention mechanism, and the iEMA attention mechanism into the WR-YOLO model improved detection accuracy without significantly increasing the number of model parameters or computational complexity. Compared to the EMA attention mechanism, iEMA demonstrated a significant advantage in improving the detection accuracy of the WR-YOLO model. Compared to the iRMB attention mechanism, the model optimized using iEMA attention not only demonstrated better detection accuracy, but also achieved a lighter weight and faster inference speed.

[0107] Table 7 Comparison of models with different attention mechanisms;

[0108]

[0109] This paper compares and analyzes the performance of four models on heat maps, such as Figure 13 As shown. Heatmap is an intuitive visualization tool, mainly used to show the distribution of the model's attention to a specific target in image recognition tasks. Its principle is to intuitively reflect the difference in the model's attention through the depth of color. The lighter the color, the less attention the model pays to that part, while the darker the color, the more the model focuses on that area. Figure 13, we can see that from model (b) to model (e), the model's attention to redundant areas gradually decreases, while its attention to target lesions significantly increases. In contrast, the WR-YOLO model integrating the iEMA attention mechanism outperforms the WR-YOLO model using the EMA attention mechanism, the iRMB attention mechanism, and the WR-YOLO model without attention mechanism support, and is more outstanding in reducing background interference and enhancing target feature extraction.

[0110] Based on the experimental data above, while the use of the attention mechanism results in a slight decrease in model inference efficiency, it significantly improves detection accuracy. This paper adds a small number of iEMA attention modules to the WR-YOLO algorithm's network architecture to enhance the model's ability to capture feature information. For ease of reference, the model combining WR-YOLO with the iEMA attention mechanism is named the WR-YOLOI model. Based on this, the model loss function is optimized.

[0111] In comparing the effects of different loss functions on the detection accuracy of the WR-YOLOI (WR-YOLO+iEMA) model, including CIoU, SIoU, and WIoU loss functions, the CIoU loss function is the original loss function of the WR-YOLO model. WR-YOLOI is used as a baseline model for comparative research, and the mAP and mF1 indicators are used to evaluate the detection accuracy. After optimization using the CIoU, SIoU, and WIoU loss functions, the mAP and mF1 indicators of the model are compared. Figure 14 shown.

[0112] Depend on Figure 14 It can be seen that using the WIoU loss function to optimize the WR-YOLOI model can achieve the best detection accuracy, specifically mF1 reaching 77.9% and mAP reaching 80.3%. Compared with the case of using the original CIoU loss function, mF1 increased by 1.2% and mAP increased by 0.8%. After optimization with the SIoU loss function, mF1 and mAP are 76.1% and 79.7%, respectively. Compared with the original CIoU loss function, mF1 decreased by 0.6% and mAP increased by 0.2%. In summary, using the WIoU loss function can improve the detection accuracy of the WR-YOLOI model, and compared with the models optimized with the CIoU or SIoU loss functions, the WR-YOLOIW model has a better mF1 indicator. Therefore, this chapter explicitly chooses WIoU as the model loss function.

[0113] In summary, using WIoU to improve the WR-YOLOI model's loss function effectively improves model training efficiency and ultimately enhances object detection accuracy. By optimizing the loss function, model performance is improved without changing model parameters or computational complexity, thus maintaining the model's lightweight nature.

[0114] To improve model accuracy, this chapter optimizes the WR-YOLO model using two strategies: introducing the iEMA attention mechanism and using the WIoU loss function. Ablation experiments validate the effectiveness of these two optimization methods, with the experimental data results detailed in Table 4.2. As shown in Table 4.2, when only the iEMA attention mechanism is introduced, the WR-YOLO model achieves a 2% improvement in mF1 and a 2.1% improvement in mAP. When only the WIoU loss function is used, mF1 and mAP improve by 0.8% and 0.9%, respectively. When both optimization methods are used simultaneously, mF1 and mAP improve by 0.8% and 3.3%, achieving optimal detection accuracy. Comparing the performance of the WR-YOLOIW and WR-YOLO models on the rice leaf disease detection task, we observe that the former improves the AP metric for all rice leaf disease targets, strongly validating the feasibility of the optimization strategies adopted in this chapter. By simultaneously using the iEMA attention mechanism and the WIoU loss function, the model effectively improves the detection accuracy of rice leaf disease targets.

[0115] Table 8 Model ablation experiment;

[0116]

[0117] Based on the above analysis, using either the iEMA attention mechanism or the WIoU loss function alone can improve the detection accuracy of the WR-YOLO model. Combining the iEMA attention mechanism with the WIoU loss function can further improve the detection accuracy of the WR-YOLO model, enabling it to achieve even more outstanding performance.

[0118] To comprehensively evaluate the performance advantages of the WR-YOLO IW model, we conducted comparative experiments with various object detection models, comparing their performance across five key performance metrics: parameter size, inference time, floating-point operations, FPS, and mAP. The results are shown in Table 9. The YOLOv7-tiny model demonstrated superior real-time performance, achieving an FPS of 74, surpassing the YOLOv8s model. Its parameter size and floating-point operations were also smaller than those of the YOLOv8s model, but its detection accuracy was slightly lower than that of the YOLOv8s model. The YOLOv8s model achieved the highest accuracy, but its large model size resulted in a relatively slow inference speed, with an FPS of only 52. ​​As for the traditional two-stage model, Faster R-CNN, its performance was unsatisfactory in terms of parameter size, floating-point operations, and inference efficiency. The RetinaNet-res50 model outperformed Faster R-CNN in terms of floating-point operations, parameter size, and inference speed, but lagged behind it in detection accuracy. According to experimental results, the lightweight WR-YOLO model achieved the lowest parameters and floating-point operations, and the highest FPS, ensuring the ultimate efficiency of its inference speed. It is considered the best lightweight model. However, compared with the original YOLOv8n model, its mAP decreased by 2.1%, indicating that while pursuing extreme lightweightness, the model also sacrificed detection accuracy to a certain extent.

[0119] Table 9. Results of multi-model comparison experiments;

[0120]

[0121] The improved WR-YOLOIW model surpasses the lightweight WR-YOLO model in detection accuracy. Compared with the YOLOv8n model, the WR-YOLOIW model achieved a 0.7% improvement in mAP, while reducing the number of parameters by 63.35% and the number of floating-point operations by 58.02%. Its model inference speed increased to 134 frames / s, which fully verified the effectiveness of the model lightweight strategy and continued optimization plan, thereby significantly improving the model's operating efficiency while ensuring detection accuracy.

[0122] The above technical solutions only reflect the preferred technical solutions of the technical solutions of the present invention. Any changes that may be made to certain parts thereof by those skilled in the art all reflect the principles of the present invention and fall within the scope of protection of the present invention.

Claims

1. A lightweight rice leaf disease recognition method based on YOLO target detection, characterized in that: The following steps are involved: Step S1: inputting rice leaf disease images; Step S2: Use the improved Real-ESRGAN algorithm to perform super-resolution reconstruction on the image; Step S3: Input the image into the improved YOLOv8n target detection algorithm; Step S4: obtaining the lesion type and location information; Step S5: Visualize the information on the image.

2. The lightweight rice leaf disease recognition method based on YOLO target detection according to claim 1 is characterized in that: In step S2: based on the generator of Real-ESRGAN, a dense block HDC-DB consisting of 5 layers of dilated convolution is constructed, and the leaky ReLU function used in the activation layer of the generator and discriminator is replaced with the GELU function. Three HDC-DB modules are connected in series to form the HDC-RRDB module.

3. The lightweight rice leaf disease recognition method based on YOLO target detection according to claim 1 is characterized in that: The backbone network in the YOLOv8 architecture in step S3 includes a CBS module, a C2f module, and an SPPF module. The CBS module is composed of a convolutional layer, a batch normalization layer, and a SiLU activation function. The operating mechanism of the C2f module is to receive the spliced ​​data as input. The Bottleneck module of GhostNetV2 is introduced into the C2f module of the backbone network. The component is defined as the C2f-Ghost module. Within the C2f-Ghost module, the initial feature information must first be processed by the CBS module. Then, a slicing operation is performed, which evenly divides the number of channels of the original data into two equal parts. The final data segment will be sent to the GhostBottleneck module for conversion. Its output will be spliced ​​with the original sliced ​​input data in the channel dimension. After a CBS module integration, the final output data is formed. The neck structure of the YOLOv8 architecture in step S3 is mainly composed of the CBS module and the C2f module. In the neck structure, the High-level Screening-feature Pyramid Networks (HSFPN) are referenced. The HSFPN consists of two core components: the Channel Attention (CA) module, which is responsible for screening feature maps of different scales, and the Selective Feature Fusion (SFF) module, which is responsible for effectively integrating high-level and low-level information in the feature maps.

4. The lightweight rice leaf disease recognition method based on YOLO target detection according to claim 1, characterized in that: The YOLOv8n model in step S3 uses a Phead detection head, which includes a single detection head consisting of two parts: module a and module b. Module a is a 3×3 PConv convolution, and module b is a 1×1 CBS module.

5. The lightweight rice leaf disease recognition method based on YOLO target detection according to claim 1, characterized in that: The step S4 includes the EW-MHSA framework, introduces the iRMB module and the EMA module, and uses the EMA attention mechanism to optimize the EW-MHSA. The operation process of the iRMB module includes the expansion and compression of the channel, interspersed with layer-by-layer convolution, and the iRMB module introduces the EMA module.

6. The lightweight rice leaf disease recognition method based on YOLO target detection according to claim 1, characterized in that: In step S4, the WR-YOLO model adopts the WIoU metric method to improve the performance of the loss function, thereby optimizing the WR-YOLO model training process.

Citation Information

Cited By

  • Field small target crop detection model and construction method

    CN117557901A

  • Rice multi-disease detection method based on improved YOLOv11n

    CN121170590A

  • A rice multi-disease detection method based on improved YOLOv11n

    CN121170590B

  • Lightweight agricultural pest detection algorithm

    CN121505541A