Rice bacterial leaf blight scab target detection model and method and storage medium

By combining depthwise separable convolution with a large kernel attention mechanism, along with deformable offset fields and adaptive threshold focus loss functions, the contradiction between deformation adaptability, lightweight design, and high accuracy in rice bacterial blight lesion detection models has been resolved, achieving efficient and robust lesion detection.

CN121937876APending Publication Date: 2026-04-28NANJING AGRICULTURAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANJING AGRICULTURAL UNIVERSITY
Filing Date
2026-01-20
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing models for detecting bacterial blight lesions in rice have poor adaptability to deformation during feature extraction, the loss function cannot dynamically balance easy and difficult samples, and the models struggle to balance lightweight design with high accuracy, thus limiting their application in the agricultural sector.

Method used

Employing a depthwise separable convolution and large kernel attention mechanism, combined with a deformable offset field, global attention is generated through depthwise dilated convolution and point convolution. A lightweight deformable large kernel attention module is constructed, and combined with a progressive convolution block stacking architecture and an adaptive threshold focus loss function, multi-scale feature extraction and dynamic sample adjustment are achieved.

Benefits of technology

It significantly improves the feature extraction capability for irregular lesions, reduces background noise, and increases the detection rate and recall rate of small lesions, meeting the deployment requirements of edge devices, while optimizing the model's lightweight design and detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121937876A_ABST
    Figure CN121937876A_ABST
Patent Text Reader

Abstract

The invention discloses a rice bacterial leaf blight disease spot target detection model and method and a storage medium, and relates to the technical field of agricultural disease intelligent detection, and the method comprises the steps: image feature enhancement and processing: a backbone network carries out the multi-scale feature extraction of an input image through employing a progressive convolution block stacking architecture; target detection and disease grading: inputting features fused by the feature fusion network into a detection head, and outputting a target bounding box and a classification result; and constructing a feature adaptive and lightweight model, and constructing a rice bacterial leaf blight scab target detection model. According to the method, the practical problems in irregular feature extraction, sample imbalance optimization and lightweight deployment in the prior art are solved, the accuracy, efficiency and environmental adaptability of rice bacterial leaf blight detection are remarkably improved, and all-around technical support is provided for intelligent upgrading of intelligent agriculture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent detection technology for agricultural diseases, specifically to a target detection model, method, and storage medium for rice bacterial blight lesions. Background Technology

[0002] With the rapid development of modern precision agriculture technology and the continuous growth of the global population, food security has become a focus of international attention. As the staple crop for more than half of the world's population, the health management of rice throughout its entire growth cycle is directly related to the stability of the agricultural economy and the cornerstone of food supply security. In the refined cultivation management of rice, early monitoring and precise control of diseases occupy a core position. Among these, rice bacterial leaf blight, a highly destructive bacterial disease, is characterized by rapid spread, short incubation period, strong destructiveness, and wide affected area. If not controlled in time, this disease can lead to large-scale leaf death, loss of photosynthetic capacity, and consequently, severe yield reduction or even crop failure. Therefore, developing an efficient, robust, and automated disease detection technology adaptable to complex field environments is of paramount practical significance for achieving early detection, early warning, and early treatment of diseases, reducing pesticide overuse, lowering planting costs, and improving rice quality.

[0003] I. The complex and variable field environment and lesion morphology make it difficult for existing models to achieve accurate feature extraction and robust representation. Rice bacterial blight lesions are highly irregular in shape, often extending along leaf veins in a wavy or striped pattern, with blurred edges and varied textures, exhibiting highly non-rigid deformation characteristics. Existing mainstream object detection networks rely on convolutional kernels with fixed geometric structures (such as 3×3 standard convolutions) for feature extraction. This fixed sampling grid lacks adaptability to geometric deformation and struggles to fit the diverse lesion morphologies, resulting in extracted features containing significant background noise or losing crucial pathological texture information. Furthermore, uneven lighting, leaf occlusion, and cluttered backgrounds (weeds, water reflections) in the field further exacerbate feature confusion. While introducing Vision Transformer (ViT) to capture global contextual information using a self-attention mechanism can compensate for the insufficient receptive field of CNNs, its computational complexity is high and the number of parameters is enormous. Simply introducing a large kernel, although it can expand the receptive field, leads to a quadratic increase in the number of parameters.

