Coffee is the most widely traded and popular beverage globally, and its flavor and quality depend significantly on the absence of defective beans. This study aimed to automate the identification and classification of impurities in green coffee beans, enabling more uniform roasting, as peaberries roast differently due to their unique shape. The automated system enhances efficiency and precision over manual checks, using 4367 green coffee bean images from Bangladesh, divided into six categories: black, sour, fade, broken, normal, and peaberry. The main contribution of this study is providing the first Bangladesh-origin dataset for coffee bean defect detection, paired with recent YOLOv10-N advances tailored to small, subtle defects. The study took an innovative step forward for Bangladesh's coffee sector, which has traditionally relied on labor-intensive and error-prone manual sorting methods. This approach addresses key inefficiencies and enhances quality control, boosting global market competitiveness. This study shows that Bangladesh's coffee industry can benefit from using YOLOv10-N to detect defects in green coffee beans, providing a cost-effective and accurate quality control system. We evaluated the following models: Efficient-Net, ResNet-50, Faster R-CNN, and several versions of YOLO (v3-v10). Among them, YOLOv10-N was identified as the most successful model, with the highest precision of 0.992, recall of 0.984, F1-scoreof 0.987, and mean average precision (mAP) of 0.995; YOLOv8 had precision of 0.959 and recall of 0.944, and ResNet-50 had precision of 0.837 and recall of 0.853. The model's accuracy and resilience can be further improved by creating a larger and more diverse dataset, which will enable it to better detect subtle differences in defects across batches of green coffee beans under varying environmental conditions.
Citation: Hira Lal Gope, Ashutus Singha, Fahim Mahafuz Ruhad, Md Mahin Erpan Chowdhury, Chandra Kanta Dash, Md Masum Billah, Md Mehedi Hasan, Shohag Barman, Hidekazu Fukai. Automated defective green coffee bean image classification using deep learning for quality enhancement and market competitiveness[J]. AIMS Agriculture and Food, 2025, 10(4): 962-983. doi: 10.3934/agrfood.2025050
Coffee is the most widely traded and popular beverage globally, and its flavor and quality depend significantly on the absence of defective beans. This study aimed to automate the identification and classification of impurities in green coffee beans, enabling more uniform roasting, as peaberries roast differently due to their unique shape. The automated system enhances efficiency and precision over manual checks, using 4367 green coffee bean images from Bangladesh, divided into six categories: black, sour, fade, broken, normal, and peaberry. The main contribution of this study is providing the first Bangladesh-origin dataset for coffee bean defect detection, paired with recent YOLOv10-N advances tailored to small, subtle defects. The study took an innovative step forward for Bangladesh's coffee sector, which has traditionally relied on labor-intensive and error-prone manual sorting methods. This approach addresses key inefficiencies and enhances quality control, boosting global market competitiveness. This study shows that Bangladesh's coffee industry can benefit from using YOLOv10-N to detect defects in green coffee beans, providing a cost-effective and accurate quality control system. We evaluated the following models: Efficient-Net, ResNet-50, Faster R-CNN, and several versions of YOLO (v3-v10). Among them, YOLOv10-N was identified as the most successful model, with the highest precision of 0.992, recall of 0.984, F1-scoreof 0.987, and mean average precision (mAP) of 0.995; YOLOv8 had precision of 0.959 and recall of 0.944, and ResNet-50 had precision of 0.837 and recall of 0.853. The model's accuracy and resilience can be further improved by creating a larger and more diverse dataset, which will enable it to better detect subtle differences in defects across batches of green coffee beans under varying environmental conditions.
| [1] |
Giacalone D, Degn TK, Yang N, et al. (2019) Common roasting defects in coffee: Aroma composition, sensory characterization and consumer perception. Food Qual Prefer 71: 463–474. https://doi.org/10.1016/j.foodqual.2018.03.009 doi: 10.1016/j.foodqual.2018.03.009
|
| [2] |
García M, Candelo-becerra JE, Hoyos FE (2019) Quality and defect inspection of green coffee beans using a computer vision system. Appl Sci 9: 4195. https://doi.org/10.3390/app9194195 doi: 10.3390/app9194195
|
| [3] |
Duarte SMdaS, de Abreu CMP, de Menezes HC, et al. (2005) Effect of processing and roasting on the antioxidant activity of coffee brews. Ciênc Tecnol Aliment, Campinas 25: 387–393. https://doi.org/10.1590/s0101-20612005000200035 doi: 10.1590/s0101-20612005000200035
|
| [4] |
Bhumiratana N, Adhikari K, Chambers E (2011) Evolution of sensory aroma attributes from coffee beans to brewed coffee. LWT-Food Sci Technol 44: 2185–2192. https://doi.org/10.1016/j.lwt.2011.07.001 doi: 10.1016/j.lwt.2011.07.001
|
| [5] |
Suhandy D, Yulia M (2017) Peaberry coffee discrimination using UV-visible spectroscopy combined with SIMCA and PLS-DA. Int J Food Prop 20: S331–S339. https://doi.org/10.1080/10942912.2017.1296861 doi: 10.1080/10942912.2017.1296861
|
| [6] |
Kim MS, Min HG, Koo N, et al. (2014) The effectiveness of spent coffee grounds and its biochar on the amelioration of heavy metals-contaminated water and soil using chemical and biological assessments. J Environ Manage 146: 124–130. https://doi.org/10.1016/j.jenvman.2014.07.001 doi: 10.1016/j.jenvman.2014.07.001
|
| [7] |
Rossmann M, Matos AT, Abreu EC, et al. (2013) Effect of influent aeration on removal of organic matter from coffee processing wastewater in constructed wetlands. J Environ Manage 128: 912–919. https://doi.org/10.1016/j.jenvman.2013.06.045 doi: 10.1016/j.jenvman.2013.06.045
|
| [8] | Nath Subedi R (2011) Comparative analysis of dry and wet processing of coffee with respect to quality and cost in Kavre District, Nepal: A case of Panchkhal Village. Int Res J Appl Basic Sci 2: 181–193. |
| [9] | H Naito et al 2022 IOP Conf. Ser. : Earth Environ. Sci. 1024 012063. Discrimination Between Normal Coffee Beans and Peaberries Using Excitation-Emission Matrix Measured by A Hand-Held Optical System. DOI 10.1088/1755-1315/1024/1/012063. |
| [10] |
Huang KY, Tu YT (2017) Development of novel autoclassifying system based on machine vision. Sens Mater 29: 1599–1605. https://doi.org/10.18494/SAM.2017.1708 doi: 10.18494/SAM.2017.1708
|
| [11] | Peaberry seed (2020) available from: https://coffeebrat.com/peaberry-coffee/. |
| [12] | Peaberry and regular coffee bean information is available (2020): https://ozonecoffee.co.uk/blogs/coffee-processing-explained/what-is-a-peaberry. |
| [13] |
Severa L, Buchar J, Nedomová Š (2012) Shape and size variability of roasted Arabica coffee beans. Int J Food Prop 15: 426–437. https://doi.org/10.1080/10942912.2010.487967 doi: 10.1080/10942912.2010.487967
|
| [14] | Wintgens JN (Ed.) (2009) Coffee: Growing, processing, sustainable production: A guidebook for growers, processors, traders, and researchers. Wiley-VCH. |
| [15] |
Rangarajan AK, Purushothaman R, Ramesh A (2018) Tomato crop disease classification using pre-trained deep learning algorithm. Procedia Comput Sci 133 1040–1047. https://doi.org/10.1016/j.procs.2018.07.070 doi: 10.1016/j.procs.2018.07.070
|
| [16] |
Jahanbakhshi A, Kheiralipour K (2020) Evaluation of image processing technique and discriminant analysis methods in postharvest processing of carrot fruit. Food Sci Nutr 8: 3346–3352. https://doi.org/10.1002/fsn3.1614 doi: 10.1002/fsn3.1614
|
| [17] |
Peña JM, Gutiérrez PA, Hervás-Martínez C, et al. (2014) Object-based image classification of summer crops with machine learning methods. Remote Sens 6: 5019–5041. https://doi.org/10.3390/rs6065019 doi: 10.3390/rs6065019
|
| [18] |
Yan B, Fan P, Lei X, et al. (2021) A real-time apple targets detection method for picking robot based on improved YOLOv5. Remote Sens 13: 1619. https://doi.org/10.3390/rs13091619 doi: 10.3390/rs13091619
|
| [19] | Kuznetsova A, Maleva T, Soloviev V (2020) Detecting apples in orchards using YOLOv3 and YOLOv5 in general and close-up images. In: Han M, Qin S, Zhang N (Eds.), Advances in Neural Networks—ISNN 2020, Springer, Cham., 233–243. https://doi.org/10.1007/978-3-030-64221-1_20 |
| [20] | Cengil E, Cinar A (2021) Poisonous mushroom detection using YOLOV5. Turkish J Sci Technol 16: 119–127. |
| [21] | Shukla R, Mahapatra AK, Peter JSP (2021) Social distancing tracker using YOLOV5. Turkish J Physiother Rehabil 32: 1785–1793. |
| [22] | Yang G, Feng W, Jin J, et al. (2021) Face mask recognition system with YOLOV5 based on image recognition. IEEE 6th International Conference on Computer and Communications (ICCC), Chengdu, China, 1398–1404. https://doi.org/10.1109/ICCC51575.2020.9345042 |
| [23] |
Gope HL, Fukai H, Ruhad FM, et al. (2024) Comparative analysis of YOLO models for green coffee bean detection and defect classification. Sci Rep 14: 28946. https://doi.org/10.1038/s41598-024-78598-7 doi: 10.1038/s41598-024-78598-7
|
| [24] |
Soeb MJA, Jubayer MF, Tarin TA, et al. (2023) Tea leaf disease detection and identification based on YOLOv7 (YOLO-T). Sci Rep 13: 6078. https://doi.org/10.1038/s41598-023-33270-4 doi: 10.1038/s41598-023-33270-4
|
| [25] |
Purwawangsa H, Irfany MI, Haq DA (2024) Indonesian coffee exports' competitiveness and determinants. Jurnal Manajemen Dan Agribisnis 21: 59. https://doi.org/10.17358/jma.21.1.59 doi: 10.17358/jma.21.1.59
|
| [26] | Gope HL, Fukai H (2020) Normal and peaberry coffee beans classification from green coffee bean images using convolutional neural networks and support vector machine. Int J Comput Inf Eng 14: 189–196. |
| [27] |
Gope HP, Fukai H (2022) Peaberry and normal coffee bean classification using CNN, SVM, and KNN: Their implementation in and the limitations of Raspberry Pi 3. AIMS Agric Food 7: 149–167. https://doi.org/10.3934/agrfood.2022010 doi: 10.3934/agrfood.2022010
|
| [28] | Gope HL, Fukai H, Aoki R (2022) Multi-label classification of defective green coffee bean images using EfficientNet deep learning model. Trans Asian J Sci Technol 5: 164–175. |
| [29] |
Chang SJ, Liu KH (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 doi: 10.1109/ACCESS.2024.3356596
|
| [30] |
Thai HD, Ko HJ, Huh JH (2024) Coffee bean defects automatic classification realtime application adopting deep learning. IEEE Access 12: 126503–126517. https://doi.org/10.1109/ACCESS.2024.3452552 doi: 10.1109/ACCESS.2024.3452552
|
| [31] |
Liu J, Wang X (2020) Tomato diseases and pests detection based on improved Yolo V3 convolutional neural network. Front Plant Sci 11: 898. https://doi.org/10.3389/fpls.2020.00898 doi: 10.3389/fpls.2020.00898
|
| [32] |
Qi J, Liu X, Liu K, et al. (2022) An improved YOLOv5 model based on visual attention mechanism: Application to recognition of tomato virus disease. Comput Electron Agric 194: 106780. https://doi.org/10.1016/j.compag.2022.106780 doi: 10.1016/j.compag.2022.106780
|
| [33] |
Gulzar Y, Ünal Z (2025) Time-sensitive bruise detection in plums using PlmNet with transfer learning. Procedia Comput Sci 257: 127–132. https://doi.org/10.1016/j.procs.2025.03.019 doi: 10.1016/j.procs.2025.03.019
|
| [34] |
Gulzar Y, Ünal Z, Kızıldeniz T, et al. (2024) Deep learning-based classification of alfalfa varieties: A comparative study using a custom leaf image dataset. MethodsX 13: 103051. https://doi.org/10.1016/j.mex.2024.103051 doi: 10.1016/j.mex.2024.103051
|
| [35] |
Seelwal P, Dhiman P, Gulzar Y, et al. (2024) A systematic review of deep learning applications for rice disease diagnosis: current trends and future directions. Fron Comput Sci 6: 1452961. https://doi.org/10.3389/fcomp.2024.1452961 doi: 10.3389/fcomp.2024.1452961
|
| [36] | Fukai H, Furukawa J, Pinto C, et al. (2018) Classification of green coffee beans by convolutional neural network and its implementation on raspberry Pi and camera module. Timorese Acad J Sci Technol 1: 1–10. |
| [37] | Pinto C, Furukawa J, Fukai H, et al. (2017) Classification of Green coffee bean images base on defect types using convolutional neural network (CNN). 2017 International Conference on Advanced Informatics, Concepts, Theory, and Applications (ICAICTA), Denpasar, Indonesia, 1–5. https://doi.org/10.1109/ICAICTA.2017.8090980 |
| [38] | Types of green coffee bean information (2019) Available from: http://www.zecuppa.com/coffeeterms-bean-defects.htm. |
| [39] | YOLOv10 model (2024) Available from: https://docs.ultralytics.com/models/yolov10/. |
| [40] |
Fang Y, Guo X, Chen K, et al. (2021) Accurate and automated detection of surface knots on sawn timbers using YOLO-V5 model. BioResources 16: 5390–5406. https://doi.org/10.15376/biores.16.3.5390-5406 doi: 10.15376/biores.16.3.5390-5406
|
| [41] | A technical comparison (2025) Available from: https://docs.ultralytics.com/compare/yolov10-vs-yolov9/. |
| [42] |
Li Li-Hua, Radius Tanone (2024) Lightweight model based on improved YOLOv7 tiny for potato leaf diseases detection. Int J Appl Sci Eng 21: 2. https://doi.org/10.6703/IJASE.202406_21(2).010 doi: 10.6703/IJASE.202406_21(2).010
|
| [43] | Liang CS, Xu ZY, Zhou JY, et al. (2023) Automated detection of coffee bean defects using multi-deep learning models. In: 2023 VTS Asia Pacific Wireless Communications Symposium (APWCS), Tainan city, 1–5. https://doi.org/10.1109/APWCS60142.2023.10234059 |
| [44] |
Hassan E (2024) Enhancing coffee bean classification: A comparative analysis of pre-trained deep learning models. Neural Comput Appl 36: 9023–9052. https://doi.org/10.1007/s00521-024-09623-z doi: 10.1007/s00521-024-09623-z
|
| [45] |
Ji Y, Xu J, Yan B (2024) Coffee green bean defect detection method based on an improved YOLOv8 model. J Food Proc Preserv 2024: 2864052. https://doi.org/10.1155/2024/2864052 doi: 10.1155/2024/2864052
|
| [46] |
Chang SJ, Huang CY (2021) Deep learning model for the inspection of coffee bean defects. Appl Sci 11: 8226. https://doi.org/10.3390/app11178226 doi: 10.3390/app11178226
|