Klasifikasi Kualitas Biji Kopi Secara Otomatis Berbasis Citra Visual Menggunakan Convolutional Neural Network (CNN)


  • Raihan Rifandi * Mail Universitas Pasir Pengaraian, Rokan Hulu, Indonesia
  • Erni Rouza Universitas Pasir Pengaraian, Rokan Hulu, Indonesia
  • Al - Khawarizmi Universitas Pasir Pengaraian, Rokan Hulu, Indonesia
  • Alzianda Putra Desmara Universitas Pasir Pengaraian, Rokan Hulu, Indonesia
  • Muhammad Noersyal Universitas Pasir Pengaraian, Rokan Hulu, Indonesia
  • Muhammad Ikhsan Alfajri Universitas Pasir Pengaraian, Rokan Hulu, Indonesia
  • (*) Corresponding Author
Keywords: Coffee Beans; Image Classification; Convolutional Neural Network; Deep Learning; Computer Vision

Abstract

Coffee bean quality is a crucial factor that determines the commercial value and overall quality of coffee products. In practice, coffee bean quality assessment is still largely performed manually through visual inspection, which may lead to subjectivity and inconsistent results. Therefore, this study aims to apply a Convolutional Neural Network (CNN) method to automatically classify coffee bean quality based on visual images. This study employs a quantitative approach using a computational experimental method. The dataset consists of 90 coffee bean images categorized into three quality classes, namely good, medium, and poor, with 30 images in each class. All images undergo preprocessing stages, including image resizing to 150 × 150 pixels, pixel value normalization, and data augmentation. The CNN model is developed using the TensorFlow and Keras frameworks on the Google Colab platform and trained using the Adam optimizer and categorical crossentropy loss function with an optimal number of 20 epochs. The results show that the CNN model is able to learn basic visual patterns of coffee beans progressively, as indicated by an increase in accuracy and a decrease in loss values during the training process. However, evaluation using a confusion matrix reveals that the model still faces difficulties in distinguishing between quality classes with similar visual characteristics, particularly between the good, medium, and poor categories. Nevertheless, this study demonstrates that CNN has strong potential as an initial approach for developing an automated system to support objective and consistent coffee bean quality classification.

References

R. Paterek, S. Geoghegan, B. S. Creaven, and A. Power, “Coffee: Lighting Its Complex Ground Truth and Percolating Its Molecular Brew,” Beverages, vol. 10, no. 4, p. 119, Dec. 2024, doi: 10.3390/beverages10040119.

D. W. Lachenmeier et al., “Shaping the Future of Coffee: Climate Resilience, Liberica’s Rise, and By-Product Innovation—Highlights from the International Coffee Convention 2023 (ICC2023),” Foods, vol. 13, no. 6, p. 832, Mar. 2024, doi: 10.3390/foods13060832.

M. A. Valles-Coral, C. I. Bernales-del-Aguila, E. Benavides-Cuvas, and L. Cabanillas-Pardo, “Effectiveness of a cherry coffee sorter prototype with image recognition using machine learning,” Rev. Bras. Ciênc. Agrár. - Braz. J. Agric. Sci., vol. 18, no. 1, pp. 1–7, Mar. 2023, doi: 10.5039/agraria.v18i1a2586.

A. Fadjeri, “Klasifikasi Biji Kopi Berdasarkan Bentuk Menggunakan Image Processing dan K-NN,” J. Ilm. SINUS, vol. 21, no. 2, p. 55, July 2023, doi: 10.30646/sinus.v21i2.726.

K. Yu et al., “Advances in Computer Vision and Spectroscopy Techniques for Non-Destructive Quality Assessment of Citrus Fruits: A Comprehensive Review,” Foods, vol. 14, no. 3, p. 386, Jan. 2025, doi: 10.3390/foods14030386.

A. Hayat, F. Morgado-Dias, T. Choudhury, T. P. Singh, and K. Kotecha, “FruitVision: A deep learning based automatic fruit grading system,” Open Agric., vol. 9, no. 1, p. 20220276, May 2024, doi: 10.1515/opag-2022-0276.

A. Lavanya, M. Arakeri, and B. J. Ambika, “Advancements in Coffee Bean Quality Assessment Using Computer Vision and Deep Learning Techniques,” in 2025 International Conference on Next Generation Communication & Information Processing (INCIP), Bangalore, India: IEEE, Jan. 2025, pp. 758–763. doi: 10.1109/INCIP64058.2025.11019029.

N. O. Adiwijaya, H. I. Romadhon, J. A. Putra, and D. P. Kuswanto, “The quality of coffee bean classification system based on color by using k-nearest neighbor method,” J. Phys. Conf. Ser., vol. 2157, no. 1, p. 012034, Jan. 2022, doi: 10.1088/1742-6596/2157/1/012034.

C. B, R. S, and S. R, “Upgrading Coffee Bean Quality Using K-nearest Algorithm over Future Selection and Extraction to Reduce Dimensionality of Data,” in 2024 8th International Conference on I-SMAC (IoT in Social, Mobile, Analytics and Cloud) (I-SMAC), Kirtipur, Nepal: IEEE, Oct. 2024, pp. 938–943. doi: 10.1109/I-SMAC61858.2024.10714790.

