Identification of Cadmium Contamination in Rice Using Near-Infrared Reflectance Spectroscopy and Machine Learning
Abstract
1. Introduction
2. Materials and Methods
2.1. Sample Preparation
2.2. Reference Measurement
2.3. Spectral Collection
2.4. Spectral Preprocessing
2.5. Variable Selection
2.6. Chemometric Analysis
2.6.1. PCA
2.6.2. KNN
2.6.3. SVM
2.6.4. PLS-DA
2.7. Model Evaluation
3. Results and Discussion
3.1. Cadmium Content in Rice Samples
3.2. Spectral Characteristics of Rice Samples
3.3. Exploratory Analysis Using PCA
3.4. Classification Models Based on the Full Spectral Range
3.5. Selection of Characteristic Variables
3.6. Classification Models Based on Characteristic Variables
3.7. Optimal Model Performance
3.8. Discussion
4. Conclusions
Supplementary Materials
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Yi, X.; Li, C. Main controllers for improving the resistant starch content in cooked white rice. Food Hydrocoll. 2022, 122, 107083. [Google Scholar] [CrossRef] [Scilit]
- Yan, Y.; Mao, Z.; Wang, X.; Chen, Z.; Ma, C.; Wei, D.; Yan, W.; Wu, X.; Guo, Y.; Xu, H.; et al. From farm to table: Assessing the status and health risk assessment of heavy metal pollution in rice in Henan Province. Front. Public Health 2025, 13, 1499653. [Google Scholar] [CrossRef] [Scilit]
- Ochoa, M.; Tierra, W.; Tupuna-Yerovi, D.S.; Guanoluisa, D.; Otero, X.L.; Ruales, J. Assessment of cadmium and lead contamination in rice farming soils and rice (Oryza sativa L.) from Guayas province in Ecuador. Environ. Pollut. 2020, 260, 114050. [Google Scholar] [CrossRef] [Scilit]
- Charkiewicz, A.E.; Omeljaniuk, W.J.; Nowak, K.; Garley, M.; Nikliński, J. Cadmium toxicity and health effects—A brief summary. Molecules 2023, 28, 6620. [Google Scholar] [CrossRef] [Scilit]
- Ishimaru, Y.; Takahashi, R.; Bashir, K.; Shimo, H.; Senoura, T.; Sugimoto, K.; Ono, K.; Yano, M.; Ishikawa, S.; Arao, T.; et al. Characterizing the role of rice NRAMP5 in manganese, iron and cadmium transport. Sci. Rep. 2012, 2, 286. [Google Scholar] [CrossRef] [Scilit]
- Shi, Z.Y.; Carey, M.; Meharg, C.; Williams, P.N.; Signes-Pastor, A.J.; Triwardhani, E.A.; Pandiangan, F.I.; Campbell, K.; Elliott, C.; Marwa, E.M. Rice grain cadmium concentrations in the global supply-chain. Expo. Health 2020, 12, 869–876. [Google Scholar] [CrossRef] [Scilit]
- Gunduz, S.; Akman, S. Investigation of arsenic and cadmium contents in rice samples in Turkey by electrothermal atomic absorption spectrometry. Food Anal. Methods 2013, 6, 1693–1696. [Google Scholar] [CrossRef] [Scilit]
- Rosa, R.; Granja Arakaki, D.; Melo, E.; Leite, L.; Pereira, H.; Nogueira da Silva, K.R.; Avellaneda Guimares, R.; Freitas, K.C.; Hiane, P.A.; Bogo, D.G.; et al. Determination of selected metals and metalloids in different types of rice by inductively coupled plasma-optical emission spectrometry (ICP-OES). Biol. Trace Elem. Res. 2025, 203, 1734–1745. [Google Scholar] [CrossRef] [Scilit]
- Lan, G.; Li, X.; Jia, H.; Yu, X.; Wang, Z.; Yao, J.; Mao, X. Fast and sensitive determination of cadmium and selenium in rice by direct sampling electrothermal vaporization inductively coupled plasma mass spectrometry. Molecules 2022, 27, 8176. [Google Scholar] [CrossRef] [Scilit]
- Tang, L.; Dong, J.Y.; Qu, M.M.; Lv, Q.M.; Zhang, L.P.; Peng, C.; Hu, Y.Y.; Li, Y.K.; Ji, Z.Y.; Mao, B.G.; et al. Knockout of OsNRAMP5 enhances rice tolerance to cadmium toxicity in response to varying external cadmium concentrations via distinct mechanisms. Sci. Total Environ. 2022, 832, 155006. [Google Scholar] [CrossRef] [Scilit]
- Shimizu, H.; Ishikawa, G.; Aoki, H.; Nakata, M.; Tanaka, J. Development of a KASP marker set for high-throughput genotyping in Japanese barley breeding programs with various end-use purposes. Breed. Sci. 2025, 75, 129–138. [Google Scholar] [CrossRef] [Scilit]
- Cardoso, K.L.R.; de Jesus, J.C.; Dargère, A.F.; da Capela, A.P.; Oliveira, T.D.; Carvalho, G.R.; Santos, L.S.; Faria, P.B.; Ferrao, S.P.B. Discrimination of artisanal Minas cheeses according to geographical origin using spectroscopic and chromatographic techniques associated with chemometrics. Food Chem. 2025, 484, 144466. [Google Scholar] [CrossRef] [Scilit]
- Zhu, Q.; Gao, Y.L.; Yang, B.; Zhao, K.J.; Wang, Z.H.; Huang, F.D.; Cheng, F.M.; Zhao, Q.; Huang, J. Advanced data-driven interpretable analysis for predicting resistant starch content in rice using NIR spectroscopy. Food Chem. 2025, 486, 144311. [Google Scholar] [CrossRef] [Scilit]
- Wang, Q.Y.; Li, F.S.; Jiang, X.Y.; Hao, J.; Zhao, Y.C.; Wu, S.L.; Cai, Y.Y.; Huang, W.G. Quantitative analysis of soil cadmium content based on the fusion of XRF and Vis-NIR data. Chemom. Intell. Lab. Syst. 2022, 226, 104578. [Google Scholar] [CrossRef] [Scilit]
- Díaz, E.O.; Iino, H.; Koyama, K.; Kawamura, S.; Koseki, S.; Lyu, S. Non-destructive quality classification of rice taste properties based on near-infrared spectroscopy and machine learning algorithms. Food Chem. 2023, 429, 136907. [Google Scholar] [CrossRef] [Scilit]
- Wang, L.; Wang, W.; Huang, Z.; Zhen, S.; Wang, R. Discrimination of internal crack for rice seeds using near infrared spectroscopy. Spectrochim. Acta A 2024, 319, 124578. [Google Scholar] [CrossRef] [Scilit]
- Huang, F.; Peng, Y.; Li, L.; Ye, S.; Hong, S. Near-Infrared spectroscopy combined with machine learning methods for distinguishment of the storage years of rice. Infrared Phys. Technol. 2023, 133, 104835. [Google Scholar] [CrossRef] [Scilit]
- Miao, X.; Miao, Y.; Tao, S.H.; Liu, D.B.; Chen, Z.W.; Wang, J.M.; Huang, W.D.; Yu, Y.Y. Classification of rice based on storage time by using near infrared spectroscopy and chemometric methods. Microchem. J. 2021, 171, 106841. [Google Scholar] [CrossRef] [Scilit]
- Tong, P.; Lim, J.K.; Wei, T.; Untzizu, E.; Zhang, H.; Jiang, Y.; Cao, W. Rapid identification of the variety and geographical origin of Wuyou No. 4 rice by fourier transform near-infrared spectroscopy coupled with chemometrics. J. Cereal Sci. 2021, 102, 103322. [Google Scholar] [CrossRef] [Scilit]
- Wongsaipun, S.; Theanjumpol, P.; Kittiwachana, S. Development of a universal calibration model for quantification of adulteration in Thai jasmine rice using near-infrared spectroscopy. Food Anal. Methods 2021, 14, 997–1010. [Google Scholar] [CrossRef] [Scilit]
- Gu, Y.; Wang, P.; Zhang, S.; Dai, J.; Chen, H.P.; Lombi, E.; Howard, D.L.; van der Ent, A.; Zhao, F.J.; Kopittke, P.M. Chemical speciation and distribution of cadmium in rice grain and implications for bioavailability to humans. Environ. Sci. Technol. 2020, 54, 12072–12080. [Google Scholar] [CrossRef] [Scilit]
- Liu, Y.; Xu, L.; Zeng, S.; Qiao, F.; Jiang, W.; Xu, Z. Rapid detection of mussels contaminated by heavy metals using near infrared reflectance spectroscopy and a constrained difference extreme learning machine. Spectrochim. Acta A 2022, 269, 120776. [Google Scholar] [CrossRef] [Scilit]
- Huang, Y.; Du, G.; Ma, Y.; Zhou, J. Predicting heavy metals in dark sun-cured tobacco by near-infrared spectroscopy modeling based on the optimized variable selections. Ind. Crops Prod. 2021, 172, 114003. [Google Scholar] [CrossRef] [Scilit]
- Wang, Z.; Deng, J.; Ding, Z.; Jiang, H. Comparison of optimization algorithms for variable selection to enhance the predictive performance of PLS regression model in determining the concentration of heavy metal Cd in peanut oil. Infrared Phys. Technol. 2024, 138, 105264. [Google Scholar] [CrossRef] [Scilit]
- Gao, W.W.; Yang, Z.; Jiang, C.J.; Sun, H.J.; Wang, Z.W.; Zhang, M.J.; Wei, Y.; Wang, C.T. Near-infrared reflectance spectroscopy model predictive of cadmium concentration in peanut kernels. J. Food Meas. Charact. 2023, 17, 5730–5735. [Google Scholar] [CrossRef] [Scilit]
- Vega-Castellote, M.; Pérez-Marín, D.; Torres-Rodríguez, I.; Moreno-Rojas, J.; Ordoñez-Díaz, J.; Sánchez, M. Green, multivariate approach for obtaining a fingerprint of quality of watermelons at supermarket level using near infrared spectroscopy. LWT-Food Sci. Technol. 2023, 182, 114831. [Google Scholar] [CrossRef] [Scilit]
- Shi, X.; Gan, X.Q.; Wang, X.B.; Peng, J.L.; Li, Z.H.; Wu, X.Q.; Shao, Q.S.; Zhang, A.L. Rapid detection of Ganoderma lucidum spore powder adulterated with dyed starch by NIR spectroscopy and chemometrics. LWT-Food Sci. Technol. 2022, 167, 113829. [Google Scholar] [CrossRef] [Scilit]
- Rezende-de-Souza, J.H.; de Moraes-Neto, V.F.; Pallone, J.A.L.; Pflanzer, S.B. Recognition of beef aging time using a miniaturized near-infrared spectrometer in tandem with support vector machine. Food Chem. 2025, 483, 144226. [Google Scholar] [CrossRef] [Scilit]
- Qi, Z.; Wu, X.; Yang, Y.; Wu, B.; Fu, H. Discrimination of the red jujube varieties using a portable NIR spectrometer and fuzzy improved linear discriminant analysis. Foods 2022, 11, 763. [Google Scholar] [CrossRef] [Scilit]
- Kwao, J.K.; Mingle, C.; Addotey, J.N.; Opuni, K.F.M.; Adutwum, L.A. The impact of cluster resolution feature selection on pattern recognition and classification for detecting Sudan dye adulteration in palm oil. Microchem. J. 2025, 208, 112433. [Google Scholar] [CrossRef] [Scilit]
- Li, T.; Lu, C.Y.; Huang, J.L.; Chen, Y.Y.; Zhang, J.X.; Wei, Y.M.; Wang, Y.J.; Ning, J.M. Qualitative and quantitative analysis of the pile fermentation degree of Pu-erh tea. LWT-Food Sci. Technol. 2023, 173, 114327. [Google Scholar] [CrossRef] [Scilit]
- Lin, X.W.; Liu, R.H.; Wang, S.; Yang, J.W.; Tao, N.P.; Wang, X.C.; Zhou, Q.; Xu, C.H. Direct identification and quantitation of protein peptide powders based on multi-molecular infrared spectroscopy and multivariate data fusion. J. Agric. Food Chem. 2023, 71, 10819–10829. [Google Scholar] [CrossRef] [Scilit]
- Li, H.D.; Liang, Y.Z.; Xu, Q.S.; Cao, D.S. Key wavelengths screening using competitive adaptive reweighted sampling method for multivariate calibration. Anal. Chim. Acta 2009, 648, 77–84. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Xu, Y.; Liu, J.; Sun, Y.; Chen, S.; Miao, X. Fast detection of volatile fatty acids in biogas slurry using NIR spectroscopy combined with feature wavelength selection. Sci. Total Environ. 2023, 857, 159282. [Google Scholar] [CrossRef] [Scilit]
- Brereton, R.G. Numerical introduction to principal components analysis. J. Chemom. 2022, 36, e3405. [Google Scholar] [CrossRef] [Scilit]
- Deng, G.; Li, J.; Liu, H.; Wang, Y. A fast method for predicting adenosine content in porcini mushrooms using Fourier transform near-infrared spectroscopy combined with regression model. LWT-Food Sci. Technol. 2024, 201, 116243. [Google Scholar] [CrossRef] [Scilit]
- GB 2762-2022; National Food Safety Standard-Limits of Contaminants in Food. National Health Commission of the People’s Republic of China and the State Administration for Market Regulation: Beijing, China, 2022.
- Kennard, R.W.; Stone, L.A. Computer aided design of experiments. Technometrics 1969, 11, 137–148. [Google Scholar] [CrossRef] [Scilit]
- Peng, H.; Yi, L.; Fan, X.; Zhang, J.; Gu, Y.; Wang, S. Near-infrared spectroscopy assisted by random forest for predicting the physicochemical indicators of yak milk powder. Food Chem. 2025, 478, 143555. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Wei, Y.; Li, X.; He, Y. Generalisation of tea moisture content models based on VNIR spectra subjected to fractional differential treatment. Biosyst. Eng. 2021, 205, 174–186. [Google Scholar] [CrossRef] [Scilit]
- Shi, S.; Feng, J.H.; Yang, L.C.; Xing, J.Y.; Pan, G.F.; Tang, J.C.; Wang, J.; Liu, J.; Cao, C.G.; Jiang, Y. Combination of NIR spectroscopy and algorithms for rapid differentiation between one-year and two-year stored rice. Spectrochim. Acta A 2023, 291, 122343. [Google Scholar] [CrossRef] [Scilit]
- Yang, H.E.; Kim, N.W.; Lee, H.G.; Kim, M.J.; Sang, W.G.; Yang, C.J.; Mo, C. Prediction of protein content in paddy rice (Oryza sativa L.) combining near-infrared spectroscopy and deep-learning algorithm. Front. Plant Sci. 2024, 15, 1398762. [Google Scholar] [CrossRef] [Scilit]
- Bagchi, T.B.; Sharma, S.; Chattopadhyay, K. Development of NIRS models to predict protein and amylose content of brown rice and proximate compositions of rice bran. Food Chem. 2016, 191, 21–27. [Google Scholar] [CrossRef] [Scilit]
- Liu, Y.; Xu, L.; Wang, R.; Qiao, F.; Xiong, J.; Xu, Z. Study on the detection of heavy metal lead (Pb) in mussels based on near-infrared spectroscopy technology and a REELM classifier. Microchem. J. 2022, 178, 107394. [Google Scholar] [CrossRef] [Scilit]
- Chu, X.L. Practical Guide to Near-Infrared Spectral Interpretation; Chemical Industry Press: Beijing, China, 2019. [Google Scholar]
- Li, P.; Jin, Q.; Liu, H.; Han, L.; Li, C.; Luo, Y. Determination of soluble solids content in loquat using near-infrared spectroscopy coupled with broad learning system and hybrid wavelength selection strategy. LWT-Food Sci. Technol. 2024, 206, 116570. [Google Scholar] [CrossRef] [Scilit]





