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

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.

Authors

Institutions

Publication Details

Journal
Agriculture
Published
2026-08-21
DOI
https://doi.org/10.3390/agriculture16161796
Primary Topic
Industrial Vision Systems and Defect Detection
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

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

Otniel Portillo-Rodríguez, Oscar Sandoval-González, Gerardo Águila Rodríguez, Ofelia Landeta-Escamilla et al.
Agriculture
Industrial Vision Systems and Defect Detection
article

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

Otniel Portillo-Rodríguez, Oscar Sandoval-González, Gerardo Águila Rodríguez, Ofelia Landeta-Escamilla, Blanca Estela González Sánchez, Dora Manrique-Santos, Diego Cruz-Jarquin
article en

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.

AgricultureVol. 16(16)
Universidad Autónoma del Estado de México (MX), Instituto Tecnologico de Orizaba (MX)
Tecnológico Nacional de México
Responsible consumption and production
Openalex Percentile: Top 10%
Industrial Vision Systems and Defect Detection
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.