[0004] II. Foreground-background sample imbalance hinders the efficient convergence of existing classification loss functions. In rice paddy images, healthy leaves and the background occupy the vast majority of pixels, while diseased lesions account for a very small proportion, resulting in extreme class imbalance. During training, a large number of simple negative samples (easily identifiable background) dominate the gradient update direction, inhibiting the model's learning of scarce and difficult-to-identify positive samples (lesions). This causes the model to tend to predict the target as the background, leading to missed detections. Traditional cross-entropy loss functions are ineffective in addressing this problem. Although Focal Loss reduces the weight of simple samples through modulation factors, its hyperparameters are usually statically fixed and cannot adapt to the dynamic changes in the model's focus on easy and difficult samples at different training stages (e.g., focusing on the overall distribution initially and then focusing on difficult samples later). Furthermore, existing loss functions lack a mechanism to explicitly decouple the target from the background, resulting in poor generalization ability when facing blurry lesions with similar texture features to the background.

[0005] Third, the inherent contradiction between lightweight models and detection accuracy severely restricts the application of intelligent detection technology at the agricultural edge. Smart agriculture requires the deployment of detection models on edge devices with limited computing resources (such as agricultural drones and handheld terminals), imposing stringent restrictions on the number of model parameters, floating-point operations, and inference speed. Existing high-precision models (such as YOLOv8-L / X) are bulky and power-consuming, making them difficult to run at the edge; while lightweight models adapted for mobile devices (such as MobileNet-SSD) often reduce feature extraction capabilities by reducing channels or simplifying the structure, resulting in a significant drop in accuracy in complex lighting and the detection of small lesions. Existing technical solutions often require a difficult trade-off between accuracy and speed, lacking a solution that can significantly reduce computational costs while compensating for or even surpassing the accuracy of large models through structural optimization (such as efficient attention mechanisms). Summary of the Invention

[0006] In view of the above-mentioned problems, the present invention is proposed.

[0007] Therefore, the technical problem solved by this invention is that existing methods for early disease monitoring and precise prevention and control have problems such as poor feature extraction adaptability to deformation, inability of loss function to dynamically balance easy and difficult samples, difficulty in modeling to balance lightweight and high accuracy, and how to achieve adaptive dynamic adjustment of loss function.

[0008] To address the aforementioned technical problems, this invention provides the following technical solution: a target detection model for rice bacterial blight lesions, comprising combining depthwise separable convolution with a large kernel attention mechanism, introducing a deformable offset field, decomposing a large-size convolution kernel into three cascaded operations; after extracting local deformation features, generating global attention through depthwise empty convolution and point convolution; and outputting enhanced features through point convolution and residual connections for feature reconstruction output.

[0009] As a preferred embodiment of the rice bacterial blight lesion target detection model described in this invention, the three cascaded operations include: depthwise convolution, depthwise dilated convolution kernel point convolution; depthwise convolution independently extracts spatial features for each channel; depthwise dilated convolution constructs a receptive field equivalent to a large-size convolution kernel by inserting holes between convolution kernel elements; and point convolution performs cross-channel information fusion.

[0010] As a preferred embodiment of the rice bacterial blight lesion detection model described in this invention, the generation of global attention includes: after extracting local deformation features, capturing long-distance dependencies through deep dilated convolution, and constructing a global receptive field equivalent to a self-attention mechanism, expressed as: , in, A global receptive field comparable to the self-attention mechanism, For channel information exchange, For deep-diffuse convolution, This is the output feature map after deformation feature extraction.

[0011] As a preferred embodiment of the rice bacterial blight lesion target detection model of the present invention, the residual connection output includes: obtaining a weighted feature map from the attention weight map and the original input feature map; performing a linear transformation of the channel dimension on the weighted feature map through point convolution; and forming a residual connection between the transformed features and the original input.

[0012] Another objective of this invention is to provide a method for detecting bacterial blight lesions in rice. This method can extract multi-scale features from input images through image feature enhancement and processing. The backbone network adopts a progressive convolutional block stacking architecture, which solves the problem of low feature extraction accuracy in current early disease monitoring and precision control technologies.

[0013] As a preferred embodiment of the rice bacterial blight lesion target detection method described in this invention, the method includes: image feature enhancement and processing, wherein the backbone network uses a progressive convolutional block stacking architecture to extract multi-scale features from the input image; target detection and disease classification, wherein the features fused by the feature fusion network are input to the detection head, and the target bounding box and classification results are output; feature adaptation and lightweight model construction, thereby building a rice bacterial blight lesion target detection model.

