Hybrid CNN-Based Classification of Coffee Bean Roasting Levels Using RGB and GLCM Features

Authors

  • Rico Halim School of Computer Science, Bina Nusantara University
  • Mohammad Faisal Riftiarrasyid Bina Nusantara University

DOI:

https://doi.org/10.21512/emacsjournal.v7i3.13420

Keywords:

coffee bean classification, roasting level, RGB features, GLCM texture, hybrid CNN

Abstract

This study aims to develop a hybrid Convolutional Neural Network (CNN) model for classifying the roasting levels of Coffea arabica beans by integrating RGB color and GLCM texture features. A total of 1,600 high-resolution images were used, consisting of 1,200 training images and 400 testing images, evenly distributed across four roasting levels: Green, Light, Medium, and Dark. Local feature extraction was performed using a sliding window approach to capture fine-grained color and texture information from each image. Three model types were evaluated: a CNN with RGB-only input, a CNN with GLCM-only input, and a hybrid CNN with dual inputs. The hybrid model consistently demonstrated superior performance, achieving a validation accuracy of 99.74%, with minimal misclassification and stable convergence throughout training. Furthermore, six architectural variations of the hybrid model were tested by applying dropout and L2 regularization techniques. The model combining both dropout and L2 regularization achieved the most balanced results in terms of accuracy, generalization, and training stability. This research contributes an effective feature fusion strategy for fine-grained visual classification tasks, particularly in domains where inter-class visual differences are subtle. The proposed approach offers a cost-effective and scalable solution that is well-suited for real-time implementation in small to medium-sized coffee production facilities, and it shows strong potential for broader applications in agricultural product quality assessment.

Dimensions

Plum Analytics

Author Biography

Mohammad Faisal Riftiarrasyid, Bina Nusantara University

Computer Science Program, Computer Science Department, School of Computer Science

References

Anhar, A., Rasyid, U. H. A., Muslih, A. M., Baihaqi, A., Romano, & Abubakar, Y. (2021). Sustainable Arabica coffee development strategies in Aceh, Indonesia. IOP Conference Series: Earth and Environmental Science, 667(1), 012106. https://doi.org/10.1088/1755-1315/667/1/012106

Anto, I. A. F., Munandar, A., Wibowo, J. W., Salim, T. I., & Mahendra, O. (2023). Coffee Bean Roasting Levels Detection: A Systematic Review. 2023 IEEE 7th International Conference on Information Technology, Information Systems and Electrical Engineering (ICITISEE), 146–151. https://doi.org/10.1109/ICITISEE58992.2023.10404775

Ashardiono, F., & Trihartono, A. (2024). Optimizing the potential of Indonesian coffee: a dual market approach. Cogent Social Sciences, 10(1). https://doi.org/10.1080/23311886.2024.2340206

Azhar, Y., & Akbi, D. R. (2024). Performance Comparison of GLCM Features and Preprocessing Effect on Batik Image Retrieval. JOIV : International Journal on Informatics Visualization, 8(3), 1339. https://doi.org/10.62527/joiv.8.3.2179

Baqueta, M. R., Coqueiro, A., Março, P. H., Valderrama, P., & Driscoll, S. (2020). Arabica coffee evaluation concerning the degree of roasting: An approach by using smartphone and projection pursuit (D. Kalschne, M. Corso, & R. Dias, Eds.). Nova Science Publishers, Inc.

Castillo, A. M., Aradanas, R. D., Arboleda, E. R., Dizon, A. A., & Dellosa, R. M. (2019). Coffee Type Classification Using Gray Level Co-Occurrence Matrix Feature Extraction And The Artificial Neural Network Classifier. INTERNATIONAL JOURNAL OF SCIENTIFIC & TECHNOLOGY RESEARCH, 8(10). www.ijstr.org

Claire, A., Ardison, I., Josheba, M., Hutagalung, R., Chernando, R., & Cenggoro, T. W. (2022). Observing Pre-Trained Convolutional Neural Network (CNN) Layers as Feature Extractor for Detecting Bias in Image Classification Data. In CommIT Journal (Vol. 16, Issue 2).

Dawwd, S. (2019). GLCM Based Parallel Texture Segmentation using A Multicore Processor. In The International Arab Journal of Information Technology (Vol. 16, Issue 1).

Domingues, L. O. C., Garcia, A. de O., Ferreira, M. M. C., & Morgano, M. A. (2020). Sensory quality prediction of coffee assessed by physicochemical parameters and multivariate model. Coffee Science, 15(1), 1–11. https://doi.org/10.25186/cs.V15I.1654

Freitas, V. V., Borges, L. L. R., Vidigal, M. C. T. R., dos Santos, M. H., & Stringheta, P. C. (2024). Coffee: A comprehensive overview of origin, market, and the quality process. Trends in Food Science & Technology, 146, 104411. https://doi.org/10.1016/j.tifs.2024.104411

Hendrawan, Y., Ramadhan, T. F., Sutan, S. M., Al-Riza, D. F., Damayanti, R., & Hermanto, M. B. (2023). Identification of Arabica coffee roasting levels using Nikon D3100 commercial camera and optimized neural network. 040002. https://doi.org/10.1063/5.0166769

Jinguang, S., Zhipeng, W., & Da, Y. (2009). Research of Image Retrieval Based on Uniting Features. 2009 International Forum on Information Technology and Applications, 603–607. https://doi.org/10.1109/IFITA.2009.318

