Quality assessment of coffee beans through computer vision and machine learning algorithms

Authors

DOI:

https://doi.org/10.25186/.v15i.1752

Abstract

The increasing market interest in coffee beverage, lead coffee growers around the world to adopt more efficient methods to select the best-quality coffee beans. Currently, coffee beans selection is carried out either manually, which is a costly and unreliable process, or using electronic sorting machines, which are often inefficient because some coffee beans defects, such as sour and immature beans, have similar spectral response patterns. In this sense, the present work aimed to assess coffee beans quality using both computer vision and machine learning techniques, such as Support Vector Machine (SVM), Deep Neural Network (DNN) and Random Forest (RF). For this purpose, an algorithm written in Python language was developed to extract shape and color features from coffee beans images. The obtained dataset was then used as input to the machine learning algorithms. The data reported in this study pointed to the importance of color descriptors for classifying coffee beans defects. Among the variables used, the components from RGB (Red, Green and Blue) and HSV (Hue, Saturation and Value) color spaces presented the most relevant contribution for the classification models. Also, the results reported in this study provides evidence that computer vision along with machine learning algorithms can be used to identify and classify coffee beans with a very high accuracy (> 90%).

Key words: Deep neural network; classification; artificial intelligence; image processing; granulometry.

References

ABADI, M. et al. TensorFlow: Large-scale machine learning on heterogeneous systems: 1-15, 2015.

ANAMI, B. S.; NAVEEN, N. M.; HANAMARATTI, N. G. Behavior of HSI Color Co-Occurrence Features in Variety Recognition from Bulk Paddy Grain Image Samples. International Journal of Signal Processing, Image Processing and Pattern Recognition, 8(4):19-30, 2015.

BARBOSA, J. N. et al. Coffee Quality and Its Interactions with Environmental Factors in Minas Gerais, Brazil. Journal of Agricultural Science, 4(5):1-10, 2012.

BELGIU, M.; DRĂGU, L. Random forest in remote sensing: A review of applications and future directions. ISPRS Journal of Photogrammetry and Remote Sensing, 114:24-31, 2016.

CLARKE, R. J.; MACRAE, R. Coffee: Technology (Vol. 2). [s.l.] Elsevier, p. 328, 1987.

CORTEZ, P. Rminer: Data Mining Classification and Regression Methods: p. 78, 2020.

CRAIG, A. P.; FRANCA, A. S.; OLIVEIRA, L. S. Evaluation of the potential of FTIR and chemometrics for separation between defective and non-defective coffees. Food Chemistry, 132(3):1368-1374, 2012.

FARAH, A. et al. Correlation between cup quality and chemical attributes of Brazilian coffee. Food Chemistry, 98(2):373-380, 2006.

FARIDAH; PARIKESIT, G. O. F.; FERDIANSJAH. Coffee bean grade determination based on image parameter. Telkomnika, 9(3):547-554, 2011.

FRANCA, A. S. et al. Physical and chemical attributes of defective crude and roasted coffee beans. Food Chemistry, 90(1-2):89-94, 2005.

FRANCA, A. S.; OLIVEIRA, L. S. Chemistry of defective coffee beans. Food Chemistry Research Developments. Nova Science Publishers, New York, v. 34, p.106-138, 2008.

FUKAI, H. et al. Classification of Green Coffee Beans by Convolutional Neural Network and its Implementation on Raspberry Pi and Camera Module. Timorese Academic Journal of Science and Technology, 1:1-10, 2018.

GARCÍA, M.; CANDELO-BECERRA, J. E.; HOYO, F. E. Quality and Defect Inspection of Green Coffee Beans Using a Computer Vision System. Applied Sciences, 9(19):e4195, 2019.

ICO. National Quality Standards. London, UK: [s.n.], p.35, 2018. Available in: <http://www.ico.org/documents/cy2017-18/icc-122-12e-national-quality-standards.pdf>.

ICO. Total crop year production by exporting countries. London, UK: [s.n.], p.3, 2020. Available in: <http://www.ico.org/trade_statistics.asp?section=Statistics>.

KAUR, H.; SINGH, B. Classification and Grading Rice Using Multi-Class SVM. International Journal of Scientific and Research Publications, 3(4):1-5, 2013.

