Enhancing green coffee quality assessment through deep learning

  • Reinaldo Gonçalves Pereira Neto UFV
  • Pedro Moisés de Sousa UFV
  • Larissa Ferreira Rodrigues Moreira UFV
  • Pedro Ivo Vieira Good God UFV
  • João Fernando Mari UFV


Coffee is the world’s most consumed commodity beverage, vital for the Brazilian market. Assessing coffee bean quality through visual features is essential for market value. However, human-based visual analysis has limitations. Deep neural networks, particularly CNNs, offer a promising solution by automating this process. In this work, we propose an evaluation of deep learning models and training strategies to classify green coffee beans automatically. We evaluate four CNN architectures: AlexNet, ResNet-50, MobileNet V3, and EfficientNet B4. After a hyperparameter optimization step, the models were fine-tuned, and we evaluated the impact of data augmentation strategies on the classification performance through the USK-Coffee dataset. EfficientNet B4 excels, achieving 0.8844 accuracy when trained with data augmentation. Our findings showcase deep learning’s potential for coffee quality assessment, aiding professionals in classifying and guaranteeing coffee quality and value.

Palavras-chave: green coffee, coffee bean, deep learning, classification, data augmentation, optimization


M. García, J. E. Candelo-Becerra, and F. E. Hoyos, “Quality and Defect Inspection of Green Coffee Beans Using a Computer Vision System,” Applied Sciences, vol. 9, no. 19, 2019.

Y. M. Guimarães, J. H. P. P. Eustachio, W. Leal Filho, L. F. Martinez, M. R. do Valle, and A. C. F. Caldana, “Drivers and barriers in sustainable supply chains: The case of the Brazilian coffee industry,” Sustainable Production and Consumption, vol. 34, pp. 42–54, 2022.

E. M. de Oliveira, D. S. Leme, B. H. G. Barbosa, M. P. Rodarte, and R. G. F. A. Pereira, “A computer vision system for coffee beans classification based on computational intelligence techniques,” Journal of Food Engineering, vol. 171, pp. 22–27, Feb 2016.

Y. LeCun, Y. Bengio, and G. Hinton, “Deep learning,” Nature, vol. 521, no. 7553, pp. 436–444, May 2015.

A. Kamilaris and F. X. Prenafeta-Boldú, “Deep learning in agriculture: A survey,” Computers and Electronics in Agriculture, vol. 147, pp. 70–90, 2018.

J. Chai, H. Zeng, A. Li, and E. W. Ngai, “Deep learning in computer vision: A critical review of emerging techniques and application scenarios,” Machine Learning with Applications, vol. 6, p. 100134, 2021.

A. G. Costa, D. A. G. D. Sousa, J. L. Paes, J. P. B. Cunha, and M. V. M. D. Oliveira, “Classification of robusta coffee fruits at different maturation stages using colorimetric characteristics,” Engenharia Agrícola, vol. 40, no. 4, pp. 518–525, Aug. 2020.

S. Pradana-López, A. M. Pérez-Calabuig, J. C. Cancilla, M. Ángel Lozano, C. Rodrigo, M. L. Mena, and J. S. Torrecilla, “Deep transfer learning to verify quality and safety of ground coffee,” Food Control, vol. 122, p. 107801, 2021.

S.-J. Chang and C.-Y. Huang, “Deep Learning Model for the Inspection of Coffee Bean Defects,” Applied Sciences, vol. 11, no. 17, 2021.

P. Wang, H.-W. Tseng, T.-C. Chen, and C.-H. Hsia, “Deep Convolutional Neural Network for Coffee Bean Inspection.” Sensors & Materials, vol. 33, 2021.

M. A. Tamayo-Monsalve, E. Mercado-Ruiz, J. P. Villa-Pulgarin, M. A. Bravo-Ortíz, H. B. Arteaga-Arteaga, A. Mora-Rubio, J. A. Alzate-Grisales, D. Arias-Garzon, V. Romero-Cano, S. Orozco-Arias, G. Gustavo-Osorio, and R. Tabares-Soto, “Coffee Maturity Classification Using Convolutional Neural Networks and Transfer Learning,” IEEE Access, vol. 10, pp. 42 971–42 982, 2022.

A. Febriana, K. Muchtar, R. Dawood, and C.-Y. Lin, “USK-COFFEE Dataset: A Multi-Class Green Arabica Coffee Bean Dataset for Deep Learning,” in 2022 IEEE International Conference on Cybernetics and Computational Intelligence (CyberneticsCom), 2022, pp. 469–473.

E. L. da Rocha, L. Rodrigues, and J. F. Mari, “Maize leaf disease classification using convolutional neural networks and hyperparameter optimization,” in Anais do XVI Workshop de Visão Computacional. Porto Alegre, RS, Brasil: SBC, 2020, pp. 104–110. [Online]. Available: [link].

B. Espejo-Garcia, I. Malounas, N. Mylonas, A. Kasimati, and S. Fountas, “Using EfficientNet and transfer learning for image-based diagnosis of nutrient deficiencies,” Computers and Electronics in Agriculture, vol. 196, p. 106868, 2022.

A. Krizhevsky, I. Sutskever, and G. E. Hinton, “Imagenet classification with deep convolutional neural networks,” Advances in neural information processing systems, vol. 25, 2012.

K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in Proceedings of the IEEE conference on computer vision and pattern recognition, 2016, pp. 770–778.

A. G. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto, and H. Adam, “Mobilenets: Efficient convolutional neural networks for mobile vision applications,” arXiv preprint arXiv:1704.04861, 2017.

M. Sandler, A. G. Howard, M. Zhu, A. Zhmoginov, and L. Chen, “Inverted residuals and linear bottlenecks: Mobile networks for classification, detection and segmentation,” CoRR, vol. abs/1801.04381, 2018. [Online]. Available: [link]

A. Howard, M. Sandler, G. Chu, L. Chen, B. Chen, M. Tan, W. Wang, Y. Zhu, R. Pang, V. Vasudevan, Q. V. Le, and H. Adam, “Searching for mobilenetv3,” CoRR, vol. abs/1905.02244, 2019. [Online]. Available: [link]

M. Tan and Q. Le, “Efficientnet: Rethinking model scaling for convolutional neural networks,” in International conference on machine learning. PMLR, 2019, pp. 6105–6114.

J. Deng, W. Dong, R. Socher, L. L, K. Li, and L. Fei-Fei, “ImageNet: A large-scale hierarchical image database,” in 2009 IEEE Conference on Computer Vision and Pattern Recognition. Miami, FL, USA: IEEE, June 2009, pp. 248–255.
PEREIRA NETO, Reinaldo Gonçalves; SOUSA, Pedro Moisés de; MOREIRA, Larissa Ferreira Rodrigues; GOD, Pedro Ivo Vieira Good; MARI, João Fernando. Enhancing green coffee quality assessment through deep learning. In: WORKSHOP DE VISÃO COMPUTACIONAL (WVC), 18. , 2023, São Bernardo do Campo/SP. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2023 . p. 84-89. DOI: https://doi.org/10.5753/wvc.2023.27537.