Your browser does not support JavaScript!

access icon openaccess Smart agriculture: real-time classification of green coffee beans by using a convolutional neural network

Coffee is an important economic crop and one of the most popular beverages worldwide. The rise of speciality coffees has changed people's standards regarding coffee quality. However, green coffee beans are often mixed with impurities and unpleasant beans. Therefore, this study aimed to solve the problem of time-consuming and labour-intensive manual selection of coffee beans for speciality coffee products. The second objective of the authors’ study was to develop an automatic coffee bean picking system. They first used image processing and data augmentation technologies to deal with the data. They then used deep learning of the convolutional neural network to analyse the image information. Finally, they applied the training model to connect an IP camera for recognition. They successfully divided good and bad beans. The false-positive rate was 0.1007, and the overall coffee bean recognition rate was 93%.


    1. 1)
      • 20. Boughorbel, S., Jarray, F., El-Anbari, M.: ‘Optimal classifier for imbalanced data using Matthews correlation coefficient metric’, PLOS ONE, 2017, 12, p. e0177678.
    2. 2)
      • 13. Arboleda, E.R., Fajardo, A.C., Medina, R.P.: ‘An image processing technique for coffee black beans identification’. 2018 IEEE Int. Conf. on Innovative Research and Development (ICIRD), Bangkok, Thailand, May 2018, pp. 15.
    3. 3)
      • 11. Okubo, N., Kurata, Y.: ‘Nondestructive classification analysis of green coffee beans by using near-infrared spectroscopy’, Foods, 2019, 8, p. 82.
    4. 4)
      • 16. Qin, Y., Sun, S., Ma, X., et al: ‘A background extraction and shadow removal algorithm based on clustering for vibe’. 2014 Int. Conf. on Machine Learning and Cybernetics, Lanzhou, China, July 2014, vol. 1, pp. 5257.
    5. 5)
      • 3. Gavat, I., Militaru, D.: ‘Deep learning in acoustic modeling for automatic speech recognition and understanding – an overview’. 2015 Int. Conf. on Speech Technology and Human-Computer Dialogue (SpeD), Bucharest, Romania, October 2015, pp. 18.
    6. 6)
      • 15. Zhu, S., Xia, X., Zhang, Q., et al: ‘An image segmentation algorithm in image processing based on threshold segmentation’. 2007 Third Int. IEEE Conf. on Signal-Image Technologies and Internet-Based System, Shanghai, China, December 2007, pp. 673678.
    7. 7)
      • 19. Kalman, B.L., Kwasny, S.C.: ‘Why tanh: choosing a sigmoidal function’. [Proc. 1992] IJCNN Int. Joint Conf. on Neural Networks, Beijing, China, June 1992, vol. 4, pp. 578581.
    8. 8)
      • 6. Ker, J., Wang, L., Rao, J., et al: ‘Deep learning applications in medical image analysis’, IEEE Access, 2018, 6, pp. 93759389.
    9. 9)
      • 18. Zaheer, R., Shaziya, H.: ‘GPU-based empirical evaluation of activation functions in convolutional neural networks’. 2018 2nd Int. Conf. on Inventive Systems and Control (ICISC), Coimbatore, India, January 2018, pp. 769773.
    10. 10)
      • 9. Arboleda, E.R., Fajardo, A.C., Medina, R.P.: ‘Classification of coffee bean species using image processing, artificial neural network and k nearest neighbors’. 2018 IEEE Int. Conf. on Innovative Research and Development, Bangkok, Thailand, 2018, pp. 18.
    11. 11)
      • 10. Arboleda, E.R.: ‘Comparing performances of data mining algorithms for classification of green coffee beans’, Int. J. Eng. Adv. Technol., 2019, 8, pp. 15631567.
    12. 12)
      • 8. ‘Specialty Coffee Association of America’. Available at
    13. 13)
      • 14. Tho, T.P., Thinh, N.T., Bich, N.H.: ‘Design and development of the vision sorting system’. 2016 3rd Int. Conf. on Green Technology and Sustainable Development (GTSD), Kaohsiung, Taiwan, November 2016, pp. 217223.
    14. 14)
      • 12. Gunadi, I.G.A., Artha, I.P.M.K., Christyaditama, I.G.P., et al: ‘Detection of coffee bean damage in the roasting process based on shape features analysis’. 2019 Int. Conf. on Mathematics and Natural Sciences, Bali, Indonesia, 2020, vol. 1503.
    15. 15)
      • 7. Kamilaris, A., Prenafeta-Boldú, F.X.: ‘Deep learning in agriculture: a survey’, Comput. Electron. Agric., 2018, 147, pp. 7090.
    16. 16)
      • 4. Young, T., Hazarika, D., Poria, S., et al: ‘Recent trends in deep learning based natural language processing [review article]’, IEEE Comput. Intell. Mag., 2018, 13, pp. 5575.
    17. 17)
      • 21. Chou, D.L.: ‘Real-time classification of green coffee beans by using a CNN’. Available at
    18. 18)
      • 17. Mikołajczyk, A., Grochowski, M.: ‘Data augmentation for improving deep learning in image classification problem’. 2018 Int. Interdisciplinary PhD Workshop (IIPhDW), Swinoujscie, Poland, May 2018, pp. 117122.
    19. 19)
      • 2. Pinto, C., Furukawa, J., Fukai, H., et al: ‘Classification of green coffee bean images based on defect types using convolutional neural network (CNN)’. 2017 Int. Conf. on Advanced Informatics, Concepts, Theory, and Applications (ICAICTA), Bali, Indonesia, August 2017, pp. 15.
    20. 20)
      • 5. Fadlullah, Z.M., Tang, F., Mao, B., et al: ‘State-of-the-art deep learning: evolving machine intelligence toward tomorrow's intelligent network traffic control systems’, IEEE Commun. Surv. Tutorials, 2017, 19, pp. 24322455.
    21. 21)
      • 1. Oder, T.: ‘How coffee changed the world’. Available at

Related content

This is a required field
Please enter a valid email address