Abstract:
To improve maize tassel detection and counting in unmanned aerial vehicle (UAV) imagery affected by dense target distributions, pronounced scale variation, overlap, occlusion, and complex field backgrounds, this study developed a lightweight adaptive sparse attention-enhanced detection transformer (AS-DETR). The work aimed to increase detection and counting accuracy while reducing computational demand and preserving real-time inference on embedded hardware. It also evaluated whether the resulting detector remained reliable across illumination changes, image degradation, maize growth stages, and flight altitudes, thereby addressing the requirements of accuracy, robustness, efficiency, and deployability in aerial field monitoring. A dataset of 2,461 red, green, and blue (RGB) UAV images containing 110,745 annotated tassel bounding boxes was assembled from four public sources and images collected in Tongliao, Inner Mongolia. Region-independent training, validation, and test subsets contained 1,722, 247, and 492 images, respectively, and illumination, occlusion, density, and noise augmentation expanded the training set to 10,332 images. The real-time detection transformer (RT-DETR) neck was modified with lightweight hybrid convolution, cross-scale alignment and concatenation, adaptive sparse self-attention (ASSA), a spatially enhanced feed-forward network (SEFN), and cross-stage multiscale feature aggregation. Comparison models were uniformly retrained. In the unified test, AS-DETR achieved average precision values of 96.3% at an intersection-over-union threshold of 0.50, 74.8% at a threshold of 0.75, and 68.6% across thresholds from 0.50 to 0.95. These values exceeded those of the original RT-DETR by 3.7, 2.6, and 3.3 percentage points, respectively. Small-object average precision increased from 38.5% to 41.8%, while medium- and large-object average precision reached 58.3% and 72.5%. Ablation experiments showed that combining ASSA and SEFN raised average precision at the 0.50 threshold from 92.6% to 94.9%; adding lightweight convolution and cross-scale concatenation increased it to 95.6%; and cross-stage multiscale aggregation produced the final 96.3%. For counting, AS-DETR yielded a mean absolute error of 2.89 tassels, a root mean square error of 4.35 tassels, a mean absolute percentage error of 6.8%, and a coefficient of determination of 0.966. The mean absolute error was lower than the 3.55 tassels obtained by RT-DETR and the 3.92 tassels obtained by the best-performing competing one-stage detector. The lightweight redesign reduced computation from 190.2 billion to 120.1 billion floating-point operations and reduced trainable parameters from 38.7 million to 35.5 million, while increasing inference speed from 56.2 to 62.1 frames per second. Under morning and nighttime low-illumination conditions, average precision at the 0.50 threshold remained 94.3% and 91.1%, respectively. Under focus blur and motion blur, average precision at the 0.75 threshold reached 69.5% and 68.3%, exceeding the corresponding RT-DETR results by 3.2 and 2.9 percentage points. Deployment on an NVIDIA Jetson Xavier NX embedded platform showed F1 scores from 92.4% to 97.4% across the grain-filling and maturity stages and flight altitudes of 6, 10, and 15 metres. Thus, the model maintained stable detection when tassel size decreased and scene density increased with flight altitude. The results demonstrated that the coordinated use of sparse spatial attention, local spatial enhancement, lightweight feature mapping, and bidirectional multiscale aggregation improved small and densely distributed tassel representation without imposing excessive computation. AS-DETR simultaneously reduced counting error, increased detection accuracy, accelerated inference, and retained robustness under illumination, blur, developmental-stage, and altitude changes. The embedded tests confirmed that the model satisfied the accuracy and efficiency requirements of edge deployment and supported reliable maize tassel monitoring and yield-estimation data acquisition from UAV platforms in complex field environments.