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

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® Jetson Orin Nano™ 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, <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">F</i>-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://comvis.unsyiah.ac.id/usk-coffee/.

Authors

Institutions

Publication Details

Journal
IEEE Access
Published
2025-01-01
DOI
https://doi.org/10.1109/access.2025.3561189
Citations
7
Primary Topic
Smart Agriculture and AI
Type
article
Field-Weighted Citation Impact
12.25
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

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

Yayang Hafifah, Ahmadiar Ahmadiar, Rahmad Dawood, Ervin Yohannes et al.
7 citations
IEEE Access
Smart Agriculture and AI
12.25
article

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

Yayang Hafifah, Ahmadiar Ahmadiar, Rahmad Dawood, Ervin Yohannes, Alifya Febriana, Al Bahri, Chih‐Yang Lin, Kahlil Muchtar
article en
7 citations

Abstract

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® Jetson Orin Nano™ 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, <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">F</i>-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://comvis.unsyiah.ac.id/usk-coffee/.

IEEE AccessVol. 13
Universitas Syiah Kuala (ID), National Central University (TW), Universitas Negeri Surabaya (ID), Yuan Ze University (TW)
Openalex Percentile: Top 2%
Smart Agriculture and AI
12.25
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.