YOLOv8-Based Multi-Class Detection of Coffee Bean Defects and Contaminants for Automated Quality Grading - Sayid Muhammad Jundullah; Hafizh Al Kautsar Aidilof; Fadlisyah (Brilliance: Research of Artificial Intelligence, 2026)
The quality of coffee beans is a crucial factor in determining export value and compliance with international standards set by the International Coffee Organization (ICO) and Standar Nasional Indonesia (SNI). Traditional manual sorting methods are time-consuming, labor-intensive, and prone to human subjectivity and inconsistency. This study aims to develop an automated coffee bean quality grading system using the YOLOv8s object detection model to accurately identify 20 classes of physical defects and contaminants from static images and automatically calculate the quality grade. A dataset consisting of 2,000 annotated images of Arabica and Robusta coffee beans was collected and divided into training (70%), validation (20%), and testing (10%) sets. The YOLOv8s model was trained using transfer learning with pre-trained weights and data augmentation techniques, then integrated into a web-based application using FastAPI for defect detection and automated defect scoring based on ICO and SNI 01-2907-2008 standards. Experimental results showed that the proposed model achieved a mean Average Precision (mAP@0.5) of 0.75, precision of 0.76, and recall of 0.75. The model performed excellently on distinct classes such as normal beans, large husk fragments, stones, and twigs, while facing challenges in differentiating visually similar defects like variants of black beans and sour beans. This study demonstrates the effectiveness of YOLOv8s for multi-class coffee bean defect detection and provides a practical, scalable, and objective solution for coffee quality assessment, significantly reducing reliance on manual inspection while improving consistency and efficiency in the grading process.