Wheat scab detection method and device based on multi-scale causal attention fusion network
By improving the YOLOv1 model to a multi-scale causal attention fusion network, the problems of high false negative rate and insufficient localization accuracy in wheat scab detection in the field were solved, achieving efficient and robust scab detection, which is suitable for field edge equipment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI UNIV
- Filing Date
- 2026-04-01
- Publication Date
- 2026-05-15
AI Technical Summary
Existing target detection models suffer from high false negative rates, insufficient positioning accuracy, and poor detection stability in field detection of wheat scab due to the small size and irregular shape of the lesions, their high similarity to the background texture, and susceptibility to interference from complex environments such as changes in light intensity and ear shading.
A multi-scale causal attention fusion network model is adopted. By improving the YOLOv1 model, the modules in the backbone network are replaced with a lightweight feature encoding module, a multi-scale feature fusion module, and a causal attention bidirectional fusion module. Combined with lightweight SE channel attention, the localization accuracy and robustness of small lesions are improved.
It significantly reduces the false negative rate, improves the accuracy of bounding box positioning, enhances the robustness and consistency of lesion detection in complex field environments, has high inference efficiency, and is suitable for deployment at the edge of the field.
Smart Images

Figure CN122049544A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of agricultural information technology and deep learning technology, and in particular to a method and device for detecting wheat scab based on a multi-scale causal attention fusion network. Background Technology
[0002] Fusarium head blight (FHB) is a fungal disease caused by Fusarium, which can significantly reduce grain yield and processing quality, and is accompanied by the accumulation of mycotoxins such as deoxynivalenol (DON), seriously affecting food security and food safety. Timely and accurate detection of Fusarium head blight lesions in the field is of great significance for early intervention, precise application of pesticides, and yield assessment.
[0003] In existing technologies, traditional manual field survey methods rely on human experience, resulting in low efficiency and susceptibility to subjective factors. With the development of deep learning technology, image-based target detection methods are increasingly being applied to agricultural disease identification. However, existing target detection models are primarily designed for general scenarios and struggle to meet the specific needs of Fusarium head blight detection in the field. Specifically, field lesions are typically millimeter-scale, irregular in shape, and have blurred boundaries, often closely resembling the ear texture and background. Furthermore, the field environment presents complex factors such as varying light levels, ear shading, and soil and weed interference, leading to high false negative rates and insufficient detection stability in scenarios with complex textures and strong background interference. In addition, while YOLO models possess real-time detection capabilities, their deep downsampling can dilute small target features, making it difficult to balance accuracy and recall. Transformer-type models like RT-DETR utilize only deep semantic features, ignoring shallow details and resulting in insufficient accuracy in locating small targets. Therefore, a dedicated method for detecting minute lesions in complex field environments is urgently needed. Summary of the Invention
[0004] To address the problems of high false negative rates, insufficient localization accuracy, and poor detection stability in existing target detection models for wheat scab spot detection in the field, due to the small size and irregular shape of the lesions, their high similarity to background textures, and susceptibility to interference from complex environmental factors such as changes in light intensity and ear shading, the primary objective of this invention is to provide a wheat scab detection method based on a multi-scale causal attention fusion network that effectively reduces the false negative rate, improves the accuracy of bounding box localization, and significantly enhances the robustness and consistency of lesion detection in complex field environments.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: a method for detecting wheat scab based on a multi-scale causal attention fusion network, the method comprising the following sequential steps:
[0006] (1) Acquire wheat images in the field and preprocess them to obtain preprocessed image data and construct a training set;
[0007] (2) Construct a multi-scale causal attention fusion network model. The multi-scale causal attention fusion network model is obtained by improving the YOLOv11 model: the C3k2 module in the backbone network of the YOLOv11 model is replaced with a lightweight feature encoding module to enhance the discriminativeness and stability of early features; the C2PSA module in the backbone network of the YOLOv11 model is replaced with a lightweight multi-scale feature fusion module to efficiently capture multi-scale context information; the C3k2 module in the neck network of the YOLOv11 model is replaced with a causal attention bidirectional fusion module to suppress background interference and strengthen causal association during cross-scale fusion; a small target detection layer is added to the neck network. After the small target detection layer is added to the causal attention bidirectional fusion module in the neck network, the shallow feature map and the deep feature map are spliced together for detection to improve the localization accuracy of small lesions.
[0008] (3) Input the training set into the multi-scale causal attention fusion network model for training to obtain the trained model;
[0009] (4) Input the image to be detected into the trained model and output the lesion detection results.
[0010] In step (1), the preprocessing includes scaling the image to a uniform resolution of 1024×1024 pixels and employing data augmentation strategies; the data augmentation strategies include mosaic enhancement, blending enhancement, copy and paste enhancement, color space enhancement, and geometric transformation.
[0011] In step (2), the lightweight feature encoding module includes two parallel 1×1 convolutional modules, multiple stacked RepConvV2 reparameterized convolutional modules, a SimAM parameterless spatial attention module, a 1×1 convolutional fusion module, and a residual connection module; wherein, the RepConvV2 reparameterized convolutional module includes a 3×3 convolutional module, a 1×1 convolutional module, a SiLU activation function module, and a reparameterized control module; the lightweight feature encoding module performs the following processing:
[0012] (3a) Construct two parallel 1×1 convolutions to convert the first input feature map X∈R. C×H×W Generate main branch features respectively and bypass branch characteristics :
[0013] ;
[0014] Wherein, C, H, and W are the number of channels, height, and width of the first input feature map X, respectively; This represents a 1×1 convolution operation;
[0015] (3b) Construct multiple stacked RepConvV2 reparameterized convolutional modules for deep texture modeling of the main branch features; each RepConvV2 reparameterized convolutional module adopts a multi-branch structure, including a 3×3 convolutional branch and a 1×1 convolutional branch, wherein the 3×3 convolutional branch contains a 3×3 convolutional layer and a batch normalization layer, and the 1×1 convolutional branch contains a 1×1 convolutional layer and a batch normalization layer; the output of the 3×3 convolutional branch and the output of the 1×1 convolutional branch are added element-wise and then activated by the SiLU activation function;
[0016] Let the input of the i-th RepConvV2 reparameterized convolutional module be... The output is Then the following condition is met:
[0017] ;
[0018] in, This represents a 3×3 convolution operation. Indicates the batch normalization layer; main branch features As input to the first RepConvV2 reparameterized convolution module ,Right now = The data is sequentially processed through i stacked RepConvV2 reparameterized convolutional modules. The output of each RepConvV2 reparameterized convolutional module serves as the input to the next RepConvV2 reparameterized convolutional module. Finally, the output of the i-th RepConvV2 reparameterized convolutional module becomes the intermediate feature map. , = ; express Activation function;
[0019] (3c) Construct a SimAM parameterless spatial attention module for processing intermediate feature maps. Enhancement is performed; the SimAM parameterless spatial attention module first calculates... Spatial mean in the channel dimension :
[0020] ;
[0021] Where b represents the corresponding intermediate feature map The batch index of the batch dimension, where c represents the corresponding intermediate feature map. Channel index of the channel dimension, H pre Wpre These represent the intermediate feature maps Y. pre The height and width, i and j represent the intermediate feature maps respectively. The position indices in the height and width directions have a range of 1 ≤ i ≤ 1≤j≤ ;
[0022] Then, an attention map is generated and compared with the intermediate feature map. Element-wise multiplication yields the enhanced feature map. :
[0023] ;
[0024] in, For the Sigmoid function; It is a very small constant, with a value of 10. −5 ; express The spatial variance is represented by ⊙, where ⊙ represents element-wise multiplication.
[0025] (3d) Main branch features Bypass branch characteristics The enhanced feature map Y is concatenated along the channel dimension and then fused using a 1×1 convolution to obtain the fused feature map Z:
[0026] ;
[0027] (3e) When the shape of the first input feature map X is consistent with that of the fused feature map Z, a residual connection module is introduced to obtain the first output feature map. for:
[0028] .
[0029] In step (2), the lightweight multi-scale feature fusion module includes three parallel depthwise separable convolutional branch modules, a concatenation and fusion module, and a lightweight SE channel attention module; the lightweight multi-scale feature fusion module performs the following processing:
[0030] (4a) Construct three parallel depthwise separable convolutional branches with dilation rates of 1, 2, and 3, respectively, to extract spatial context information at different scales; each depthwise separable convolutional branch consists of a dilated depthwise separable convolutional layer, a batch normalization layer, and a SiLU activation function layer; the output feature map of the d-th depthwise separable convolutional branch for:
[0031] ;
[0032] Among them, X ms ∈R Cms×Hms×Wms C is the second input feature map, i.e., the input feature map of the lightweight multi-scale feature fusion module. ms H ms W ms X ms The number of channels, height, and width; Indicates the expansion rate Depth-separable convolution operations, BN represents batch normalization, and SiLU represents the SiLU activation function; Indicates the batch normalization layer; express Activation function;
[0033] (4b) The second input feature map X ms The outputs of the three depthwise separable convolutional branches are concatenated along the channel dimension, and then fused features are obtained through 1×1 convolution, batch normalization, and SiLU activation. :
[0034] ;
[0035] in, This represents a 1×1 convolution operation. These represent the output feature maps of the 1st, 2nd, and 3rd depthwise separable convolutional branches, respectively.
[0036] (4c) Construct a lightweight SE channel attention mechanism for adaptive recalibration of the fused feature F. First, generate channel weights. Then, the second output feature map is obtained by element-wise multiplication with the fused feature F. :
[0037] ;
[0038] Here, GAP represents the global average pooling operation. This is the Sigmoid function, where ⊙ represents element-wise multiplication.
[0039] In step (2), the causal attention bidirectional fusion module includes a first 1×1 convolution module, a second 1×1 convolution module, a dynamic weight generation module, a causal attention module, and a residual connection module; the causal attention bidirectional fusion module performs the following processing:
[0040] (5a) Construct two parallel 1×1 convolutions to generate top-down path features. and bottom-up path features :
[0041] ;
[0042] Among them, X cb ∈R Ccb×Hcb×Wcb The third input feature map is the input feature map of the causal attention bidirectional fusion module, Ccb, H cb W cb X cb The number of channels, height, and width; This represents a 1×1 convolution operation;
[0043] (5b) Construct a dynamic weight generator to adaptively calculate the fusion weights of the two paths; the dynamic weight generator first processes the third input feature map X. cb Global average pooling is performed to compress the spatial information of each channel into a scalar, resulting in a feature vector G with shape C. cb ×1×1; then the feature vector G is passed sequentially through the first 1×1 convolutional layer, the SiLU activation function layer, and the second 1×1 convolutional layer to output a two-dimensional weight vector. Finally, the fused weight vector is obtained by normalization using the Softmax function. =[ , ] T ,in, Top-down path feature map The fusion weight, Bottom-up path feature map The fusion weights, and satisfying + =1;
[0044] ;
[0045] in, This represents the global average pooling operation, i.e., G = GAP(X). cb ), This represents the SiLU activation function. This represents the Softmax normalization function;
[0046] Top-down path feature map With bottom-up path feature map By performing weighted summation, a preliminary fusion feature map is obtained. :
[0047] ;
[0048] (5c) Construct a causal attention module to process the initial fused feature map. Perform channel dimension recalibration; the causal attention module first performs... Global average pooling is performed to compress the spatial information of each channel into a scalar, resulting in a feature vector P with shape C. fuse ×1×1, where C fuse For F fuse The number of channels is determined; then the feature vector P is passed sequentially through a third 1×1 convolutional layer, a SiLU activation function layer, a fourth 1×1 convolutional layer, and a Sigmoid activation function layer to generate a channel weight map. Finally, and Element-wise multiplication yields a feature map enhanced by causal attention. :
[0049] ;
[0050] in, The symbol represents the Sigmoid function, ⊙ represents element-wise multiplication, and GAP represents the global average pooling operation, i.e., P = GAP( );
[0051] (5d) Feature maps enhanced by causal attention After activation by the SiLU activation function layer, the activated feature map is obtained. :
[0052] ;
[0053] When the third input feature map With activated feature map When the shapes are consistent, a residual connection module is introduced to... and By adding elements one by one, we obtain the final output feature map. for:
[0054] ;
[0055] When the third input feature map With activated feature map If the shapes are inconsistent, output directly. As the final output feature map:
[0056]
[0057] The term "uniform shape" refers to the fact that the number of channels, height, and width of the image are all consistent.
[0058] Another object of the present invention is to provide an electronic device comprising:
[0059] Processor; and
[0060] A memory storing computer program instructions that, when executed by the processor, cause the processor to perform the wheat scab detection method based on a multi-scale causal attention fusion network as described above.
[0061] The present invention also provides a computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the wheat scab detection method based on a multi-scale causal attention fusion network as described above.
[0062] As can be seen from the above technical solution, the beneficial effects of the present invention are as follows: First, the present invention combines heavily parameterized convolution with the SimAM parameterless spatial attention module through a lightweight feature encoding module, which significantly enhances the response capability of early features to small lesions with zero additional inference overhead, effectively reducing the false negative rate; Second, the lightweight multi-scale feature fusion module utilizes multi-dilation rate depthwise separable convolution branches to capture multi-scale contextual information in parallel, and achieves adaptive recalibration through lightweight SE channel attention, enriching the receptive field while retaining fine-grained details and improving the bounding box localization accuracy; Third, the causal attention bidirectional fusion module introduces dynamic weight generation and causal attention mechanism on the basis of lightweight bidirectional path, adaptively fusing cross-scale features and effectively suppressing non-causal interference such as background noise, significantly improving the robustness and consistency of lesion detection in complex field environments; Fourth, the present invention has a lightweight overall structure and high inference efficiency, making it suitable for deployment on field edge devices, providing an efficient and feasible solution for intelligent field monitoring of wheat scab. Attached Figure Description
[0063] Figure 1 This is a flowchart of the method of the present invention;
[0064] Figure 2 This is a schematic diagram of the lightweight feature encoding module in this invention;
[0065] Figure 3 This is a schematic diagram of the lightweight multi-scale feature fusion module in this invention;
[0066] Figure 4 This is a schematic diagram of the causal attention bidirectional fusion module in this invention;
[0067] Figure 5 This is a schematic diagram comparing the heatmap of the present invention with that of the baseline model. Detailed Implementation
[0068] like Figure 1 As shown, a method for detecting wheat scab based on a multi-scale causal attention fusion network is presented. This method includes the following sequential steps:
[0069] (1) Acquire wheat images in the field and preprocess them to obtain preprocessed image data and construct a training set;
[0070] (2) Construct a multi-scale causal attention fusion network model. The multi-scale causal attention fusion network model is obtained by improving the YOLOv11 model: the C3k2 module in the backbone network of the YOLOv11 model is replaced with a lightweight feature encoding module to enhance the discriminativeness and stability of early features; the C2PSA module in the backbone network of the YOLOv11 model is replaced with a lightweight multi-scale feature fusion module to efficiently capture multi-scale context information; the C3k2 module in the neck network of the YOLOv11 model is replaced with a causal attention bidirectional fusion module to suppress background interference and strengthen causal association during cross-scale fusion; a small target detection layer is added to the neck network. After the small target detection layer is added to the causal attention bidirectional fusion module in the neck network, the shallow feature map and the deep feature map are spliced together for detection to improve the localization accuracy of small lesions.
[0071] (3) Input the training set into the multi-scale causal attention fusion network model for training to obtain the trained model;
[0072] (4) Input the image to be detected into the trained model and output the lesion detection results.
[0073] In step (1), the preprocessing includes scaling the image to a uniform resolution of 1024×1024 pixels and employing data augmentation strategies; the data augmentation strategies include mosaic enhancement, blending enhancement, copy and paste enhancement, color space enhancement, and geometric transformation.
[0074] like Figure 2 As shown, in step (2), the lightweight feature encoding module includes two parallel 1×1 convolutional modules, multiple stacked RepConvV2 reparameterized convolutional modules, a SimAM parameterless spatial attention module, a 1×1 convolutional fusion module, and a residual connection module; wherein, the RepConvV2 reparameterized convolutional module includes a 3×3 convolutional module, a 1×1 convolutional module, a SiLU activation function module, and a reparameterized control module; the lightweight feature encoding module performs the following processing:
[0075] (3a) Construct two parallel 1×1 convolutions to convert the first input feature map X∈R. C×H×W Generate main branch features respectively and bypass branch characteristics :
[0076] ;
[0077] Wherein, C, H, and W are the number of channels, height, and width of the first input feature map X, respectively; This represents a 1×1 convolution operation;
[0078] (3b) Construct multiple stacked RepConvV2 reparameterized convolutional modules for deep texture modeling of the main branch features; each RepConvV2 reparameterized convolutional module adopts a multi-branch structure, including a 3×3 convolutional branch and a 1×1 convolutional branch, wherein the 3×3 convolutional branch contains a 3×3 convolutional layer and a batch normalization layer, and the 1×1 convolutional branch contains a 1×1 convolutional layer and a batch normalization layer; the output of the 3×3 convolutional branch and the output of the 1×1 convolutional branch are added element-wise and then activated by the SiLU activation function;
[0079] Let the input of the i-th RepConvV2 reparameterized convolutional module be... The output is Then the following condition is met:
[0080] ;
[0081] in, This represents a 3×3 convolution operation. Indicates the batch normalization layer; main branch features As input to the first RepConvV2 reparameterized convolution module ,Right now = The data is sequentially processed through i stacked RepConvV2 reparameterized convolutional modules. The output of each RepConvV2 reparameterized convolutional module serves as the input to the next RepConvV2 reparameterized convolutional module. Finally, the output of the i-th RepConvV2 reparameterized convolutional module becomes the intermediate feature map. , = ; express Activation function;
[0082] (3c) Construct a SimAM parameterless spatial attention module for processing intermediate feature maps. Enhancement is performed; the SimAM parameterless spatial attention module first calculates... Spatial mean in the channel dimension :
[0083] ;
[0084] Where b represents the corresponding intermediate feature map The batch index of the batch dimension, where c represents the corresponding intermediate feature map. Channel index of the channel dimension, H pre W pre These represent the intermediate feature maps Y. pre The height and width, i and j represent the intermediate feature maps respectively. The position indices in the height and width directions have a range of 1 ≤ i ≤ 1≤j≤ ;
[0085] Then, an attention map is generated and compared with the intermediate feature map. Element-wise multiplication yields the enhanced feature map. :
[0086] ;
[0087] in, For the Sigmoid function; It is a very small constant, with a value of 10. −5 ; express The spatial variance is represented by ⊙, where ⊙ represents element-wise multiplication.
[0088] (3d) Main branch features Bypass branch characteristics The enhanced feature map Y is concatenated along the channel dimension and then fused using a 1×1 convolution to obtain the fused feature map Z:
[0089] ;
[0090] (3e) When the shape of the first input feature map X is consistent with that of the fused feature map Z, a residual connection module is introduced to obtain the first output feature map. for:
[0091] .
[0092] like Figure 3 As shown, in step (2), the lightweight multi-scale feature fusion module includes three parallel depthwise separable convolutional branch modules, a splicing and fusion module, and a lightweight SE channel attention module; the lightweight multi-scale feature fusion module performs the following processing:
[0093] (4a) Construct three parallel depthwise separable convolutional branches with dilation rates of 1, 2, and 3, respectively, to extract spatial context information at different scales; each depthwise separable convolutional branch consists of a dilated depthwise separable convolutional layer, a batch normalization layer, and a SiLU activation function layer; the output feature map of the d-th depthwise separable convolutional branch for:
[0094] ;
[0095] Among them, X ms ∈R Cms×Hms×Wms C is the second input feature map, i.e., the input feature map of the lightweight multi-scale feature fusion module. ms H ms W ms X ms The number of channels, height, and width; Indicates the expansion rate Depth-separable convolution operations, BN represents batch normalization, and SiLU represents the SiLU activation function; Indicates the batch normalization layer; express Activation function;
[0096] (4b) The second input feature map X ms The outputs of the three depthwise separable convolutional branches are concatenated along the channel dimension, and then fused features are obtained through 1×1 convolution, batch normalization, and SiLU activation. :
[0097] ;
[0098] in, This represents a 1×1 convolution operation. These represent the output feature maps of the 1st, 2nd, and 3rd depthwise separable convolutional branches, respectively.
[0099] (4c) Construct a lightweight SE channel attention mechanism for adaptive recalibration of the fused feature F. First, generate channel weights. Then, the second output feature map is obtained by element-wise multiplication with the fused feature F. :
[0100] ;
[0101] Here, GAP represents the global average pooling operation. This is the Sigmoid function, where ⊙ represents element-wise multiplication.
[0102] like Figure 4 As shown, in step (2), the causal attention bidirectional fusion module includes a first 1×1 convolution module, a second 1×1 convolution module, a dynamic weight generation module, a causal attention module, and a residual connection module; the causal attention bidirectional fusion module performs the following processing:
[0103] (5a) Construct two parallel 1×1 convolutions to generate top-down path features. and bottom-up path features :
[0104] ;
[0105] Among them, X cb ∈R Ccb×Hcb×Wcb The third input feature map is the input feature map of the causal attention bidirectional fusion module, Ccb, H cb W cb X cb The number of channels, height, and width; This represents a 1×1 convolution operation;
[0106] (5b) Construct a dynamic weight generator to adaptively calculate the fusion weights of the two paths; the dynamic weight generator first processes the third input feature map X. cb Global average pooling is performed to compress the spatial information of each channel into a scalar, resulting in a feature vector G with shape C. cb ×1×1; then the feature vector G is passed sequentially through the first 1×1 convolutional layer, the SiLU activation function layer, and the second 1×1 convolutional layer to output a two-dimensional weight vector. Finally, the fused weight vector is obtained by normalization using the Softmax function. =[ , ] T ,in, Top-down path feature map The fusion weight, Bottom-up path feature map The fusion weights, and satisfying + =1;
[0107] ;
[0108] in, This represents the global average pooling operation, i.e., G = GAP(X). cb ), This represents the SiLU activation function. This represents the Softmax normalization function;
[0109] Top-down path feature map With bottom-up path feature map By performing weighted summation, a preliminary fusion feature map is obtained. :
[0110] ;
[0111] (5c) Construct a causal attention module to process the initial fused feature map. Perform channel dimension recalibration; the causal attention module first performs... Global average pooling is performed to compress the spatial information of each channel into a scalar, resulting in a feature vector P with shape C. fuse ×1×1, where C fuse For F fuse The number of channels is determined; then the feature vector P is passed sequentially through a third 1×1 convolutional layer, a SiLU activation function layer, a fourth 1×1 convolutional layer, and a Sigmoid activation function layer to generate a channel weight map. Finally, and Element-wise multiplication yields a feature map enhanced by causal attention. :
[0112] ;
[0113] in, The symbol represents the Sigmoid function, ⊙ represents element-wise multiplication, and GAP represents the global average pooling operation, i.e., P = GAP( );
[0114] (5d) Feature maps enhanced by causal attention After activation by the SiLU activation function layer, the activated feature map is obtained. :
[0115] ;
[0116] When the third input feature map With activated feature map When the shapes are consistent, a residual connection module is introduced to... and By adding elements one by one, we obtain the final output feature map. for:
[0117] ;
[0118] When the third input feature map With activated feature map If the shapes are inconsistent, output directly. As the final output feature map:
[0119]
[0120] The term "uniform shape" refers to the fact that the number of channels, height, and width of the image are all consistent.
[0121] like Figure 5As shown, the left side is the heatmap of the YOLOv11 model, and the right side is the heatmap of the multi-scale causal attention fusion network model of this invention. In the heatmap, red areas represent high-activation features, and blue areas represent low-activation background. The activation regions of the YOLOv11 model are scattered and diffused; high-intensity hotspots are not only distributed at lesion sites but also widely scattered in non-lesion areas such as wheat awns, ear edges, and background illumination gradients, indicating significant false activation. The heatmap of the multi-scale causal attention fusion network model of this invention, however, is highly concentrated, with high-response regions precisely locked at the core of the lesion, and almost no residual noise in the background area. This advantage is due to the synergistic effect of the lightweight feature encoding module, the lightweight multi-scale feature fusion module, and the bidirectional causal attention fusion module, enabling the multi-scale causal attention fusion network model to shift from a broad response to background interference to a precise focus on the lesion region, effectively suppressing background interference and improving detection robustness.
[0122] In summary, this invention combines heavily parameterized convolution with the parameterless spatial attention module of SimAM using a lightweight feature encoding module, significantly enhancing the response capability of early features to small lesions with zero additional inference overhead and effectively reducing the false negative rate. A lightweight multi-scale feature fusion module utilizes multi-dilation rate depthwise separable convolutional branches to capture multi-scale contextual information in parallel, and achieves adaptive recalibration through lightweight SE channel attention, enriching the receptive field while preserving fine-grained details and improving bounding box localization accuracy. A causal attention bidirectional fusion module introduces dynamic weight generation and causal attention mechanisms on top of a lightweight bidirectional path, adaptively fusing cross-scale features and effectively suppressing non-causal interference such as background noise, significantly improving the robustness and consistency of lesion detection in complex field environments. The invention has a lightweight overall structure, high inference efficiency, and is suitable for deployment on field edge devices, providing an efficient and feasible solution for intelligent field monitoring of wheat scab.
[0123] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention. The scope of protection claimed by the appended claims and their equivalents is defined.
Claims
1. A method for detecting wheat scab based on a multi-scale causal attention fusion network, characterized in that: The method includes the following steps in sequence: (1) Acquire wheat images in the field and preprocess them to obtain preprocessed image data and construct a training set; (2) Construct a multi-scale causal attention fusion network model. The multi-scale causal attention fusion network model is obtained by improving the YOLOv11 model: the C3k2 module in the backbone network of the YOLOv11 model is replaced with a lightweight feature encoding module to enhance the discriminativeness and stability of early features; the C2PSA module in the backbone network of the YOLOv11 model is replaced with a lightweight multi-scale feature fusion module to efficiently capture multi-scale context information; the C3k2 module in the neck network of the YOLOv11 model is replaced with a causal attention bidirectional fusion module to suppress background interference and strengthen causal association during cross-scale fusion; a small target detection layer is added to the neck network. After the small target detection layer is added to the causal attention bidirectional fusion module in the neck network, the shallow feature map and the deep feature map are spliced together for detection to improve the localization accuracy of small lesions. (3) Input the training set into the multi-scale causal attention fusion network model for training to obtain the trained model; (4) Input the image to be detected into the trained model and output the lesion detection results.
2. The wheat scab detection method based on a multi-scale causal attention fusion network according to claim 1, characterized in that: In step (1), the preprocessing includes scaling the image uniformly to a resolution of 1024×1024 pixels and employing a data augmentation strategy; The data augmentation strategies include mosaic enhancement, blending enhancement, copy and paste enhancement, color space enhancement, and geometric transformation.
3. The wheat scab detection method based on a multi-scale causal attention fusion network according to claim 1, characterized in that: In step (2), the lightweight feature encoding module includes two parallel 1×1 convolutional modules, multiple stacked RepConvV2 reparameterized convolutional modules, a SimAM parameterless spatial attention module, a 1×1 convolutional fusion module, and a residual connection module; wherein, the RepConvV2 reparameterized convolutional module includes a 3×3 convolutional module, a 1×1 convolutional module, a SiLU activation function module, and a reparameterized control module; the lightweight feature encoding module performs the following processing: (3a) Construct two parallel 1×1 convolutions to convert the first input feature map X∈R. C×H×W Generate main branch features respectively and bypass branch characteristics : ; Wherein, C, H, and W are the number of channels, height, and width of the first input feature map X, respectively; This represents a 1×1 convolution operation; (3b) Construct multiple stacked RepConvV2 reparameterized convolutional modules for deep texture modeling of the main branch features; each RepConvV2 reparameterized convolutional module adopts a multi-branch structure, including a 3×3 convolutional branch and a 1×1 convolutional branch, wherein the 3×3 convolutional branch contains a 3×3 convolutional layer and a batch normalization layer, and the 1×1 convolutional branch contains a 1×1 convolutional layer and a batch normalization layer; the output of the 3×3 convolutional branch and the output of the 1×1 convolutional branch are added element-wise and then activated by the SiLU activation function; Let the input of the i-th RepConvV2 reparameterized convolutional module be... The output is Then the following condition is met: ; in, This represents a 3×3 convolution operation. Indicates the batch normalization layer; main branch features As input to the first RepConvV2 reparameterized convolution module ,Right now = The data is sequentially processed through i stacked RepConvV2 reparameterized convolutional modules. The output of each RepConvV2 reparameterized convolutional module serves as the input to the next RepConvV2 reparameterized convolutional module. Finally, the output of the i-th RepConvV2 reparameterized convolutional module becomes the intermediate feature map. , = ; express Activation function; (3c) Construct a SimAM parameterless spatial attention module for processing intermediate feature maps. Enhancement is performed; the SimAM parameterless spatial attention module first calculates... Spatial mean in the channel dimension : ; Where b represents the corresponding intermediate feature map The batch index of the batch dimension, where c represents the corresponding intermediate feature map. Channel index of the channel dimension, H pre W pre These represent the intermediate feature maps Y. pre The height and width, i and j represent the intermediate feature maps respectively. The position indices in the height and width directions have a range of 1 ≤ i ≤ 1≤j≤ ; Then, an attention map is generated and compared with the intermediate feature map. Element-wise multiplication yields the enhanced feature map. : ; in, For the Sigmoid function; It is a very small constant, with a value of 10. −5 ; express The spatial variance is represented by ⊙, where ⊙ represents element-wise multiplication. (3d) Main branch features Bypass branch characteristics The enhanced feature map Y is concatenated along the channel dimension and then fused using a 1×1 convolution to obtain the fused feature map Z: ; (3e) When the shape of the first input feature map X is consistent with that of the fused feature map Z, a residual connection module is introduced to obtain the first output feature map. for: 。 4. The wheat scab detection method based on a multi-scale causal attention fusion network according to claim 1, characterized in that: In step (2), the lightweight multi-scale feature fusion module includes three parallel depthwise separable convolutional branch modules, a concatenation and fusion module, and a lightweight SE channel attention module; the lightweight multi-scale feature fusion module performs the following processing: (4a) Construct three parallel depthwise separable convolutional branches with dilation rates of 1, 2, and 3, respectively, to extract spatial context information at different scales; each depthwise separable convolutional branch consists of a dilated depthwise separable convolutional layer, a batch normalization layer, and a SiLU activation function layer; the output feature map of the d-th depthwise separable convolutional branch for: ; Among them, X ms ∈R Cms×Hms×Wms C is the second input feature map, i.e., the input feature map of the lightweight multi-scale feature fusion module. ms H ms W ms X ms The number of channels, height, and width; Indicates the expansion rate Depth-separable convolution operations, BN represents batch normalization, and SiLU represents the SiLU activation function; Indicates the batch normalization layer; express Activation function; (4b) The second input feature map X ms The outputs of the three depthwise separable convolutional branches are concatenated along the channel dimension, and then fused features are obtained through 1×1 convolution, batch normalization, and SiLU activation. : ; in, This represents a 1×1 convolution operation. These represent the output feature maps of the 1st, 2nd, and 3rd depthwise separable convolutional branches, respectively. (4c) Construct a lightweight SE channel attention mechanism for adaptive recalibration of the fused feature F. First, generate channel weights. Then, the second output feature map is obtained by element-wise multiplication with the fused feature F. : ; Here, GAP represents the global average pooling operation. This is the Sigmoid function, where ⊙ represents element-wise multiplication.
5. The wheat scab detection method based on a multi-scale causal attention fusion network according to claim 1, characterized in that: In step (2), the causal attention bidirectional fusion module includes a first 1×1 convolution module, a second 1×1 convolution module, a dynamic weight generation module, a causal attention module, and a residual connection module; the causal attention bidirectional fusion module performs the following processing: (5a) Construct two parallel 1×1 convolutions to generate top-down path features. and bottom-up path features : ; Among them, X cb ∈R Ccb×Hcb×Wcb The third input feature map is the input feature map of the causal attention bidirectional fusion module, Ccb, H cb W cb X cb The number of channels, height, and width; This represents a 1×1 convolution operation; (5b) Construct a dynamic weight generator to adaptively calculate the fusion weights of the two paths; the dynamic weight generator first processes the third input feature map X. cb Global average pooling is performed to compress the spatial information of each channel into a scalar, resulting in a feature vector G with shape C. cb ×1×1; then the feature vector G is passed sequentially through the first 1×1 convolutional layer, the SiLU activation function layer, and the second 1×1 convolutional layer to output a two-dimensional weight vector. Finally, the fused weight vector is obtained by normalization using the Softmax function. =[ , ] T ,in, Top-down path feature map The fusion weight, Bottom-up path feature map The fusion weights, and satisfying + =1; ; in, This represents the global average pooling operation, i.e., G = GAP(X). cb ), This represents the SiLU activation function. This represents the Softmax normalization function; Top-down path feature map With bottom-up path feature map By performing weighted summation, a preliminary fusion feature map is obtained. : ; (5c) Construct a causal attention module to process the initial fused feature map. Perform channel dimension recalibration; the causal attention module first performs... Global average pooling is performed to compress the spatial information of each channel into a scalar, resulting in a feature vector P with shape C. fuse ×1×1, where C fuse For F fuse The number of channels is determined; then the feature vector P is passed sequentially through a third 1×1 convolutional layer, a SiLU activation function layer, a fourth 1×1 convolutional layer, and a Sigmoid activation function layer to generate a channel weight map. Finally, and Element-wise multiplication yields a feature map enhanced by causal attention. : ; in, The symbol represents the Sigmoid function, ⊙ represents element-wise multiplication, and GAP represents the global average pooling operation, i.e., P = GAP( ); (5d) Feature maps enhanced by causal attention After activation by the SiLU activation function layer, the activated feature map is obtained. : ; When the third input feature map With activated feature map When the shapes are consistent, a residual connection module is introduced to... and By adding elements one by one, we obtain the final output feature map. for: ; When the third input feature map With activated feature map If the shapes are inconsistent, output directly. As the final output feature map: ; The term "uniform shape" refers to the fact that the number of channels, height, and width of the image are all consistent.
6. An electronic device, comprising: processor; as well as A memory storing computer program instructions that, when executed by the processor, cause the processor to perform the wheat scab detection method based on a multi-scale causal attention fusion network as described in any one of claims 1-5.
7. A computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the wheat scab detection method based on a multi-scale causal attention fusion network as described in any one of claims 1-5.