Abstract:Aiming to achieve accurate detection of citrus flowering stages in mountainous orchards, an improved citrus flower detection method was proposed based on YOLO v8m, named YOLO v8m-CFDNet. Within the YOLO v8m framework, a petal-aware convolution (PAC) module was introduced to optimize the C2f structure, thereby enhancing fine-grained feature extraction. The integration of MS CAM and SAM modules strengthened multi-scale and spatial attention representation, while the DySample dynamic up-sampling method alleviated edge blurring. In addition, an illumination-adaptive weighted cross-entropy loss was designed to improve robustness under backlight conditions, and Linear Soft NMS was adopted in post-processing to reduce missed detections of densely distributed targets. The model was trained and validated on Yongchun tangerine and Fuzhou mandarin datasets, with ablation, comparative, and generalization experiments conducted for comprehensive performance evaluation. The ablation results demonstrated that each module independently contributed to performance improvement, with the final model achieving 83.07% mAP@0.5, representing an 8.55 percentage points increase over the baseline. In comparative experiments, YOLO v8m CFDNet outperformed SSD, YOLO v5m, YOLO v6, YOLO v9e, and YOLO v10m, achieving a detection speed of 91.94 f/s with only 28.39 million parameters. Generalization experiments further showed a 6.64 percentage points increase in mAP@0.5 and a 7.2 percentage points improvement in recall under backlight conditions on the Fuzhou mandarin dataset. Confusion matrix analysis indicated the highest recognition accuracy (86.91%) during the full-bloom stage. Overall, the proposed YOLO v8m-CFDNet achieved a favorable balance among detection accuracy, real-time performance, and computational efficiency. It demonstrated strong robustness and generalization capability across citrus varieties and illumination conditions, providing an effective technical foundation for automated citrus flowering monitoring and intelligent orchard management.