Hyperspectral Imaging Using a Convolutional Neural Network with Transformer for the Soluble Solid Content and pH Prediction of Cherry Tomatoes
Abstract
:1. Introduction
2. Materials and Methods
2.1. Sample Preparation
2.2. SSC and pH Measurements
2.3. Hyperspectral Imaging System
2.4. Spectra Extraction and Processing
2.5. Partitioning the Sample Set
2.6. Regression Models
2.6.1. PLSR
2.6.2. SVR
2.6.3. CNN
2.6.4. Long Short-Term Memory (LSTM) and CNN-LSTM
2.6.5. Transformer and CNN-Transformer
2.7. Software, Hardware, and Performance Evaluation
3. Results and Discussion
3.1. Spectral Profiles
3.2. Regression Model Establishment
3.3. CNN-Transformer Network Visualization
3.3.1. Important Wavelengths for SSC Prediction
3.3.2. Important Wavelengths for pH Prediction
3.4. Discussion
4. Conclusions
Supplementary Materials
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Kumar, K.S.; Paswan, S.; Srivastava, S. Tomato-a natural medicine and its health benefits. J. Pharmacogn. Phytochem. 2012, 1, 33–43. [Google Scholar] [CrossRef]
- Li, J.; Xiang, Z.; Wang, X.; Guo, Y.M.; Huang, Z.; Liu, L.; Li, X.; Du, Y. Current situation and prospect of tomato industry in China during the 13th Five-Year Plan. Chin. Veg. 2021, 13–20. [Google Scholar] [CrossRef]
- Wang, T.; Chen, J.; Fan, Y.; Qiu, Z.; He, Y. SeeFruits: Design and evaluation of a cloud-based ultra-portable NIRS system for sweet cherry quality detection. Comput. Electron. Agric. 2018, 152, 302–313. [Google Scholar] [CrossRef]
- Huang, F.-H.; Liu, Y.-H.; Sun, X.; Yang, H. Quality inspection of nectarine based on hyperspectral imaging technology. Syst. Sci. Control Eng. 2021, 9, 350–357. [Google Scholar] [CrossRef]
- Medus, L.D.; Saban, M.; Frances-Villora, J.V.; Bataller-Mompean, M.; Rosado-Muñoz, A. Hyperspectral image classification using CNN: Application to industrial food packaging. Food Control 2021, 125, 107962. [Google Scholar] [CrossRef]
- Jeyaraj, P.R.; Samuel Nadar, E.R. Computer-assisted medical image classification for early diagnosis of oral cancer employing deep learning algorithm. J. Cancer Res. Clin. Oncol. 2019, 145, 829–837. [Google Scholar] [CrossRef] [PubMed]
- Chandrasekaran, I.; Panigrahi, S.S.; Ravikanth, L.; Singh, C.B. Potential of Near-Infrared (NIR) Spectroscopy and Hyperspectral Imaging for Quality and Safety Assessment of Fruits: An Overview. Food Anal. Methods 2019, 12, 2438–2458. [Google Scholar] [CrossRef]
- Leiva-Valenzuela, G.A.; Lu, R.; Aguilera, J.M. Prediction of firmness and soluble solids content of blueberries using hyperspectral reflectance imaging. J. Food Eng. 2013, 115, 91–98. [Google Scholar] [CrossRef]
- Li, X.; Wei, Y.; Xu, J.; Feng, X.; Wu, F.; Zhou, R.; Jin, J.; Xu, K.; Yu, X.; He, Y. SSC and pH for sweet assessment and maturity classification of harvested cherry fruit based on NIR hyperspectral imaging technology. Postharvest Biol. Technol. 2018, 143, 112–118. [Google Scholar] [CrossRef]
- Ma, T.; Xia, Y.; Inagaki, T.; Tsuchikawa, S. Rapid and nondestructive evaluation of soluble solids content (SSC) and firmness in apple using Vis–NIR spatially resolved spectroscopy. Postharvest Biol. Technol. 2021, 173, 111417. [Google Scholar] [CrossRef]
- Mishra, P.; Marini, F.; Brouwer, B.; Roger, J.M.; Biancolillo, A.; Woltering, E.; Echtelt, E.H. Sequential fusion of information from two portable spectrometers for improved prediction of moisture and soluble solids content in pear fruit. Talanta 2021, 223, 121733. [Google Scholar] [CrossRef]
- Gao, Q.; Wang, M.L.; Guo, Y.Y.; Zhao, X.Q.; He, D.J. Comparative Analysis of Non-Destructive Prediction Model of Soluble Solids Content for Malus micromalus Makino Based on Near-Infrared Spectroscopy. IEEE Access 2019, 7, 128064–128075. [Google Scholar] [CrossRef]
- Sohrabi, M.M.; Ahmadi, E.; Monavar, H.M. Nondestructive analysis of packaged grape tomatoes quality using PCA and PLS regression by means of fiber optic spectroscopy during storage. J. Food Meas. Charact. 2017, 12, 949–966. [Google Scholar] [CrossRef]
- Rahman, A.; Kandpal, L.M.; Lohumi, S.; Kim, M.S.; Lee, H.; Mo, C.; Cho, B.-K. Nondestructive estimation of moisture content, pH and soluble solid contents in intact tomatoes using hyperspectral imaging. Appl. Sci. 2017, 7, 109. [Google Scholar] [CrossRef]
- Sun, Y.; Liu, C.; Sun, X.; Wen, S. Rapid sugar analysis model of cherry tomato based on portable near infrared spectrometer. Food Ferment. Ind. 2021, 47, 214–220. [Google Scholar] [CrossRef]
- Cho, B.-H.; Kim, Y.-H.; Lee, K.-B.; Hong, Y.-K.; Kim, K.-C. Potential of Snapshot-Type Hyperspectral Imagery Using Support Vector Classifier for the Classification of Tomatoes Maturity. Sensors 2022, 22, 4378. [Google Scholar] [CrossRef]
- Liu, L.; Shi, X.; Zhang, S.; Shi, Y.; Long, Y. Saccharinity Test on Cherry Tomatoes Based on Hyperspectral Imaging. Int. J. Des. Nat. Ecodynamics 2020, 15, 103–111. [Google Scholar] [CrossRef]
- Xiang, Y.; Chen, Q.; Su, Z.; Zhang, L.; Chen, Z.; Zhou, G.; Yao, Z.; Xuan, Q.; Cheng, Y. Deep learning and hyperspectral images based tomato soluble solids content and firmness estimation. Front. Plant Sci. 2022, 13, 860656. Available online: https://arxiv.org/pdf/2203.05199.pdf (accessed on 3 January 2024). [CrossRef]
- Zhang, B.; Zhang, M.; Shen, M.; Li, H.; Zhang, Z.; Zhang, H.; Zhou, Z.; Ren, X.; Ding, Y.; Xing, L.; et al. Quality monitoring method for apples of different maturity under long-term cold storage. Infrared Phys. Technol. 2021, 112, 103580. [Google Scholar] [CrossRef]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. Adv. Neural Inf. Process. Syst. 2017, 30. [Google Scholar] [CrossRef]
- Jin, B.; Qi, H.; Jia, L.; Tang, Q.; Gao, L.; Li, Z.; Zhao, G. Determination of viability and vigor of naturally-aged rice seeds using hyperspectral imaging with machine learning. Infrared Phys. Technol. 2022, 122, 104097. [Google Scholar] [CrossRef]
- Cheng, J.-H.; Sun, D.-W. Partial least squares regression (PLSR) applied to NIR and HSI spectral data modeling to predict chemical properties of fish muscle. Food Eng. Rev. 2017, 9, 36–49. [Google Scholar] [CrossRef]
- Malegori, C.; Nascimento Marques, E.J.; de Freitas, S.T.; Pimentel, M.F.; Pasquini, C.; Casiraghi, E. Comparing the analytical performances of Micro-NIR and FT-NIR spectrometers in the evaluation of acerola fruit quality, using PLS and SVM regression algorithms. Talanta 2017, 165, 112–116. [Google Scholar] [CrossRef]
- Sarkar, S.; Basak, J.K.; Moon, B.E.; Kim, H.T. A Comparative Study of PLSR and SVM-R with Various Preprocessing Techniques for the Quantitative Determination of Soluble Solids Content of Hardy Kiwi Fruit by a Portable Vis/NIR Spectrometer. Foods 2020, 9, 1078. [Google Scholar] [CrossRef]
- Hochreiter, S.; Schmidhuber, J. LSTM can solve hard long time lag problems. Adv. Neural Inf. Process. Syst. 1996, 9. [Google Scholar]
- Clark, K.; Khandelwal, U.; Levy, O.; Manning, C.D. What does bert look at? an analysis of bert’s attention. arXiv 2019, arXiv:1906.04341. [Google Scholar]
- Dosovitskiy, A.; Beyer, L.; Kolesnikov, A.; Weissenborn, D.; Zhai, X.; Unterthiner, T.; Dehghani, M.; Minderer, M.; Heigold, G.; Gelly, S. An image is worth 16 × 16 words: Transformers for image recognition at scale. arXiv 2020, arXiv:2010.11929. [Google Scholar]
- Lee, J.; Toutanova, K. Pre-training of deep bidirectional transformers for language understanding. arXiv 2018, arXiv:1810.04805. [Google Scholar]
- Liu, Y.; Zhang, Y.; Jiang, X.; Liu, H. Detection of the quality of juicy peach during storage by visible/near infrared spectroscopy. Vib. Spectrosc. 2020, 111, 103152. [Google Scholar] [CrossRef]
- Li, P.; Li, S.; Du, G.; Jiang, L.; Liu, X.; Ding, S.; Shan, Y. A simple and nondestructive approach for the analysis of soluble solid content in citrus by using portable visible to near-infrared spectroscopy. Food Sci. Nutr. 2020, 8, 2543–2552. [Google Scholar] [CrossRef] [PubMed]
- Li, L.; Peng, Y.; Yang, C.; Li, Y. Optical sensing system for detection of the internal and external quality attributes of apples. Postharvest Biol. Technol. 2020, 162, 111101. [Google Scholar] [CrossRef]
- Zhang, C.; Wu, W.; Zhou, L.; Cheng, H.; Ye, X.; He, Y. Developing deep learning based regression approaches for determination of chemical compositions in dry black goji berries (Lycium ruthenicum Murr.) using near-infrared hyperspectral imaging. Food Chem. 2020, 319, 126536. [Google Scholar] [CrossRef]
- Huang, Y.; Lu, R.; Chen, K. Assessment of tomato soluble solids content and pH by spatially-resolved and conventional Vis/NIR spectroscopy. J. Food Eng. 2018, 236, 19–28. [Google Scholar] [CrossRef]
- Pu, H.; Liu, D.; Wang, L.; Sun, D.-W. Soluble solids content and pH prediction and maturity discrimination of lychee fruits using visible and near infrared hyperspectral imaging. Food Anal. Methods 2016, 9, 235–244. [Google Scholar] [CrossRef]
Number of Samples | SSC (°Brix) | pH | ||||||
---|---|---|---|---|---|---|---|---|
Mean | Maximum | Minimum | Standard Deviation | Mean | Maximum | Minimum | Standard Deviation | |
357 | 6.90 | 10.20 | 4.20 | 1.41 | 4.20 | 4.78 | 3.77 | 0.20 |
Indicators | Models | Calibration | Validation | Prediction | ||||
---|---|---|---|---|---|---|---|---|
R2C | RMSEC | R2V | RMSEV | R2P | RMSEP | RPDP * | ||
SSC | PLSR | 0.80 | 0.55 | 0.82 | 0.58 | 0.84 | 0.56 | 2.44 |
SVR | 0.90 | 0.39 | 0.87 | 0.52 | 0.85 | 0.59 | 2.34 | |
CNN | 0.50 | 0.95 | 0.68 | 0.81 | 0.50 | 0.97 | 1.41 | |
LSTM | 0.56 | 0.89 | 0.54 | 0.98 | 0.56 | 0.91 | 1.52 | |
Transformer | 0.62 | 0.82 | 0.73 | 0.75 | 0.72 | 0.73 | 1.88 | |
CNN-LSTM | 0.57 | 0.88 | 0.55 | 0.98 | 0.56 | 0.91 | 1.50 | |
CNN-Transformer | 0.83 | 0.58 | 0.87 | 0.52 | 0.83 | 0.56 | 2.45 | |
pH | PLSR | 0.66 | 0.10 | 0.61 | 0.12 | 0.73 | 0.10 | 1.82 |
SVR | 0.75 | 0.08 | 0.55 | 0.13 | 0.58 | 0.13 | 1.53 | |
CNN | 0.60 | 0.12 | 0.58 | 0.12 | 0.54 | 0.13 | 1.48 | |
LSTM | 0.47 | 0.14 | 0.42 | 0.15 | 0.48 | 0.14 | 1.39 | |
Transformer | 0.51 | 0.14 | 0.56 | 0.13 | 0.63 | 0.12 | 1.64 | |
CNN-LSTM | 0.73 | 0.10 | 0.53 | 0.13 | 0.61 | 0.12 | 1.60 | |
CNN-Transformer | 0.74 | 0.10 | 0.69 | 0.11 | 0.60 | 0.12 | 1.59 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Qi, H.; Li, H.; Chen, L.; Chen, F.; Luo, J.; Zhang, C. Hyperspectral Imaging Using a Convolutional Neural Network with Transformer for the Soluble Solid Content and pH Prediction of Cherry Tomatoes. Foods 2024, 13, 251. https://doi.org/10.3390/foods13020251
Qi H, Li H, Chen L, Chen F, Luo J, Zhang C. Hyperspectral Imaging Using a Convolutional Neural Network with Transformer for the Soluble Solid Content and pH Prediction of Cherry Tomatoes. Foods. 2024; 13(2):251. https://doi.org/10.3390/foods13020251
Chicago/Turabian StyleQi, Hengnian, Hongyang Li, Liping Chen, Fengnong Chen, Jiahao Luo, and Chu Zhang. 2024. "Hyperspectral Imaging Using a Convolutional Neural Network with Transformer for the Soluble Solid Content and pH Prediction of Cherry Tomatoes" Foods 13, no. 2: 251. https://doi.org/10.3390/foods13020251
APA StyleQi, H., Li, H., Chen, L., Chen, F., Luo, J., & Zhang, C. (2024). Hyperspectral Imaging Using a Convolutional Neural Network with Transformer for the Soluble Solid Content and pH Prediction of Cherry Tomatoes. Foods, 13(2), 251. https://doi.org/10.3390/foods13020251