Disease detection method, system and equipment and storage medium

By employing a model chain that integrates multi-branch feature extraction, cross-scale attention fusion, and dynamic loss optimization, the problems of low detection efficiency and insufficient accuracy in traditional detection methods are solved, achieving efficient and accurate detection of peony leaf diseases.

CN121564478APending Publication Date: 2026-02-24HENAN INST OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511650519.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

Traditional manual detection methods cannot meet the high-efficiency, accurate, and real-time requirements for peony disease detection. Existing automated detection methods are insufficient in terms of accuracy, real-time performance, and environmental adaptability, and are difficult to replace manual detection.

Method used

A model link employing multi-branch feature extraction, cross-scale attention fusion, and dynamic loss optimization is used to detect diseases through a pre-trained target detection network, which includes a backbone network, a neck network, and an output layer. Multi-scale features are extracted using multi-branch modules, and the neck network fuses cross-scale features through a scale aggregation attention mechanism. Finally, a dynamic weighted cross-union loss function is used to optimize the detection box regression.

Benefits of technology

It achieves high-precision, real-time detection of peony leaf diseases, can quickly and accurately identify diseased areas, is applicable to various scenarios, has high practicality and reliability, and reduces false detections and missed detections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121564478A_ABST
    Figure CN121564478A_ABST
Patent Text Reader

Abstract

The invention discloses a disease detection method, system and device and a storage medium. The method comprises the following steps: acquiring image data of a to-be-detected disease; the disease image data is input into a pre-trained target detection network, the target detection network comprises a backbone network, a neck network and an output layer, the backbone network adopts a multi-branch module to extract multi-scale features, the neck network fuses cross-scale features through a scale aggregation attention mechanism, and the output layer is used for outputting the cross-scale features; the output layer adopts a dynamic weighted intersection-to-union ratio loss function to optimize detection frame regression; and outputting a target detection result of the image data. Through a model link of multi-branch feature extraction, cross-scale attention fusion and dynamic loss optimization, the problems of scale diversity, feature confusion and inaccurate positioning in target detection are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, specifically to a disease detection method, system, device, and storage medium. Background Technology

[0002] Peonies, as one of my country's traditional precious flowers, are widely cultivated throughout the country due to their unique ornamental and economic value. However, peonies are susceptible to various diseases during their growth, severely impacting their growth and development and the economic benefits of the flower industry. Common peony diseases include anthracnose, gray mold, black spot, and powdery mildew. These diseases not only reduce the ornamental value of peonies but can also lead to large-scale plant mortality, causing significant economic losses to agricultural production. Traditional disease detection methods mostly rely on manual inspection and visual observation. This traditional manual detection method has obvious drawbacks: low detection efficiency, unable to meet the needs of large-scale, high-frequency detection; detection results are greatly affected by subjective factors such as personnel experience and fatigue, making accuracy difficult to guarantee; real-time monitoring and immediate early warning are not possible, making it difficult to detect and address problems promptly; labor costs are high, and manual operation is unsuitable in some dangerous or harsh environments. With technological advancements, although some automated detection methods have emerged in the fields of forest diseases and crop diseases, they still have shortcomings in terms of detection accuracy, real-time performance, and environmental adaptability, making it difficult to completely replace manual detection. Therefore, there is an urgent need to develop an intelligent detection technology for peony leaf diseases that can achieve high precision and real-time performance. Summary of the Invention

[0003] The main objective of this application is to provide a disease detection method, system, device, and storage medium. By employing a model chain involving multi-branch feature extraction, cross-scale attention fusion, and dynamic loss optimization, the problems of scale diversity, feature confusion, and inaccurate localization in disease detection are addressed.

[0004] To achieve the above objectives, the embodiments of this application provide the following technical solutions: According to a first aspect of the embodiments of this application, a disease detection method is provided, the method comprising: Acquire image data of the target to be detected; The image data is input into a pre-trained target detection network, which includes a backbone network, a neck network, and an output layer. The backbone network uses a multi-branch module to extract multi-scale features, the neck network fuses cross-scale features through a scale aggregation attention mechanism, and the output layer uses a dynamic weighted intersection-union loss function to optimize the detection box regression. Output the target detection results of the image data.

[0005] Optionally, the backbone network employs a multi-branch module to extract multi-scale features, including: A feature extraction framework is constructed using the multi-branch module, and target branches are set in parallel in the multi-branch module. The target branches include 1×1 convolutional branches, 3×3 convolutional branches and pooling branches. The features output by the target branch are normalized respectively; The features output by each target branch after normalization are fused to obtain multi-scale features.

[0006] Optionally, the neck network fuses cross-scale features through a scale-aggregated attention mechanism, including: Perform height-dimensional pooling and width-dimensional pooling operations on the multi-scale features; Multi-scale convolutional kernels are used to extract features after pooling in both the height and width dimensions. The features obtained after pooling in the height dimension and the features obtained after pooling in the width dimension are weighted and fused. Normalization is performed on the weighted fused features; Softmax weights are calculated on the normalized features to generate a target feature representation with spatial attention weights.

[0007] Optionally, multi-scale convolutional kernels can be used to extract the features after pooling in both the height and width dimensions, according to the following formula:

