Non-Destructive Detection of Coffee Bean Defects using Machine Vision and the YOLOv11 Algorithm

  • Hary Kurniawan
    Universitas Mataram
  • Ince Siti Wardatullatifah S
    Universitas Mataram
  • Hanifah Ayu
    Universitas Mataram
  • Surya Abdul Muttalib
    Universitas Mataram
  • Sukmawaty
    Universitas Mataram
  • Ansar
    Universitas Mataram
  • Rahmat Sabani
    Universitas Mataram
  • Murad
    Universitas Mataram
DOI: https://doi.org/10.23960/jtepl.v15i3.1164-1179
Keywords Coffee beans, Defect detection, Machine vision, YOLOv11
Abstract Views (Last 12 Months)
31 Abstract Views
27 Downloads

Abstract

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 [email protected] values exceeding 0.98. YOLOv11s showed the best overall balance, achieving the highest recall (0.954), [email protected]: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 [email protected] 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.

Downloads

Download data is not yet available.

References

Adiwijaya, N.O., Sarno, R., & Wijaya, D.R. (2024). Coffee defects detection based on green bean images using YOLO architecture. In Proceedings of the 2024 IEEE 2nd International Conference on Electrical Engineering, Computer and Information Technology (ICEECIT) (pp. 314–319). https://doi.org/10.1109/ICEECIT63698.2024.10859988

Al Husaini, M., Raharja, A.R., Putra, V.H.C., & Lukmana, H.H. (2025). Enhanced plant disease detection using computer vision YOLOv11: Pre-trained neural network model application. Journal of Computer Networks, Architecture and High Performance Computing, 7(1), 82–95. https://doi.org/10.47709/cnahpc.v7i1.5146

Al-Ghamdi, S., Alfaifi, B., Elamin, W., & Lateef, M.A. (2024). Advancements in coffee manufacturing: From dehydration techniques to quality control. Food Engineering Reviews, 16(4), 513–539. https://doi.org/10.1007/s12393-024-09383-5

Ali, M.M., Hashim, N., Aziz, S.A., & Lasekan, O. (2021). Quality inspection of food and agricultural products using artificial intelligence. Advances in Agricultural and Food Research Journal, 2(2). https://doi.org/10.36877/aafrj.a0000237

Alif, M.A.R., & Hussain, M. (2024). YOLOv1 to YOLOv10: A comprehensive review of YOLO variants and their application in the agricultural domain. ArXiv, 1-31. http://arxiv.org/abs/2406.10139

Al-Mahish, M., & Alfayadh, R. (2024). The impact of coffee quality attributes and ratings on specialty coffee bean prices. Beverage Plant Research, 4(1), 0–0. https://doi.org/10.48130/bpr-0024-0029

Amadea, V., Rachmawati, E., Ferdian, E., & Akbar, M.N.S. (2024). Defect detection in Arabica green coffee beans based on grade quality. In Proceedings of the 2024 10th International Conference on Computing and Artificial Intelligence (pp. 103–110). https://doi.org/10.1145/3669754.3669770

Anastácio, L.M., da Silva, M.deC.S., Debona, D.G., Veloso, T.G.R., Entringer, T.L., Bullergahn, V.B., da Luz, J.M.R., Moreli, A.P., Megumi, M.C., & Pereira, L.L. (2023). Relationship between physical changes in the coffee bean due to roasting profiles and the sensory attributes of the coffee beverage. European Food Research and Technology, 249(2), 327–339. https://doi.org/10.1007/s00217-022-04118-4

Ardian, Y., Irawan, N.D., Sutoko, S., Astawa, I.N.G.A., Purnama, I.B.I., & Dwiyanto, F.A. (2024). A novel approach to defect detection in Arabica coffee beans using deep learning: Investigating data augmentation and model optimization. Knowledge Engineering and Data Science, 7(1), 117–127. https://doi.org/10.17977/um018v7i12024p117-127

Arwatchananukul, S., Xu, D., Charoenkwan, P., Moon, S.A., & Saengrayap, R. (2024). Implementing a deep learning model for defect classification in Thai Arabica green coffee beans. Smart Agricultural Technology, 9, 100680. https://doi.org/10.1016/j.atech.2024.100680

Badgujar, C.M., Poulose, A., & Gan, H. (2024). Agricultural object detection with You Only Look Once (YOLO) algorithm: A bibliometric and systematic literature review. Computers and Electronics in Agriculture, 223, 109090. https://doi.org/10.1016/j.compag.2024.109090

