Abstract:The detection of inflorescences from the world’s three major cereal crops (rice panicles, wheat spikes, and maize tassels) is a fundamental task in precision farming and cereal crop phenotyping. However, accurate detection remains challenging due to dense distributions, significant scale variations, and small-target in complex environments, which substantially compromise the precision of detection. To tackle these issues, gated attention-DETR (GA-DETR), an architecture based on RT-DETR was proposed, which introduced three novel components: aiming at the delicate tip features of cereal inflorescences, a gated mechanism C2F (GMC2F) module was proposed to enhance backbone feature discrimination through dynamic channel weighting and cross-stage local feature integration. To address the scale mismatch caused by differences in the shapes of cereal inflorescences, an attention upsample scale sequence feature fusion (AUSSFF) module was proposed, which enhanced the robustness of multi-scale dependency modeling through 3D convolutions. For difficult small target in UAV images, a FPIoU loss function was proposed, which combined target-size adaptive weighting and difficulty-aware stratification to optimize the performance on hard samples. GA-DETR performed better than the baseline RT-DETR and five mainstream detection models on the RiceR dataset, GWHD dataset, and MTC-UAV dataset, including rice panicles, wheat spikes, and maize tassels, achieving mAP@0.5 of 92.8%, 91.7%, and 91.3%, respectively, while for RiceR dataset reducing model parameters by 32.5% and floating-point computational load by 14.4%. The proposed framework surpassed five state-of-the-art frameworks in inflorescence counting on GWHD dataset, achieving an MAE of 5.650 and an RMSE of 7.383. It effectively balanced accuracy and efficiency, providing a cross-species feature modeling paradigm for the universal detection framework of cereal inflorescence morphology. Compatible with diverse cereal crops (e.g., wheat, rice, maize) and data from different acquisition platforms (ground cameras, UAVs), it supported automated high-throughput field phenotyping monitoring of cereals, further advancing precision agriculture.