[0008] in, This represents the features after high-dimensional pooling; denoted by width-dimensional pooling, x represents the input feature, and H represents the height-dimensional space of the feature map; The features pooled in the height dimension and the features pooled in the width dimension are weighted and fused according to the following formula:

[0009] in, Let xi represent the fused multi-scale feature representation, wi represent the learnable weights at the corresponding scale, and x represent the multi-scale feature representation. init Optional residual connections represent input features.

[0010] Optionally, the weighted fused features are normalized according to the following formula:

[0011] Where σ is the activation function, and weights are spatial attention weights with the same shape as x; The normalized features are weighted using the following formula to obtain a target feature representation with spatial attention weights: Where output represents the weighted feature map.

[0012] Optionally, the dynamically weighted intersection-over-union (IoU) loss function is calculated according to the following formula:

[0013] Where IoU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box; (x,y) is the center coordinate of the predicted bounding box, (xg,yg) is the center coordinate of the ground truth bounding box, and Wg and Hg are the width and height of the ground truth bounding box.

[0014] Optionally, the training steps of the object detection network include: The target image is acquired using an image acquisition device, and the target image is annotated using an annotation tool to generate an annotated dataset; The labeled dataset is divided into a training set, a validation set, and a test set according to a preset ratio; After performing random horizontal flip data augmentation and / or random color jitter data augmentation on the training images of the training set, the images are input into the target detection network to be trained. Multi-scale features are extracted through the backbone network, cross-scale features are fused through the neck network, and prediction boxes are generated through the output layer. Calculate the WIoU loss between the predicted bounding box and the ground truth bounding box, and the classification loss; The network parameters are updated by backpropagation, the model performance is evaluated on the validation set, and the final model performance is tested on the test set to obtain the trained object detection network.

[0015] According to a second aspect of the embodiments of this application, a target detection system is provided, the system comprising: The data acquisition module is used to acquire image data of the target to be detected; The detection module is used to input the image data into a pre-trained target detection network. The target detection network includes a backbone network, a neck network, and an output layer. The backbone network uses a multi-branch module to extract multi-scale features. The neck network fuses cross-scale features through a scale aggregation attention mechanism. The output layer uses a dynamic weighted intersection-union loss function to optimize the detection box regression. The result output module is used to output the target detection results of the image data.

[0016] According to a third aspect of the present application, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.

[0017] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided having computer-readable instructions stored thereon, the computer-readable instructions being executable by a processor to implement the method described in the first aspect above.

[0018] In summary, this application provides a target detection method, system, device, and storage medium. It acquires image data of the target to be detected; inputs the image data into a pre-trained target detection network, which includes a backbone network, a neck network, and an output layer. The backbone network uses multi-branch modules to extract multi-scale features, the neck network fuses cross-scale features through a scale aggregation attention mechanism, and the output layer optimizes bounding box regression using a dynamically weighted intersection-union loss function; finally, it outputs the target detection result of the image data. Through a model chain of multi-branch feature extraction, cross-scale attention fusion, and dynamic loss optimization, it solves the problems of scale diversity, feature confusion, and inaccurate localization in target detection. Attached Figure Description

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

[0021] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed in the specification, and are not intended to limit the implementation conditions of the embodiments of this application. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportional relationships, or adjustments to the size should still fall within the scope of the technical content disclosed in the embodiments of this application, provided that they do not affect the effects and purposes that the embodiments of this application can produce.

[0022] Figure 1 This is a schematic diagram of a target detection method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the DBB convolution module provided in an embodiment of this application; Figure 3A schematic diagram of the network structure in which the DBB convolutional module replaces the Conv module, provided in an embodiment of this application; Figure 4 This is a schematic diagram of the SCAttention network structure provided in an embodiment of this application; Figure 5 A schematic diagram of the network structure for adding DBB and SCAttention modules to the YOLO11 network algorithm, provided for an embodiment of this application; Figure 6 A schematic diagram of a target detection system provided in an embodiment of this application; Figure 7 This paper shows a structural diagram of an electronic device provided in an embodiment of this application; Figure 8 A diagram of a computer-readable storage medium provided in an embodiment of this application is shown.

[0023] The realization of the objectives, functional features and advantages of the embodiments of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the embodiments of this application.

[0026] It should be noted that all directional indicators (such as up, down, left, right, front, back, etc.) in the embodiments of this application are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicator will also change accordingly.

[0027] Furthermore, in the embodiments of this application, descriptions involving "first," "second," etc., are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of the embodiments of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0028] In the embodiments of this application, unless otherwise expressly specified and limited, the terms "connection," "fixed," etc., should be interpreted broadly. For example, "fixed" can mean a fixed connection, a detachable connection, or an integral part; it can mean a mechanical connection or an electrical connection; it can mean a direct connection or an indirect connection through an intermediate medium; it can mean the internal communication of two components or the interaction between two components, unless otherwise expressly limited. Those skilled in the art can understand the specific meaning of the above terms in the embodiments of this application according to the specific circumstances.

[0029] Furthermore, the technical solutions of the various embodiments of this application can be combined with each other, but only if they are based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by the embodiments of this application.

