pp. 3785-3802
S&M4152 Research paper of Special Issue https://doi.org/10.18494/SAM5701 Published: August 28, 2025 Lightweight Vision-transformer-based Coffee Bean Quality Inspection with Class-aware Unsupervised Domain Adaptation [PDF] Hsien-Chun Cho, Zih-Ching Chen, and Ching-Yi Chen (Received April 21, 2025; Accepted August 15, 2025) Keywords: automated optical inspection, unsupervised domain adaptation, vision transformer, model compression
With the rapid development of automated optical inspection (AOI) technology and imaging sensor systems, image-based coffee bean quality inspection has emerged as an effective alternative to manual sorting. High-resolution imaging sensors are capable of capturing critical surface features of coffee beans, including texture, color, and structural patterns, thereby providing rich input for downstream intelligent classification algorithms. However, most existing research has concentrated on green beans, while labeled datasets for roasted beans remain scarce. This imbalance severely restricts the generalization capability of trained models in real-world applications. To address this issue, a class-aware unsupervised domain adaptation (UDA) framework based on the vision transformer (ViT) architecture is proposed. The framework simultaneously aligns the feature distributions between the source domain (green beans) and the target domain (roasted beans), while enhancing class-level consistency during training. This design effectively mitigates domain shifts induced by variations in coffee processing stages, thereby improving model robustness in cross-domain scenarios. In addition, to enhance deployment efficiency and operational practicality in intelligent sensing environments, a model compression strategy is further introduced. By leveraging the modular dependency structure inherent in transformer-based architectures, we developed an approach that integrates structured pruning with knowledge distillation (KD) to significantly reduce model complexity while preserving classification performance. Experimental results confirm that the proposed method delivers high classification accuracy and generalization capability, demonstrating its potential for deployment in image-based coffee bean quality inspection systems.
Corresponding author: Ching-Yi Chen![]() ![]() This work is licensed under a Creative Commons Attribution 4.0 International License. Cite this article Hsien-Chun Cho, Zih-Ching Chen, and Ching-Yi Chen, Lightweight Vision-transformer-based Coffee Bean Quality Inspection with Class-aware Unsupervised Domain Adaptation, Sens. Mater., Vol. 37, No. 8, 2025, p. 3785-3802. |