Bumbálek, R., Ufitikirezi, J.deD.M., Umurungi, S.N., Zoubek, T., Kuneš, R., Stehlík, R., & Bartoš, P. (2025). Computer vision in precision livestock farming: Benchmarking YOLOv9, YOLOv10, YOLOv11, and YOLOv12 for individual cattle identification. Smart Agricultural Technology, 12, 101208. https://doi.org/10.1016/j.atech.2025.101208

Chandu, B., Surendran, R., & Selvanarayanan, R. (2025). To instant of coffee beans using K-nearest algorithm over clustering for quality and sorting process. In Proceedings of the 2024 International Conference on IT Innovation and Knowledge Discovery (ITIKD) (pp. 1–7). https://doi.org/10.1109/ITIKD63574.2025.11005039

Chang, S.J., & Liu, K.H. (2024). Multiscale defect extraction neural network for green coffee bean defects detection. IEEE Access, 12, 15856–15866. https://doi.org/10.1109/ACCESS.2024.3356596

Chen, F., Zhang, Y., Fu, L., Hua, R., Zhang, Q., & Bi, S. (2025). A comparative review of the next-generation YOLO models: YOLOv10 and YOLO11. Journal of Computer Science and Artificial Intelligence, 3(2), 1–6. https://doi.org/10.54097/22zsmc10

Chen, S.-Y., Chiu, M.-F., & Zou, X.-W. (2022). Real-time defect inspection of green coffee beans using NIR snapshot hyperspectral imaging. Computers and Electronics in Agriculture, 197, 106970. https://doi.org/10.1016/j.compag.2022.106970

García, M., Candelo-Becerra, J.E., & Hoyos, F.E. (2019). Quality and defect inspection of green coffee beans using a computer vision system. Applied Sciences, 9(19), 4195. https://doi.org/10.3390/app9194195

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, 14(1), 28946. https://doi.org/10.1038/s41598-024-78598-7

Gosalvitr, P., Cuéllar-Franca, R.M., Smith, R., & Azapagic, A. (2024). Environmental and economic sustainability assessment of the production and consumption of different types of coffee in the UK. Sustainable Production and Consumption, 49, 144–162. https://doi.org/10.1016/j.spc.2024.06.004

He, L., Zhou, Y., Liu, L., Cao, W., & Ma, J. (2025). Research on object detection and recognition in remote sensing images based on YOLOv11. Scientific Reports, 15(1), Article 14032. https://doi.org/10.1038/s41598-025-96314-x

Hemamalini, V., Rajarajeswari, S., Nachiyappan, S., Sambath, M., Devi, T., Singh, B.K., & Raghuvanshi, A. (2022). Food quality inspection and grading using efficient image segmentation and machine learning-based system. Journal of Food Quality, 2022, 5262294. https://doi.org/10.1155/2022/5262294

Hidayatullah, P., Syakrani, N., Sholahuddin, M.R., Gelar, T., & Tubagus, R. (2025). YOLOv8 to YOLO11: A comprehensive architecture in-depth comparative review. arXiv, 1-22. http://arxiv.org/abs/2501.13400

Ji, Y., Xu, J., & Yan, B. (2024). Coffee green bean defect detection method based on an improved YOLOv8 model. Journal of Food Processing and Preservation, 2024(1), 2864052. https://doi.org/10.1155/2024/2864052

Jung, E., & Nam, D. (2025). Lightweight YOLO-based real-time fall detection using feature map-level knowledge distillation. ICT Express, 11(6), 1152-1161. https://doi.org/10.1016/j.icte.2025.08.009

Katsamenis, I., Karolou, E.E., Davradou, A., Protopapadakis, E., Doulamis, A., Doulamis, N., & Kalogeras, D. (2023). TraCon: A novel dataset for real-time traffic cones detection using deep learning. In Proceedings of the conference (pp. 382–391). https://doi.org/10.1007/978-3-031-17601-2_37

Khanam, R., & Hussain, M. (2024). YOLOv11: An overview of the key architectural enhancements. arXiv, 1-9. http://arxiv.org/abs/2410.17725

Kishor, R. (2024). Performance benchmarking of YOLOv11 variants for real-time delivery vehicle detection: A study on accuracy, speed, and computational trade-offs. Asian Journal of Research in Computer Science, 17(12), 108–122. https://doi.org/10.9734/ajrcos/2024/v17i12532