[0030] Figure 1 This application illustrates a target detection method provided in an embodiment, the method comprising: Step 101: Acquire image data of the target to be detected; Step 102: Input the image data into a pre-trained target detection network. The target detection network includes a backbone network, a neck network, and an output layer. The backbone network uses a multi-branch module to extract multi-scale features. The neck network fuses cross-scale features through a scale aggregation attention mechanism. The output layer uses a dynamic weighted intersection-union loss function to optimize the detection box regression. Step 103: Output the target detection results of the image data.

[0031] In one embodiment, the backbone network uses a multi-branch module to extract multi-scale features, including: constructing a feature extraction framework using the multi-branch module; setting target branches in parallel within the multi-branch module; the target branches including 1×1 convolutional branches, 3×3 convolutional branches, and pooling branches; normalizing the features output by the target branches respectively; and fusing the normalized features output by each target branch to obtain multi-scale features.

[0032] For example, the first branch is a 1×1 convolutional layer used for channel-dimensional feature transformation; the second branch is a 3×3 convolutional layer used for local spatial feature extraction; and the third branch is a max-pooling layer used for background noise suppression. By employing a multi-branch module (containing a parallel structure of 1×1 convolutional branches, 3×3 convolutional branches, and pooling branches) in the backbone network, the technical objective is to construct an adaptive feature extraction framework. The 1×1 convolutions capture global contextual features, the 3×3 convolutions extract local detail features, and the pooling branches enhance robustness to scale changes. Features from each branch are independently normalized and then fused, enabling the network to respond simultaneously to targets of different sizes.

[0033] This technical solution aims to achieve efficient and accurate target detection. Image data of the target to be detected is acquired and input into a pre-trained target detection network, which consists of a backbone network, a neck network, and an output layer. The backbone network utilizes a multi-branch module to extract multi-scale features. This module constructs a feature extraction framework and sets 1×1 convolutional branches, 3×3 convolutional branches, and pooling branches in parallel as target branches. The features output from each target branch are normalized and then fused to obtain multi-scale features, which can fully capture target information at different scales in the image, improving the richness and accuracy of feature extraction. The neck network fuses cross-scale features through a scale aggregation attention mechanism, further integrating feature information at different scales, enabling the network to better focus on key features and enhance feature expressiveness. The output layer uses a dynamic weighted intersection-and-conclusion (OCC) loss function to optimize the detection box regression, effectively improving the localization accuracy of the detection box and reducing false positives and false negatives. Finally, the target detection results of the output image data are displayed, achieving fast and accurate target detection in images. This solution is suitable for target detection tasks in various scenarios and has high practicality and reliability.

[0034] In one implementation, the neck network fuses cross-scale features through a scale-aggregated attention mechanism, including: The multi-scale features are subjected to height-dimensional pooling and width-dimensional pooling operations; multi-scale convolutional kernels are used to extract the height-dimensional pooled features and the width-dimensional pooled features; the height-dimensional pooled features and the width-dimensional pooled features are weighted and fused; the weighted and fused features are normalized; and the normalized features are subjected to Softmax weight calculation to obtain a target feature representation with spatial attention weights.

[0035] The Scale-Based Aggregation Attention (SCA) mechanism introduced in the neck network primarily addresses the cross-level information decay problem in the traditional Feature Pyramid Network (FPN). It captures long-range spatial dependencies through bidirectional row and column pooling, combined with weighted fusion of multi-scale convolutions. This mechanism is particularly suitable for detecting complex leaf textures and diverse disease morphologies in peony plants. Specifically, the neck network first performs height-dimensional pooling and width-dimensional pooling operations on the multi-scale features, extracting key information in different directions. Next, multi-scale convolutional kernels are used to extract the features from both the height-dimensional and width-dimensional pooling, further enhancing their expressive power. Then, these two pooled features are weighted and fused, allowing the network to dynamically adjust the fusion weights based on feature importance. The fused features are then normalized to ensure scale consistency and avoid computational bias caused by differences in feature scale. Finally, Softmax weights are calculated on the normalized features to generate a target feature representation with spatial attention weights, enabling the network to focus more on key features of the target region, thereby improving the accuracy and robustness of target detection.

[0036] In one implementation, multi-scale convolutional kernels are used to extract features after pooling in both the height and width dimensions, according to the following formula:

[0037] in, This represents the features after high-dimensional pooling; denoted by width-dimensional pooling, x represents the input feature, and H represents the height-dimensional space of the feature map; In one implementation, the height-dimensional pooled features and the width-dimensional pooled features are weighted and fused according to the following formula:

[0038] in, Let xi represent the fused multi-scale feature representation, wi represent the learnable weights at the corresponding scale, and x represent the multi-scale feature representation. init Optional residual connections represent input features.

[0039] In one implementation, the weighted fused features are normalized according to the following formula:

[0040] Where σ is the activation function, and weights are spatial attention weights with the same shape as x; In one implementation, the normalized features are subjected to Softmax weight calculation according to the following formula to obtain a target feature representation with spatial attention weights: Where output represents the weighted feature map.

[0041] In one implementation, the dynamically weighted intersection-over-union (IoU) loss function is calculated according to the following formula:

[0042] Where IoU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box; (x,y) is the center coordinate of the predicted bounding box, (xg,yg) is the center coordinate of the ground truth bounding box, and Wg and Hg are the width and height of the ground truth bounding box.

