IEEE Access (Jan 2025)

Edge AI-Based Detection for Defective Coffee Beans Using Deep Learning and Streamlit Framework

  • Kahlil Muchtar,
  • Yayang Hafifah,
  • Alifya Febriana,
  • Rahmad Dawood,
  • Ahmadiar Ahmadiar,
  • Al Bahri,
  • Chih-Yang Lin,
  • Ervin Yohannes

DOI
https://doi.org/10.1109/access.2025.3561189
Journal volume & issue
Vol. 13
pp. 67977 – 67992

Abstract

Read online

Coffee is one of the most popular beverages nowadays. To ensure the quality of coffee beans, farmers must go through a sorting process to distinguish between normal and defective beans. Manual sorting by the farmer is time-consuming, prone to errors due to fatigue, and results in inconsistent quality. To solve these problems, this paper makes a three-fold contribution. First, an Edge AI-based detection for defective coffee beans using the USK-Coffee dataset, which contains a total of 8,000 images and is divided into 4 classes, is proposed. To the best of our knowledge, our USK-Coffee dataset is currently the most comprehensive green coffee bean dataset. To be specific, the edge device used is the NVIDIA (Registered trademark) Jetson Orin Nano (Trademark) 8GB. The model outputs the confidence percentage of defective coffee beans. For visual analysis, we built a GUI-friendly web interface through the Streamlit framework. Second, this study provides an extensive comparison of deep learning models using famous CNN and Transformer-based architectures in order to detect normal and defective coffee beans, namely ResNet-34, VGG-16, EfficientNet-B7, DenseNet121, InceptionV4, ViT, Swin Transformer, ConvNeXt, and FocalNet. These architectures are compared according to several performance evaluation metrics, including accuracy, recall, specificity, F-score, and running time. Finally, we implemented Grad-CAM heatmaps with increasing generalizability for CNN architecture interpretation to analyze the impact of CNN deep learning models on heatmap creation and visually identified the defect location. In the case of normal coffee beans, the heatmap is dispersed and does not highlight specific areas of the coffee bean image. The USK-Coffee dataset can be found through this link: https://coffee.comvislab-usk.org/.

Keywords