Methods, systems, equipment and media for detecting pests and diseases throughout the entire growth period of cereal crops

By targeting hierarchical data enhancement and improving the YOLOv11n model, the problems of feature adaptation and sample imbalance in the detection of pests and diseases throughout the entire growth period of cereal crops were solved, and high-precision pest and disease identification was achieved in complex field environments, meeting the needs of real-time and precise prevention and control.

CN122313166APending Publication Date: 2026-06-30NORTHWEST A & F UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTHWEST A & F UNIV
Filing Date
2026-05-29
Publication Date
2026-06-30

Smart Images

  • Figure CN122313166A_ABST
    Figure CN122313166A_ABST
Patent Text Reader

Abstract

This invention provides a method, system, equipment, and medium for detecting pests and diseases throughout the entire growth period of cereal crops, belonging to the interdisciplinary field of smart agriculture and computer vision technology. The invention first collects field images covering the seedling stage to the grain-filling stage and different stages of pests and diseases, and annotates them with fine granularity. Then, it decouples foreground and background through a targeted hierarchical data augmentation strategy and expands the samples through generative fusion to construct a hybrid dataset. Based on a lightweight YOLOv11n, a multi-scale dilated attention module is embedded in the detection head, and a meta-learning feature adaptation module is set between the backbone and neck networks. The model is trained using an adaptive threshold focus loss function. During training, common features of pests and diseases across the growth period are extracted, full-scale pest and disease features are captured, and sample weights are balanced, ultimately resulting in an integrated detection model that can output pest and disease categories, confidence levels, and bounding box positions. This method effectively solves the problem of imbalanced sample distribution and improves detection accuracy and model generalization ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of smart agriculture and deep learning technology, specifically relating to a method, system, equipment and medium for detecting diseases and pests in cereal crops throughout their entire growth period. Background Technology

[0002] Cereal crops, as traditional miscellaneous grain crops in my country, are rich in nutrients and highly resistant to adverse conditions, making them important varieties for ensuring food security and the diversified development of agriculture. The core purpose of pest and disease detection for cereal crops is to identify the occurrence type, extent, and location of pests and diseases such as white spot disease and millet leafminer throughout the entire growth period in a timely and accurate manner, providing a scientific basis for field control.

[0003] In the field of pest and disease detection for cereal crops, current mainstream technologies mainly revolve around computer vision and deep learning, encompassing two main categories: traditional image processing methods and deep learning-based target detection methods. Traditional image processing methods, through manually designed feature extraction operators (such as color histograms, texture features, and shape contour features), combined with threshold segmentation and edge detection techniques, achieve the identification and classification of lesions or insect areas. These methods have seen initial application in pest and disease detection in single environments and with typical symptoms. Deep learning-based methods, centered on convolutional neural networks (CNNs), encompass various classic model architectures. For example, image classification models based on networks such as AlexNet and VGG can achieve preliminary determination of pest and disease categories; target detection models based on Faster R-CNN, the YOLO series (such as YOLOv5 and YOLOv7-tiny), and SSD can simultaneously output the pest and disease category, location, and confidence level, meeting the basic needs of real-time field detection. In addition, some studies have attempted to introduce simple data augmentation techniques (such as random cropping, flipping, brightness adjustment, Gaussian blurring, etc.) to expand the number of samples in order to improve the generalization ability of the model. These techniques together constitute the technical basis for the current detection of pests and diseases in cereal crops.

[0004] Existing technologies face multiple bottlenecks in practical field applications, making it difficult to meet the complex needs of detecting pests and diseases throughout the entire growth cycle of cereal crops. Firstly, the coverage of characteristics across the entire growth cycle is incomplete. Most technologies only model specific growth stages of cereal crops (such as the heading stage) or typical morphologies of pests and diseases (such as severe lesions or adult insect bodies), neglecting the dynamic evolution of pest and disease characteristics throughout the growth cycle. For example, white spot disease manifests as water-soaked lesions in the seedling stage, develops into a gray-backed lesion during the jointing stage, and forms a spiky lesion during the grain-filling stage. The morphological differences between these different stages are significant, and existing models lack the ability to adapt to these multi-stage characteristics, resulting in a high rate of missed detections of mild infections and atypical symptoms in the early or late stages of growth. Secondly, the scarcity and imbalanced distribution of samples are prominent issues. Some pests and diseases affecting cereal crops (such as the white spot stage and millet borer larvae in specific environments) occur infrequently, resulting in extremely limited natural samples. Traditional data augmentation methods often involve simple physical transformations, leading to "pseudo-realistic" samples with harsh feature edges and inconsistent lighting and field backgrounds, failing to simulate the complex features of real-world infection scenarios. Finally, the resistance to interference in complex field environments is insufficient. Field images contain numerous background interference factors such as weeds, soil, variable lighting (strong light, shadow), and plant occlusion. Existing lightweight models (such as the basic YOLO series) have simplified feature extraction networks for mobile deployment, resulting in weak feature capture capabilities for small pests (such as leaf beetle larvae) and small lesions. Furthermore, they struggle to effectively suppress background noise, leading to high false positive rates and insufficient accuracy.

[0005] Regarding the issue of feature adaptation across the entire growth period, some studies have improved the situation by increasing the number of samples from a single growth period or optimizing model parameters. However, these approaches do not address the adaptation problem of feature differences across growth periods at the feature extraction mechanism level, and thus cannot cope with the dynamic changes in pest and disease morphology. For the problem of sample scarcity, traditional data augmentation methods can only perform simple transformations based on existing samples, failing to generate new samples with realistic background integration and natural morphology, and thus cannot fundamentally solve the model bias caused by sample imbalance. Regarding the contradiction between background interference and multi-scale feature detection, existing solutions either employ complex network architectures (such as large Transformer models) to improve feature extraction capabilities, but this increases computational consumption and makes them unsuitable for field mobile devices such as drones and smartphones; or they maintain lightweight architectures, but sacrifice detection accuracy, making it difficult to balance real-time performance and precision. These shortcomings collectively result in insufficient detection accuracy, generalization ability, and field applicability of existing technologies, failing to meet the needs of integrated and precise control of pests and diseases across the entire growth period of cereal crops. Summary of the Invention