[0043] First, multi-scale convolutional kernels are used to extract features from the image at different scales, including height and width dimensions. This step aims to capture target information at different scales in the image, enhancing the richness and accuracy of the features. Then, the extracted multi-scale features are weighted and fused. By learning the importance of features at different scales, the fusion weights are dynamically adjusted, enabling the network to focus more on key features, thereby improving the feature expressiveness. The weighted fused features are normalized to ensure scale consistency and avoid computational bias caused by differences in feature scale. Softmax weights are used to generate target feature representations with spatial attention weights, enabling the network to focus more on key features of the target region, improving the accuracy and robustness of target detection. Finally, a dynamically weighted intersection-and-union loss function is used to optimize the bounding box regression, effectively improving the localization accuracy of the bounding boxes and reducing false positives and false negatives.

[0044] In one implementation, the training steps of the object detection network include: Image acquisition devices are used to acquire target images, which are then labeled using annotation tools to generate a labeled dataset. This labeled dataset is divided into training, validation, and test sets according to a preset ratio. The training images in the training set undergo random horizontal flipping data augmentation and / or random color jitter data augmentation processing, and are then input into the target detection network to be trained. Multi-scale features are extracted through the backbone network, cross-scale features are fused through the neck network, and predicted bounding boxes are generated through the output layer. The WIoU loss between the predicted and ground truth bounding boxes and the classification loss are calculated. Network parameters are updated through backpropagation. Model performance is evaluated on the validation set, and the final model performance is tested on the test set to obtain the trained target detection network.

[0045] Through a systematic training process, including data acquisition, annotation, augmentation, feature extraction, fusion, loss calculation, and parameter updating, this project aims to train an object detection network capable of accurately detecting the location and category of objects in images, suitable for various practical applications. First, target images are acquired using image acquisition equipment, and then these images are annotated using annotation tools to generate an annotated dataset containing target location and category information. This step ensures the data quality and diversity required for network training. The annotated dataset is divided into training, validation, and test sets according to a predetermined ratio. This division helps the model learn generalization ability during training, while the validation and test sets evaluate model performance, ensuring the model's generalization and accuracy. Data augmentation processing, such as random horizontal flipping and / or random color jittering, is performed on the images in the training set. These augmentation techniques increase the diversity of training data and improve the model's robustness to different lighting, pose, and color variations. The augmented training images are input into the object detection network. Multi-scale features are extracted through the backbone network, and then these cross-scale features are fused through the neck network. This process aims to capture target information at different scales in the image and improve the expressive power of the features. The output layer generates predicted bounding boxes, and calculates the WIoU (Weighted Intersection over Union) loss and classification loss between the predicted and ground truth bounding boxes. These loss functions guide the network to learn more accurate object localization and classification. The network parameters are updated using backpropagation to minimize the loss functions. The model performance is evaluated on a validation set, and the network architecture or training strategy is adjusted. Finally, the final model performance is tested on a test set to obtain the trained model.

[0046] This application introduces a Diverse Branch Block (DBB) module into the backbone network of the YOLO11n network algorithm, replacing the original Conv module. By utilizing multi-branch convolution operations and contextual information fusion, it enhances the feature extraction capability of targets of different sizes. In addition, a novel Scale-Converging Attention (SCA) mechanism is introduced into the neck network of the YOLO11n network algorithm. Through the convergence of cross-scale information, it can effectively fuse features of different scales and better capture the detailed features of the region. Finally, the Wise-IoU (WIoU) loss function is used to replace the original Complete Intersection over Union (CIoU) loss function, which can better handle the scale changes and shape differences of the target and further improve the detection accuracy.

[0047] The target detection method provided in the embodiments of this application will be described in detail below.

[0048] The following is a detailed description of various aspects of the detection method applied to peony leaf disease detection in the embodiments of this application, so as to achieve rapid, accurate and high-speed detection of peony diseases.

