Skip to content
Open access

Dual-Sided Green Coffee Bean Defect Inspection Using a Mechatronic System with AI-Powered Computer Vision

Aug 2026 · Agriculture · 0 citations · 41 references

Abstract

Quality control in green coffee bean production is critical for food safety and economic sustainability. A persistent gap in existing automated inspection systems is their inability to capture both sides of each bean, which leads to systematic under-detection of surface defects. This work presents three contributions: (i) a novel mechatronic apparatus that mechanically guarantees dual-sided imaging of every bean, (ii) a public 12-class dataset of green coffee bean defects, and (iii) an embedded, real-time inspection pipeline validated on low-cost hardware. The apparatus sequentially presents each bean, from a standard 350 g sample, to two 16-megapixel cameras under controlled LED illumination. A dataset of 9600 images spanning 12 classes (11 defects and 1 normal) was generated from expert-classified samples and enriched through data augmentation. Four convolutional neural network (CNN) architectures, VGG-16, VGG-19, ResNet-50 and YOLOv8, were trained and benchmarked using precision, recall, F1-score and mean average precision. YOLOv8 achieved the best overall performance, with a precision of 97.4%, a recall of 99.6%, an F1-score of 0.930 and a mean average precision of 96.5%, outperforming VGG-16 (accuracy 86.07%), VGG-19 (accuracy 67.03%) and ResNet-50 (accuracy 87.76%). Dual-sided acquisition raised mean per-class detection accuracy from 0.727 to 0.908, a relative gain of 25.7% over an equivalent single-sided configuration. Deployed in real-time “track” mode on a Raspberry Pi 4, the system simultaneously classifies defects and counts beans by category, processing a 350 g sample in approximately 38 min. Combining mechanical innovation with lightweight deep learning enables practical, scalable, and cost-effective quality control for laboratories specialized in coffee analysis.

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.