[0014] As a preferred embodiment of the rice bacterial blight lesion target detection method described in this invention, the image feature enhancement and processing includes: the backbone network adopts a progressive convolutional block stacking architecture to extract multi-scale features from the input rice image; a module integrating a deformable large kernel attention mechanism is introduced to extract deformation-aware features; and deformable convolution is used to learn spatial offset to adaptively fit the irregular geometric boundaries of the lesion.

[0015] As a preferred embodiment of the rice bacterial blight lesion target detection method of the present invention, the target detection and disease classification includes: inputting a multi-scale feature map after fusion by a feature fusion network into a detection head for final prediction; the detection head predicts multiple anchor boxes for each spatial location of each feature map.

[0016] As a preferred embodiment of the rice bacterial blight lesion target detection method of the present invention, the target detection and disease classification includes: configuring the detection task as a single-class mode, filtering candidate boxes through a confidence threshold, removing redundant overlapping boxes through non-maximum suppression, and finally outputting the bounding box coordinates and corresponding confidence scores of each lesion.

[0017] As a preferred embodiment of the rice bacterial blight lesion target detection method described in this invention, it further includes real-time detection and deployment decision-making. The output detection results are optimized and trained using an adaptive threshold focus loss function. Based on the relationship between the predicted probability of the YOLOv13 model and the set threshold, the samples are dynamically decoupled by a threshold, and the training samples are dynamically divided into two categories: easy-to-classify samples and difficult-to-classify samples.

[0018] Another object of the present invention is to provide a rice bacterial blight lesion target detection storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of a rice bacterial blight lesion target detection method.

[0019] The beneficial effects of this invention are: The rice bacterial blight lesion detection method provided by this invention breaks through the limitation of fixed receptive field and significantly enhances the feature extraction capability for irregular lesions. A lightweight, deformable large-kernel attention module is constructed in the backbone network and feature fusion stage. This module decomposes large-size convolutional kernels into depthwise convolution, depthwise dilated convolution, and pointwise convolution, and introduces a deformable convolution offset learning mechanism. This allows the network to break free from the limitation of the fixed rectangular receptive field of traditional convolution, adaptively adjusting the sampling grid to accurately fit the natural geometry of the lesions. This effectively captures the long-distance contextual dependencies of slender lesions and significantly reduces the introduction of background noise, thereby significantly improving the model's localization accuracy for deformed lesions, solving the problem of extreme sample imbalance, and improving the detection rate of small lesions. An adaptive threshold focus loss function is proposed. This function uses exponential smoothing to predict the probability mean in real time to construct an adaptive modulation factor, realizing dynamic adjustment of the loss weights for simple and difficult samples. This mechanism automatically suppresses the gradient contribution of a large number of simple background samples during training, forcing the model to focus on the features of small and blurred lesions that are difficult to distinguish. Experiments demonstrate that this strategy effectively addresses the problem of small targets being overwhelmed, significantly improving the model's recall rate and reducing the false negative rate. It achieves a dual optimization of lightweight design and high accuracy, meeting the requirements for mobile deployment. This invention, through the lightweight design and network structure reorganization of DSC-DLKA, significantly improves detection performance while drastically reducing the hardware computational barrier of the model. This invention achieves better results in extracting deformation features of irregular lesions, learning from difficult samples under imbalanced conditions, and synergistic optimization of model lightweighting and detection accuracy. Attached Figure Description

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

[0021] Figure 1 This is a structural diagram of a lightweight, deformable, large kernel attention module for detecting rice bacterial blight lesions, as provided in Embodiment 1 of the present invention.

[0022] Figure 2 This is an overall architecture diagram of an improved model for detecting bacterial blight lesions in rice, as provided in Embodiment 1 of the present invention.

[0023] Figure 3 This is a comparison of the detection results of different methods for detecting bacterial blight lesions in rice, as provided in Embodiment 3 of the present invention.

[0024] Figure 4This is an overall flowchart of a method for detecting bacterial blight lesions in rice, provided in Embodiment 3 of the present invention. Detailed Implementation

[0025] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.

[0026] Example 1, referring to Figures 1-2 As one embodiment of the present invention, a target detection model for rice bacterial blight lesions is provided, comprising: a lightweight deformable large kernel attention module (DSC-DLKA): to address the problems that standard convolutional kernels cannot adapt to the irregular deformation of rice bacterial blight lesions and the excessive number of parameters. This module combines depth-wise separable convolution (DSC) and large kernel attention (LKA) mechanisms, and introduces a deformable offset field.

