Raw Milk Analysis

Return to Smart Farming

Overview

Milk is one the most widely used products and it is the raw material of all dairy products. Given this, measuring milk components has become very crucial for the dairy industry. Each dairy product requires milk with different ratios of its contents. Moreover, in order to keep track of the product quality, milk contents should be measured regularly. Besides the dairy industry, milk analysis has a high impact on the supplying milk farming industry as well. The contents of the milk are closely related to the health of the animal and the quality and content of its feed. Accordingly, these measurements can provide valuable insights to enhance the quality and selection of their feed, as well as valuable insights for early diagnosis and treatment of sick animals.

Nowadays, the most accurate methods for milk analysis are chemical decomposition methods which are slow, destructive and must be done in the lab not the field. Practically, users usually take samples from many milk batches and get an averaged conclusion for all batches. Monitoring health and feeding quality for the animals using these methods is extremely expensive and very inefficient.

A simple tool for rapid measurement of the milk contents would be a significant progress in both the dairy and the milk farming industries. This tool has to be portable, affordable and should allow users to analyze their target samples non- destructively and in the field, and preferably inline in the milking station in the case of milk farming applications. Miniaturization of near-infrared (NIR) spectrometers has advanced to the point where handheld instruments could provide reliable and affordable means to serve this purpose. In this application note, we demonstrate the possibility of using NeoSpectra spectral sensors for the analysis of milk in the field.

Nowadays, the most accurate methods for milk analysis are chemical decomposition methods which are slow, destructive and must be done in the lab not the field. Practically, users usually take samples from many milk batches and get an averaged conclusion for all batches. Monitoring health and feeding quality for the animals using these methods is extremely expensive and very inefficient.

A simple tool for rapid measurement of the milk contents would be a significant progress in both the dairy and the milk farming industries. This tool has to be portable, affordable and should allow users to analyze their target samples non- destructively and in the field, and preferably inline in the milking station in the case of milk farming applications. Miniaturization of near-infrared (NIR) spectrometers has advanced to the point where handheld instruments could provide reliable and affordable means to serve this purpose. In this application note, we demonstrate the possibility of using NeoSpectra spectral sensors for the analysis of milk in the field.

Quantify milk contents

In order to demonstrate the ability of NeoSpectra spectral sensors in quantification of raw milk contents, we choose to perform our analysis on the fat, protein and lactose components of raw milk to determine the percentage of each component in a test sample.

Sample set used:
• Samples were collected from local farms, where each sample is collected from a different animal to ensure that the sample space has a good variance.
• Accurate destructive chemical tests were performed on the samples to record accurately their contents.
• Number of samples is 131.
• Each sample was measured 5 times with the NeoSpectra spectral sensor.

Measurement conditions:
• Measurements are done in diffuse reflection.
• Spectral range: 1300 – 2600 nm.
• Scan time: 2s.
• Resolution: 16nm at λ=1,550 nm.
• Spot size = 3 mm2.
• Background: 99% Spectralon™ (a reflection standard with almost flat spectral response in NIR).
• All measurements were performed at room temperature.

Some standard and simple data treatment processes were performed on measured spectra:
• The wavelength scale was converted into wavenumbers in the range 7692 – 3846 1 cm.
• Spectra were pretreated using baseline correction and scattering effects removal routines.

Data evaluation:
• Partial least squares regression (PLS) models were built to develop a linear relation between the spectra and the milk contents measurements, which were determined using lab chemical analysis. This model is used in the prediction of milk sample contents percentages from its spectrum only. PLS reduces spectrum data into a small number of latent variables (L.V.) to reduce the complexity of the data since each spectrum may originally exceed 300 variables (wavelengths). Latent variables were chosen according to their correlation with the responses (milk contents in our case); variables with high correlation were chosen while others with lower correlation were discarded. After that a linear regression was fit to relate the predictors (L.V. of the spectra) to the responses (milk contents quantifications).

• A cross validation technique was used to calculate the performance of the PLS model by reporting the prediction error (root mean square of the errors of all samples) and the coefficient of determination (R2) between predicted contents and the reference data (reported from chemical analysis). This technique splits the data into calibration and validation sets. The calibration set is used to train the PLS model while the validation set is used for reporting the performance of the model. In the next iteration, the validation and calibration sets are mixed together, another portion of data is taken as the validation set, and finally, model training and validation on the new sets are repeated. The previous procedure is repeated again and again until each sample was represented once in the validation set. Results from the cross validation are shown in Figure 1,

Figure 1.
The relation between the reference data (chemical analysis) and the predicted results from our model. Each circle represents a test sample where the x-coordinate is the reference value and the y-coordinate is the model prediction. The red line represents the ideal model and R 2 (ideal value is 1) shows how far the model deviates from the ideal one.

Conclusions

This investigation develops a milk analysis model by applying preprocessing methods to the spectra then using PLS to build a regression model. In the prediction phase, the developed model is used to predict the content of the test sample.

These results clearly demonstrate that the spectra of the raw milk samples measured with NeoSpectra spectral sensros provide suitable analytical data to accurately measure the milk contents with an error less than 8% of the full range for any of the components as opposed to an error of 9% using a commercial benchtop ultrasound-based analysis tool for the same samples set. On the other hand, the absolute error from these investigations is slightly better in predicting protein and lactose percentages compared to numbers reported in research papers using commercially available lab benchtop spectrometers. However, absolute error for predicting fat percentages was not as good due to the small spot size used. NeoSpectra spectral sensors can support larger spot sizes to address such issues. This validates the potential of this technology to enable fast, non-destructive testing in the field and without the need for sample preparation using a low-cost technology that enables a scalable solution for milk qualification.

Download the Raw Milk Analysis PDF >