This study presents a comparative analysis of YOLO detection models for the accurate identification of bean leaf diseases caused by Coleoptera pests in natural environments. By using a manually collected dataset of healthy and infected bean leaves in natural conditions, we labeled at the leaf level and evaluated the performance of the YOLOv5, YOLOv8, YOLOv9, YOLOv10, and YOLOv11 models. Mean average precision (mAP) was used to assess the performance of the models. Among these, YOLOv9e exhibited the best performance, effectively balancing precision and recall for datasets with limited size and variability. In addition, we integrated the Sophia optimizer and PolyLoss function into YOLOv9e and enhanced it, providing even more accurate detection results. This paper highlights the potential of advanced deep learning models, optimized with second-order optimizers and custom loss functions, in improving pest detection, crop management, and overall agricultural yield.