[0049] In the specific detection phase, high-resolution images of peony leaves are first captured under natural light conditions to ensure coverage of different angles, lighting conditions, and disease stages (such as anthracnose, black spot, and powdery mildew). The pre-processed images are then input into an improved YOLO11n network, which outputs the target detection results, marking the diseased areas (BBox), category, and confidence level (e.g., "Anthracnose, 92%)" in the images. Optionally, a disease distribution heatmap (based on SCA attention weights) can be generated.

[0050] The improvements to the YOLO11n network can specifically include the following aspects: First aspect: Backbone network improvement: Diverse Branch Block (DBB) module.

[0051] To address the issue of insufficient ability of traditional convolutional methods (Conv) to extract multi-scale disease target features in complex contexts, this application introduces a Diverse Branch Block (DBB) module into the backbone network of the YOLO11n network algorithm to replace the original Conv module. The DBB module, through an innovative multi-branch parallel structure design, simultaneously integrates 1×1 convolution (extracting local features), 3×3 convolution (capturing spatial context), and pooling operations (preserving global information), and employs a dynamic weight adjustment mechanism, enabling each branch to adaptively learn disease features at different scales. After normalization using GroupNorm, feature fusion is performed by element-wise addition of the outputs of each branch. This design significantly enhances the model's ability to express multi-scale features of peony diseases, especially effectively suppressing interference from leaf reflections and stains in high-noise backgrounds, accurately focusing on the true disease area.

[0052] Figure 2 The DBB convolution module in this embodiment demonstrates a multi-branch convolutional structure, which is part of the model's backbone network and used to extract multi-scale features. Here, K×K convolution (Conv) represents a convolution operation, where K×K is the kernel size. The Transform module contains different convolution operations and activation functions for feature transformation and extraction. 1×1 convolution is used to adjust the number of channels in the feature map. Concat concatenates feature maps from different branches along the channel dimension. AVG (Average pooling) represents average pooling, used to reduce the spatial dimensionality of the feature map. Batch Normalization represents batch normalization, used to accelerate training and improve model stability. This structure enhances the model's ability to extract features from targets of different sizes through parallel convolutional branches and feature fusion.

[0053] Figure 3 This diagram illustrates the network structure in which DBB (Diverse Branch Block) convolutional modules replace Conv modules in an embodiment of this application. It shows an alternative backbone network structure where Conv modules are replaced by DBB modules. This structure aims to enhance the diversity of feature extraction and the expressive power of the model through multi-branch convolutional operations and contextual information fusion. DBB multi-branch blocks are used to replace traditional convolutional layers to enhance feature extraction capabilities. C3K2 represents a module containing three convolutional layers, where K2 represents the kernel size or other parameters. SPPF is a specific pooling or feature fusion module. C2PS is another specific feature fusion or attention mechanism module. The left side uses a standard Conv+C3K2 (cross-stage partial connection module) repeatedly stacked, ultimately outputting features through SPPF (Spatial Pyramid Pooling Fast Version) and C2PSA (Cross-Stage Partial Spatial Attention). The right side shows an improved structure where all Conv modules are replaced by DBB modules (Diverse Branch Blocks), each DBB containing: a parallel 1×1 convolutional branch (extracting local features), a 3×3 convolutional branch (capturing spatial context), and a pooling branch (preserving global information).

[0054] Combination Figure 2 and Figure 3 As shown, the Diverse Branch Block (DBB) module is introduced into the backbone network of the YOLO11n network algorithm to replace the original Conv module. Specifically, the DBB multi-convolutional kernel structure can adaptively extract features at different scales. Then, the output of each branch is normalized and processed by a non-linear activation function before feature fusion. This improves the diversity of features and enhances the model's generalization ability and accuracy. After processing, the features of each convolutional branch are added element-wise for feature fusion, further improving feature diversity and the model's generalization ability. Compared with ordinary convolution, in the peony disease detection experiment, the DBB multi-branch convolutional structure is more suitable for complex backgrounds, has a stronger ability to capture details, and reflects higher accuracy. The comparison results of ordinary convolution and DBB convolution are shown in Table 1 below: Table 1 Model Precision Recall(%) Map0.5(%) mAP 0.5: 0.95 (%) Conv 82.1 77.5 81.9 33.8 DBB 81.9 77.5 82.9 34.5 Improve the model's ability to capture disease details and reduce background interference (experiments show a 0.7% improvement in mAP).

[0055] The second aspect: Improvement of the neck network: Scale-Converging Attention (SCA) mechanism.

[0056] To address the challenge of simultaneously and effectively detecting disease targets at different scales (such as small spots and large lesion areas) in existing technologies, a novel Scale-Converging Attention (SCA) mechanism is introduced into the neck network of the YOLO11n network algorithm. This mechanism achieves cross-scale feature fusion through the following steps: first, row and column pooling is performed to extract spatial context information (Equations 1-2); then, features from different convolution kernels are fused through multi-scale convolution weighting (Equation 3); finally, adaptive weights are generated through GroupNorm and Softmax normalization and weight calculation (Equations 4-5). This design can effectively aggregate cross-scale information and fuse features from different scales, thereby better capturing the detailed features of disease targets. Figure 4 The SCAttention network structure shown in this embodiment illustrates a portion of the neck network, incorporating a Scale-Converging Attention (SCA) mechanism. Row polling and column polling represent pooling operations in the row and column directions of the feature map, respectively, to obtain spatial context information. AdaptiveAvgpooling2d represents adaptive average pooling, used to adjust the size of the feature map. Conv uses convolutional kernels of different sizes to extract features. GroupNorm and Softmax are used for normalization and weight calculation to generate a target feature representation with spatial attention weights. This structure, through the convergence of cross-scale information, effectively fuses features at different scales, better capturing the detailed features of the target.

[0057] Figure 5 This paper demonstrates the network structure of the YOLO11 network algorithm by adding DBB and SCAttention modules, showcasing the overall model structure, including the backbone, neck, and head. The backbone uses DBB and C3K2 modules to extract multi-scale features and fuses these features through SPPF and C2PSA modules. The neck fuses features from different scales through upsampling and concatenation, and then further fuses these cross-scale features through the SCA module. The head is the final detection head, used to output the target detection results. The entire model achieves accurate detection of peony leaf diseases by introducing the DBB module into the backbone, the SCA attention mechanism into the neck, and the WIoU loss function into the head.

[0058] Combination Figure 4 and Figure 5As shown, a novel Scale-Converging Attention (SCA) mechanism is introduced into the neck network of the YOLO11n network algorithm to obtain an optimized YOLO11n network algorithm; specifically, row pooling and column pooling are performed on the input features to obtain their spatial context information. The input features are... Where B is the batch size, i.e., the number of images input at one time. C is the number of channels, representing the depth of the feature map (e.g., 256 dimensions). H and W are the height and width (spatial dimensions) of the feature map, respectively. Row pooling and column pooling are calculated using the following formulas: Formula 1 Formula 2 Adaptive average pooling is performed on the input feature x along both the row direction (height H) and the column direction (width W) to extract spatial context information. The features after column pooling (shape B×C×H×1) B × C × H ×1), preserving global information in the high-dimensional dimension. The features after row pooling (shape B×C×1×W) B × C ×1× W ), retaining global information in the width dimension.

