Portable Protein and Fat Detector in Milk Based on Multi-Spectral Sensor and Machine Learning
Abstract
:1. Introduction
2. Materials and Methods
2.1. Milk Samples
2.2. Measuring Device
2.2.1. Raspberry Pi
2.2.2. Multi-Spectral Sensor
2.2.3. Light Source and Constant-Current Driving Circuit
2.2.4. Power Supply Module
2.2.5. Software Setup
2.2.6. Operation Instructions
2.3. Measurement Methods
2.4. XGBoost Algorithms
2.5. Model Training
2.5.1. Correlation Analysis of Model Characteristics
2.5.2. Model Parameter Setting
2.5.3. Repeat Verification
2.5.4. Five-Fold Cross-Validation
3. Results
3.1. Model Comparison
3.2. Instrument Validation Results
4. Discussion
4.1. Near-Infrared Spectroscopy Analysis Using Machine Learning
4.2. Advantages of Proposed Method
4.3. Potential Interference
5. Conclusions
Supplementary Materials
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Hayes, E.; Wallace, D.; O’Donnell, C.; Greene, D.; Hennessy, D.; O’Shea, N.; Tobin, T.J.; Fenelon, M.A. Trend analysis and prediction of seasonal changes in milk composition from a pasture-based dairy research herd. J. Dairy Sci. 2023, 106, 2326–2337. [Google Scholar] [CrossRef]
- Shim, H.W.; Lee, W.Y.; Kim, H.W.; Park, J.K.; Cho, K.; Yeo, J.M.; Park, H.J. Physiological Effects of Hydrolyzed Skim Milk and Probiotics on Osteoporosis Models. Appl. Sci. 2023, 13, 10424. [Google Scholar] [CrossRef]
- Willett, W.C.; Ludwig, D.S. Milk and health. N. Engl. J. Med. 2020, 382, 644–654. [Google Scholar] [CrossRef] [PubMed]
- Kumar, D.N.; Pinker, N.; Shtenberg, G. Porous silicon Fabry–Pérot interferometer for N-acetyl-β-d-glucosaminidase biomarker monitoring. ACS Sens. 2020, 5, 1969–1976. [Google Scholar] [CrossRef] [PubMed]
- Di Marzo, L.; Pranata, J.; Barbano, D.M. Measurement of casein in milk by Kjeldahl and sodium dodecyl sulfate–polyacrylamide gel electrophoresis. J. Dairy Sci. 2021, 104, 7448–7456. [Google Scholar] [CrossRef]
- Gurd, C.; Jefferson, B.; Villa, R.; De Castro Rodriguez, C. Determination of fats, oils and greases in food service establishment wastewater using a modification of the Gerber method. Water Environ. J. 2020, 34, 5–13. [Google Scholar] [CrossRef]
- Di Stefano, V.; Avellone, G.; Bongiorno, D.; Cunsolo, V.; Muccilli, V.; Sforza, S.; Dossena, A.; Drahos, L.; Vékey, K. Applications of liquid chromatography-mass spectrometry for food analysis. J. Chromatogr. A 2012, 1259, 74–85. [Google Scholar] [CrossRef] [PubMed]
- Eskildsen, C.E.; Skov, T.; Hansen, M.S.; Larsen, L.B.; Poulsen, N.A. Quantification of bovine milk protein composition and coagulation properties using infrared spectroscopy and chemometrics: A result of collinearity among reference variables. J. Dairy Sci. 2016, 99, 8178–8186. [Google Scholar] [CrossRef]
- Mohamed, H.; Nagy, P.; Agbaba, J.; Kamal-Eldin, A. Use of near and mid infra-red spectroscopy for analysis of protein, fat, lactose and total solids in raw cow and camel milk. Food Chem. 2021, 334, 127436. [Google Scholar] [CrossRef]
- Soyeurt, H.; Dehareng, F.; Gengler, N.; McParland, S.; Wall, E.P.B.D.; Berry, D.P.; Coffey, M.; Dardenne, P. Mid-infrared prediction of bovine milk fatty acids across multiple breeds, production systems, and countries. J. Dairy Sci. 2011, 94, 1657–1667. [Google Scholar] [CrossRef]
- Bonfatti, V.; Vicario, D.; Lugo, A.; Carnier, P. Genetic parameters of measures and population-wide infrared predictions of 92 traits describing the fine composition and technological properties of milk in Italian Simmental cattle. J. Dairy Sci. 2017, 100, 5526–5540. [Google Scholar] [CrossRef]
- Dabrowska, A.; David, M.; Freitag, S.; Andrews, A.M.; Strasser, G.; Hinkov, B.; Schwaighofer, A.; Lendl, B. Broadband laser-based mid-infrared spectroscopy employing a quantum cascade detector for milk protein analysis. Sens. Actuators B Chem. 2022, 350, 130873. [Google Scholar] [CrossRef]
- Zhao, X.; Song, Y.; Zhang, Y.; Cai, G.; Xue, G.; Liu, Y.; Chen, K.; Zhang, F.; Wang, K.; Zhang, M.; et al. Predictions of milk fatty acid contents by mid-infrared spectroscopy in Chinese Holstein cows. Molecules 2023, 28, 666. [Google Scholar] [CrossRef]
- Diaz-Olivares, J.A.; Adriaens, I.; Stevens, E.; Saeys, W.; Aernouts, B. Online milk composition analysis with an on-farm near-infrared sensor. Comput. Electron. Agric. 2020, 178, 105734. [Google Scholar] [CrossRef]
- De Marchi, M.; Penasa, M.; Zidi, A.; Manuelian, C.L. Invited review: Use of infrared technologies for the assessment of dairy products—Applications and perspectives. J. Dairy Sci. 2018, 101, 10589–10604. [Google Scholar] [CrossRef]
- Yakubu, H.G.; Kovacs, Z.; Toth, T.; Bazar, G. The recent advances of near-infrared spectroscopy in dairy production—A review. Crit. Rev. Food Sci. Nutr. 2022, 62, 810–831. [Google Scholar] [CrossRef] [PubMed]
- Mancini, M.; Mazzoni, L.; Gagliardi, F.; Balducci, F.; Duca, D.; Toscano, G.; Mezzetti, B.; Capocasa, F. Application of the non-destructive NIR technique for the evaluation of strawberry fruits quality parameters. Foods 2020, 9, 441. [Google Scholar] [CrossRef] [PubMed]
- Kapse, S.; Kedia, P.; Kausley, S.; Rai, B. Nondestructive Evaluation of Banana Maturity Using NIR AS7263 Sensor. J. Nondestruct. Eval. 2023, 42, 30. [Google Scholar] [CrossRef]
- Li, J.; Wang, Q.; Xu, L.; Tian, X.; Xia, Y.; Fan, S. Comparison and optimization of models for determination of sugar content in pear by portable Vis-NIR spectroscopy coupled with wavelength selection algorithm. Food Anal. Methods 2019, 12, 12–22. [Google Scholar] [CrossRef]
- Coppa, M.; Ferlay, A.; Leroux, C.; Jestin, M.; Chilliard, Y.; Martin, B.; Andueza, D. Prediction of milk fatty acid composition by near infrared reflectance spectroscopy. Int. Dairy J. 2010, 20, 182–189. [Google Scholar] [CrossRef]
- Uusitalo, S.; Diaz-Olivares, J.; Sumen, J.; Hietala, E.; Adriaens, I.; Saeys, W.; Utriainen, M.; Frondelius, L.; Pastell, M.; Aernouts, B. Evaluation of MEMS NIR Spectrometers for On-Farm Analysis of Raw Milk Composition. Foods 2021, 10, 2686. [Google Scholar] [CrossRef]
- Saranwong, S.; Kawano, S. System design for non-destructive near infrared analyses of chemical components and total aerobic bacteria count of raw milk. J. Near Infrared Spectrosc. 2007, 16, 389–398. [Google Scholar] [CrossRef]
- Muñoz-Salinas, F.; Andrade-Montemayor, H.M.; De la Torre-Carbot, K.; Duarte-Vázquez, M.Á.; Silva-Jarquin, J.C. Comparative analysis of the protein composition of goat milk from French Alpine, Nubian, and Creole breeds and Holstein Friesian cow milk: Implications for early infant nutrition. Animals 2022, 12, 2236. [Google Scholar] [CrossRef] [PubMed]
- Zaky, Z.A.; Sharma, A.; Alamri, S.; Saleh, N.; Aly, A.H. Detection of fat concentration in milk using ternary photonic crystal. Silicon 2021, 14, 6063–6073. [Google Scholar] [CrossRef]
- Almawgani, A.H.; Daher, M.G.; Taya, S.A.; Mashagbeh, M.; Colak, I. Optical detection of fat concentration in milk using MXene-based surface plasmon resonance structure. Biosensors 2022, 12, 535. [Google Scholar] [CrossRef]
- Yang, B.; Zhu, Z.; Gao, M.; Yan, X.; Zhu, X.; Guo, W. A portable detector on main compositions of raw and homogenized milk. Comput. Electron. Agric. 2020, 177, 105668. [Google Scholar] [CrossRef]
- Xingcai, L.; Kun, N. Effectively predict the solar radiation transmittance of dusty photovoltaic panels through Lambert-Beer law. Renew. Energy 2018, 123, 634–638. [Google Scholar] [CrossRef]
- Chen, T.; Guestrin, C. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 785–794. [Google Scholar]
- Maulud, D.; Abdulazeez, A.M. A review on linear regression comprehensive in machine learning. J. Appl. Sci. Technol. Trends 2020, 1, 140–147. [Google Scholar] [CrossRef]
- Ketkar, N.; Ketkar, N. Stochastic gradient descent. In Deep Learning with Python: A Hands-on Introduction; Apress: Berkeley, CA, USA, 2017; pp. 113–132. [Google Scholar]
- Rozos, E.; Dimitriadis, P.; Mazi, K.; Koussis, A.D. A multilayer perceptron model for stochastic synthesis. Hydrology 2021, 8, 67. [Google Scholar] [CrossRef]
- Wang, L.; Zhang, Y.; Yao, Y.; Xiao, Z.; Shang, K.; Guo, X.; Yang, J.; Xue, S.; Wang, J. Gbrt-based estimation of terrestrial latent heat flux in the haihe river basin from satellite and reanalysis datasets. Remote Sens. 2021, 13, 1054. [Google Scholar] [CrossRef]
- Rigatti, S.J. Random forest. J. Insur. Med. 2017, 47, 31–39. [Google Scholar] [CrossRef] [PubMed]
- Niero, G.; Penasa, M.; Gottardo, P.; Cassandro, M.; De Marchi, M. Selecting the most informative mid-infrared spectra wavenumbers to improve the accuracy of prediction models for detailed milk protein content. J. Dairy Sci. 2016, 99, 1853–1858. [Google Scholar] [CrossRef] [PubMed]
- Kawamura, S.; Kawasaki, M.; Nakatsuji, H.; Natsuga, M. Near-infrared spectroscopic sensing system for online monitoring of milk quality during milking. Sens. Instrum. Food Qual. Saf. 2007, 1, 37–43. [Google Scholar] [CrossRef]
- Kucheryavskiy, S.; Melenteva, A.; Bogomolov, A. Determination of fat and total protein content in milk using conventional digital imaging. Talanta 2014, 121, 144–152. [Google Scholar] [CrossRef]
- Gastélum-Barrios, A.; Soto-Zarazúa, G.M.; Escamilla-García, A.; Toledano-Ayala, M.; Macías-Bobadilla, G.; Jauregui-Vazquez, D. Optical Methods Based on Ultraviolet, Visible, and Near-Infrared Spectra to Estimate Fat and Protein in Raw Milk: A Review. Sensors 2020, 20, 3356. [Google Scholar] [CrossRef]
- Dos Santos Pereira, E.V.; de Sousa Fernandes, D.D.; de Araújo, M.C.U.; Diniz, P.H.G.D.; Maciel, M.I.S. Simultaneous determination of goat milk adulteration with cow milk and their fat and protein contents using NIR spectroscopy and PLS algorithms. LWT 2020, 127, 109427. [Google Scholar] [CrossRef]
- Jabbar, H.; Khan, R.Z. Methods to avoid over-fitting and under-fitting in supervised machine learning (comparative study). Comput. Sci. Commun. Instrum. Devices 2015, 70, 978–981. [Google Scholar]
- Aernouts, B.; Van Beers, R.; Watté, R.; Huybrechts, T.; Lammertyn, J.; Saeys, W. Visible and near-infrared bulk optical properties of raw milk. J. Dairy Sci. 2015, 98, 6727–6738. [Google Scholar] [CrossRef] [PubMed]
- Zhu, X.; Guo, W.; Jia, Y.; Kang, F. Dielectric properties of raw milk as functions of protein content and temperature. Food Bioprocess Technol. 2015, 8, 670–680. [Google Scholar] [CrossRef]
- O’connell, A.; Ruegg, P.L.; Jordan, K.; O’brien, B.; Gleeson, D. The effect of storage temperature and duration on the microbial quality of bulk tank milk. J. Dairy Sci. 2016, 99, 3367–3374. [Google Scholar] [CrossRef] [PubMed]
- Marchand, S.; De Block, J.; De Jonghe, V.; Coorevits, A.; Heyndrickx, M.; Herman, L. Biofilm formation in milk production and processing environments; influence on milk quality and safety. Compr. Rev. Food Sci. Food Saf. 2012, 11, 133–147. [Google Scholar] [CrossRef]
Parameters | Protein Model | Fat Model | |
---|---|---|---|
XGBoost | max_depth | 6 | 8 |
n_estimators | 235 | 220 | |
learning_rate | 0.14 | 0.20 | |
subsample | 0.6 | 0.8 | |
reg_alpha | 0 | 0 | |
reg_lambda | 0 | 1 |
R2 | MAE | MSE | ||
---|---|---|---|---|
Original model | Protein | 0.9251 | 0.0459 | 0.0049 |
Fat | 0.9899 | 0.0521 | 0.0070 | |
Optimized model | Protein | 0.9816 | 0.0086 | 0.0012 |
Fat | 0.9978 | 0.0079 | 0.0015 | |
Improvement | Protein | 6.11% | 81.26% | 75.51% |
Fat | 0.80% | 84.84% | 78.57% |
Data | Protein | Fat | ||||
---|---|---|---|---|---|---|
R2 | MAE | MSE | R2 | MAE | MSE | |
Fold-1 | 0.8641 | 0.0325 | 0.0084 | 0.9831 | 0.0354 | 0.0127 |
Fold-2 | 0.9021 | 0.0238 | 0.0052 | 0.9209 | 0.0413 | 0.0319 |
Fold-3 | 0.7832 | 0.0395 | 0.0163 | 0.9787 | 0.0343 | 0.0135 |
Fold-4 | 0.8491 | 0.0307 | 0.0102 | 0.9903 | 0.0312 | 0.0078 |
Fold-5 | 0.9401 | 0.0244 | 0.0042 | 0.9837 | 0.0363 | 0.0132 |
Average | 0.8677 | 0.0301 | 0.0088 | 0.9713 | 0.0357 | 0.0158 |
Method | R² | MAE | MSE | |
---|---|---|---|---|
LR | Protein | 0.1809 | 0.1806 | 0.0541 |
Fat | 0.8624 | 0.2290 | 0.0946 | |
SGD | Protein | 0.1165 | 0.1866 | 0.0584 |
Fat | 0.8112 | 0.2739 | 0.1300 | |
MLP | Protein | 0.6405 | 0.1155 | 0.0237 |
Fat | 0.5792 | 0.1270 | 0.0278 | |
GBRT | Protein | 0.7905 | 0.0847 | 0.0134 |
Fat | 0.9919 | 0.0959 | 0.0160 | |
RF | Protein | 0.9703 | 0.0136 | 0.0020 |
Fat | 0.9951 | 0.0172 | 0.0035 | |
XGBOOST | Protein | 0.9864 | 0.0048 | 0.0009 |
Fat | 0.9994 | 0.0079 | 0.0013 |
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. |
© 2023 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
Wang, Y.; Zhang, K.; Shi, S.; Wang, Q.; Liu, S. Portable Protein and Fat Detector in Milk Based on Multi-Spectral Sensor and Machine Learning. Appl. Sci. 2023, 13, 12320. https://doi.org/10.3390/app132212320
Wang Y, Zhang K, Shi S, Wang Q, Liu S. Portable Protein and Fat Detector in Milk Based on Multi-Spectral Sensor and Machine Learning. Applied Sciences. 2023; 13(22):12320. https://doi.org/10.3390/app132212320
Chicago/Turabian StyleWang, Yanyan, Kaikai Zhang, Shengzhe Shi, Qingqing Wang, and Sheng Liu. 2023. "Portable Protein and Fat Detector in Milk Based on Multi-Spectral Sensor and Machine Learning" Applied Sciences 13, no. 22: 12320. https://doi.org/10.3390/app132212320
APA StyleWang, Y., Zhang, K., Shi, S., Wang, Q., & Liu, S. (2023). Portable Protein and Fat Detector in Milk Based on Multi-Spectral Sensor and Machine Learning. Applied Sciences, 13(22), 12320. https://doi.org/10.3390/app132212320