Multi-Class Real-Time Color Classification of Coffee Beans via Fine-Tuned EfficientNetB0 and Post-Training Quantization

Authors

  • Siti Yuliyanti Departement of Informatics, Faculty of Enginnering, Siliwangi University, Indonesia
  • Syamsul Maarip Departement of Informatics, Faculty of Enginnering, Siliwangi University, Indonesia

DOI:

https://doi.org/10.52436/1.jutif.2026.7.1.5400

Keywords:

Coffee beans, Device low-end, EfficientNetB0, Lightweight, Quantization

Abstract

The first problem faced in coffee bean classification is that the manual grading or sorting process still relies heavily on human labor, making it subjective, time-consuming, and prone to errors. Secondly, existing deep learning-based systems often require substantial computing resources, rendering them inefficient for industrial-scale implementation or on limited hardware. The research objective is to develop an efficient, lightweight, and accurate automatic classification model to recognize coffee bean color and support the automation of quality control processes in the coffee post-harvest chain. This study develops an automated system for coffee bean classification based on four color classes: light, medium, green, and dark, utilizing the lightweight EfficientNet model with fine-tuning of smaller versions of EfficientNet (B0–B3). The research stages consist of dataset acquisition, pre-processing, modeling and fine-tuning, as well as model evaluation on the detection system on low-end devices. The main innovation of this research is the efficiency and speed of real-time classification of coffee bean color images using a lightweight CNN model optimized through quantization, which supports field applications with hardware limitations without sacrificing accuracy. Fine-tuning EfficientNetB0 by unfreezing the last 30 layers achieved 97.17% training accuracy and 99.25% validation accuracy with consistent loss reduction, supported by Test-Time Augmentation (TTA) which improves prediction stability to >80% confidence against variations in field image quality. Deployment to TensorFlow Lite (TFLite) with 8-bit quantization resulted in a lighter model that maintained 99.50% accuracy and accelerated inference by up to 6x compared to the original H5 model, and excelled at multi-object detection without sacrificing classification confidence.

Downloads

Download data is not yet available.

Author Biography

Syamsul Maarip, Departement of Informatics, Faculty of Enginnering, Siliwangi University, Indonesia

Departement of Infomatic

References

U. P. Ganesha, “Klasifikasi Kualitas Biji Kopi Robusta Dengan Metode Naive Bayes,” vol. 10, pp. 280–289, 2023.

S. Wahyudi, “Aplikasi Deteksi Kualitas Biji Kopi Menggunakan Metode Histogram Equalization Berbasis Android,” vol. 2, no. 1, pp. 50–56, 2018.

K. Ciptady, M. Harahap, J. Jonvin, Y. Ndruru, and I. Ibadurrahman, “Prediksi Kualitas Kopi Dengan Algoritma Random Forest Melalui Pendekatan Data Science,” Data Sci. Indones., vol. 2, no. 1, 2022, doi: 10.47709/dsi.v2i1.1708.