[0006] To address the aforementioned issues, this invention provides a method for detecting pests and diseases in cereal crops throughout their entire growth cycle. Specifically, it involves an integrated detection method that addresses sample imbalance and background interference by combining target and background region decoupling enhancement throughout the entire growth cycle of cereal crops, achieving high-precision identification of various pests and diseases (such as white spot disease and millet leafminer). This method resolves sample imbalance and complex background issues through targeted hierarchical data augmentation strategies and combines an improved YOLOv11n model to achieve accurate detection throughout the entire growth cycle. This improves the detection accuracy of cereal crop pests and diseases while meeting the deployment requirements of devices with limited computing power, such as drones.

[0007] To achieve the above objectives, the present invention provides the following technical solution: A method for detecting diseases and pests in cereal crops throughout their entire growth period includes the following steps: Historical images of cereal crops throughout their entire growth period were collected in different field environments. Fine-grained annotations of pest and disease symptoms were performed on these historical images to obtain annotated images, thereby constructing a pest and disease sample set covering the entire growth period. The historical images of the entire growth period covered the seedling stage, jointing stage, heading stage, grain-filling stage, and different stages of pests and diseases. A targeted hierarchical data augmentation strategy was adopted to decouple and generatively fuse and expand the foreground and background of historical images throughout the entire reproductive period, constructing cross-scene augmented samples; a hybrid dataset was constructed by combining the cross-scene augmented samples with labeled images. Using the aforementioned hybrid dataset as the training basis, an integrated detection model is trained with an adaptive threshold focus loss function. The integrated detection model is based on the original YOLOv11n model, embedding a multi-scale dilated attention module in the detection head of the original YOLOv11n model, and setting a meta-learning feature adaptation module between the backbone network and the neck network. During training, the meta-learning feature adaptation module performs unified adaptation processing on the basic visual features output by the backbone network, extracting common features of pests and diseases across their growth stages. The multi-scale dilated attention module performs multi-scale dilated convolution and attention weighting operations on the feature map output by the neck network to obtain full-scale pest and disease features. The common features of pests and diseases across their growth stages and the full-scale pest and disease features jointly constrain and optimize the predicted confidence score output by the integrated detection model. The optimized predicted confidence score is input into the adaptive threshold focus loss function for loss calculation, and the weights of different samples within the hybrid dataset are dynamically balanced in reverse based on the loss calculation results. After iterative training, an integrated detection model is obtained that can output detection results including pest and disease categories, confidence scores, and bounding box positions.

[0008] Preferably, the images of the entire growth period are annotated with fine-grained disease and pest symptoms, specifically: for white spot disease, the morphological characteristics of the water-soaked stage, gray-backed stage and thorn-headed stage are annotated; for millet borer, the larval, adult and dead heart seedling damage characteristics are annotated; for mud beetle, the insect body and damage characteristics are annotated, so as to form a consistent disease and pest sample annotation system across the growth stage.

[0009] Preferably, the method of employing a targeted hierarchical data augmentation strategy to decouple and generatively fuse and expand the foreground and background of historical full-life-cycle images to construct cross-scene augmented samples specifically includes the following steps: A semantic segmentation network is used to process historical full-growth-cycle images to extract mask and texture features corresponding to the target areas of pests and diseases in the images. The pixel set corresponding to the mask and texture features is defined as the foreground layer. At the same time, after removing the extracted foreground layer, the remaining field environment is defined as the background layer, thus decoupling the foreground and background. An improved recurrent generative adversarial network was constructed by introducing foreground consistency loss and background adversarial loss. The decoupled foreground layer of pests and diseases was set as the source domain feature input of the network, and the background layer obtained under different field conditions was set as the target domain feature input of the network. The foreground features of the source domain and the background features of the target domain are input into the improved recurrent generative adversarial network. The network completes the mapping and fusion of the foreground features of pests and diseases to different field backgrounds, generating a fused image that integrates real field lighting and texture features. The fused image is optimized by dual constraints of foreground consistency loss and background adversarial loss, and the output is a cross-scene enhanced sample of pests and diseases that conforms to the real growth scene in the field.

[0010] Preferably, the step of performing multi-scale dilated convolution and attention weighting operations on the feature map output by the neck network through a multi-scale dilated attention module to obtain full-scale pest and disease features specifically includes the following steps: Receive the feature map output by the neck network; perform dilated convolution operation on the feature map through three parallel convolution branches to obtain feature streams with different receptive fields, and set the dilation rates of the three parallel convolution branches to 1, 2 and 5 respectively; Feature streams from different receptive fields are spliced ​​and fused, and a spatial weight map is calculated using an attention weighting unit. The fused features are then weighted using the spatial weight map to obtain enhanced full-scale pest and disease features, which are then output to the prediction layer of the detection head.

[0011] Preferably, the adaptive threshold focus loss function is used to dynamically balance the weights of different samples within the mixed dataset during training, including the following steps: During the model training iteration, the IoU overlap value between the model's predicted bounding box and the labeled true bounding box is calculated synchronously and in real time based on the optimized prediction confidence score. The dynamic focusing parameters and classification threshold of the adaptive threshold focus loss function are adaptively adjusted based on the IoU overlap value. Positive and negative samples are distinguished based on a classification threshold, and differential weights are assigned to the two types of samples; positive samples are the target areas of pests and diseases, and negative samples are the background areas. The differential weights are embedded in the loss calculation process, and the adaptive focus classification loss and bounding box regression loss are calculated by combining the dynamic focus parameters and IoU values ​​respectively. The adaptive focus classification loss and regression loss are weighted and summed to form the total model loss, which is used for backpropagation to update network parameters, thereby achieving automatic balancing of the weights of different samples during training.

[0012] Preferably, the meta-learning feature adaptation module specifically performs the following operations: During the training phase, a gradient update strategy involving inner and outer loops is used to simulate the adaptation process of a few-sample task; common characteristics of diseases across reproductive stages are extracted.

[0013] Preferably, the recurrent generative adversarial network introduces foreground consistency loss and background adversarial loss during the generation process; the foreground consistency loss is used to constrain the diseased areas in the generated image to retain the original morphology and texture features; the background adversarial loss is used to make the pixel histogram distribution of the diseased edges consistent with that of the new background, thereby achieving dynamic adaptation of features.