| Compound | Sample Set | Total Samples | Content (mg/kg) | Mean (mg/kg) | SD | Non-Contaminated Samples | Contaminated Samples |
|---|---|---|---|---|---|---|---|
| Cd | Training set | 159 | 0.005~1.86 | 0.39 | 0.43 | 81 | 78 |
| Test set | 79 | <LOQ~1.83 | 0.41 | 0.44 | 37 | 42 |
| Model | Preprocessing Methods | Training Set | Cross-Validation Set | Test Set | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Sens (%) | Spec (%) | Accu (%) | Sens (%) | Spec (%) | Accu (%) | Sens (%) | Spec (%) | Accu (%) | ||
| KNN | Origin | 86 | 65 | 76 | 88 | 68 | 78 | 81 | 64 | 73 |
| FD | 95 | 83 | 89 | 96 | 85 | 91 | 78 | 88 | 83 | |
| SD | 95 | 83 | 89 | 95 | 86 | 91 | 92 | 93 | 93 | |
| SNV | 88 | 88 | 88 | 85 | 86 | 86 | 89 | 74 | 82 | |
| MSC | 88 | 88 | 88 | 85 | 86 | 86 | 86 | 79 | 83 | |
| Normalize | 93 | 79 | 86 | 93 | 81 | 87 | 86 | 90 | 88 | |
| PLSDA | Origin | 90 | 92 | 91 | 90 | 88 | 89 | 92 | 88 | 90 |
| FD | 100 | 100 | 100 | 90 | 87 | 89 | 86 | 88 | 87 | |
| SD | 100 | 100 | 100 | 89 | 91 | 90 | 84 | 93 | 89 | |
| SNV | 89 | 94 | 92 | 90 | 91 | 91 | 92 | 90 | 91 | |
| MSC | 90 | 94 | 92 | 90 | 91 | 91 | 97 | 57 | 77 | |
| Normalize | 93 | 92 | 93 | 90 | 92 | 91 | 92 | 86 | 89 | |
| SVM | Origin | 89 | 91 | 90 | 89 | 90 | 89 | 89 | 86 | 88 |
| FD | 88 | 94 | 91 | 88 | 94 | 91 | 89 | 88 | 89 | |
| SD | 94 | 88 | 91 | 90 | 90 | 90 | 89 | 93 | 91 | |
| SNV | 90 | 90 | 90 | 90 | 90 | 90 | 92 | 83 | 88 | |
| MSC | 100 | 100 | 100 | 84 | 81 | 83 | 97 | 45 | 71 | |
| Normalize | 95 | 88 | 92 | 91 | 90 | 91 | 89 | 79 | 84 | |
| Model | Data Type | Pretreat Method | Variables | Training Set | Cross-Validation Set | Test Set | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Sens (%) | Spec (%) | Accu (%) | Sens (%) | Spec (%) | Accu (%) | Sens (%) | Spec (%) | Accu (%) | ||||
| KNN | Full | SD | 1154 | 95 | 83 | 89 | 95 | 86 | 91 | 92 | 93 | 92 |
| CARS | SD | 106 | 94 | 87 | 91 | 95 | 88 | 92 | 92 | 93 | 92 | |
| SPA | SD | 10 | 88 | 90 | 89 | 88 | 92 | 90 | 89 | 92 | 91 | |
| UVE | SNV | 278 | 94 | 94 | 94 | 90 | 91 | 91 | 92 | 93 | 92 | |
| PLSDA | Full | SNV | 1154 | 89 | 94 | 91 | 90 | 91 | 91 | 92 | 90 | 91 |
| CARS | origin | 34 | 91 | 94 | 92 | 89 | 92 | 91 | 92 | 93 | 92 | |
| SPA | SD | 10 | 94 | 90 | 92 | 92 | 88 | 90 | 95 | 89 | 92 | |
| UVE | MSC | 284 | 94 | 94 | 94 | 91 | 90 | 90 | 92 | 93 | 92 | |
| SVM | Full | SD | 1154 | 94 | 88 | 91 | 90 | 90 | 90 | 89 | 93 | 91 |
| CARS | FD | 23 | 88 | 92 | 90 | 85 | 92 | 89 | 92 | 93 | 92 | |
| SPA | SD | 10 | 88 | 94 | 91 | 88 | 94 | 91 | 89 | 92 | 91 | |
| UVE | Origin | 593 | 89 | 91 | 90 | 89 | 92 | 91 | 89 | 86 | 87 | |
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. |
© 2026 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.
Share and Cite
Miao, X.; Miao, Y.; Li, N.; Liu, Y.; Wang, W. Identification of Cadmium Contamination in Rice Using Near-Infrared Reflectance Spectroscopy and Machine Learning. Foods 2026, 15, 3000. https://doi.org/10.3390/foods15173000
Miao X, Miao Y, Li N, Liu Y, Wang W. Identification of Cadmium Contamination in Rice Using Near-Infrared Reflectance Spectroscopy and Machine Learning. Foods. 2026; 15(17):3000. https://doi.org/10.3390/foods15173000
Chicago/Turabian StyleMiao, Xuexue, Ying Miao, Ni Li, Yang Liu, and Weiping Wang. 2026. "Identification of Cadmium Contamination in Rice Using Near-Infrared Reflectance Spectroscopy and Machine Learning" Foods 15, no. 17: 3000. https://doi.org/10.3390/foods15173000
APA StyleMiao, X., Miao, Y., Li, N., Liu, Y., & Wang, W. (2026). Identification of Cadmium Contamination in Rice Using Near-Infrared Reflectance Spectroscopy and Machine Learning. Foods, 15(17), 3000. https://doi.org/10.3390/foods15173000
