Abstract:
Accurate and rapid detection and counting of winter wheat seedlings are often required to obtain key seedling information, including emergence density and emergence rate, under complex field conditions. However, conventional detection is limited by variations in soil background and illumination, due to generally small, densely distributed, and easily occluded seedling targets. This study aims to propose an improved lightweight YOLOv8n model for the detection and counting of winter wheat seedlings in fields. Visible-light images were acquired from a winter wheat experimental field using near-ground Internet of Things (IoT) devices, unmanned aerial vehicles (UAVs), and smartphones. Images were collected at four representative emergence stages, namely 5, 9, 14, and 20 days after sowing, including newly emerged, one-leaf, two-leaf, and three-leaf seedlings under sunny and cloudy conditions. A multi-source dataset of winter wheat seedlings was obtained with 4 550 images after image cleaning, stratified dataset partitioning, and data augmentation. The dataset was then divided into 3 185 training images, 910 validation images, and 455 test images. A YOLOv8n-GC-S (ghost-convolutional block attention module-small object detection layer YOLOv8n) model was then developed. 1) The original YOLOv8n backbone was replaced with the lightweight GhostNet backbone. Additional feature maps were generated after low-cost linear transformations. Thereby, the number of model parameters was reduced by 28.1% compared with redundant convolution. 2) A convolutional block attention module (CBAM) was introduced between the backbone and neck. Channel and spatial attention were used to enhance seedling-related features and then suppress interference from soil and crop residues under complex backgrounds. The CBAM increased mAP@0.5 by 9.4 percentage points, compared with the GhostNet lightweight model. 3) A small-object detection branch was added with a feature-map size of 160 × 160 to retain shallow spatial features. The small-scale seedlings were represented to strengthen weak visual features. The mAP@0.5 increased by 12.6 percentage points, compared with the GhostNet lightweight model. Ablation experiments were conducted to evaluate the contribution rates of each modification. A comparison was also made with mainstream object detection models under the same dataset and experimental conditions. The experimental results showed that the precision, recall, and mAP@0.5 of the YOLOv8n-GC-S model reached 92.1%, 80.0%, and 86.2%, respectively, which were 2.3, 5.9, and 2.9 percentage points higher than those of the baseline YOLOv8n model. The final model contained 2.8 million parameters with a weight file size of 5.7 MB, which was reduced by 12.5% and 8.1%, respectively, compared with the baseline model. Furthermore, the missed-detection rate decreased from 8.0% to 4.7% under cloudy conditions, whereas it decreased from 12.7% to 7.8% under sunny conditions. The average missed detection rate decreased from 10.4% to 6.3% under both illumination conditions, with a reduction of 4.1 percentage points. Multi-temporal counting showed that there was an excellent agreement between model-predicted and manually counted seedling numbers. The coefficient of determination (
R2) ranged from 0.88 to 0.94 over the four emergence stages, while the root mean square error (RMSE) ranged from 4.73 to 7.61 seedlings. The best counting agreement was obtained at the one-leaf stage, with an
R2 of 0.94 and an RMSE of 4.73 seedlings. In addition, emergence density and emergence rate were calculated from the seedling numbers after detection. The emergence rate after estimation was highly consistent with the manually measured ones, with an
R2 of 0.93 and an RMSE of 2.52%. The YOLOv8n-GC-S achieved a favorable balance between detection performance and a lightweight model. Small seedlings of winter wheat can be detected and counted under varying illumination and complex backgrounds. The findings can also support seedling counting and emergence-rate assessment in field environments.