Implementing a deep learning model for defect classification in Thai Arabica green coffee beans - Sujitra Arwatchananukul; Dan Xu; Phasit Charoenkwan; Sai Aung Moon; Rattapon Saengrayap (Smart Agricultural Technology)
Arabica coffee is a significant economic driver in Northern Thailand and has substantial opportunities for market growth. However, the Thai coffee business must ensure consistent quality standards and is currently heavily dependent on manual labor, to first identify, and then remove substandard unroasted coffee beans. This research developed a classification model based on a Convolutional Neural Network to detect 17 types of defects in green coffee beans. The image augmentation phase was enhanced by rotating images at 45, 90, 135, 180, 225, and 270° and expanding the dataset from 979 original images across 17 defect types to a robust 6,853 images. Several architectures including MobileNetV2, MobileNetV3, EfficientNetV2, InceptionV2, and ResNetV2 were assessed. Following extensive evaluations, MobileNetV3 emerged as the best-performing model and underwent further fine-tuning, achieving significant accuracy improvements through hyperparameter optimization. The model's robustness and generalizability were validated via 5-fold cross-validation, with accuracy ranging from 98.78 % to 99.84 % across all defect types. When tested with unseen data, the model achieved an accuracy of 88.63 %. A web application prototype was also developed for real-time coffee bean defect classification and its usability was tested. Seven farmers reported high satisfaction with the ease of use and effectiveness of the application in classifying coffee bean defects, with 71.4 % expressing a strong likelihood of recommending the application to others. These promising results demonstrate the practical utility of the model in enhancing quality sorting processes in the coffee industry.