[0014] This invention also provides a pest and disease detection system for cereal crops throughout their entire growth period, comprising: The data acquisition module is used to collect historical full-growth-period images of cereal crops in different field environments, and to perform fine-grained annotation of pest and disease symptoms on the historical full-growth-period images to obtain annotated images; the historical full-growth-period images cover the seedling stage, jointing stage, heading stage, grain-filling stage, and different pest and disease stages; The data augmentation module is used to decouple and generatively fuse and expand the foreground and background of historical full reproductive period images using a targeted hierarchical data augmentation strategy, and to construct cross-scene augmented samples; a hybrid dataset is constructed by combining the cross-scene augmented samples with labeled images. The model training module is used to train the integrated detection model using a mixed dataset as the training basis and an adaptive threshold focus loss function. The integrated detection model is based on the original YOLOv11n model, embedding a multi-scale dilated attention module in the detection head of the original YOLOv11n model, and setting a meta-learning feature adaptation module between the backbone network and the neck network. During training, the meta-learning feature adaptation module performs unified adaptation processing on the basic visual features output by the backbone network to extract the common features of pests and diseases across the growth stage. The multi-scale dilated attention module performs multi-scale dilated convolution and attention weighting operations on the feature map output by the neck network to obtain full-scale pest and disease features. The common features of pests and diseases across the growth stage and the full-scale pest and disease features jointly constrain and optimize the predicted confidence score output by the integrated detection model. The optimized predicted confidence score is input into the adaptive threshold focus loss function for loss calculation, and the weights of different samples in the mixed dataset are dynamically balanced in reverse according to the loss calculation results. After iterative training, an integrated detection model that can output detection results including pest and disease categories, confidence scores, and bounding box positions is obtained.

[0015] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement any of the steps in the method for detecting pests and diseases throughout the entire growth period of cereal crops.

[0016] The present invention also provides a computer-readable storage medium storing a computer program that, when loaded by a processor, can execute any of the steps in the method for detecting pests and diseases throughout the entire growth period of cereal crops.

[0017] The method for detecting diseases and pests in cereal crops throughout their entire growth period provided by this invention has the following beneficial effects: This invention first collects images of the entire growth period and multiple disease and pest stages and completes fine-grained annotation to build basic samples. Then, it innovatively adopts a targeted hierarchical data augmentation strategy. Through foreground-background decoupling and generative fusion, it generates cross-scene augmented samples that integrate real field backgrounds and natural morphology. This fundamentally supplements scarce samples and solves the model bias problem caused by sample imbalance, thus building a high-quality and balanced hybrid dataset foundation for model training.

[0018] A meta-learning feature adaptation module is set between the backbone and neck network of the YOLOv11n lightweight architecture. This module performs unified adaptation processing on the basic visual features output by the backbone network, accurately extracting the common features of pests and diseases across the entire growth period. It eliminates the intra-class feature differences of the same pest or disease at different stages such as the seedling stage and the jointing stage, allowing the model to break through the limitations of the growth period and effectively cope with the dynamic changes in the morphology of pests and diseases. This fundamentally solves the problem of feature adaptation across the entire growth period and significantly improves the model's generalization ability. A multi-scale dilated attention module is embedded in the detection head. By performing multi-scale dilated convolution and attention weighting operations on the feature map output by the neck network, it accurately captures the full-scale features of pests and diseases, from tiny insects and small lesions to large-area damage. At the same time, it effectively suppresses background interference in the field. Without increasing the network's computing power consumption, it significantly improves the multi-scale feature extraction and discrimination capabilities of the lightweight model, taking into account both the real-time performance and accuracy of detection.

[0019] Meanwhile, using a mixed dataset as the training basis, and combining it with an adaptive threshold focus loss function to dynamically balance the weights of different data during training, along with a targeted hierarchical data augmentation strategy, forms a dual guarantee of sample expansion and loss optimization, further solving the sample imbalance problem. At the same time, it allows the model to focus more on learning difficult-to-detect samples. The high-quality features extracted by the meta-learning feature adaptation module and the multi-scale dilated attention module also make the weight optimization of the loss function more targeted. Finally, through the collaborative training and iterative optimization of each module, the resulting integrated detection model retains the lightweight characteristics of YOLOv11n and can be perfectly adapted to field mobile devices such as drones and smartphones. It can also accurately output the detection results of pest and disease categories, confidence levels, and bounding box positions, effectively improving detection accuracy and generalization ability. It completely solves the problems of insufficient detection accuracy, generalization ability, and field practicality of existing technologies, meeting the actual needs of integrated and precise prevention and control of pests and diseases throughout the entire growth period of cereal crops. Attached Figure Description

[0020] To more clearly illustrate the embodiments and design schemes of the present invention, the accompanying drawings required for this embodiment will be briefly described below. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a flowchart of the method for detecting diseases and pests in cereal crops throughout their entire growth period according to Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the targeted hierarchical data augmentation (TLA) strategy process provided in an embodiment of the present invention; Figure 3 The data processing flow of the integrated detection model (improved YOLOv11n) provided in the embodiments of the present invention. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. The following embodiments are used to illustrate the present invention, but are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0023] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0024] It should be noted that the terms "first", "second", and "third" used in the embodiments of the present invention are only used to distinguish similar objects and do not represent a specific ordering of objects.

[0025] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which these embodiments of the invention pertain.

[0026] This invention addresses the bottlenecks in existing technologies, such as scarce samples, insufficient coverage of features throughout the entire growth period, poor performance of traditional data augmentation methods, and weak anti-interference capabilities of detection models in complex field environments. For the first time, this invention constructs a fine-grained image database covering the entire growth period of four major pests and diseases: white spot disease, leaf spot, millet borer, and leaf beetle, filling a gap in the field. It innovatively proposes a targeted hierarchical data augmentation technique, utilizing semantic segmentation and generative adversarial networks to achieve precise decoupling and natural fusion of the pest / disease foreground and field background, overcoming the limitations of traditional physical stitching. Simultaneously, it improves the YOLOv11n model based on the Multi-Scale Hollow Attention Module (MSDA) and Adaptive Threshold Focus Loss (ATFL), enhancing the model's ability to suppress complex backgrounds and accurately detect multi-morphological and highly variable features. This method effectively solves key challenges such as imbalanced sample distribution and dynamic changes in features throughout the growth period, improving detection accuracy to 82.3%, providing technical support for precise control of pests and diseases in cereal crops.

[0027] Based on this, the present invention proposes a method for detecting diseases and pests in cereal crops throughout their entire growth period, comprising the following steps: Historical images of cereal crops throughout their entire growth period were collected in different field environments. Fine-grained annotations of pest and disease symptoms were performed on these historical images to obtain annotated images. The historical images of the entire growth period covered the seedling stage, jointing stage, heading stage, grain filling stage, and different stages of pests and diseases.