Krstinić, D., Skelin, A. K., Slapničar, I., & Braović, M. (2024). Multi-Label Confusion Tensor. IEEE Access, 12, 9860–9870. https://doi.org/10.1109/ACCESS.2024.3353050

Kumar, K. S. V., Maheen, A., & Devulapalli, P. K. (2022). Classification of Brain Tumours from The MR Images Using Neural Network and Central Moments. 2022 First International Conference on Artificial Intelligence Trends and Pattern Recognition (ICAITPR), 1–4. https://doi.org/10.1109/ICAITPR51569.2022.9844188

Liu, P., Jia, K., & Wang, Z. (2007). An Effective Image Retrieval Method Based on Color and Texture Combined Features. Third International Conference on Intelligent Information Hiding and Multimedia Signal Processing (IIH-MSP 2007), 169–172. https://doi.org/10.1109/IIH-MSP.2007.79

Marzuki, K., Apriani, & Qulub, M. (2025). Coffee Roaster Maturity Level Classification Based on Convolutional Neural Network. Mathematical Modelling of Engineering Problems, 12(1), 46–54. https://doi.org/10.18280/mmep.120106

Muhlisin, E. I., Nurmalasari, R. R., Kamelia, L., & Sururie, R. W. (2024). Implementation Of Convolutional Neural Network (CNN) in The Android-Based Application for Detecting Coffee Bean Maturity. 2024 10th International Conference on Wireless and Telematics (ICWT), 1–5. https://doi.org/10.1109/ICWT62080.2024.10674676

Nasution, T. H., & Andayani, U. (2017). Recognition of Roasted Coffee Bean Levels using Image Processing and Neural Network. IOP Conference Series: Materials Science and Engineering, 180, 012059. https://doi.org/10.1088/1757-899X/180/1/012059

Ngure, G. M., & Watanabe, K. N. (2024). Coffee sustainability: leveraging collaborative breeding for variety improvement. Frontiers in Sustainable Food Systems, 8. https://doi.org/10.3389/fsufs.2024.1431849

Noel, J., Sarino, C., Bayas, M. M., Arboleda, E. R., Guevarra, E. C., & Dellosa, R. M. (2019). Classification Of Coffee Bean Degree Of Roast Using Image Processing And Neural Network. INTERNATIONAL JOURNAL OF SCIENTIFIC & TECHNOLOGY RESEARCH, 8(10). www.ijstr.org

Nugroho, H., Pramudito, W. A., & Laksono, H. S. (2025). Gray Level Co-Occurrence Matrix (GLCM)-based Feature Extraction for Rice Leaf Diseases Classification. Buletin Ilmiah Sarjana Teknik Elektro, 6(4), 392–400. https://doi.org/10.12928/biste.v6i4.9286

Prabhakar, A., Jena, P., & Pati, U. C. (2024). A New Framework for Brain Tumor Feature Extraction and Classification Using Localized Global Feature Patches. 2024 International Conference on Smart Systems for Applications in Electrical Sciences (ICSSES), 1–6. https://doi.org/10.1109/ICSSES62373.2024.10561327

Pratama, Y., Dirgayussa, I. G. E., Simarmata, P. F., & Tambunan, M. H. (2021). Detection roasting level of Lintong coffee beans by using euclidean distance. Bulletin of Electrical Engineering and Informatics, 10(6), 3072–3082. https://doi.org/10.11591/eei.v10i6.3153

Qur, A., Harsani, P., Ayu Wulandhari, L., & Agung Santoso Gunawan, A. (2020). Color Extraction and Edge Detection of Nutrient Deficiencies in Cucumber Leaves Using Artificial Neural Networks. In Communication & Information Technology) Journal (Vol. 14, Issue 1).

Samper, L., & Quiñones-Ruiz, X. (2017). Towards a Balanced Sustainability Vision for the Coffee Industry. Resources, 6(2), 17. https://doi.org/10.3390/resources6020017

Sutarmin, Mukroji, Rastuti, U., Yunanto, A., Suliyanto, & Jatmiko, D. P. (2022). Increasing the Additional Value of Coffee Cultivation Results in Brebes Regency with a Value Chain Analysis Approach. Quality - Access to Success, 23(188). https://doi.org/10.47750/QAS/23.188.13

Tang, D., Yang, N., Deng, Y., Zhang, Y., Sani, A. S., & Yuan, D. (2025). Stability-Driven CNN Training with Lyapunov-Based Dynamic Learning Rate (pp. 58–70). https://doi.org/10.1007/978-981-96-1242-0_5

Wei, F., & Tanokura, M. (2015). Chemical Changes in the Components of Coffee Beans during Roasting. In Coffee in Health and Disease Prevention (pp. 83–91). Elsevier. https://doi.org/10.1016/B978-0-12-409517-5.00010-3

Yuzhan, M., Abdullah Jalab, H., Hassan, W., Fan, D., & Minjin, M. (2020). Recaptured Image Forensics Based on Image Illumination and Texture Features. 2020 The 4th International Conference on Video and Image Processing, 93–97. https://doi.org/10.1145/3447450.3447465

Downloads

Published

2025-09-29

How to Cite

Halim, R., & Riftiarrasyid, M. F. (2025). Hybrid CNN-Based Classification of Coffee Bean Roasting Levels Using RGB and GLCM Features. Engineering, MAthematics and Computer Science Journal (EMACS), 7(3), 249–261. https://doi.org/10.21512/emacsjournal.v7i3.13420
Abstract 5  .
PDF downloaded 3  .