[0027] Specifically, large kernel decomposition and deformation perception: DSC-DLKA abandons the approach of directly using large-size convolutional kernels, instead decomposing them into spatially local large-kernel depthwise convolutions, dilated depthwise convolutions, and pointwise convolutions, and directly using large-size convolutional kernels (such as... While it can expand the receptive field, it presents two key problems: first, the number of parameters increases quadratically, resulting in a large model size and low computational efficiency; second, many parameters in the large convolutional kernel correspond to positions far from the center, contributing little to the target features and causing parameter redundancy. The decomposition strategy adopted in this invention decomposes the large kernel convolution into three cascaded operations: firstly... The depthwise convolution (DIV) extracts spatial features independently for each channel; secondly, it uses a dilation rate of 3. Dilated Depth-wise Convolution (DDC) achieves an equivalent function with fewer parameters by inserting holes between the kernel elements. The receptive field of the convolution kernel; finally, Point-wise convolution enables cross-channel information fusion. This decomposition strategy reduces the number of parameters while maintaining a large receptive field. To adapt to lesion deformation, an offset generation layer is introduced before depthwise convolution. The core purpose of introducing the offset generation layer is to overcome the limitations of the fixed sampling grid in standard convolution. Traditional convolution samples using a regular rectangular grid, which cannot adapt to the irregular shape and extension of rice bacterial blight lesions along leaf veins. The offset generation layer is composed of lightweight... The system consists of convolutional layers, whose input is the current feature map. The output is a two-dimensional spatial offset field. , including each sampling point in and The offset in direction is learned through end-to-end learning, which enables the network to automatically adjust the sampling coordinates of each position according to the content of the input image, so that the sampling points can be distributed along the edge of the lesion, thereby accurately capturing the geometric features of irregular lesions and learning the offset field from the input features.

[0028] It should be noted that the feature extraction process is represented as follows: , , in, The learned sampling offset, For the input feature map, This is the output feature map after deformation feature extraction. This is a depthwise convolution with deformation offset, used to capture local deformation features. This refers to the channel-wise independent convolution operation in depthwise separable convolution. As a deformable convolution mechanism, this operation performs bilinear interpolation on the sampling position based on the offset field, enabling adaptive feature acquisition of irregular lesion regions. The activation function is defined as follows: ,in It is the cumulative distribution function of the standard normal distribution, which has a smoother gradient transition characteristic compared to ReLU, and helps the model converge stably.

[0029] Global attention generation: After extracting local deformation features, long-range dependencies are captured through deep dilated convolution, constructing a global receptive field comparable to the self-attention mechanism, represented as: , in, A global receptive field comparable to the self-attention mechanism, For channel information exchange, It is a deep-hole convolution.

[0030] Feature reconstruction output: This invention does not use Sigmoid or Softmax normalization functions to preserve high-frequency detail information at lesion edges, but directly outputs the feature through element-wise multiplication, as follows: , in, For feature reconstruction output, For the input feature map, It is a Hadamard product (element-wise multiplication), which outputs enhanced features through residual connections.

[0031] The specific steps for the residual connection output are as follows: First, the attention weight map is element-wise multiplied with the original input feature map F (Hadamard product) to obtain a weighted feature map. This operation enables the network to adaptively enhance the feature response of the lesion region and suppress background noise; second, the weighted feature map is processed through... Convolution performs a linear transformation of the channel dimension; finally, the transformed features are added element-wise to the original input F to form residual connections. The residual connections enable the gradient to be directly propagated back to the shallow layers, effectively alleviating the gradient vanishing problem, while preserving the low-level details in the original features.

[0032] It should also be noted that the single-class detection network architecture, YOLOv13s (Small version), is a lightweight configuration in the YOLOv13 series, using a depth factor of 0.50 and a width factor of 0.50. Its overall architecture consists of three parts: a backbone network 100, a feature fusion network 200 (Neck), and a detection head 300 (Head). The backbone employs a progressive downsampling structure, extracting feature maps at five scales (P1 to P5) through modules such as Conv, DSC3k2_DLKA, and A2C2f. The Neck uses HyperACE and FullPAD_Tunnel modules to construct a bidirectional feature pyramid. The Head performs object detection at three scales (P3, P4, and P5), and the output layer of the detection head 300 (Head) is configured in single-class mode (nc=1). The network focuses on enhancing the representation of bacterial blight lesions as a specific target through the DSC-DLKA module, while suppressing responses to other non-disease textures (such as cluttered backgrounds and healthy leaves). The DSC-DLKA module enhances the representation of bacterial blight lesions and suppresses responses to non-disease textures through the following mechanisms: In terms of feature enhancement, the offset learning mechanism of deformable convolution enables sampling points to adaptively cluster in the lesion region, densely sampling the wavy edges and irregular textures of the lesions; the large kernel attention mechanism generates a spatial attention weight map, assigning higher response weights to the lesion region; in terms of background suppression, non-disease regions (such as healthy leaves and soil backgrounds) naturally have lower response values ​​due to the lack of lesion-specific texture patterns; and deep dilated convolution captures long-range context, enabling the model to distinguish isolated noise points from real lesions with continuous distribution features.

[0033] Example 2 is an embodiment of the present invention, which provides a method for detecting bacterial blight lesions in rice. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.

[0034] First, the experimental dataset consisted of 1489 RGB images of rice bacterial blight of different varieties, growth stages, and disease severity, acquired using a high-resolution digital camera. These images were precisely labeled using the Labelme tool, resulting in 14388 lesion targets. The dataset was divided into a training set (1042 images, 11042 labels), a test set (298 images, 2429 labels), and a validation set (149 images, 917 labels) in a 7:2:1 ratio. The experimental environment consisted of an NVIDIA RTX 4090 GPU, PyTorch 2.0 framework, and training for 300 epochs.

[0035] First, the baseline model YOLOv13s was trained and its performance metrics were recorded. Then, the ATFL loss function and the DLKA module were trained separately. Finally, both modules were trained simultaneously for the complete model. The results after training are shown in Table 1. Introducing ATFL alone improved mAP50 from 86.3% to 87.1%, an increase of 0.8%, and Recall from 77.5% to 79.4%, an increase of 1.9%, indicating that ATFL effectively alleviated the sample imbalance problem. Introducing DLKA alone improved mAP50 to 86.7%, while reducing the number of parameters by 12.2% and the computational cost by 6.6%. The complete model achieved optimal performance with mAP50 of 87.4%.

[0036] Table 1 Comparison of Ablation Experiment Results Method mAP50 P R mAP50-95 Params(M) GFLOPs(G) YOLOv13s 0.863 0.839 0.775 0.560 9.53 21.3 YOLOv13s-ATFL 0.871(+0.8%) 0.854(+1.5%) 0.794(+1.9%) 0.557(-0.3%) 9.53 21.3 YOLOv13s-DLKA 0.867(+0.4%) 0.839(--) 0.807(+3.2%) 0.559(-0.1%) 8.37 19.9 YOLOv13s-ATFL+DLKA 0.874(+1.1%) 0.844(+0.5%) 0.796(+2.1%) 0.558(-0.2%) 8.37 19.9

[0037] The above ablation experiments demonstrate the following beneficial effects of this invention: First, the detection accuracy is significantly improved, with the mAP50 index increasing from 86.3% to 87.4%, an improvement of 1.1%; second, the false negative rate is effectively reduced, with the recall rate increasing from 77.5% to 79.6%, reducing the false negatives of tiny lesions and lesions with blurred boundaries; third, the model is significantly lightweight, with the number of parameters reduced by 12.2% and the amount of computation reduced by 6.6%, meeting the deployment requirements of edge devices.

[0038] Example 3, referring to Figures 3-4 As an embodiment of the present invention, a method for detecting bacterial blight lesions in rice is provided, comprising: S1: Image feature enhancement and processing. The backbone network uses a progressive convolutional block stacking architecture to extract multi-scale features from the input image.

[0039] Specifically, image feature enhancement and processing include: the backbone network uses a progressive convolutional block stacking architecture to extract multi-scale features from the input rice image; a module integrating a deformable large kernel attention mechanism is introduced to extract deformation-aware features; and deformable convolution is used to learn spatial offsets to adaptively fit the irregular geometric boundaries of lesions.

[0040] It should be noted that the backbone network 100 employs a progressive convolutional block stacking architecture to extract multi-scale features from the input rice image. Specifically, the network first uses a standard convolution (Conv) with a stride of 2 to downsample the input image to 1 / 2 resolution (P1 layer), extracting 64 channels of primary edge and texture features. Then, a second standard convolution layer further downsamples to 1 / 4 resolution (P2 layer), expanding the number of channels to 128. After the output of P2 layer (1 / 4 resolution), the network introduces the DSC3k2_DLKA module, which integrates a deformable large kernel attention mechanism, to replace the standard convolutional blocks for deformation-aware feature extraction, outputting 256 channels of features. After downsampling to P3 layer (1 / 8 resolution) via standard convolution, the DSC3k2_DLKA module extracts 512 channels of features again. This module reduces computational complexity by decomposing large convolutional kernels using depthwise separable convolution, while utilizing deformable convolution to learn spatial offsets, enabling sampling points to adaptively fit the irregular geometric boundaries of lesions. In layers P4 (1 / 16 resolution) and P5 (1 / 32 resolution), the network uses depthwise separable convolution (DSConv) in conjunction with the A2C2f attention module to perform high-level semantic feature abstraction. Through the above five-level pyramid feature extraction structure (resolutions of 1 / 2, 1 / 4, 1 / 8, 1 / 16, and 1 / 32 respectively), Backbone can simultaneously capture fine-grained edge details of lesions and global contextual semantic information, significantly enhancing the network's ability to perceive irregular lesion morphology and blurred boundaries.

[0041] It should also be noted that by using a progressive convolutional block stacking structure and a deformable large kernel attention module, combined with deformable convolutional adaptive learning spatial offset, the problem of difficulty in accurately extracting irregular geometric boundaries and fuzzy features of rice lesions is solved. This significantly enhances the ability to perceive multi-scale lesion details and global semantics, and improves the recognition accuracy and the model's adaptability and robustness to complex morphologies.

[0042] S2: Target detection and disease classification. The features fused by the feature fusion network are input into the detection head, and the target bounding box and classification results are output.

[0043] Specifically, target detection and disease classification include inputting multi-scale feature maps fused by a feature fusion network into the detection head for final prediction. The detection head predicts multiple anchor boxes for each spatial location of each feature map.

[0044] The multi-scale feature maps (P3, P4, and P5 layers) fused by the feature fusion network (Neck) are input into the detection head for final prediction. The detection head predicts multiple anchor boxes for each spatial location of each feature map, and each anchor box outputs a 6-dimensional vector (5 + nc, nc = 1), where the first 4 dimensions are the bounding box regression parameters (center point coordinate offset). and width and height scaling factors The fifth dimension is the objectness score, and the sixth dimension is the class probability.

[0045] It should be noted that the target detection and disease classification includes configuring the detection task as a single-class mode, filtering candidate boxes through a confidence threshold, removing redundant overlapping boxes through non-maximum suppression, and finally outputting the bounding box coordinates and corresponding confidence score of each lesion.

[0046] The detection task is configured in single-class mode (nc=1), meaning it only detects the category of "rice bacterial blight lesions". During the inference phase, the model first filters candidate boxes using a confidence threshold, then removes redundant overlapping boxes using non-maximum suppression (NMS), and finally outputs the precise bounding box coordinates (top-left x and y coordinates, width, and height) of each lesion along with its corresponding confidence score. Compared to multi-class mode, single-class configuration reduces the number of output layer parameters, lowers the risk of inter-class confusion, and allows the model to focus on the accurate localization of bacterial blight lesions.

[0047] It should also be noted that by adopting a single-category detection head configuration and anchor frame prediction mechanism, combined with confidence threshold screening and non-maximum consistency post-processing, the problems of low positioning accuracy and high false detection rate of irregular lesions in complex field backgrounds are solved, enabling rapid and accurate positioning of rice lesions and providing an efficient and stable detection basis for subsequent disease grading.

[0048] S3: Feature adaptation and lightweight model construction to build a target detection model for rice bacterial blight lesions.

[0049] Specifically, regarding the feature adaptation and lightweight strategy, in the feature extraction and fusion process, this invention constructs a hierarchical feature pyramid fusion architecture. Specifically, the three-level features P3 (1 / 8), P4 (1 / 16), and P5 (1 / 32) output by the Backbone are first enhanced with channel attention by the HyperACE module; then, through a top-down path, the high-level semantic features are upsampled and adaptively fused with the low-level detail features through the FullPAD_Tunnel module; at the same time, a bottom-up path is constructed, where the low-level features are downsampled and fused with the high-level features again to form a bidirectional feature pyramid network (BiFPN) structure.

[0050] In the above process, the DSC3k2_DLKA module implements dynamic adaptive adjustment of the receptive field: the offset generation layer inside this module learns a two-dimensional offset vector for each sampling position based on the spatial distribution of the input features. This allows the originally fixed convolutional sampling grid to deform along the edge of the lesion, thereby adaptively fitting the geometric contour of the irregular lesion.

[0051] It should be noted that, in terms of lightweight design, the D-LKA module adopts a deep separable convolution decomposition strategy: [the strategy involves] decomposing traditional... The solution of the large kernel convolution is as follows Depthwise convolution, which is an independent convolution for each channel, is similar to... A concatenated form of pointwise convolution, with the number of parameters ranging from... Reduce to The price reduction can reach Furthermore, this invention draws upon the concept of dynamic token sparsity: during attention calculation, key tokens are dynamically selected for subsequent calculations based on the response intensity at each spatial location of the feature map. Low-response regions (such as uniform backgrounds) are sparsified, skipping redundant calculations. This significantly reduces the overall computational load while maintaining high-precision feature extraction of lesion regions. Experiments show that this lightweight strategy reduces the number of model parameters from 9.53M to 8.37M and the computational load from 21.3G to 19.9G, meeting the real-time deployment requirements at the edge.

[0052] Real-time detection and deployment decision: The final output detection results are optimized and trained using the ATFL loss function to ensure that the model still has high accuracy and high recall under imbalanced sample conditions.

[0053] It should also be noted that the detection method includes real-time detection and deployment decision-making. The output detection results are optimized and trained using an adaptive threshold focus loss function. Based on the relationship between the predicted probability of the YOLOv13 model and the set threshold, the samples are dynamically decoupled by a threshold, and the training samples are dynamically divided into two categories: easy-to-classify samples and hard-to-classify samples.

[0054] To address the severe foreground-background sample imbalance in rice images, an Adaptive Threshold Focal Loss (ATFL) function is proposed. This function decouples samples through a dynamic threshold, which means adjusting the sample decoupling based on the model's predicted probability and a set threshold. Based on the relationship, the training samples are dynamically divided into two categories: easy-to-classify samples and hard-to-classify samples. When the predicted probability is less than or equal to... When the probability is greater than a certain value, the pixel is considered a hard sample and requires reinforcement learning; when the predicted probability is greater than a certain value... If a sample is deemed easily separable, its loss contribution should be reduced. This sample crosses the threshold during each forward propagation. Decoupling can be achieved in real time through comparison, requiring no additional labeling, and the loss weights are adjusted in real time using adaptive modulation factors. The specific process of adaptive adjustment is as follows: First, the historical mean of the model's predicted probability is tracked using the exponential moving average (EMA) method to construct a training progress indicator, which reflects the overall learning status of the model; second, based on this indicator, two modulation factors are dynamically constructed: a suppression factor and a control factor. Used to adjust the loss weights of easily separable samples, enhancement factor The loss weights are used to adjust the difficulty in classifying samples. The range of adaptive adjustment is determined by the hyperparameters. Number control, this mechanism enables the model to learn all samples evenly in the early stages of training, and automatically focus on difficult-to-distinguish lesion samples in the later stages. The calculation process is as follows: First, define the expected value of the predicted probability. This is used to measure the training progress of the model and is expressed as: , in, The expected value of the predicted probability. The momentum coefficient, For category indexing, To train the iteration rounds, This represents the mean of the predicted probabilities for the current batch of samples. This represents the total number of samples in the current training batch.

[0055] Next, an adaptive modulation factor is constructed. and For easily distinguishable samples (background), utilize... Suppress; for difficult-to-distinguish samples (lesions), utilize Enhancement is represented as: , in, As an inhibitor, For categories The expected value of the predicted probability. As an enhancing factor, This is the predicted probability that the current pixel belongs to "white leaf blight".

[0056] Finally, using threshold (In this embodiment, the threshold value is 0.5) The selection of 0.5 is based on probability theory and experimental verification: From a theoretical perspective, 0.5 serves as a natural decision boundary for binary classification tasks; a predicted probability higher than 0.5 indicates that the model tends to classify it as the target class, while a probability lower than 0.5 indicates that it tends to classify it as the background. From an experimental perspective, tests were conducted... The results show that, for multiple values ​​in the range of 0.3 to 0.7, (When mAP50 is 0.5, the model achieves the best balance between mAP50 and Recall metrics.) Construct a piecewise loss function to clearly distinguish between background suppression and target discovery, expressed as: , in, For adaptive threshold focus loss function, This represents the model's predicted probability that the current pixel belongs to "white leaf blight". Hyperparameters (selected in this embodiment) =3.5. Hyperparameters The value of 3.5 was determined through a grid search experiment. Ablation experiments were conducted within the range of 2.0 to 5.0. Its function is to control the upper bound of loss enhancement for hard-to-separate samples. Experiments show that: When the sample size is too small, the enhancement effect on difficult-to-distinguish samples is insufficient, resulting in a large number of missed detections. When the size is too large, it overemphasizes difficult-to-distinguish samples, leading to overfitting and an increase in false detection rate; (The optimal precision-recall balance is achieved when the value is 3.5.) Through this formula, the model can automatically reduce the loss contribution of a large number of simple background samples, forcing the model to focus on sparse and morphologically complex lesion samples.

[0057] It should also be noted that by constructing a bidirectional feature pyramid network and a deformable large kernel attention module, combined with lightweight designs such as depthwise separable convolution decomposition and sparsification, the problems of irregular lesion geometry, high model computational complexity, and sample imbalance are solved, achieving adaptive feature extraction and efficient model compression, significantly reducing the number of parameters and computational load.

[0058] This embodiment also provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the rice bacterial blight lesion target detection method as proposed in the above embodiment.

[0059] This embodiment also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the rice bacterial blight lesion target detection method as proposed in the above embodiment.

[0060] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0061] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0062] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0063] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0064] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A detection model for rice bacterial blight lesions, characterized in that, include: By combining depthwise separable convolution with a large kernel attention mechanism, a deformable offset field is introduced to decompose the large-size convolution kernel into three cascaded operations; After extracting local deformation features, global attention is generated through depthwise empty convolution and point convolution; Enhanced features are output through point convolution and residual connections, and then features are reconstructed and output.