[0028] A targeted hierarchical data augmentation strategy is employed to decouple and generatively fuse historical full-growth-cycle images, constructing cross-scene augmented samples. These enhanced samples are then combined with labeled images to generate a hybrid dataset. The augmented samples obtained through foreground-background decoupling retain authentic pest and disease characteristics while incorporating diverse field backgrounds. In this invention, the original labeled images provide ground truth for supervision, while the cross-scene augmented samples expand data distribution, balance samples, and improve generalization ability. Both are input into the model, enabling high-precision detection across the entire growth cycle and under complex backgrounds without increasing annotation costs.

[0029] Using a mixed dataset as the training basis, an integrated detection model is trained with an adaptive threshold focus loss function. The integrated detection model is based on the original YOLOv11n model, embedding a multi-scale dilated attention module into the detection head of the original YOLOv11n model, and setting a meta-learning feature adaptation module between the backbone network and the neck network. During training, the basic visual features output by the backbone network are uniformly adapted through the meta-learning feature adaptation module to extract the common features of pests and diseases across the growth stage. Multi-scale dilated convolution and attention weighting operations are performed on the feature map output by the neck network through the multi-scale dilated attention module to obtain full-scale pest and disease features. The common features of pests and diseases across the growth stage and the full-scale pest and disease features jointly constrain and optimize the predicted confidence score output by the integrated detection model. The optimized predicted confidence score is input into the adaptive threshold focus loss function for loss calculation, and the weights of different samples in the mixed dataset are dynamically balanced in reverse according to the loss calculation results. After iterative training, an integrated detection model that can output detection results including pest and disease categories, confidence scores, and bounding box positions is obtained.

[0030] The method of the present invention will be further described below through specific embodiments.

[0031] Example 1 This invention provides a method for detecting pests and diseases throughout the entire growth period of cereal crops, specifically a data-enhanced, data-driven, integrated intelligent detection method for pests and diseases throughout the entire growth period of cereal crops. Figure 1 This is a schematic flowchart of the detection method provided in an embodiment of the present invention. The method can be executed by a control device, including drones, edge devices, smartphones, etc.

[0032] like Figure 1As shown, the implementation of this method includes steps S101-S102, as detailed below: S101. Collect historical full-growth-period images of cereal crops in different field environments. In this embodiment, the full growth period includes the seedling stage, jointing stage, heading stage, and grain-filling stage. Historical full-growth-period images cover different growth stages, different types of pests and diseases (white spot disease, millet leaf borer, etc.), different degrees of occurrence (mild infection, typical symptoms), and different field environments (light intensity, shading, soil background), ensuring data comprehensiveness and providing a sufficient sample base for subsequent annotation and data augmentation. In some embodiments, the image to be detected includes multiple crop plants or typical diseased areas in the same field environment. Exemplarily, the control device can control a drone or handheld device to collect images of cereal crop plants throughout their entire growth period to obtain the image to be detected. In some embodiments, the full-growth-period image acquisition fills a gap in high-quality datasets in this field. For four major pests and diseases of cereal crops—white spot disease, leaf spot, millet leaf borer, and leaf beetle—the morphological characteristics and symptoms of damage from occurrence to development are fully recorded. Simultaneously, fine-grained annotation data of historical detection images is acquired. In this embodiment, the fine-grained annotation not only marks the categories of pests and diseases such as white spot disease and millet leafminer and their bounding box positions in the images, but also further subdivides the morphological evolution and different damage states of each pest and disease throughout its entire growth period. For example, for white spot disease, it is necessary to distinguish the stage characteristics of the waterlogged stage, gray back stage, and thorn head stage; for millet leafminer, it is necessary to separately mark the different morphological forms of damage in larvae, adults, and dead heart seedlings; and for leaf beetle, it is necessary to clarify the differences between the insect body itself and the damage in the plant. This annotation method can provide the model with richer and more accurate training information, helping the model learn the subtle feature differences of different stages and forms of pests and diseases, thereby adapting to the detection needs of dynamic changes throughout the entire growth period and reducing the problems of missed detection and false detection of atypical symptoms. The labels correspond one-to-one with the original images. During model training, it can learn the visual features of specific growth periods and specific pest and disease stages through the labels, such as the texture of white spot disease in the gray back stage and the morphology of millet leafminer in the larval stage. The labeled full-life-cycle images are further enhanced with targeted hierarchical data augmentation during actual model training to generate more enhanced samples, such as images of the whitehead stage with different backgrounds. Finally, the full-life-cycle images and the labeled images are divided into training and test sets.

[0033] S102. Construct an integrated detection model. In some embodiments, the integrated detection model is based on the original YOLOv11n model. A multi-scale dilated attention module is embedded in the detection head of the original YOLOv11n model. A meta-learning feature adaptation module is set between the backbone network and the neck network. The model is trained based on a hybrid dataset generated by a targeted hierarchical data augmentation strategy and an adaptive threshold focus loss function.

[0034] In some embodiments, Targeted Layered Augmentation (TLA) is used to address the problems of sample imbalance and background interference. This strategy specifically performs the following operations: A semantic segmentation network is used to extract mask and texture features of scarce disease targets, defining these as the foreground layer, and the field image after removing the foreground is defined as the background layer, thus decoupling the foreground and background; an improved CycleGAN is constructed, using the decoupled foreground layer as the source domain and the background layers under different environments as the target domain; the disease features of the foreground layer are mapped to the background layer of the target domain through the CycleGAN. It is understood that through this generative feature fusion, cross-scene augmented samples that integrate realistic lighting and texture can be generated, overcoming the limitations of traditional physical stitching (crop-scaling) augmentation methods and significantly improving the visual realism and feature effectiveness of the augmented samples.

[0035] In some embodiments, the Multi-Scale Hollow Attention Module (MSDA) is embedded in the detection head. The MSDA performs the following operations: receiving feature maps output from the neck network; performing dilated convolution operations on the feature maps through three parallel convolutional branches to obtain feature flows with different receptive fields; wherein the dilation rates of the three parallel convolutional branches are set to 1, 2, and 5, respectively. For example, the branch with a dilation rate of 1 is used to focus on the texture features of small targets (such as leafhopper larvae and the gray-backed mold layer of white spot disease); the branch with a dilation rate of 5 is used to capture the global contours of large-scale targets (such as dead heart seedlings and white spot disease thorns). A spatial weight map is calculated through an attention weighting unit to weight the fused features. This enhances the model's ability to suppress complex field backgrounds and capture features of different morphological forms of pests and diseases.

