Domain Adaptation for Roasted Coffee Bean Quality Inspection


  • Cheng-Lung Chang Department of Information and Telecommunications Engineering, Ming Chuan University, Taoyuan, Taiwan, ROC
  • Shou-Chuan Lai Department of Information and Telecommunications Engineering, Ming Chuan University, Taoyuan, Taiwan, ROC
  • Ching-Yi Chen Department of Information and Telecommunications Engineering, Ming Chuan University, Taoyuan, Taiwan, ROC



machine learning, domain adaptation, domain adversarial training, coffee bean quality inspection


Current research in machine learning primarily focuses on raw coffee bean quality, hampered by limited labeled datasets for roasted beans. This study proposes a domain adaptation approach to transfer knowledge acquired from raw coffee beans to the task of inspecting roasted beans. The method maps the source and target data, originating from different distributions, into a shared feature space while minimizing distribution discrepancies with domain adversarial training. Experimental results demonstrate that the proposed approach effectively uses annotated raw bean datasets to achieve a high-performance quality inspection system tailored specifically to roasted coffee beans.


J. Yu, D. Liang, J. Li, Z. Liu, F. Zhou, T. Wang, et al., “Coffee, Green Tea Intake, and the Risk of Hepatocellular Carcinoma: A Systematic Review and Meta-Analysis of Observational Studies,” Nutrition and Cancer, vol. 75, no. 5, pp. 1295-1308, 2023.

S. Shin, J. E. Lee, E. Loftfield, X. O. Shu, S. K. Abe, M. S. Rahman, et al., “Coffee and Tea Consumption and Mortality from All Causes, Cardiovascular Disease and Cancer: A Pooled Analysis of Prospective Studies from the Asia Cohort Consortium,” International Journal of Epidemiology, vol. 51, no. 2, pp. 626-640, April 2022.

K. N. Papadopoulos, Food Chemistry Research Developments, New York: Nova Science Publishers, pp. 105-138, 2008.

L. Servillo, A. Giovane, R. Casale, D. Cautela, N. D’Onofrio, M. L. Balestrieri, et al., “Glucosylated Forms of Serotonin and Tryptophan in Green Coffee Beans,” LWT, vol. 73, pp. 117-122, November 2016.

B. Mehari, M. Redi-Abshiro, B. S. Chandravanshi, S. Combrinck, M. Atlabachew, and R. McCrindle, “Profiling of Phenolic Compounds Using UPLC–MS for Determining the Geographical Origin of Green Coffee Beans from Ethiopia,” Journal of Food Composition and Analysis, vol. 45, pp. 16-25, February 2016.

E. R. Arboleda, A. C. Fajardo, and R. P. Medina, “An Image Processing Technique for Coffee Black Beans Identification,” IEEE International Conference on Innovative Research and Development, pp. 1-5, May 2018.

Radi, M. Rivai, and M. H. Purnomo, “Combination of First and Second Order Statistical Features of Bulk Grain Image for Quality Grade Estimation of Green Coffee Bean,” ARPN Journal of Engineering and Applied Sciences, vol. 10, no. 18, pp. 8165-8174, October 2015.

D. Mandal, “Adaptive Neuro-Fuzzy Inference System Based Grading of Basmati Rice Grains Using Image Processing Technique,” Applied System Innovation, vol. 1, no. 2, article no. 19, June 2018.

E. Ordukaya and B. Karlik, “Quality Control of Olive Oils Using Machine Learning and Electronic Nose,” Journal of Food Quality, vol. 2017, article no. 9272404, 2017.

H. Zareiforoush, S. Minaei, M. R. Alizadeh, and A. Banakar, “Qualitative Classification of Milled Rice Grains Using Computer Vision and Metaheuristic Techniques,” Journal of Food Science and Technology, vol. 53, no. 1, pp. 118-131, January 2016.

E. R. Arboleda, A. C. Fajardo, and R. P. Medina, “Classification of Coffee Bean Species Using Image Processing, Artificial Neural Network and K Nearest Neighbors,” IEEE International Conference on Innovative Research and Development, pp. 1-5, May 2018.

V. A. M. Luis, M. V. T. Quiñones, and A. N. Yumang, “Classification of Defects in Robusta Green Coffee Beans Using YOLO,” IEEE International Conference on Artificial Intelligence in Engineering and Technology, pp. 1-6, September 2022.

N. Ruttanadech, K. Phetpan, N. Srisang, S. Srisang, T. Chungcharoen, W. Limmun‬, et al., “Rapid and Accurate Classification of Aspergillus Ochraceous Contamination in Robusta Green Coffee Bean Through Near-Infrared Spectral Analysis Using Machine Learning,” Food Control, vol. 145, article no. 109446, March 2023.

M. García, J. E. Candelo-Becerra, and F. E. Hoyos, “Quality and Defect Inspection of Green Coffee Beans Using a Computer Vision System,” Applied Sciences, vol. 9, no. 19, article no. 4195, October 2019.

Y. Chen, B. Gao, and W. Lu, “Recent Research Advancements of Coffee Quality Detection: Targeted Analyses vs. Nontargeted Fingerprinting and Related Issues,” Journal of Food Quality, vol. 2023, article no. 6156247, 2023.

Y. Kim, D. Cho, K. Han, P. Panda, and S. Hong, “Domain Adaptation Without Source Data,” IEEE Transactions on Artificial Intelligence, vol. 2, no. 6, pp. 508-518, December 2021.

M. HassanPour Zonoozi and V. Seydi, “A Survey on Adversarial Domain Adaptation,” Neural Processing Letters, vol. 55, no. 3, pp. 2429-2469, June 2023.

G. Iglesias, E. Talavera, and A. Díaz-Álvarez, “A Survey on GANs for Computer Vision: Recent Research, Analysis and Taxonomy,” Computer Science Review, vol. 48, article no. 100553, May 2023.

E. Tzeng, J. Hoffman, N. Zhang, K. Saenko, and T. Darrell, “Deep Domain Confusion: Maximizing for Domain Invariance,”, December 10, 2014.

F. Yu, X. Xiu, and Y. Li, “A Survey on Deep Transfer Learning and Beyond,” Mathematics, vol. 10, no. 19, article no. 3619, October 2022.

M. Martini, V. Mazzia, A. Khaliq, and M. Chiaberge, “Domain-Adversarial Training of Self-Attention-Based Networks for Land Cover Classification Using Multi-Temporal Sentinel-2 Satellite Imagery,” Remote Sensing, vol. 13, no. 13, article no. 2564, July 2021.

“Small Optical Sorter,”, March 26, 2021.

“Coffee Bean Defect Detection,”, June 04, 2022.

M. Tan and Q. Le, “Efficientnetv2: Smaller Models and Faster Training,” International Conference on Machine Learning, vol. 139, pp. 10096-10106, July 2021.

L. Brocki and N. C. Chung, “Input Bias in Rectified Gradients and Modified Saliency Maps,” IEEE International Conference on Big Data and Smart Computing, pp. 148-151, January 2021.

J. Hu, K. Zhu, S. Cheng, N. M. Kovalchuk, A. Soulsby, M. J. H. Simmons, et al., “Explainable AI Models for Predicting Drop Coalescence in Microfluidics Device,” Chemical Engineering Journal, vol. 481, article no. 148465, February 2024.




How to Cite

Cheng-Lung Chang, Shou-Chuan Lai, and Ching-Yi Chen, “Domain Adaptation for Roasted Coffee Bean Quality Inspection”, Int. j. eng. technol. innov., vol. 14, no. 3, pp. 321–334, Jul. 2024.