[0059] Features are extracted and fused using multi-scale convolutional kernels to generate new feature representations. By weighted fusion of convolutional features at different scales: Formula 3 By fusing convolutional features of different scales (such as the outputs of 1×1, 3×3, and 5×5 convolutional kernels), the model's ability to capture multi-scale targets is enhanced. xi : The convolutional feature map at the i-th scale. These are the fusion weights (learnable parameters) for the corresponding scale. Xint represents optional residual connections (original input or intermediate features). These are convolutional features at the corresponding scale.

[0060] The features are normalized and weights are calculated using GroupNorm (GN) and Softmax operations, resulting in the final weighted features obtained through the following formula: Formula 4 Formula 5 Spatial attention weights are generated using GroupNorm (GN) and Softmax to weight the input features. GN represents GroupNorm normalization, which stabilizes the training process. σ represents the activation function (such as Sigmoid), which limits the range of weights. weights: Spatial attention weights (with the same shape as x).

[0061] Furthermore, the WIoU loss function is used instead of the original CIoU loss function. Compared to CIoU, the WIoU loss function provides a weighted IoU calculation method that pays more attention to the influence of different regions. Its calculation formula is as follows: Formula 6 By adjusting the IoU calculation using a weighted strategy, the detection accuracy for small targets and complex shapes is improved. (x, y) are the center coordinates of the predicted bounding box. (xg, yg) are the center coordinates of the ground truth bounding box. Wg and Hg are the width and height of the ground truth bounding box. The denominator Wg... 2 +Hg 2 Normalize the distance difference to avoid large targets dominating the loss. The exponential function exp(⋅) amplifies the weight of key regions (such as predictions close to the ground truth box).

[0062] SCAttention generates adaptive weights through multi-scale convolution and column pooling operations, thereby weighting features at different spatial locations. Furthermore, the SCAttention mechanism effectively weights information, focusing on important details and suppressing irrelevant or redundant background features. The results after adding the SCAttention mechanism compared to the original model are shown in Table 2 below: Table 2 Model Precision Recall(%) Map0.5(%) mAP 0.5: 0.95 (%) YOLO11n 82.1 77.5 81.9 33.8 YOLO11n-SCA 83.4 79.3 883.9 35.2 It can be seen that it focuses more on the diseased area and suppresses background noise (experiments show that mAP is improved by 1.4%).

[0063] Third aspect: Improved loss function: Wise-IoU (WIoU).

[0064] To address the shortcomings of traditional CIoU loss functions in adapting to scale variations and shape differences, the Wise-IoU (WIoU) loss function is used instead of the original Complete Intersection over Union (CIoU) loss function. This better handles scale variations, shape differences, and texture differences in targets, further improving detection accuracy. WIoU adjusts the IoU calculation through a weighting strategy: assigning higher weights to important regions (such as disease edges) and reducing the interference of complex backgrounds on the detection results.

[0065] In the YOLO11n model, the WIoU loss function is used instead of the traditional CIoU loss function. CIoU considers factors such as the intersection and overlap of bounding boxes and the distance between center points. WIoU, by introducing a weighting mechanism, can adjust the calculation process according to the weight of each pixel, reducing the interference of complex background regions on target detection. Furthermore, the WIoU loss function can better adapt to the diversity of target size and shape through a weighted strategy, thereby further improving detection accuracy. Especially for the detection of small target defects, WIoU can effectively solve the problem of insufficient accuracy in small target detection in traditional methods. The formula for WIoU is shown in Equation 7.

[0066] Formula 7 The optimized YOLO11n algorithm of this application embodiment is compared with four mainstream object detection algorithms: YOLOv10n, YOLOv9t, YOLOv8n, and YOLOv6n. The three parameters mAP@0.5, mAP@0.5:0.95, and GFLOP are used as evaluation indicators. The performance of the algorithm of this application embodiment and other mainstream algorithms in disease detection on the dataset are compared in Table 3. Table 3 Model mAP@0.5(%) mAP@0.5:95(%) GFLOPs YOLOv6n 81.9 33.6 11.8 YOLOv8n 81.5 33.2 8.1 YOLOv9t 82.4 34.7 7.6 YOLOv10n 78.2 31.2 8.2 YOLO11n 81.9 33.8 6.3 Ours 86.1 36.8 9.1 Fourthly: The optimized YOLO11n network algorithm was trained using a peony leaf disease dataset, and a YOLO11n target detection network for peony leaf detection was obtained.