[0036] In some embodiments, the integrated detection model employs an adaptive threshold focus loss function (ATFL-Loss). During training, ATFL-Loss calculates the overlap (IoU) between the predicted bounding box and the ground truth bounding box in real time; the focus parameters are dynamically adjusted based on the overlap. When the overlap is lower than a preset threshold (meaning the sample is difficult to detect), the focus parameters are increased to enhance the loss weight of that sample. This effectively addresses the problem of imbalanced sample distribution in real-world field applications, achieving a dynamic balance between the weights of simple samples (background) and difficult samples (lesions, insects).

[0037] In some embodiments, the integrated detection model incorporates a meta-learning feature adaptation module between the backbone and neck networks. This module integrates a meta-learning strategy (MAML). During training, a gradient update strategy using inner and outer loops simulates the rapid adaptation process for tasks with few samples. This enables the model to extract commonalities in disease features across reproductive stages and adapt to significant differences in features within the same class (different stages of the same disease).

[0038] S103. The integrated detection model is trained using a training set. The construction of the training set includes: using a targeted hierarchical data augmentation strategy to decouple and generatively fuse and expand the foreground and background of historical full-life-cycle images to construct cross-scene augmented samples; and generating a hybrid dataset, i.e., the training set, by combining the cross-scene augmented samples with the labeled images.

[0039] Specifically, such as Figure 1 The processing flow of the targeted hierarchical data augmentation module in Phase 1 employs a targeted hierarchical data augmentation strategy to decouple and generatively fuse and expand the foreground and background of historical full-life-cycle images, constructing cross-scene augmented samples. Specifically, it includes the following steps: Feature-based decoupling: A semantic segmentation network is used to process historical images of the entire growth period to accurately extract the mask and texture features of pests and diseases in the images. The mask and texture features are defined as the foreground layer. At the same time, the original image is processed to remove the extracted foreground layer and the remaining field environment is defined as the background layer, thus achieving effective decoupling between the foreground and the background.

[0040] Constructing an improved generative network: An improved cyclic generative adversarial network (CycleGAN) is constructed by introducing foreground consistency loss and background adversarial loss. The foreground layer of pests and diseases obtained by decoupling in step 1 is set as the source domain of the network, and the background layer obtained by decoupling under different field conditions is set as the target domain of the network.

[0041] Feature-generative fusion: The foreground features of the source domain and the background features of the target domain are input into the improved recurrent generative adversarial network. The network completes the mapping and fusion of the foreground features of pests and diseases to different field backgrounds, generating a preliminary fused image that integrates real field lighting and texture features.

[0042] Generate cross-scene enhanced samples: For the initial fused image, dual constraint optimization is performed through foreground consistency loss and background adversarial loss. The former maintains the core features of the foreground of pests and diseases, while the latter allows the foreground edges to naturally adapt to the new background, correcting problems such as feature distortion and harsh edges that may exist in the initial fused image. The fused image after optimization by the two loss constraints is the cross-scene enhanced sample of pests and diseases that meets the requirements of the real field scene.

[0043] The integrated detection model is iteratively trained based on the training set. For example... Figure 1The integrated detection model training and inference module shown in Phase 2 demonstrates the following processing flow: During training, the meta-learning feature adaptation module uniformly adapts the basic visual features output by the backbone network, extracting common features of pests and diseases across growth stages. This eliminates intra-class feature differences for the same pest or disease at different growth stages, such as seedling, jointing, heading, and grain-filling stages, achieving standardized representation of pest and disease features across growth stages. Furthermore, the multi-scale dilated attention module performs multi-scale dilated convolution and attention weighting operations on the feature maps output by the neck network, accurately capturing full-scale pest and disease features from tiny insects and small lesions to large-scale damage, thus enhancing the model's ability to handle different scales. The model enhances the extraction and discrimination capabilities of pest and disease features. An adaptive threshold focus loss function dynamically balances the weights of different data points in the mixed dataset during training, specifically the weights of positive, negative, difficult, and easy samples. Positive samples are image regions labeled with pests and diseases; negative samples are field background regions without pests and diseases; difficult samples are pest and disease regions with blurred boundaries, small morphology, or background interference; and easy samples are pest and disease regions with obvious features, clear outlines, and no background interference. A target loss function (including ATFL-Loss) is used to calculate the loss between the target detection result and the predicted detection result, and the model parameters are updated until the model converges. For example, the sample image set covers the entire process from seedling stage to grain-filling stage, and a long-tail distribution is balanced through an enhancement strategy. After iterative training, an integrated detection model is obtained that outputs detection results including pest and disease categories, confidence levels, and bounding box locations.

[0044] Specifically, the adaptive threshold focus loss function is used to dynamically balance the weights of different samples within the mixed dataset during training, including the following steps: During the model training iteration, the IoU overlap value between the model's predicted bounding box and the labeled true bounding box is calculated synchronously and in real time based on the optimized prediction confidence score.

[0045] The dynamic focusing parameters and classification threshold of the adaptive threshold focus loss function are adaptively adjusted based on the IoUIoU overlap value.

[0046] Positive and negative samples are distinguished based on a classification threshold, and differential weights are assigned to the two types of samples; positive samples are the target areas of pests and diseases, and negative samples are the background areas.

[0047] By embedding differential weights into the loss calculation process, and combining dynamic focusing parameters and IoU values, adaptive focus classification loss and bounding box regression loss are calculated respectively.

[0048] The adaptive focus classification loss and regression loss are weighted and summed to form the total model loss, which is used for backpropagation to update network parameters, thereby achieving automatic balancing of the weights of different samples during training.

[0049] Specifically, multi-scale dilated convolution and attention weighting operations are performed on the feature map output by the neck network through a multi-scale dilated attention module to obtain full-scale pest and disease features. The steps include: The multi-scale feature map output from the YOLOv11n neck network is used as the module input.

[0050] Parallel branches were constructed using convolutions with different void ratios to extract multi-scale pest and disease features at the micro, conventional, and large scales. Specifically, convolutions with low void ratios captured small, localized pest and disease features (such as tiny lesions and insect eggs), convolutions with medium void ratios captured conventionally sized pest and disease features (such as leaf lesions and larvae), and convolutions with high void ratios captured large-area, global pest and disease features (such as whole-leaf wilting and ear diseases), resulting in multiple sets of feature maps with different competent fields.

[0051] The feature maps output by convolutions with different dilation rates are spliced ​​together along the channel dimension to form a fused feature map containing full-scale pest and disease information.

