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.