Li, Z., Wang, L., You, D., & Chen, L. (2025). LDV-YOLO: A lightweight improved YOLOv11 for photovoltaic cell defect detection. Contemporary Mathematics, 6(5), 6259–6274. https://doi.org/10.37256/cm.6520257513

Liang, C.-S., Xu, Z.-Y., Zhou, J.-Y., Yang, C.-M., & Chen, J.-Y. (2023). Automated detection of coffee bean defects using multi-deep learning models. In Proceedings of the 2023 VTS Asia Pacific Wireless Communications Symposium (APWCS) (pp. 1–5). https://doi.org/10.1109/APWCS60142.2023.10234059

Lin, Y., Ma, J., Wang, Q., & Sun, D.-W. (2023). Applications of machine learning techniques for enhancing nondestructive food quality and safety detection. Critical Reviews in Food Science and Nutrition, 63(12), 1649–1669. https://doi.org/10.1080/10408398.2022.2131725

Luis, V.A.M., Quinones, M.V.T., & Yumang, A.N. (2022). Classification of defects in Robusta green coffee beans using YOLO. In Proceedings of the 2022 IEEE International Conference on Artificial Intelligence in Engineering and Technology (IICAIET) (pp. 1–6). https://doi.org/10.1109/IICAIET55139.2022.9936831

Matias, G.C., Borém, F.M., Alves, A.P.C., Haeberlin, L., Santos, C.M.dos, & Andrade, E.T.de. (2025). Impact of initial sensory quality of specialty natural coffee during storage. Anais da Academia Brasileira de Ciências, 97(2). https://doi.org/10.1590/0001-3765202520241042

Murat, A.A., & Kiran, M.S. (2025). A comprehensive review on YOLO versions for object detection. Engineering Science and Technology, an International Journal, 70, 102161. https://doi.org/10.1016/j.jestch.2025.102161

Oncu, E. (2025). Withdrawn: Deep learning framework for coffee quality assessment via YOLOv8n object detection of bean defects. Preprints. https://doi.org/10.20944/preprints202509.0643.v1

Rasheed, A.F., & Zarkoosh, M. (2025). YOLOv11 optimization for efficient resource utilization. ArXiv, 1-14. http://arxiv.org/abs/2412.14790

Samudra, M.N., & Rachmawati, E. (2025). Deep learning-based defect detection in Arabica green coffee beans using LSKNet. In Proceedings of the 2025 International Conference on Data Science and Its Applications (ICoDSA) (pp. 692–697). https://doi.org/10.1109/ICoDSA67155.2025.11157423

Shen, C., Wang, R., Nawazish, H., Wang, B., Cai, K., & Xu, B. (2024). Machine vision combined with deep learning–based approaches for food authentication: An integrative review and new insights. Comprehensive Reviews in Food Science and Food Safety, 23(6), e70054. https://doi.org/10.1111/1541-4337.70054

Thai, H.D., Ko, H.J., & Huh, J.H. (2024). Coffee bean defects automatic classification realtime application adopting deep learning. IEEE Access, 12, 126503–126517. https://doi.org/10.1109/ACCESS.2024.3452552

Wang, P., Tseng, H.-W., Chen, T.-C., & Hsia, C.-H. (2021). Deep convolutional neural network for coffee bean inspection. Sensors and Materials, 33(7), 2299–2310. https://doi.org/10.18494/SAM.2021.3277

Xia, Y., Nguyen, M., & Yan, W.Q. (2023). A real-time kiwifruit detection based on improved YOLOv7. In Lecture Notes in Computer Science (Vol. 13836, pp. 48–61). https://doi.org/10.1007/978-3-031-25825-1_4

Zhao, Q., & Zhu, J. (2025). An improved YOLOv11 architecture with multi-scale attention and spatial fusion for fine-grained residual detection. Results in Engineering, 27, 107061. https://doi.org/10.1016/j.rineng.2025.107061

Cover
Published
2026-06-29
How to Cite
Kurniawan, H., Wardatullatifah S, I. S., Ayu, H., Muttalib, S. A., Sukmawaty, S., Ansar, A., Sabani, R., & Murad, M. (2026). Non-Destructive Detection of Coffee Bean Defects using Machine Vision and the YOLOv11 Algorithm. Jurnal Teknik Pertanian Lampung (Journal of Agricultural Engineering), 15(3), 1164–1179. https://doi.org/10.23960/jtepl.v15i3.1164-1179