[0052] Channel and spatial attention weighting is applied to the fused feature map to automatically highlight key features of pests and diseases and suppress background noise; the key feature regions of pests and diseases are automatically learned and highlighted, while irrelevant noise features such as field background, soil, and weeds are suppressed to obtain the weighted attention feature map.

[0053] Attention weights are added to the fused feature map to enhance effective features and weaken interfering information. The final output includes full-scale pest and disease features ranging from tiny lesions to large-area damage symptoms, which are then fed into the subsequent detection head to complete the identification.

[0054] In this embodiment, the adaptive threshold focus loss function is used to dynamically balance the weights of different samples in the mixed dataset during training. The specific implementation steps are as follows: During the model training iteration process, the overlap (IoU) value between the predicted bounding box and the labeled ground truth bounding box is calculated in real time as a basis for judging the difficulty of sample detection.

[0055] The dynamic focusing parameters and classification threshold of the adaptive focus loss function are adaptively adjusted based on the IoU value: the lower the IoU, the more difficult the sample is to detect, and the loss weight of the sample is automatically increased; the higher the IoU, the easier the sample is to detect, and the loss weight of the sample is automatically decreased.

[0056] Based on the classification threshold, positive samples and negative samples are distinguished. Differentiated weights are assigned to positive samples (target areas of pests and diseases) and negative samples (background areas), which automatically reduces the loss contribution of a large number of simple negative samples and avoids the model being trained by the background.

[0057] Differentiated weights are embedded in the loss calculation process, and adaptive focus classification loss and bounding box regression loss are calculated separately by combining dynamic focusing parameters and IoU values. Using dynamic focusing parameters to calculate the classification loss allows the model to focus more on difficult-to-classify, small-sample, and ambiguous pest and disease samples; simultaneously, combining IoU to guide the calculation of bounding box regression loss improves localization accuracy.

[0058] The adaptive focus classification loss and regression loss are weighted and summed to form the total model loss, which is used for backpropagation to update network parameters, thereby achieving automatic balancing of the weights of easy and difficult samples, positive and negative samples, and large and small samples during training.

[0059] To verify the effectiveness of the optimization modules proposed in this invention, ablation experiments were conducted under the same experimental conditions. As shown in Table 1, the results show that the original YOLOv11n baseline model suffers from severe false negatives when faced with complex field backgrounds and scarce samples, with an mAP50 of only 0.612. After introducing the targeted hierarchical data augmentation (TLA) strategy, the model accuracy jumped significantly from 0.701 to 0.866 and the mAP50 increased to 0.707 without any increase in computing power (GFLOPs remained at 6.5), effectively overcoming the problems of background interference and sample imbalance from the data source. Building upon this foundation, each algorithm module exhibits independent gain effects: the MAML meta-learning strategy improves recall to 0.649 without increasing computational overhead, enhancing dynamic adaptation to features with large intra-class differences; the MSDA module significantly improves multi-scale feature capture and noise suppression with minimal computational cost (7.1 GFLOPs); and ATFL-Loss improves mAP50 to 0.734 with zero computational increase, successfully achieving a dynamic balance between easy and difficult sample weights. When the improved modules work synergistically, the final model of this invention achieves optimal performance, with a precision of 0.881, a recall of 0.664, and an mAP50 as high as 0.821, representing a 20.9% improvement in absolute precision compared to the original baseline model, while the overall computational cost only slightly increases to 7.2 GFLOPs.

[0060] Table 1 Experimental results for different detection models The experimental results above show that the method of the present invention effectively solves key problems such as interference from complex backgrounds in the field, scarcity of samples, and drastic evolution of features, while taking into account robustness and computational efficiency, providing technical support for the precise control of pests and diseases in cereal crops.

[0061] S104. Input the image to be detected into the trained integrated detection model to obtain the detection results of cereal crop diseases and pests. For example, after the control device obtains the image to be detected, it inputs the image into the trained integrated detection model, and the model performs feature extraction and disease and pest detection to obtain detection results including category, confidence level and bounding box position.

[0062] The detection method provided by this invention has the following advantages: I. This invention collects images of cereal crops throughout their entire growth cycle, including seedling, jointing, heading, and grain-filling stages, and performs multi-stage, fine-grained annotation on four major pests: white spot disease (waterlogging stage, gray back stage, and thorny head stage), millet leafminer (larvae, adults, and dead heart symptoms), and leaf beetle (insect body and symptoms). It comprehensively records the morphological characteristics and symptoms of these pests from their occurrence to development, constructing a dedicated fine-grained image database. This, in turn, creates a fine-grained sample system covering the entire growth cycle and multiple stages, filling a gap in the field and providing comprehensive and accurate sample support for model training.

[0063] Second, a targeted hierarchical data augmentation strategy is adopted. First, a semantic segmentation network is used to accurately decouple the foreground layer (mask and texture features) of pests and diseases from the field background layer. Then, an improved CycleGAN is constructed, introducing foreground consistency loss and background adversarial loss to generatively fuse the foreground disease features with background layers in different environments. This generates cross-scene augmented samples with natural and coordinated lighting and texture, replacing the traditional physical splicing method and fundamentally solving the problems of small sample scarcity and pseudo-realistic augmented samples. This achieves high-quality sample expansion and breaks through the limitations of traditional data augmentation.

[0064] III. Design a lightweight and robust model architecture to improve detection accuracy and generalization ability. Based on the YOLOv11n framework, a lightweight and robust model architecture was designed through three improvements to enhance detection accuracy and generalization ability: 1) A multi-scale dilated attention module (MSDA) was embedded to extract different receptive field features in parallel with three dilution rates of 1, 2, and 5. After fusion, attention weighting was used to enhance the ability to capture multi-scale pest and disease features; 2) An adaptive threshold focus loss (ATFL) was introduced to dynamically adjust sample weights based on IoU, balancing positive and negative samples with easy and difficult samples; 3) A meta-learning strategy (MAML) was integrated to extract common features across the growth stage through inner and outer loop gradient updates, adapting to the dynamic evolution features of pests and diseases. Based on the improvements to YOLOv11n, while maintaining a lightweight architecture (suitable for deployment on drones and handheld terminals), complex background interference was suppressed, balancing the deployment requirements of mobile devices and detection accuracy.