D. Herdhiansyah, S. Sudarmi, S. Sakir, and A. Asriani, “Analisis Faktor Prioritas Pengembangan Komoditas Perkebunan Unggulan Dengan Metode Ahp (Analtycal Hierarchy Process,” J. Tek. Pertan. Lampung (Journal Agric. Eng., vol. 10, no. 2, p. 239, 2021, doi: 10.23960/jtep-l.v10i2.239-251.

A. Agung Istri Ratnadewi, R. Anggraini, A. Yulvia, and A. A. Ngurah Nara Kusuma, “Extraction and Purification of Xylooligosaccharides from Coffee Peel Using Endo-β-1,4-D-Xylanase XynBTN63D and Adsorption for Prebiotics,” Coffee Sci., vol. 20, pp. 1–11, 2025, doi: 10.25186/.v20i.2354.

V. Carolina Achicanoy Mejia, L. Alberto Sandoval Mejia, and S. de los Angeles Morales Vanegas, “Profiling coffee consumers: an instrument based on values and attitudes for Spanish-speaking countries in Latin America with a sustainability perspective,” Coffee Sci., vol. 20, 2025, doi: 10.25186/.v20i.2346.

R. Rusinek et al., “How to Identify Roast Defects in Coffee Beans Based on the Volatile Compound Profile,” Molecules, vol. 27, no. 23, pp. 1–13, 2022, doi: 10.3390/molecules27238530.

N. L. H. Hien, A. L. Kor, M. C. Ang, E. Rondeau, and J. P. Georges, Image Filtering Techniques for Object Recognition in Autonomous Vehicles, vol. 30, no. 1. 2024. doi: 10.3897/jucs.102428.

A. Ardiansyah, J. Triloka, K. kunci-Pengolahan Citra, D. Kesegaran Buah, and K. Akurasi, “Evaluasi Kinerja Model YOLOv8… 357.”

S. Widyaningtyas, M. Arwani, Sucipto, and Y. Hendrawan, “Improving the accuracy of green bean palm civet coffee purity classification using wrapper feature selection,” Coffee Sci., vol. 20, 2025, doi: 10.25186/.v20i.2277.

S. C. Vanegas-Ayala, D. D. Leal-Lara, and J. Barón-Velandia, “Roasted coffee beans characterization through optoelectronic color sensing,” Coffee Sci., vol. 18, 2023, doi: 10.25186/.v18i.2156.

M. A. B. Bhuiyan, H. M. Abdullah, S. E. Arman, S. Saminur Rahman, and K. Al Mahmud, “BananaSqueezeNet: A very fast, lightweight convolutional neural network for the diagnosis of three prominent banana leaf diseases,” Smart Agric. Technol., vol. 4, Aug. 2023, doi: 10.1016/j.atech.2023.100214.

T. Jiang et al., “Improved YOLOv8 Model for Lightweight Pigeon Egg Detection,” Animals, vol. 14, no. 8, pp. 1–18, 2024, doi: 10.3390/ani14081226.

M. C. da Silva Andrea, J. P. F. de Oliveira Nascimento, F. C. M. Mota, and R. de Souza Oliveira, “Predictive framework of plant height in commercial cotton fields using a remote sensing and machine learning approach,” Smart Agric. Technol., vol. 4, Aug. 2023, doi: 10.1016/j.atech.2022.100154.

M. N. Yusri, I. P. Ramadhani, and A. B. Aswar, “Citra Digital Dan Jaringan Syaraf Tiruan,” vol. 02, no. May, pp. 36–43, 2021.

A. Astaraja, B. S. Syamsudin, M. Diaz, and M. Dhafin, “Optimizing Coffee Ripeness Classification Using Yolov5 for Automated Detection and Sorting,” vol. 4, 2025.

X. Huang, Z. Liu, S. Y. Liu, and T. K. T. Cheng, “Efficient and Robust Quantization-aware Training via Adaptive Coreset Selection,” Trans. Mach. Learn. Res., vol. 2024, pp. 1–23, 2024.

J. A. Suarez-Peña, H. F. Lobaton-García, J. I. Rodríguez-Molano, and W. C. Rodriguez-Vazquez, Machine Learning for Cup Coffee Quality Prediction from Green and Roasted Coffee Beans Features, vol. 1274 CCIS, no. October. Springer International Publishing, 2020. doi: 10.1007/978-3-030-61834-6_5.

A. Melke Woldegebriel, “Coffee (Coffea arabica L.) Cup Quality Varies with Growing Environments in Ethiopia: Climate and Soil Perspectives,” Coffee Sci., vol. 20, 2025, doi: 10.25186/.v20i.2295.

W. de M. Moura et al., “Identification of morphoagronomic traits correlated with the N use efficiency in coffee,” Coffee Sci., vol. 20, 2025, doi: 10.25186/.v20i.2303.

E. Aghdamifar, V. Rasooli Sharabiani, E. Taghinezhad, A. Rezvanivand Fanaei, and M. Szymanek, “Non-destructive method for identification and classification of varieties and quality of coffee beans based on soft computing models using VIS/NIR spectroscopy,” Eur. Food Res. Technol., vol. 249, no. 6, pp. 1599–1612, 2023, doi: 10.1007/s00217-023-04240-x.

R. Arablouei, L. Wang, C. Phillips, L. Currie, J. Yates, and G. Bishop-Hurley, “In-situ animal behavior classification using knowledge distillation and fixed-point quantization,” Smart Agric. Technol., vol. 4, Aug. 2023, doi: 10.1016/j.atech.2022.100159.

S. Ashkboos, B. Verhoef, T. Hoefler, E. Eleftheriou, and M. Dazzi, “EfQAT: An Efficient Framework for Quantization-Aware Training,” 2024, [Online]. Available: http://arxiv.org/abs/2411.11038

E. Yvinec, A. Dapogny, and K. Bailly, “NUPES : Non-Uniform Post-Training Quantization via Power Exponent Search,” IEEE Trans. Pattern Anal. Mach. Intell., pp. 1–11, 2025, doi: 10.1109/TPAMI.2025.3593987.

M. Polignano, P. Basile, M. de Gemmis, G. Semeraro, and V. Basile, “AlBERTo: Italian BERT language understanding model for NLP challenging tasks based on tweets,” CEUR Workshop Proc., vol. 2481, 2019.

J. Lang, Z. Guo, and S. Huang, “A Comprehensive Study on Quantization Techniques for Large Language Models,” 2024 4th Int. Conf. Artif. Intell. Robot. Commun. ICAIRC 2024, pp. 224–231, 2024, doi: 10.1109/ICAIRC64177.2024.10899941.

V. No, D. Gusmaliza, and S. Aminah, “Edumatic : Jurnal Pendidikan Informatika Sistem Identifikasi Kualitas Biji Kopi Robusta berbasis Image Processing dengan Support Vector Machine,” vol. 8, no. 2, pp. 744–753, 2024, doi: 10.29408/edumatic.v8i2.28008.

T. Firmansyah, R. Kurniawan, and A. T. Hidayat, “Klasfikasi Tingkat Kematangan Roasting Biji Kopi Berbasis Deep Learning dengan Arsitektur MobileNet,” vol. 6, no. 2, pp. 1432–1442, 2025, doi: 10.47065/josh.v6i2.6811.

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, 2023, doi: 10.3390/app131910786.

J. Y. Kim, “Coffee Beans Quality Prediction Using Machine Learning,” SSRN Electron. J., pp. 1–7, 2022, doi: 10.2139/ssrn.4024785.

I. Alfiantama, M. I. Kresnawan, and A. P. Handoko, “Klasifikasi Tingkat Roasting Biji Kopi Dengan Metode CNN,” Pros. Semin. Nas. Teknol. Dan Sains Tahun 2024, vol. 3, pp. 285–290, 2024.

T. Agus Siswoyo, E. Novianti, and A. Isnainun, “Changes in the antioxidant activities and angiotensin-I converting enzyme inhibitory protein during the germination of green coffee beans,” Coffee Sci., vol. 20, pp. 1–9, 2025, doi: 10.25186/.v20i.2332.

Q. D. Utama et al., “Effect of Ethyl Acetate Concentration on Decaffeination of Robusta Coffee From Lombok, Indonesia,” Coffee Sci., vol. 20, no. 2009, 2025, doi: 10.25186/.v20i.2306.

Kamil Fadli, “Pengolahan Citra Digital Menggunakan Metode Yolo Untuk Mendeteksi Kualitas Dari Biji Kopi Berbasis Android,” J. Artif. Intel. dan Sist. Penunjang Keputusan, vol. 1, no. 1, pp. 120–125, 2023, [Online]. Available: https://jurnalmahasiswa.com/index.php/aidanspk

C. H. de Freitas, R. D. Coelho, J. de O. Costa, and P. C. Sentelhas, “Smart Coffee: Machine Learning Techniques for Estimating Arabica Coffee Yield,” AgriEngineering, vol. 6, no. 4, pp. 4925–4942, 2024, doi: 10.3390/agriengineering6040281.

A. A. Soomro et al., “Data augmentation using SMOTE technique: Application for prediction of burst pressure of hydrocarbons pipeline using supervised machine learning models,” Results Eng., vol. 24, no. September, 2024, doi: 10.1016/j.rineng.2024.103233.

Y. Yu et al., “Design and Operation Parameters of Vibrating Harvester for Coffea arabica L.,” Agric., vol. 13, no. 3, 2023, doi: 10.3390/agriculture13030700.

dkk Dzulfian Syafrian, No 主観的健康感を中心とした在宅高齢者における 健康関連指標に関する共分散構造分析Title, vol. 11, no. 1. 2025. [Online]. Available: http://scioteca.caf.com/bitstream/handle/123456789/1091/RED2017-Eng-8ene.pdf?sequence=12&isAllowed=y%0Ahttp://dx.doi.org/10.1016/j.regsciurbeco.2008.06.005%0Ahttps://www.researchgate.net/publication/305320484_SISTEM_PEMBETUNGAN_TERPUSAT_STRATEGI_MELESTARI

A. Z. Putra, C. Chalvin, A. Nurhadi, A. E. Tambun, and S. Defha, “Coffee Quality Prediction with Light Gradient Boosting Machine Algorithm Through Data Science Approach,” Sinkron, vol. 8, no. 1, pp. 563–573, 2023, doi: 10.33395/sinkron.v8i1.12169.

F. H. Alkallas, A. M. Mostafa, E. A. Rashed, A. B. G. Trabelsi, M. A. I. Essawy, and R. A. Rezk, “Authentication of Roasted Coffee Beans via LIBS: Statistical Principal Component Analysis,” Coatings, vol. 13, no. 10, 2023, doi: 10.3390/coatings13101790.

Y. Ji, J. Xu, and B. Yan, “Coffee Green Bean Defect Detection Method Based on an Improved YOLOv8 Model,” J. Food Process. Preserv., vol. 2024, no. 1, 2024, doi: 10.1155/2024/2864052.

F. F. L. Dos Santos, J. T. F. Rosas, R. N. Martins, G. de M. Araújo, L. de A. Viana, and J. de P. Gonçalves, “Quality assessment of coffee beans through computer vision and machine learning algorithms,” Coffee Sci., vol. 15, no. 1, pp. 1–9, 2020, doi: 10.25186/.v15i.1752.

Additional Files

Published

2026-02-15

How to Cite

[1]
S. . Yuliyanti and S. Maarip, “Multi-Class Real-Time Color Classification of Coffee Beans via Fine-Tuned EfficientNetB0 and Post-Training Quantization”, J. Tek. Inform. (JUTIF), vol. 7, no. 1, pp. 273–285, Feb. 2026.