Rotten Apple Detection Using YOLOv12 for Postharvest Quality Sorting - Bradika Almandin Almandin Wisesa; Vivin Mahat Putri; Evvin Faristasari; Sirlus Andreanto Jasman Duli; Satria Agus Darma (LPPM Universitas Bhinneka Nusantara, 2026)
Detecting rotten apples is critical in postharvest quality sorting, as spoiled fruit can accelerate overall decay, shorten shelf life, and lower market value. This study introduces a real-time, edge-deployable object detection method using YOLOv12 to differentiate between fresh and rotten apples in RGB images. The dataset included 2,312 annotated images, with 1,011 fresh apples and 1,301 rotten apples, split into training, validation, and testing sets with an 80:10:10 stratified ratio. To enhance model generalization, data augmentation techniques such as mosaic augmentation, horizontal flipping, rotation, scaling, HSV color jitter, and mixup were applied. The YOLOv12s model was trained with an input resolution of 640 × 640 and evaluated using accuracy, precision, recall, and F1-score. The results from the confusion matrix showed that the model achieved an accuracy of 0.93, precision of 0.91, recall of 0.89, and F1-score of 0.90, indicating that YOLOv12 offers a lightweight and effective framework for rapid apple quality assessment. The primary contribution of this work lies in integrating an attention-focused YOLOv12 detector into a postharvest apple sorting workflow, accompanied by quantitative performance evaluation and robustness analysis under challenging visual conditions.