2. The rice bacterial blight lesion target detection model as described in claim 1, characterized in that: The three cascaded operations include, Depthwise convolution, dilated convolution, and point convolution; Depthwise convolution extracts spatial features independently for each channel; Deeply dilated convolution constructs a receptive field equivalent to a large-size convolution kernel by inserting holes between kernel elements; Point convolution is used to fuse cross-channel information.

3. The rice bacterial blight lesion target detection model as described in claim 1 or 2, characterized in that: The generation of global attention includes, After extracting local deformation features, long-range dependencies are captured through deep dilated convolution, constructing a global receptive field comparable to a self-attention mechanism, represented as: , in, A global receptive field comparable to the self-attention mechanism, For channel information exchange, For deep-diffuse convolution, This is the output feature map after deformation feature extraction.

4. The rice bacterial blight lesion target detection model as described in claim 3, characterized in that: The residual connection output includes, A weighted feature map is obtained from the attention weight map and the original input feature map. The weighted feature map is then linearly transformed in channel dimension through point convolution. The transformed features are then connected to the original input to form a residual connection.

5. A method for detecting bacterial blight lesions in rice, characterized in that: include, Image feature enhancement and processing: The backbone network uses a progressive convolutional block stacking architecture to extract multi-scale features from the input image; For target detection and disease classification, the features fused by the feature fusion network are input into the detection head, and the target bounding box and classification results are output. Feature adaptation and lightweight model construction were used to build a target detection model for rice bacterial blight lesions as described in any one of claims 1 to 4.

