YOLOv8-Based Multi-Class Detection of Coffee Bean Defects and Contaminants for Automated Quality Grading
DOI:
https://doi.org/10.47709/brilliance.v6i2.8612Keywords:
Coffee, Detection, Grading, Vision, YOLOv8Abstract
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.
References
Adhi Prasetya, I., Sukandiarsyah, F., Aryani Fitri, N., Adam, S., Studi Teknologi Informasi Politeknik Aisyiyah Pontianak Jl Ampera, P., Kalimantan Barat Indonesia, P., & Pontianak Jl Ahmad Yani, N. (2024). Klasifikasi kualitas buah jeruk menggunakan computer vision dengan arsitektur YOLO V8. Jurnal Pendidikan Informatika Dan Sains, 13(2), 187–201. https://doi.org/10.31571/SAINTEK.V13I2.8346
Adiwijaya, N. O., Sarno, R., & Wijaya, D. R. (2024). Real Time Detection of Coffee Bean Defects Using YOLO Method and SAHI (Slicing Aided Hyper Inference) Framework. 2024 Beyond Technology Summit on Informatics International Conference, BTS-I2C 2024, 286–291. https://doi.org/10.1109/BTS-I2C63534.2024.10941784
Alam, B. M. S., Noor, M. T., Momo, I. J., Mia, M. P., Ahammed, F., & Ali, M. N. Y. (2025). Fabric Finesse: Harnessing YOLOv8 for Enhanced Textile Detection. 2025 International Conference on Electrical, Computer and Communication Engineering, ECCE 2025. https://doi.org/10.1109/ECCE64574.2025.11013032
Ariatmanto, Aris Setiyadi, Ema Utami, D. (2023). Analisa Kemampuan Algoritma YOLOv8 Dalam Deteksi Objek Manusia Dengan Metode Modifikasi Arsitektur. J-SAKTI (Jurnal Sains Komputer Dan Informatika), 7(2), 891–901. Retrieved from http://tunasbangsa.ac.id/ejurnal/index.php/jsakti/article/view/694
Arifin, N., Insani, C. N., & Rasyid, M. R. (2023). Klasifikasi Tingkat Kematangan Buah Tomat menggunakan Computer Vision untuk Smart Agriculture. Jurnal SAINTIKOM (Jurnal Sains Manajemen Informatika Dan Komputer), 22(2), 509–516. https://doi.org/10.53513/JIS.V22I2.8387
Gope, H. L., Fukai, H., Ruhad, F. M., & Barman, S. (2024). Comparative analysis of YOLO models for green coffee bean detection and defect classification. Scientific Reports 2024 14:1, 14(1), 1–16. https://doi.org/10.1038/s41598-024-78598-7
Hossain, H. M., Nath, P., Mahi, M. N., Uddin, I., Eiste, I. J., Ratul, S. N. R., … Hossain, M. T. (2025). Evaluating YOLO Architectures: Implications for Real-Time Vehicle Detection in Urban Environments of Bangladesh. Retrieved from https://arxiv.org/pdf/2509.05652
International Coffee Organization. (2024). Existing Definitions of Specialty Coffee. Retrieved from https://ico.org/documents/cy2024-25/fgsc-3e-definitions-specialty-coffee.pdf
Michael, A., Rusman, J., & History, A. (2023). Klasifikasi Cacat Biji Kopi Menggunakan Metode Transfer Learning dengan Hyperparameter Tuning Gridsearch. Jurnal Teknologi Dan Manajemen Informatika, 9(1), 37–45. https://doi.org/10.26905/JTMI.V9I1.10035
Musakkir, A. F. R., & Sulastiyo, L. E. P. (2023). Sistem Sortir Buah Berbasis Internet of Things.
Qi, Z., Dong, R., Fan, G., Ge, Z., Zhang, X., Ma, K., & Yi, L. (2023). Contrast with Reconstruct: Contrastive 3D Representation Learning Guided by Generative Pretraining. Proceedings of Machine Learning Research, 202, 28223–28243. Retrieved from https://arxiv.org/pdf/2302.02318
Rusman, J., & Pasae, N. (2023). Prototype Sistem Penyortir Buah Kopi Arabika Berdasarkan Tingkat Kematangan Menggunakan Metode Support Vector Machine. Teknika, 12(1), 65–72. https://doi.org/10.34148/TEKNIKA.V12I1.602
Satya, L., Septian, M. R. D., Sarjono, M. W., Cahyanti, M., & Swedia, E. R. (2023). SISTEM PENDETEKSI PLAT NOMOR POLISI KENDARAAN DENGAN ARSITEKTUR YOLOV8. Sebatik, 27(2), 753–761. https://doi.org/10.46984/SEBATIK.V27I2.2374
Sirappa, M. P., Heryanto, R., & Silitonga, Y. R. (2024). Standardisasi Pengolahan Biji Kopi Berkualitas. Warta BSIP Perkebunan, 2(1), 18–25.
Siwaka, F. A., Panjaitan, S. D., & Yacoub, R. R. (2025). IMPLEMENTASI ALGORITMA DEEP LEARNING YOLOV8 PADA ALAT SORTIR KEMATANGAN BUAH TOMAT. Kohesi: Jurnal Sains Dan Teknologi, 7(11), 1–10. https://doi.org/10.2238/52EQV641
Suwela, N., & Hedriyadi, M. Z. (2025). DETEKSI JENIS SAMPAH MENGGUNAKAN METODE TRANSFER LEARNING YOLO-V8. Jurnal Sistem Informasi Dan Sains Teknologi, 7(1). https://doi.org/10.31326/SISTEK.V7I1.2125
Terven, J., Córdova-Esparza, D. M., & Romero-González, J. A. (2023). A Comprehensive Review of YOLO Architectures in Computer Vision: From YOLOv1 to YOLOv8 and YOLO-NAS. Machine Learning and Knowledge Extraction, 5(4), 1680–1716. https://doi.org/10.3390/make5040083
www.kompas.com. (2025). Berita BRMP Perkebunan - Tren 2025: Peluang dan Daya Saing Kopi. Retrieved November 13, 2025, from https://perkebunan.brmp.pertanian.go.id/berita/tren-2025-peluang-dan-daya-saing-kopi
Xiao, P., Xiao, M., Cai, N., Qiu, B., Zhou, S., & Wang, H. (2023). Adaptive Hybrid Framework for Multiscale Void Inspection of Chip Resistor Solder Joints. IEEE Transactions on Instrumentation and Measurement, 72. https://doi.org/10.1109/TIM.2023.3235435
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Sayid Muhammad Jundullah, Hafizh Al Kautsar Aidilof, Fadlisyah

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.















