Non-Destructive Detection of Coffee Bean Defects using Machine Vision and the YOLOv11 Algorithm - Hary Kurniawan; Ince Siti Wardatullatifah S; Hanifah Ayu; Surya Abdul Muttalib; Sukmawaty Sukmawaty; Ansar Ansar; Rahmat Sabani; Murad Murad (The University of Lampung, 2026)
Advances in machine vision and deep learning offer a promising solution for automated, non-destructive quality assessment for high-quality coffee. This study evaluated the performance of five YOLOv11 variants (n, s, m, l, and x) for real-time detection of defective coffee beans and identified the most suitable model in terms of detection accuracy and computational efficiency. A conveyor-based machine vision system was developed to acquire top-view images of Robusta coffee beans under controlled illumination. A dataset of 3,500 images was prepared, comprising 3,000 annotated images for training and validation (80:20) and 500 images reserved for blind testing. All defective beans were grouped into a single defect class, and the YOLOv11 variants were evaluated using precision, recall, F1-score, mean Average Precision (mAP) at IoU thresholds of 0.5 and 0.5:0.95, and inference time. All YOLOv11 variants achieved high detection performance, with mAP@0.5 values exceeding 0.98. YOLOv11s showed the best overall balance, achieving the highest recall (0.954), mAP@0.5:0.95 (0.689), and F1-score (0.959), while maintaining low inference time and a compact model size. Larger variants, such as YOLOv11x, achieved slightly higher mAP@0.5 but required substantially greater computational resources, whereas YOLOv11n provided faster inference but lower robustness under stricter localization criteria. Blind testing revealed a performance gap relative to validation results, highlighting remaining challenges in model generalization. Overall, the results confirm the effectiveness of YOLOv11 for coffee bean defect detection and identify YOLOv11s as the most suitable variant for real-time inspection within the defined experimental scope.