[0065] The method proposed in this invention solves the technical challenges of existing cereal crop pest and disease detection methods, including poor adaptation of features across the entire growth period, scarce and unbalanced samples, strong interference from field backgrounds, insufficient capture of multi-scale pest and disease features, and low accuracy of lightweight models. First, this invention collects and finely annotates field images covering the seedling to grain-filling stage and each stage of pests and diseases, comprehensively covering the multi-morphological features of pests and diseases throughout their entire growth period. This compensates for the lack of features in single-growth-stage samples and the missed detection of atypical symptoms, laying a data foundation for the model to learn the differences in disease characteristics across stages. Second, a targeted hierarchical data augmentation strategy is employed to achieve foreground-background decoupling and generative fusion expansion, generating cross-scene augmented samples that closely match the real light and shadow and texture of the field. This constructs a hybrid dataset, supplementing scarce pest and disease samples from the source, and solving the problems of distortion and uneven sample distribution leading to model training bias in traditional augmented samples.

[0066] Based on this data support, a meta-learning feature adaptation module and a multi-scale dilated attention module were added to the YOLOv11n lightweight model framework. The former uniformly adapts the basic features of the backbone network, extracts the commonalities of pest and disease features across the growth stage, eliminates the intra-class feature differences of the same pest and disease at different growth stages, and solves the problem of weak cross-growth stage adaptation ability of the model. The latter captures full-scale pest and disease features from tiny insects and small lesions to large-scale damage through multi-scale dilated convolution and attention weighting, effectively suppressing background interference from weeds, soil, light and other factors in the field.

[0067] Two types of high-quality features jointly constrain and optimize the model's prediction confidence. Accurate and reliable confidence scores are input into an adaptive threshold focus loss function. Combined with IoU, the focus parameters and classification threshold are dynamically adjusted to distinguish between positive and negative samples and assign differentiated weights. The training weights of various samples in the mixed dataset are then back-balanced, enabling the model to focus on learning difficult-to-detect, small-scale, and multi-generational pest and disease samples. The integrated detection model obtained through iterative training retains the lightweight advantages of YOLOv11n for deployment on drones and mobile devices, while significantly improving the accuracy and generalization ability of pest and disease identification across the entire growth period and at multiple scales. This effectively reduces false negatives and missed detections, meeting the practical needs of accurate detection and control of pests and diseases in the field around the clock and throughout the entire growth period.

[0068] Based on the same inventive concept, this invention also provides a pest and disease detection system for cereal crops throughout their entire growth period, comprising: The data acquisition module is used to collect historical full-growth-period images of cereal crops in different field environments, and to perform fine-grained annotation of pest and disease symptoms on the historical full-growth-period images to obtain annotated images; the historical full-growth-period images cover the seedling stage, jointing stage, heading stage, grain filling stage, and different pest and disease stages.

[0069] The data augmentation module is used to decouple and generatively fuse and expand the foreground and background of historical full reproductive period images using a targeted hierarchical data augmentation strategy to construct cross-scene augmented samples; and to construct a hybrid dataset by combining the cross-scene augmented samples with labeled images.

[0070] The model training module is used to train the integrated detection model using a mixed dataset as the training basis and an adaptive threshold focus loss function. The integrated detection model is based on the original YOLOv11n model, embedding a multi-scale dilated attention module in the detection head of the original YOLOv11n model, and setting a meta-learning feature adaptation module between the backbone network and the neck network. During training, the meta-learning feature adaptation module performs unified adaptation processing on the basic visual features output by the backbone network to extract the common features of pests and diseases across the growth stage. The multi-scale dilated attention module performs multi-scale dilated convolution and attention weighting operations on the feature map output by the neck network to obtain full-scale pest and disease features. The common features of pests and diseases across the growth stage and the full-scale pest and disease features jointly constrain and optimize the prediction confidence score output by the integrated detection model. The optimized prediction confidence score is input into the adaptive threshold focus loss function for loss calculation, and the weights of different samples in the mixed dataset are dynamically balanced in reverse according to the loss calculation results. After iterative training, an integrated detection model that can output detection results including pest and disease categories, confidence scores, and bounding box positions is obtained.

[0071] Each module in the aforementioned pest and disease detection system for cereal crops throughout their entire growth cycle can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the computer device's memory as software, allowing the processor to call and execute the corresponding operations of each module.

[0072] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps in the embodiment of the method for detecting diseases and pests throughout the entire growth period of cereal crops. Specific implementation methods can be found in the method embodiments, and will not be repeated here.

[0073] Furthermore, the present invention also provides a non-transitory computer-readable storage medium containing instructions, on which a computer program is stored. For example, a memory containing instructions that can be executed by a processor of a computer device to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc. When the computer program is executed by the processor, it can implement the steps in the embodiments of the method for detecting pests and diseases throughout the entire growth period of cereal crops. Specific implementation methods can be found in the method embodiments, which will not be repeated here.

[0074] Those skilled in the art will understand that embodiments of the present invention can provide methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0075] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0076] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0077] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0078] It should be noted that the specific embodiments described above enable those skilled in the art to more fully understand the present invention, but do not limit the present invention in any way. Therefore, although the present invention has been described in detail in this specification and embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the present invention; and all technical solutions and improvements that do not depart from the spirit and scope of the present invention are covered within the protection scope of the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims. Any simple variations or equivalent substitutions of technical solutions that can be readily obtained by those skilled in the art within the scope of the technology disclosed in the present invention are within the protection scope of the present invention.

Claims

1. A method for detecting diseases and pests in cereal crops throughout their entire growth period, characterized in that, Includes the following steps: Historical full-growth period images of cereal crops in different field environments were collected, and the images were annotated with fine-grained disease and pest symptoms to obtain annotated images; the historical full-growth period images covered the seedling stage, jointing stage, heading stage, grain filling stage, and different disease and pest stages. A targeted hierarchical data augmentation strategy was adopted to decouple and generatively fuse and expand the foreground and background of historical images throughout the entire reproductive period, constructing cross-scene augmented samples; a hybrid dataset was constructed by combining the cross-scene augmented samples with labeled images. The integrated detection model is trained using the hybrid dataset as the training basis and an adaptive threshold focus loss function. The integrated detection model is based on the original YOLOv11n model. A multi-scale dilated attention module is embedded in the detection head of the original YOLOv11n model, and a meta-learning feature adaptation module is set between the backbone network and the neck network. During training, the basic visual features output by the backbone network are uniformly adapted through the meta-learning feature adaptation module to extract the common features of pests and diseases across the growth stage; and the feature maps output by the neck network are subjected to multi-scale dilated convolution and attention weighting operations through the multi-scale dilated attention module to obtain full-scale pest and disease features. The common characteristics of pests and diseases across the reproductive cycle and the characteristics of pests and diseases at all scales jointly constrain and optimize the prediction confidence score output by the integrated detection model. The optimized prediction confidence score is then input into an adaptive threshold focus loss function for loss calculation. Based on the loss calculation results, the weights of different samples in the mixed dataset are dynamically balanced in reverse during the training process. After iterative training, an integrated detection model is obtained that can output detection results including pest and disease categories, confidence levels, and bounding box locations.