6. The method for detecting rice bacterial blight lesions as described in claim 5, characterized in that: The image feature enhancement and processing includes, The backbone network uses a progressive convolutional block stacking architecture to extract multi-scale features from the input rice image. It introduces a module with an integrated deformable large kernel attention mechanism to extract deformation-aware features. At the same time, it uses deformable convolution to learn spatial offset and adaptively fit the irregular geometric boundaries of the lesions.

7. The method for detecting rice bacterial blight lesions as described in claim 5 or 6, characterized in that: The target detection and disease classification include, The multi-scale feature maps fused by the feature fusion network are input into the detection head for final prediction. The detection head predicts multiple anchor boxes for each spatial location of each feature map.

8. The method for detecting rice bacterial blight lesions as described in claim 7, characterized in that: The target detection and disease classification include, The detection task is configured in single-class mode. Candidate boxes are filtered by confidence threshold, and redundant overlapping boxes are removed by non-maximum suppression. Finally, the bounding box coordinates and corresponding confidence scores of each lesion are output.

9. The method for detecting rice bacterial blight lesions as described in claim 5, 6, or 8, characterized in that: It also includes real-time detection and deployment decisions. The output detection results are optimized and trained using an adaptive threshold focus loss function. Based on the relationship between the YOLOv13 model's predicted probability and the set threshold, samples are dynamically decoupled by a threshold, and the training samples are dynamically divided into two categories: easy-to-classify samples and hard-to-classify samples.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the rice bacterial blight lesion target detection method according to any one of claims 5 to 9.