Implementation of Coffee Bean Roasting Level Classification System Using CNN and Knn Models with Web-Based Real-Time Camera - Andini Sintawati; Ira Windarti; Ari Rosemalatriasari; Muhammad Alan Darma Saputra (HORIZON: Indonesian Journal of Multidisciplinary, 2026)
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.