Non-destructive classification of milk types using visible–near infrared spectroscopy and machine learning
Abstract
Milk authentication is important for ensuring product quality, consumer confidence, and regulatory compliance in the dairy industry. This study developed a non-destructive milk classification framework by integrating Visible–Near Infrared (Vis–NIR) spectroscopy with machine learning to differentiate cow milk, goat milk, and reconstituted milk. A total of 3000 spectra (1000 per class) were collected and divided into training (n = 2400) and independent test (n = 600) datasets using stratified sampling. Four preprocessing pipelines and ten machine learning models were systematically evaluated. Spectral analysis revealed clear class-dependent differences, particularly within the 600–1000 nm region, corresponding to absorption features associated with water, lipids, and proteins. Principal Component Analysis (PCA) demonstrated distinct clustering among milk classes, indicating strong spectral separability. Cross-validation performed on the training dataset showed excellent performance, with XGBoost achieving the highest mean accuracy (99.35%), followed by LightGBM (99.20%) and Gradient Boosting (99.00%). Independent test evaluation further confirmed strong generalization capability, where XGBoost achieved the highest accuracy (99.17%). Overall, the results demonstrate the potential of Vis–NIR spectroscopy combined with machine learning for rapid and reliable milk authentication.
Fields of Study & Subjects
Spectroscopy and Chemometric Analyses
Milk Quality and Mastitis in Dairy Cows
Identification and Quantification in Food
Publication details
- Journal / source
- Journal of Food Composition and Analysis
- Publisher
- Elsevier BV
- Volume
- 156
- Pages
- 109313–109313
- Publication date
- 12 June 2026
- Language
- EN