M. Wu, J. Zhou, Y. Peng, S. Wang, and Y. Zhang, “Deep Learning for Image Classification: A Review,” in Proceedings of 2023 International Conference on Medical Imaging and Computer-Aided Diagnosis (MICAD 2023), vol. 1166, R. Su, Y.-D. Zhang, and A. F. Frangi, Eds., in Lecture Notes in Electrical Engineering, vol. 1166. , Singapore: Springer Nature Singapore, 2024, pp. 352–362. doi: 10.1007/978-981-97-1335-6_31.

A. C. S, “Advancements in CNN Architectures for Computer Vision: A Comprehensive Review,” in 2023 Annual International Conference on Emerging Research Areas: International Conference on Intelligent Systems (AICERA/ICIS), Kanjirapally, India: IEEE, Nov. 2023, pp. 1–7. doi: 10.1109/AICERA/ICIS59538.2023.10420413.

I. D. Mienye, T. G. Swart, G. Obaido, M. Jordan, and P. Ilono, “Deep Convolutional Neural Networks: A Comprehensive Review,” Aug. 19, 2024, Computer Science and Mathematics. doi: 10.20944/preprints202408.1288.v1.

K. S, V. T, A. S, G. D J, A. K, and S. Madhumitha, “Comparative Analysis of CNN-based Feature Extraction Techniques and Conventional Machine Learning Models for Quality Assessment in Agricultural Produce,” SSRN Electron. J., 2025, doi: 10.2139/ssrn.5089073.

M. K. Goel and G. Singh, “Optimizing Vegetable Classification with Convolutional Neural Networks Model,” in 2024 Second International Conference on Intelligent Cyber Physical Systems and Internet of Things (ICoICI), Coimbatore, India: IEEE, Aug. 2024, pp. 1171–1175. doi: 10.1109/ICoICI62503.2024.10696858.

S. Arwatchananukul, D. Xu, P. Charoenkwan, S. Aung Moon, and R. Saengrayap, “Implementing a deep learning model for defect classification in Thai Arabica green coffee beans,” Smart Agric. Technol., vol. 9, p. 100680, Dec. 2024, doi: 10.1016/j.atech.2024.100680.

K. Przybył et al., “Application of Machine Learning to Assess the Quality of Food Products—Case Study: Coffee Bean,” Appl. Sci., vol. 13, no. 19, p. 10786, Sept. 2023, doi: 10.3390/app131910786.

Y. K. Molla and E. A. Mitiku, “CNN-HOG based hybrid feature mining for classification of coffee bean varieties using image processing,” Multimed. Tools Appl., vol. 84, no. 2, pp. 749–764, Apr. 2024, doi: 10.1007/s11042-024-18952-z.

R. E. G. Rivas, P. L. L. Bertarini, and H. Fernandes, “Automated Coffee Roast Level Classification Using Machine Learning and Deep Learning Models,” J. Food Sci., vol. 90, no. 9, p. e70532, Sept. 2025, doi: 10.1111/1750-3841.70532.

S. Muhammad Syadham and M. Akbar, “Klasifikasi Citra Biji Kopi Temanggung Menggunakan Gray Level Co-Ocurrence Matrix – Convolutional Neural Network,” J. Inform. Dan Tek. Elektro Terap., vol. 13, no. 3, July 2025, doi: 10.23960/jitet.v13i3.7274.

G. Miranda and C. Rubio-Manzano, “Image Classification Using Deep and Classical Machine Learning on Small Datasets: A Complete Comparative,” Jan. 25, 2022, Mathematics & Computer Science. doi: 10.20944/preprints202201.0367.v1.

Y. Yang, “Fruit Image Classification Using Convolution Neural Networks,” Highlights Sci. Eng. Technol., vol. 34, pp. 110–119, Feb. 2023, doi: 10.54097/hset.v34i.5430.

F. O. A. Hashim et al., “Comparative analysis of deep learning models for post-roasting coffee bean classification,” Edelweiss Appl. Sci. Technol., vol. 9, no. 8, pp. 624–640, Aug. 2025, doi: 10.55214/2576-8484.v9i8.9393.

G. Cai, “Advanced Image Classification Using Convolutional Neural Networks,” Sci. Technol. Eng. Chem. Environ. Prot., vol. 1, no. 9, Oct. 2024, doi: 10.61173/117trk02.

Q. Xu, L. Zhu, X. Cheng, and B. Jiang, “Beyond Frequency: Seeing Subtle Cues Through the Lens of Spatial Decomposition for Fine-Grained Visual Classification,” 2025, arXiv. doi: 10.48550/ARXIV.2508.06959.


Bila bermanfaat silahkan share artikel ini

Berikan Komentar Anda terhadap artikel Klasifikasi Kualitas Biji Kopi Secara Otomatis Berbasis Citra Visual Menggunakan Convolutional Neural Network (CNN)

Dimensions Badge
Article History
Submitted: 2025-12-27
Published: 2026-04-22
Abstract View: 34 times
pdf Download: 15 times
Issue
Section
Articles