Abstract:Pollination is a critical stage in muskmelon cultivation, and mechanical pollination has emerged as a significant development direction due to its efficiency benefits. Accurate identification of female and male flowers is essential for the operation of pollination robots. For identifying melon female and male flowers, an improved YOLO 12s target detection network was applied, and the systematic deployment was implemented on edge device. By replacing the Backbone of the original model with the ShuffleNetV2 structure, the model?s complexity and computational load were reduced, and the purpose of improving detection speed was achieved. Additionally, the knowledge distillation was also employed to further improve the performance of the improved model. A total of 3 597 muskmelon images were annotated in the greenhouse environment and then sent to the improved YOLO 12s object detection network for model training. Under identical experimental conditions, a comprehensive comparison was conducted with current mainstream algorithms. The melon flower detection model was evaluated across five metrics: precision, recall, mean average precision, model size, and detection speed. Test results showed that the model achieved a precision of 79.93%, recall of 87.65%, mAP of 86.54%, a model size of 4.10 MB, and a detection speed of 153.46 f/s. Compared with YOLO 12s, YOLO v10s, YOLO v8s, YOLO v5s, SSD, and Faster R?CNN models, the detection speed was improved by 79.32%, 75.11%, 45.14%, 38.23%, 746.44% and 1 168.26%, respectively. Furthermore, the model maintained accurate detection performance under complex conditions such as varying lighting, partial occlusion, and image blur. When deployed on the Jetson Xavier NX embedded platform, this model achieved a mAP of 86.62%, the detection speed was 26.37 f/s. Compared with YOLO 12s and YOLO v5s, the detection speed was 90.40% and 15.51% faster, respectively. This performance was sufficient to meet the practical requirements for both accuracy and real?time processing in pollination operations. The results demonstrated that the lightweight model can accurately and efficiently identify male and female melon flowers. With only a minor loss in accuracy, it significantly reduced memory consumption, facilitating its deployment on edge devices. The research result can provide technical support for mechanical pollination of melons.