Horizon: Indonesian Journal of Multidisciplinary
Vol. 4 No. 3 (2026): HORIZON: Indonesian Journal of Multidisciplinary

Implementation of Coffee Bean Roasting Level Classification System Using CNN and Knn Models with Web-Based Real-Time Camera

Andini Sintawati (Universitas Gunadarma)
Ira Windarti (Universitas Gunadarma)
Ari Rosemalatriasari (Universitas Gunadarma)
Muhammad Alan Darma Saputra (Universitas Gunadarma)



Article Info

Publish Date
30 Jun 2026

Abstract

Manual coffee bean roasting assessment is still susceptible to operator subjectivity, variations in lighting conditions, and inconsistencies in results between assessors. This study aims to develop a real-time web-based coffee bean roasting classification system by integrating Convolutional Neural Network (CNN) and K-Nearest Neighbor (KNN) models. The study uses a quantitative experimental approach with a dataset of coffee bean images collected independently and expanded to 6,470 images, which are grouped into five classes: GreenRoasting, LightRoasting, MediumRoasting, DarkRoasting, and Unknown. All images are processed through a pre-processing stage including resizing to 160 × 160 pixels, normalization, data augmentation, and splitting training and test data with a ratio of 80:20 in stages. MobileNetV2 is used as a feature extractor in CNN, while KNN with a value of k = 7 and a cosine distance metric is applied for feature vector classification. The final prediction was obtained using a weighted ensemble method with a composition of 60% CNN and 40% KNN, then implemented in a Flask-based web application with support for real-time image upload and camera. Test results showed the ensemble model achieved an accuracy of 85.67% with an average response time of 1,247 ms. This system has the potential to support faster, more consistent, and objective coffee roasting level assessments, especially for small to medium-scale coffee businesses.

Copyrights © 2026






Journal Info

Abbrev

hijm

Publisher

Subject

Agriculture, Biological Sciences & Forestry Humanities Decision Sciences, Operations Research & Management Economics, Econometrics & Finance Languange, Linguistic, Communication & Media Social Sciences Other

Description

Horizon: Indonesian Journal of Multidisciplinary (HIJM) journal aims to stimulate discussions at all levels of mathematics education through disseminating significant and innovative scholarly studies that are of value to the international research communities. The journal welcomes articles focusing ...