Monitoring sorghum during the flowering stage is essential for effective fertilization management and improving yield quality, with spike identification serving as the core component of this process. Factors such as varying heights and weather conditions significantly influence the accuracy of sorghum spike detection models, and few comparative studies exist on model performance under different conditions. YOLO (You Only Look Once) is a deep learning object detection algorithm. In this research, images of sorghum during the flowering stage were captured at two heights (15 m and 30 m) in 2023 via a UAV and utilized to train and evaluate variants of YOLOv5, YOLOv8, YOLOv9, and YOLOv10. This investigation aimed to assess the impact of dataset size on model accuracy and predict sorghum flowering stages. The results indicated that YOLOv5, YOLOv8, YOLOv9, and YOLOv10 achieved mAP@50 values of 0.971, 0.968, 0.967, and 0.965, respectively, with dataset sizes ranging from 200 to 350. YOLOv8m performed best on 15