Identification of Cadmium Contamination in Rice Using Near-Infrared Reflectance Spectroscopy and Machine Learning
Routine monitoring of cadmium (Cd) contamination in rice is essential for public health protection and agricultural trade security. Conventional chemical detection methods are environmentally unfriendly, labor-intensive, and slow. This study presents a rapid, accurate classification approach based on near-infrared reflectance spectroscopy (NIRS) for discriminating Cd-contaminated rice from uncontaminated rice. Five spectral preprocessing methods and three variable selection algorithms were systematically evaluated for their influence on model performance. Classification models were developed using partial least squares discriminant analysis (PLS-DA), K-nearest neighbors (KNN), and support vector machines (SVM). Second derivative (2D) preprocessing yielded the greatest performance gains, raising KNN and SVM test-set accuracy from 73% and 88% to 93% and 91%, respectively. Among the variable selection strategies, the successive projections algorithm (SPA) proved most effective. Under optimized conditions, PLS-DA achieved the best overall performance, attaining 92% accuracy, 89% specificity, and 95% sensitivity on the test set. These results demonstrate the strong potential of NIRS coupled with machine learning for rapid, large-scale Cd surveillance in rice, providing robust technical support for grain quality monitoring and low-cadmium variety breeding programs.