Wheat aphids are the primary pests in wheat-producing areas, posing a serious threat to stable, high wheat yields and regional food security. To detect and count wheat aphids under different complex conditions, this study designed an improved model and developed a mini program. Firstly, we constructed a dual-source dataset containing 542 images collected from indoor and field environments, including 117 indoor images and 425 field images. Secondly, we proposed Aphid Identification and Detection YOLO (AID-YOLO), an enhanced YOLO11n-based method for close-range wheat aphid detection and image-level counting. Specifically, the original downsampling structure was replaced with the ADown module to improve feature extraction efficiency while reducing redundant computation, an IEMA multi-scale attention mechanism integrating IRMB and EMA was introduced to strengthen feature learning under complex background interference, and the dynamic upsampling operator DySample was adopted to enhance cross-scale feature fusion. Finally, AID-YOLO achieved a 19.0% reduction in parameter count (2.09 M vs. 2.58 M) and a 19.0% decrease in computational cost (5.1 vs. 6.3 GFLOPs). Across three random seeds, AID-YOLO achieved an average mAP50 of 95.3 ± 0.10%, compared with 93.0 ± 0.39% for the YOLO11n baseline on the combined indoor–field evaluation set. These results suggest that AID-YOLO achieves a favorable balance between detection accuracy and model lightweighting under the tested indoor and field conditions, providing a useful technical reference for intelligent wheat aphid monitoring.
Frequent occurrences of pests and diseases in tomatoes severely restrict yield and quality improvements. Traditional detection methods are labor-intensive and prone to errors, while advancements in deep learning provide a promising solution for rapid and accurate identification. However, existing deep learning-based models often face high computational complexity and a large number of parameters, which hinder their deployment on resource-constrained edge devices. To overcome this limitation, we propose a novel lightweight detection model named YOLOv11n-KL based on the YOLOv11n framework. In this model, the feature extraction capability for small targets and the overall computational efficiency are enhanced through the integration of the Conv_KW and C3k2_KW modules, both of which incorporate the KernelWarehouse (KW) algorithm, and the Detect_LSCD detection head is employed to enable parameter sharing and adaptive multi-scale feature calibration. The results indicate that YOLOv11n-KL achieves superior performance in tomato pest and disease detection, balancing lightweight design and detection accuracy. The model achieves an mAP@0.5 of 92.5% with only 3.0 GFLOPs and 5.2 M parameters, reducing computational cost by 52.4% and improving mAP@0.5 by 0.9% over YOLOv11n. With its low complexity and high precision, YOLOv11n-KL is well-suited for resource-constrained applications. The proposed YOLOv11n-KL model offers an effective solution for detecting tomato pests and diseases, serving as a useful reference for agricultural automation.