[0067] The optimized YOLO11n network algorithm was trained using a peony leaf disease dataset, resulting in a YOLO11n object detection network for peony leaf disease detection. The peony disease dataset was obtained by taking photos in the field at the Luoyang Academy of Agricultural and Forestry Sciences using a Huawei nova10, and then labeling the dataset with LabelImg to generate .txt files. The peony disease dataset and the corresponding .txt files were randomly divided into training, validation, and test sets in a ratio of 7:2:1.

[0068] During training, the SGD optimizer was used with a momentum factor of 0.937, a weight decay coefficient of 0.0005, a batch size of 16, 150 iterations, and an initial learning rate of 0.01. Precision (P), recall (R), average precision (AP), and mean average precision (mAP) were used as performance metrics. Results Figure 3As shown; where P represents the percentage of correct predictions among all positive samples; R represents the percentage of correctly predicted positive samples; the PR curve is a curve composed of Recall on the x-axis and Precision on the y-axis. The larger the area in the lower left corner of the PR curve, the better the model performs on that dataset. The area enclosed by this area is the mean precision (AP), representing the average precision for each class; mAP represents the average AP for each class. The larger the value, the better the model's performance. The specific calculation formulas for each indicator are as follows: (8-11) Formula 8 Formula 9 Formula 10 Formula 11 Where TP represents the number of instances correctly detected as positive samples; FP represents the number of instances incorrectly labeled as positive samples; FN represents the number of instances incorrectly predicted as negative samples; p(r) represents the PR curve; and m represents the number of classes.

[0069] The optimized YOLO11n network algorithm of this application embodiment is compared with four mainstream target detection algorithms, namely YOLOv10n, YOLOv9t, YOLOv8n and YOLOv6n. The three parameters mAP@0.5, mAP@0.5:0.95 and GFLOP are used as evaluation indicators. The performance of different networks in disease detection on the dataset is shown in Table 3.

[0070] In the YOLO11n network algorithm, the DBB convolutional module replaces the original Conv module, then the SCAttention attention mechanism is added, and finally the WIoU loss function replaces the original CIoU loss function, enabling accurate detection of peony diseases. To more intuitively demonstrate the performance difference between the improved YOLO11n-DSW model and the basic model, an application was conducted. The results show that the YOLO11n-DSW model outperforms the YOLO11n model in all stages of the detection accuracy, recall, and mAP curves, and exhibits superior stability and reliability throughout the training process.

[0071] The target detection method based on the improved YOLO11n proposed in this application is not only applicable to peony leaf disease detection, but its innovatively designed multi-branch feature extraction module (DBB), cross-scale attention mechanism (SCA), and dynamic weighted loss function (WIoU) are also universal and can be widely applied to other agricultural disease detection and general target detection tasks. Through modular design, it can be transferred to new scenarios simply by adjusting the training data. Its core innovations (multi-scale feature enhancement + adaptive attention + dynamic loss optimization) provide a general technical framework for target detection in complex environments.

[0072] For example, it can also be applied to the detection of other plant diseases, such as wheat rust detection: the multi-scale feature fusion capability of the DBB module can effectively identify the morphological differences of rust spore masses at different growth stages (such as the lesion texture of stripe rust and leaf rust), and the SCA attention mechanism can suppress interference from complex backgrounds in wheat fields. In apple black spot detection: the adaptability of the WIoU loss function to irregular lesion shapes can improve the detection accuracy of blurred areas at the edges of black spot, and combined with multi-branch convolution, it enhances the ability to capture small lesions on the fruit surface.

[0073] For example, it can also be applied to the field of general target detection, industrial defect detection: such as PCB board welding defects, textile defects, etc. The SCA mechanism can integrate microscopic and macroscopic features, and the DBB module can adapt to the diversity of defects of different sizes. Medical image analysis: for lesion detection in CT / MRI (such as lung nodules, tumors), the dynamic weighting characteristics of WIoU can optimize the localization of small targets, and the multi-branch structure can improve the sensitivity to blurred edges.

[0074] In summary, this application provides a target detection method by acquiring image data of the target to be detected; inputting the image data into a pre-trained target detection network, which includes a backbone network, a neck network, and an output layer. The backbone network uses a multi-branch module to extract multi-scale features, the neck network fuses cross-scale features through a scale aggregation attention mechanism, and the output layer optimizes the bounding box regression using a dynamically weighted intersection-union loss function; and outputting the target detection result of the image data. Through a model chain of multi-branch feature extraction, cross-scale attention fusion, and dynamic loss optimization, the methods address the problems of scale diversity, feature confusion, and inaccurate localization in target detection.

[0075] Based on the same technical concept, embodiments of this application also provide a target detection system, such as... Figure 6 As shown, the system includes: Data acquisition module 601 is used to acquire image data of the target to be detected; Detection module 602 is used to input the image data into a pre-trained target detection network. The target detection network includes a backbone network, a neck network, and an output layer. The backbone network uses a multi-branch module to extract multi-scale features. The neck network fuses cross-scale features through a scale aggregation attention mechanism. The output layer uses a dynamic weighted intersection-union loss function to optimize the detection box regression. The result output module 603 is used to output the target detection result of the image data.

[0076] This application also provides an electronic device corresponding to the method provided in the foregoing embodiments. Please refer to... Figure 7 The diagram illustrates an electronic device provided by some embodiments of this application. The electronic device 20 may include: a processor 200, a memory 201, a bus 202, and a communication interface 203, wherein the processor 200, the communication interface 203, and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can run on the processor 200, and when the processor 200 runs the computer program, it executes the method provided by any of the foregoing embodiments of this application.

