Ripeness Evaluation Using Near-Infrared (NIR) Spectroscopy and NLP for Interpretability
Main Article Content
Abstract
This study develops a non-destructive avocado ripeness classification system using a low-cost, portable near-infrared (NIR) scanner and machine learning. Traditional ripeness assessment methods are often destructive and subjective, limiting their efficiency in agricultural practices. To address this issue, we developed a custom NIR scanner capable of capturing spectral information across 18 discrete wavelength bands for avocado ripeness classification. The research focuses on Buccaneer avocados sourced from the Royal Project, with samples collected from both the Royal Project Gardens and Sorting Plant. A total of 120 kg of avocados were systematically sampled and categorized by agricultural experts into three ripeness stages: raw, ripe, and aged. This study applies Multiplicative Scatter Correction (MSC) to preprocess NIR spectra, enhancing feature separation before machine learning model training. This study evaluates three classification models: Random Forest, XGBoost, and the Gaussian Mixture Model (GMM). Random Forest achieved the highest classification accuracy (78%) with an AUC score of 0.93, followed by XGBoost (74% accuracy, AUC 0.91). GMM performed worse, with 42% accuracy and an AUC of 0.58. Additionally, Natural Language Processing (NLP) was applied to convert model predictions into human-readable ripeness descriptions, assisting farmers in decision-making. This study demonstrates that low-cost NIR technology combined with AI-driven analysis enables efficient, non-destructive classification of avocado ripeness.
Article Details

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
References
M. Rizzo, M. Marcuzzo, A. Zangari, A. Gasparetto and A. Albarelli, “Fruit ripeness classification: A survey,” Artificial Intelligence in Agriculture, vol. 7, pp. 44-57, 2023.
M. Palumbo et al., “Emerging Postharvest Technologies to Enhance the Shelf-Life of Fruit and Vegetables: An Overview,” Foods, vol. 11, no. 23, p. foods11233925, 2022.
C. Santos et al., “Non-Destructive Measurement of the Internal Quality of Citrus Fruits Using a Portable NIR Device,” Journal of AOAC INTERNATIONAL, vol. 104, no. 1, pp. 61-67, 2021.
E. R. Arboleda, K. M. Parazo and C. M. Pareja, “Watermelon ripeness detector using near infrared spectroscopy,” Jurnal Teknologi dan Sistem Komputer, vol. 8, no. 4, pp. 317-322, 2020.
N. T. Anderson and K. B. Walsh, “Review: The evolution of chemometrics coupled with near infrared spectroscopy for fruit quality evaluation,” Journal of Near Infrared Spectroscopy, vol. 30, no. 1, p. 09670335211057235, 2022.
J. Walsh, A. Neupane, A. Koirala, M. Li and N. Anderson, “Review: The evolution of chemometrics coupled with near infrared spectroscopy for fruit quality evaluation. II. The rise of convolutional neural networks,” Journal of Near Infrared Spectroscopy, vol. 31, no. 3, p. 09670335231173140, 2023.
P. Reddy et al., “Near-Infrared Hyperspectral Imaging Pipelines for Pasture Seed Quality Evaluation: An Overview,” Sensors, vol. 22, no. 5, p. s22051981, 2022.
W. Zhang, L. C. Kasun, Q. J. Wang, Y. Zheng and Z. Lin, “A Review of Machine Learning for Near-Infrared Spectroscopy,” Sensors, vol. 22, no. 24, p. s22249764, 2022.
A. C. Agulheiro-Santos et al., “Non-destructive prediction of total soluble solids in strawberry using near infrared spectroscopy,” The Journal of the Science of Food and Agriculture, vol. 102, no. 11, pp. 4866-4872, 2022.
R. Pandiselvam et al., “Recent advancements in NIR spectroscopy for assessing the quality and 103 safety of horticultural products: A comprehensive review,” Frontiers in Nutrition, vol. 9, p. fnut.2022.973457, 2022.
D. K. Bwambok et al., “QCM Sensor Arrays, Electroanalytical Techniques and NIR Spectroscopy Coupled to Multivariate Analysis for Quality Assessment of Food Products, Raw Materials, Ingredients and Foodborne Pathogen Detection: Challenges and Breakthroughs,” Sensors, vol. 20, no. 23, p. s20236982, 2020.
Z. Du, W. Tian, M. Tilley, D. Wang, G. Zhang and Y. Li, “Quantitative assessment of wheat quality using near-infrared spectroscopy: A comprehensive review,” Comprehensive Reviews in Food Science and Food Safety, vol. 21, no. 3, pp. 2956-3009, 2022.
D. Wang et al., “A Lightweight convolutional neural network for nicotine prediction in tobacco by near-infrared spectroscopy,” Frontiers in Plant Science, vol. 14, p. fpls.2023.1138693, 2023.
J.-R. Riba, R. Cantero, P. Riba-Mosoll and R. Puig, “Post-Consumer Textile Waste Classification through Near-Infrared Spectroscopy, Using an Advanced Deep Learning Approach,” Polymers, vol. 14, no. 12, p. polym14122475, 2022.
B. Benmouna et al., “Convolutional Neural Networks for Estimating the Ripening State of Fuji Apples Using Visible and Near-Infrared Spectroscopy,” Food and Bioprocess Technology, vol. 15, pp. 2226-2236, 2022.
V. Gomes, A. Mendes-Ferreira and P. MeloPinto, “Application of Hyperspectral Imaging and Deep Learning for Robust Prediction of Sugar and pH Levels in Wine Grape Berries,” Sensors, vol. 21, no. 10, p. s21103459, 2021.
Y. Xu, W. Yang, X. Wu, Y Wang and J. Zhang, “ResNet Model Automatically Extracts and Identifies FT-NIR Features for Geographical Traceability of Polygonatum kingianum,” Foods, vol. 11, no. 22, p. foods11223568, 2022.
Z. Su et al., “Application of Hyperspectral Imaging for Maturity and Soluble Solids Content Determination of Strawberry With Deep Learning Approaches,” Frontiers in Plant Science, vol. 12, p. fpls.2021.736334, 2021.
P. Luekhong, P. Limkonchotiwat and T. Ruangrajitpakorn, “A Study on an Effect of Using Deep Learning in Thai-English Machine Translation Processes,” 2019 14th International Joint Symposium on Artificial Intelligence and Natural Language Processing (iSAI-NLP), Chiang Mai, Thailand, pp. 1-6, 2019.
N. Ketui, K. Homjun, K. Poonyasiri, J. Deepinjai and P. Luekhong, “Item-based approach for online exam performance and its application,” 2016 13th International Conference on Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology (ECTI-CON), Chiang Mai, Thailand, pp. 15, 2016.
P. Mishra, D. N. Rutledge, J.-M. Roge, K. Wali and H. A. Khan, Chemometric pre-processing can negatively affect the performance of nearinfrared spectroscopy models for fruit quality prediction,” Talanta, vol. 229, p. 122303, 2021.
P. Tipauksorn, P. Luekhong, J. Thongpron, U. Kamnarn, K. Yingkayun and A. Namin, “Stereo Vision-based Turn-Alignment Optimization for Wireless Power Transmission Positioning,” 2023 IEEE Transportation Electrification Conference and Expo, Asia-Pacific (ITEC Asia-Pacific), Chiang Mai, Thailand, pp. 1-8, 2023.
N. Chen and M. Okada, “Toward 6G Internet of Things and the Convergence With RoF System,” in IEEE Internet of Things Journal, vol. 8, no. 11, pp. 8719-8733, 1 June1, 2021.
A. Benelli, C. Cevoli and A. Fabbri, “In-field hyperspectral imaging: An overview on the ground-based applications in agriculture,” Journal of Agricultural Engineering, vol. 51, no. 3, pp. 129-139, 2020.
W. Ye et al., “Application of Near-Infrared Spectroscopy and Hyperspectral Imaging Combined with Machine Learning Algorithms for Quality Inspection of Grape: A Review,” Foods, vol. 12, no. 1, p. foods12010132, 2023.
P. Tipauksorn, J. Thongpron, P. Luekhong, M. Okada and K. Yingkayun, “Low-Cost NIR and AI for Avocado Ripeness Classification: A Cloud-Integrated Approach,” 2025 SICE Festival with Annual Conference (SICE FES), Chiang Mai, Thailand, pp. 1282-1287, 2025.