Detection of Coffee Bean Defects in Speciality Coffee Association Standards using YOLOv12 - Hocwin Hebert; Alamsyah, Derry (INOVTEK Polbeng - Seri Informatika, 2026)
Coffee is a high-value plantation commodity with a significant role in the global economy. Coffee consumption, reaching more than two billion cups per day, continues to increase global demand for coffee beans. To ensure quality and consumer acceptance, green coffee bean quality evaluation must follow consistent international standards. However, inspection is still carried out manually, making it time-consuming and subjective. This study proposes coffee bean defect detection based on the Specialty Coffee Association (SCA) standard using YOLOv12. YOLOv12 addresses limitations of previous YOLO versions by integrating R-ELAN to improve training efficiency and reduce gradient loss, as well as Flash Attention to enhance focus on important regions in complex images. A total of 225 images were obtained through augmentation from 45 original samples captured using a smartphone camera under controlled indoor conditions, with each image representing 300 grams of Mandheling coffee beans. The dataset was divided into training (80%), validation (10%), and testing (10%). Eight experimental configurations were evaluated using variations in initial learning rate (0.001 and 0.0005), batch size (8 and 16), and epochs (100 and 150). The optimal configuration, an initial learning rate of 0.0005, a batch size of 16, and 150 epochs, achieved a precision of 87%, a recall of 85%, and an F1 score of 84%. These results indicate that the effectiveness of YOLOv12 in detecting coffee bean defects depends on proper hyperparameter tuning. The model performs well on visually prominent defects such as cherry pods but shows reduced performance on subtle defects including floaters, fungus damage, and slight insect damage.