2. The method for detecting diseases and pests in cereal crops throughout their entire growth period according to claim 1, characterized in that, Fine-grained annotation of pest and disease symptoms is performed on the images throughout the entire growth period. Specifically, for white spot disease, the morphological characteristics of the water-soaked stage, gray-back stage, and thorn-head stage are annotated; for millet borer, the larval, adult, and dead heart seedling damage characteristics are annotated; and for mud beetle, the insect body and damage characteristics are annotated, so as to form a consistent pest and disease sample annotation system across the growth stage.

3. The method for detecting diseases and pests in cereal crops throughout their entire growth period according to claim 1, characterized in that, The method employs a targeted hierarchical data augmentation strategy to decouple and generatively fuse and expand the foreground and background of historical full-life-cycle images, constructing cross-scene augmented samples. This specifically includes the following steps: A semantic segmentation network is used to process historical full-growth-cycle images to extract mask and texture features corresponding to the target areas of pests and diseases in the images. The pixel set corresponding to the mask and texture features is defined as the foreground layer. At the same time, after removing the extracted foreground layer, the remaining field environment is defined as the background layer, thus decoupling the foreground and background. An improved recurrent generative adversarial network was constructed by introducing foreground consistency loss and background adversarial loss. The decoupled foreground layer of pests and diseases was set as the source domain feature input of the network, and the background layer obtained under different field conditions was set as the target domain feature input of the network. The foreground features of the source domain and the background features of the target domain are input into the improved recurrent generative adversarial network. The network completes the mapping and fusion of the foreground features of pests and diseases to different field backgrounds, generating a fused image that integrates real field lighting and texture features. The fused image is optimized by dual constraints of foreground consistency loss and background adversarial loss, and the output is a cross-scene enhanced sample of pests and diseases that conforms to the real growth scene in the field.

4. The method for detecting diseases and pests in cereal crops throughout their entire growth period according to claim 1, characterized in that, The process of performing multi-scale dilated convolution and attention-weighted operations on the feature map output by the neck network through a multi-scale dilated attention module to obtain full-scale pest and disease features includes the following steps: Receive the feature map output by the neck network; perform dilated convolution operation on the feature map through three parallel convolution branches to obtain feature streams with different receptive fields; Feature streams from different receptive fields are spliced ​​and fused, and a spatial weight map is calculated using an attention weighting unit. The fused features are then weighted using the spatial weight map to obtain enhanced full-scale pest and disease features, which are then output to the prediction layer of the detection head.

5. The method for detecting diseases and pests in cereal crops throughout their entire growth period according to claim 1, characterized in that, The adaptive threshold focus loss function is used to dynamically balance the weights of different samples within the mixed dataset during training, including the following steps: During the model training iteration, the IoU overlap value between the model's predicted bounding box and the labeled true bounding box is calculated synchronously and in real time based on the optimized prediction confidence score. The dynamic focusing parameters and classification threshold of the adaptive threshold focus loss function are adaptively adjusted based on the IoU overlap value. Positive and negative samples are distinguished based on a classification threshold, and differential weights are assigned to the two types of samples; positive samples are the target areas of pests and diseases, and negative samples are the background areas. The differential weights are embedded in the loss calculation process, and the adaptive focus classification loss and bounding box regression loss are calculated by combining the dynamic focus parameters and IoU values ​​respectively. The adaptive focus classification loss and regression loss are weighted and summed to form the total model loss, which is used for backpropagation to update network parameters, thereby achieving automatic balancing of the weights of different samples during training.

6. The method for detecting diseases and pests in cereal crops throughout their entire growth period according to claim 1, characterized in that, The meta-learning feature adaptation module specifically performs the following operations: During the training phase, a gradient update strategy involving inner and outer loops is used to simulate the adaptation process of a few-sample task; common characteristics of diseases across reproductive stages are extracted.

7. The method for detecting diseases and pests in cereal crops throughout their entire growth period according to claim 3, characterized in that, The recurrent generative adversarial network introduces foreground consistency loss and background adversarial loss during the generation process; the foreground consistency loss is used to constrain the diseased areas in the generated image to retain their original morphology and texture features. The background adversarial loss is used to make the pixel histogram distribution of the disease edge consistent with that of the new background, thereby achieving dynamic adaptation of features.

8. A pest and disease detection system for cereal crops throughout their entire growth period, characterized in that, include: The data acquisition module is used to collect historical full-growth-period images of cereal crops in different field environments, and to perform fine-grained annotation of pest and disease symptoms on the historical full-growth-period images to obtain annotated images; the historical full-growth-period images cover the seedling stage, jointing stage, heading stage, grain-filling stage, and different pest and disease stages; The data augmentation module is used to decouple and generatively fuse and expand the foreground and background of historical full reproductive period images using a targeted hierarchical data augmentation strategy, and to construct cross-scene augmented samples; a hybrid dataset is constructed by combining the cross-scene augmented samples with labeled images. The model training module is used to train the integrated detection model with a mixed dataset as the training basis and an adaptive threshold focus loss function. The integrated detection model is based on the original YOLOv11n model. A multi-scale dilated attention module is embedded in the detection head of the original YOLOv11n model, and a meta-learning feature adaptation module is set between the backbone network and the neck network. During training, the basic visual features output by the backbone network are uniformly adapted through the meta-learning feature adaptation module to extract the common features of pests and diseases across the growth stage; and the feature maps output by the neck network are subjected to multi-scale dilated convolution and attention weighting operations through the multi-scale dilated attention module to obtain full-scale pest and disease features. The common characteristics of pests and diseases across the reproductive cycle and the characteristics of pests and diseases at all scales jointly constrain and optimize the prediction confidence score output by the integrated detection model. The optimized prediction confidence score is then input into an adaptive threshold focus loss function for loss calculation. Based on the loss calculation results, the weights of different samples in the mixed dataset are dynamically balanced in reverse during the training process. After iterative training, an integrated detection model is obtained that can output detection results including pest and disease categories, confidence levels, and bounding box locations.

9. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is loaded by the processor, it is able to perform the steps of the method according to any one of claims 1 to 7.