[0077] The memory 201 includes high-speed random access memory (RAM) and also includes non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one physical port (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.

[0078] Bus 202 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs. After receiving an execution instruction, the processor 200 executes the program. The method disclosed in any of the foregoing embodiments of this application can be applied to the processor 200, or implemented by the processor 200.

[0079] Processor 200 is an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 200 or by instructions in software form. Processor 200 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 201. The processor 200 reads the information in memory 201 and, in conjunction with its hardware, completes the steps of the above method.

[0080] The electronic devices and methods provided in the embodiments of this application are based on the same inventive concept and have the same beneficial effects as the methods they employ, operate, or implement.

[0081] This application also provides a computer-readable storage medium corresponding to the method provided in the foregoing embodiments. Please refer to... Figure 8 The computer-readable storage medium shown is an optical disc 30, on which a computer program (i.e., a program product) is stored, which, when run by a processor, executes the methods provided in any of the foregoing embodiments.

[0082] The above description is merely a preferred embodiment of the present application and does not limit the patent scope of the present application. Any equivalent structural transformations made based on the concept of the present application and the description and drawings of the present application, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present application.

Claims

1. A method for detecting diseases, characterized in that, The method includes: Acquire image data of the target to be detected; The image data is input into a pre-trained target detection network, which includes a backbone network, a neck network, and an output layer. The backbone network uses a multi-branch module to extract multi-scale features, the neck network fuses cross-scale features through a scale aggregation attention mechanism, and the output layer uses a dynamic weighted intersection-union loss function to optimize the detection box regression. Output the target detection results of the image data.

2. The method as described in claim 1, characterized in that, The backbone network employs multi-branch modules to extract multi-scale features, including: A feature extraction framework is constructed using the multi-branch module, and target branches are set in parallel in the multi-branch module. The target branches include 1×1 convolutional branches, 3×3 convolutional branches and pooling branches. The features output by the target branch are normalized respectively; The features output by each target branch after normalization are fused to obtain multi-scale features.

3. The method as described in claim 1, characterized in that, The neck network fuses cross-scale features through a scale-aggregated attention mechanism, including: Perform height-dimensional pooling and width-dimensional pooling operations on the multi-scale features; Multi-scale convolutional kernels are used to extract features after pooling in both the height and width dimensions. The features obtained after pooling in the height dimension and the features obtained after pooling in the width dimension are weighted and fused. Normalization is performed on the weighted fused features; Softmax weights are calculated on the normalized features to generate a target feature representation with spatial attention weights.

4. The method as described in claim 3, characterized in that, The following formula is used to extract the features after pooling in both the height and width dimensions using multi-scale convolutional kernels: ; ; in, This represents the features after high-dimensional pooling; denoted by width-dimensional pooling, x represents the input feature, and H represents the height-space dimension of the feature map. The features pooled in the height dimension and the features pooled in the width dimension are weighted and fused according to the following formula: ;in, Let xi represent the fused multi-scale feature representation, wi represent the learnable weights at the corresponding scale, and x represent the multi-scale feature representation. init Optional residual connections representing input features.

5. The method as described in claim 3, characterized in that, The weighted fused features are normalized according to the following formula: Where σ is the activation function and weights are spatial attention weights with the same shape as x; The normalized features are weighted using the following formula to obtain a target feature representation with spatial attention weights: Where output represents the weighted feature map.

6. The method as described in claim 1, characterized in that, The dynamic weighted intersection-over-union (IoU) loss function is calculated according to the following formula: Where IoU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box; (x,y) is the center coordinate of the predicted bounding box, (xg,yg) is the center coordinate of the ground truth bounding box, and Wg and Hg are the width and height of the ground truth bounding box.

7. The method as described in claim 1, characterized in that, The training steps of the object detection network include: The target image is acquired using an image acquisition device, and the target image is annotated using an annotation tool to generate an annotated dataset; The labeled dataset is divided into a training set, a validation set, and a test set according to a preset ratio; After performing random horizontal flip data augmentation and / or random color jitter data augmentation on the training images of the training set, the images are input into the target detection network to be trained. Multi-scale features are extracted through the backbone network, cross-scale features are fused through the neck network, and prediction boxes are generated through the output layer. Calculate the WIoU loss between the predicted bounding box and the ground truth bounding box, and the classification loss; The network parameters are updated by backpropagation, the model performance is evaluated on the validation set, and the final model performance is tested on the test set to obtain the trained object detection network.

8. A target detection system, characterized in that, The system includes: The data acquisition module is used to acquire image data of the target to be detected; The detection module is used to input the image data into a pre-trained target detection network. The target detection network includes a backbone network, a neck network, and an output layer. The backbone network uses a multi-branch module to extract multi-scale features. The neck network fuses cross-scale features through a scale aggregation attention mechanism. The output layer uses a dynamic weighted intersection-union loss function to optimize the detection box regression. The result output module is used to output the target detection results of the image data.

9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when running the computer program, performs an action to implement the method as claimed in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, It stores computer-readable instructions that can be executed by a processor to implement the method as described in any one of claims 1-7.