KONG, W. et al. Rice seed cultivar identification using near-infrared hyperspectral imaging and multivariate data analysis. Sensors (Basel, Switzerland), 13(7):8916-8927, 2013.

KUHN, M.; JOHNSON, K. Applied Predictive Modeling with Applications in R. [s.l.] Springer International Publishing, 2013. 600p.

LÄDERACH, P. et al. Systematic agronomic farm management for improved coffee quality. Field Crops Research, 120(3): 321-329 2011.

LANDIS, J. R.; KOCH, G. G. The Measurement of Observer Agreement for Categorical Data. Biometrics, 33(1):159-174, 1977.

LIAW, A.; WIENER, M. Classification and Regression by randomForest. R News, 2(3):18-22, 2002.

MANDAL, D. Adaptive Neuro-Fuzzy Inference System Based Grading of Basmati Rice Grains Using Image Processing Technique. Applied System Innovation, 1(2):19, 2018.

MARINI, F.; ZUPAN, J.; MAGRÌ, A. L. On the use of counterpropagation artificial neural networks to characterize Italian rice varieties. Analytica Chimica Acta, 510(2):231-240, 2004.

MEYER, D. et al. Package “e1071”: p. 63, 2019. Available in: <https://cran.rproject.org/web/packages/e1071/index.html>.

MOLLAZADE, K.; OMID, M.; AREFI, A. Comparing data mining classifiers for grading raisins based on visual features. Computers and Electronics in Agriculture, 84:124-131, 2012.

OLGUN, M. et al. Wheat grain classification by using dense SIFT features with SVM classifier. Computers and Electronics in Agriculture, 122:185-190, 2016.

OLIVEIRA, E. M. et al. A computer vision system for coffee beans classification based on computational intelligence techniques. Journal of Food Engineering, 171:22-27, 2016.

ORDUKAYA, E.; KARLIK, B. Quality Control of Olive Oils Using Machine Learning and Electronic Nose. Journal of Food Quality, 2017:7, 2017.

PATIL, N. K.; MALEMATH, V. S.; YADAHALLI, R. M. Color and Texture Based Identification and Classification of food Grains using different Color Models and Haralick features. International Journal on Computer Science and Engineering, 3(12):3669-3680, 2011.

PEDRINI, H.; SCHWARTZ, W. R. Análise de imagens digitais: Princípios, algoritmos e apli-cações. [s.l.] Thomson Learning: p.528, 2008.

R CORE TEAM. R: A Language and Environment for Statistical Computing. Viena, Austria, 2019. Available in: < https://www.r-project.org/index.html>.

RAMALAKSHMI, K. et al. Bioactivities of low-grade green coffee and spent coffee in different in vitro model systems. Food Chemistry, 115(1):79-85, 2009.

SANTOS, F. F. L. et al. Open source iterative bayesian classifier algorithm for quality assessment of processed coffee beans. Nativa, 8(1):118-123, 2020.

SILVA, S. DE A. et al. Coffee quality and its relationship with Brix degree and colorimetric information of coffee cherries. Precision Agriculture, 15:543-554 2014.

SILVEIRA, A. S. de. et al. Sensory analysis of specialty coffee from different environmental conditions in the region of matas de minas, minas gerais, Brazil. Revista Ceres, 63(4):1-8, 2016.

SMRKE, S. et al. Differentiation of degrees of ripeness of Catuai and Tipica green coffee by chromatographical and statistical techniques. Food Chemistry, 174:637-642, 2015.

TOCI, A. T.; FARAH, A. Volatile compounds as potential defective coffee beans’ markers. Food Chemistry, 108(3):1133-1141, 2008.

ZAREIFOROUSH, H. et al. Qualitative classification of milled rice grains using computer vision and metaheuristic techniques. Journal of Food Science and Technology, 53(1):118-131, 2016.

Published

2020-08-19

How to Cite

SANTOS, F.; ROSAS, J.; MARTINS, R.; ARAÚJO, G.; VIANA, L.; GONÇALVES, J. Quality assessment of coffee beans through computer vision and machine learning algorithms. Coffee Science - ISSN 1984-3909, v. 15, p. e151752, 19 Aug. 2020.