Abstract
Real-time detecting and identifying impurities in wheat grain mass is crucial for wheat storage silos, flour mills and modern combines. Depending on the detection objectives, accuracy is typically prioritized in laboratory-based applications, whereas real-time detection scenarios require a trade-off between accuracy and speed. Consequently, detection algorithms should be developed in alignment with the specific performance demands of each application. Given the strong object detection capabilities of YOLO models, four updated algorithms-YOLOv5n, YOLOv5x, YOLOv8n, and YOLOv8x-were employed to achieve the research objectives. In this study, a total of 700 labeled images of three different resolutions, encompassing 11 distinct classes, were used to train the algorithms. The results of this study demonstrated that increasing the model size had no significant effect on mAP but substantially reduced processing speed. For laboratory applications, YOLOv5x and YOLOv8x exhibited nearly identical performance, making them suitable candidates. Among the tested models and image sizes, YOLOv5n with an image resolution of 320 × 320 maintained accuracies while improving detection speed by 4%, making it a suitable choice for real-time applications. Overall, the mAP@50 for impurities with similar visual characteristics, such as wheat grains, sun pest-damaged grains, and shriveled grains, was 88%, 86%, and 85%, respectively, while for other impurities, it exceeded 95%. These findings underscore the potential of YOLO models for impurity detection in wheat, providing a non-destructive testing method that could be extended to impurity recognition in other grains.