Research| Volume 101, ISSUE 5, P4448-4459, May 01, 2018

# Automated body weight prediction of dairy cows using 3-dimensional vision

Open AccessPublished:February 21, 2018

## ABSTRACT

The objectives of this study were to quantify the error of body weight prediction using automatically measured morphological traits in a 3-dimensional (3-D) vision system and to assess the influence of various sources of uncertainty on body weight prediction. In this case study, an image acquisition setup was created in a cow selection box equipped with a top-view 3-D camera. Morphological traits of hip height, hip width, and rump length were automatically extracted from the raw 3-D images taken of the rump area of dairy cows (n = 30). These traits combined with days in milk, age, and parity were used in multiple linear regression models to predict body weight. To find the best prediction model, an exhaustive feature selection algorithm was used to build intermediate models (n = 63). Each model was validated by leave-one-out cross-validation, giving the root mean square error and mean absolute percentage error. The model consisting of hip width (measurement variability of 0.006 m), days in milk, and parity was the best model, with the lowest errors of 41.2 kg of root mean square error and 5.2% mean absolute percentage error. Our integrated system, including the image acquisition setup, image analysis, and the best prediction model, predicted the body weights with a performance similar to that achieved using semi-automated or manual methods. Moreover, the variability of our simplified morphological trait measurement showed a negligible contribution to the uncertainty of body weight prediction. We suggest that dairy cow body weight prediction can be improved by incorporating more predictive morphological traits and by improving the prediction model structure.

## INTRODUCTION

Since 1960, the average farm size has increased in some upper-middle-income countries and almost all high-income countries throughout the world (
• Lowder S.K.
• Skoet J.
• Raney T.
The number, size, and distribution of farms, smallholder farms, and family farms worldwide.
). In the Netherlands, for example, the total number of dairy cows kept by farmers increased by 13%, whereas the number of dairy farms decreased by 29%, from 2005 to 2015 (
• Statistics Netherlands
Agriculture; Crops, Livestock and Land Use by General Farm Type, Region.
). Moreover, Dutch dairy farmers increased the average annual milk yield per cow to 8,373 kg in 2015 (
• CRV
Melkproductieregistratie Statistiek–Rollend Jaargemiddelde Melkproductie Landelijk.
). However, concerns about the welfare of production animals are growing among the general public (
• Wolf C.A.
• Tonsor G.T.
• McKendree M.G.S.
• Thomson D.U.
• Swanson J.C.
Public and farmer perceptions of dairy cattle welfare in the United States.
). Consumers significantly influence the dairy industry by choosing premium welfare products (
• de Graaf S.
• Van Loo E.J.
• Bijttebier J.
• Vanhonacker F.
• Lauwers L.
• Tuyttens F.A.M.
• Verbeke W.
Determinants of consumer intention to purchase animal-friendly milk.
). With increasing production per cow and pressure from consumers, dairy farmers must provide intensive and high-standard care to individual cows to maintain high-quality and animal-friendly milk production. Due to farm upscaling, however, it becomes increasingly difficult to manage individual care because of the high number of cows per full-time equivalent and the high labor demand (
• Barkema H.W.
• Von Keyserlingk M.A.G.
• Kastelic J.P.
• Lam T.J.G.M.
• Luby C.
• Roy J.-P.
Invited review: Changes in the dairy industry affecting dairy cattle health and welfare.
). To ease the burden, farmers can choose to purchase available commercial products to automate certain routine labor-intensive procedures, such as milking and feeding (
• Jacobs J.A.
• Siegford J.M.
Invited review: The impact of automatic milking systems on dairy cow management, behavior, health, and welfare.
). For other procedures, such as health monitoring, available equipment to automate the procedures is less developed. Recent developments in sensor technology offer promising solutions to automate health monitoring by collecting daily information on the physical status of individual cows (
• Rutten C.J.
• Velthuis A.G.J.
• Steeneveld W.
• Hogeveen H.
Invited review: Sensors to support health management on dairy farms.
). Continuous monitoring can help farmers gain insight into a cow's changes over time, identify anomalies in their health status, and take necessary actions. Automation of continuous health monitoring will contribute to maintaining high-quality care for individual cows under increasing farm size and production.
An example of health monitoring includes monitoring of the BW of dairy cows. Body weight changes during lactation. This change reflects the energy balance in the cow (
• Mäntysaari P.
• Mäntysaari E.A.
Modeling of daily body weights and body weight changes of Nordic Red cows.
). A long-term negative energy balance could cause problems in health and reproduction (
• de Vries M.J.
• van der Beek S.
• Kaal-Lansbergen L.M.
• Ouweltjes W.
• Wilmink J.B.
Modeling of energy balance in early lactation and the effect of energy deficits in early lactation on first detected estrus postpartum in dairy cows.
;
• Collard B.L.
• Boettcher P.J.
• Dekkers J.C.M.
• Petitclerc D.
• Schaeffer L.R.
Relationships between energy balance and health traits of dairy cattle in early lactation.
). To estimate the effect of a negative energy balance, frequently measured BW can be used in farm management (
• Thorup V.M.
• Edwards D.
• Friggens N.C.
On-farm estimation of energy balance in dairy cows using only frequent body weight measurements and body condition score.
). Thus, monitoring BW can help farmers to make management decisions with respect to a cow's health status (
• van der Tol P.P.J.
• van der Kamp A.
Time series analysis of live weight as health indicator.
). More importantly, the BW of individual cows must be measured and monitored automatically to prevent additional labor input and to ensure farmers have time to maintain high quality and individual care (
• Maltz E.
The body weight of the dairy cow: III. Use for on-line management of individual cows.
). Often, dairy cows are weighed routinely with automated weighing scales (
• Alawneh J.I.
• Stevenson M.A.
• Williamson N.B.
• Lopez-Villalobos N.
• Otley T.
Automatic recording of daily walkover liveweight of dairy cattle at pasture in the first 100 days in milk.
). Such scales, however, are relatively expensive and their electronics are prone to damage in the harsh environment covered with manure and urine and in direct contact with cows (
• Dickinson R.A.
• Morton J.M.
• Beggs D.S.
• Anderson G.A.
• Pyman M.F.
• Mansell P.D.
• Blackwood C.B.
An automated walk-over weighing system as a tool for measuring liveweight change in lactating dairy cows.
). Hence, a low-cost and robust automated weighing system is needed.
As an alternative to the use of scales, BW can be predicted based on morphological traits that are significantly correlated with weight, such as heart girth (
• Heinrichs A.J.
• Rogers G.W.
• Cooper J.B.
Predicting body weight and wither height in Holstein heifers using body measurements.
), withers height (
• Tasdemir S.
• Urkmez A.
• Inal S.
Determination of body measurements on the Holstein cows using digital image analysis and estimation of live weight with regression analysis.
), and hip width (
• Enevoldsen C.
• Kristensen T.
Estimation of body weight from body size measurements and body condition scores in dairy cows.
). These morphological traits are typically measured manually. In addition to being labor intensive, the measurement process can be stressful to cows (
• Dickinson R.A.
• Morton J.M.
• Beggs D.S.
• Anderson G.A.
• Pyman M.F.
• Mansell P.D.
• Blackwood C.B.
An automated walk-over weighing system as a tool for measuring liveweight change in lactating dairy cows.
). To automate the morphological trait measurement, new techniques, such as computer vision, have been explored (
• Tasdemir S.
• Urkmez A.
• Inal S.
Determination of body measurements on the Holstein cows using digital image analysis and estimation of live weight with regression analysis.
;

Marinello, F., A. Pezzuolo, D. Cillis, F. Gasparini, and L. Sartori. 2015. Application of Kinect-Sensor for three-dimensional body measurements of cows. Pages 661–669 in 7th European Conference on Precision Livestock Farming, ECPLF 2015. European Conference on Precision Livestock Farming, Milan, Italy.

). With computer vision, morphological traits are defined and measured as distances or areas among pre-identified anatomical landmarks on the surface of a cow's body (
• Kuzuhara Y.
• Kawamura K.
• Yoshitoshi R.
• Tamaki T.
• Sugai S.
• Ikegami M.
• Kurokawa Y.
• Obitsu T.
• Okita M.
• Sugino T.
• Yasuda T.
A preliminarily study for predicting body weight and milk properties in lactating Holstein cows using a three-dimensional camera system.
). These anatomical landmarks are typically clearly visible, such as some bone structures (e.g., hip bones and spine) that clearly protrude from their surrounding region (
• Kawasue K.
• Ikeda T.
• Tokunaga T.
Three-dimensional shape measurement system for black cattle using KINECT sensor.
). Identifying anatomical landmarks with computer vision is the basis for automatically measuring morphological traits and their derivatives.
Currently used computer vision techniques to measure dairy cow morphological traits include 2-dimensional (2-D) vision, thermal vision (
• Stajnko D.
• Brus M.
• Hočevar M.
Estimation of bull live weight through thermographically measured body dimensions.
), stereo vision using multiple calibrated 2-D cameras (
• Tasdemir S.
• Urkmez A.
• Inal S.
Determination of body measurements on the Holstein cows using digital image analysis and estimation of live weight with regression analysis.
), and 3-dimensional (3-D) vision using one or multiple 3-D cameras (

Marinello, F., A. Pezzuolo, D. Cillis, F. Gasparini, and L. Sartori. 2015. Application of Kinect-Sensor for three-dimensional body measurements of cows. Pages 661–669 in 7th European Conference on Precision Livestock Farming, ECPLF 2015. European Conference on Precision Livestock Farming, Milan, Italy.

;
• Salau J.
• Haas J.H.
• Junge W.
• Thaller G.
Extrinsic calibration of a multi-Kinect camera scanning passage for measuring functional traits in dairy cows.
). Images taken in 3-D vision, in contrast to 2-D vision, show a clear depth difference between a cow and the background. This difference can significantly simplify the background segmentation (
• Rosell-Polo J.R.
• Cheeinx F.A.
• Gregorio E.
• Andújar D.
• Puigdomènech L.
• Masip J.
• Escolà A.
Advances in structured light sensors applications in precision agriculture and livestock farming.
). Moreover, images taken in 3-D vision include depth information on the body surface, whereas 2-D and thermal images include only body contour and cross-sectional area information. Additionally, certain morphological traits quantified using 3-D vision are more strongly correlated with manually measured reference values compared with stereo vision (
• Tasdemir S.
• Urkmez A.
• Inal S.
Determination of body measurements on the Holstein cows using digital image analysis and estimation of live weight with regression analysis.
;

Marinello, F., A. Pezzuolo, D. Cillis, F. Gasparini, and L. Sartori. 2015. Application of Kinect-Sensor for three-dimensional body measurements of cows. Pages 661–669 in 7th European Conference on Precision Livestock Farming, ECPLF 2015. European Conference on Precision Livestock Farming, Milan, Italy.

). Lastly, compared with a single 3-D camera, the costs for multiple 2-D or 3-D cameras and a subsequent recording synchronization system are substantially higher (
• Kuzuhara Y.
• Kawamura K.
• Yoshitoshi R.
• Tamaki T.
• Sugai S.
• Ikegami M.
• Kurokawa Y.
• Obitsu T.
• Okita M.
• Sugino T.
• Yasuda T.
A preliminarily study for predicting body weight and milk properties in lactating Holstein cows using a three-dimensional camera system.
).
In this case study, we chose to quantify dairy cow body morphological traits by automatically processing images taken in a 3-D single-camera vision system. The error produced in the automated image processing will produce an error in the quantification of morphological traits, which in turn might have considerable consequences for BW prediction. The objectives of this study were to quantify the error of BW prediction using automatically measured morphological traits in a 3-D vision system and to assess the influence of various sources of uncertainty in BW prediction.

## MATERIALS AND METHODS

### Image Acquisition

In December 2015, 3-D images of 30 lactating Holstein cows (i.e., one image per cow) were acquired at a commercial dairy farm in the Netherlands. The farm had a freestall barn equipped with automatic milking systems (AMS, Astronaut A4, Lely Industries N.V., Maassluis, the Netherlands). Near one of the AMS, an image acquisition setup was constructed (Figure 1). The setup was placed next to the exit of the AMS so that cows could enter it immediately after milking. The setup consisted of a cow selection box, an electronic weighing scale, a 3-D camera, and a computer that connected and controlled the setup.
A cow selection box (Grazeway, Lely Industries N.V) was built with automatic entrance and exit gates. Near the exit gate, a cow identification (ID) receiver (long-range wireless base unit, SCR, Netanya, Israel) was mounted on the side of the box. The receiver automatically identified the cow in the setup through an ID tag (HR-LD, SCR) around its neck. The floor of the box was an iron plate (2.8 × 0.8 × 0.15 m) attached to an electronic weighing scale (AllScales, Hank Maas B.V., Veen, the Netherlands). One load cell was attached to each corner under the iron plate, and all 4 could weigh up to 1,500 kg with a measurement precision of 0.5 kg. These load cells were connected to a digital weight indicator that showed a stable weight every second when the difference between the currently measured weight and the previous weight was no more than 1 kg.
A 3-D camera (Kinect Sensor for Windows version 2, Microsoft, Redmond, WA) was mounted on the metal frame of the selection box to capture a top-view image of a cow's rump. The 3-D camera was a depth-sensing time-of-flight camera with a resolution of 512 × 424 pixels and a field of view of 70° (horizontal) × 60° (vertical). Its range was between 0.5 m and 4.5 m, with a pixel size of 0.003 × 0.003 m and depth precision of 0.001 m at a viewing distance of 1 m. The camera was attached to the box at an angle of 3° to the xy plane to capture the greatest possible amount of information on a cow's body. The angles to the other 2 planes were 0°. Moreover, the center of the camera lens was on the centerline of the box in the x direction, 0.50 m from the entrance gate in the y direction, and 1.95 m above the iron plate of the weighing scale in the z direction (Figure 2).
Image acquisition was triggered by a cow entering the setup after a successful milking. Both the entrance and exit gates of the selection box were closed to keep the cow in the box. After closing both gates, a raw 3-D image of the cow's rump was taken and saved by an image recording algorithm in C-language. The recording algorithm also saved the cow's ID, the recording time, and the weight measured at the recording time from the electronic weighing scale. Additionally, DIM, age, and parity were collected from a dairy farm management software (T4C, Lely Industries N.V.). After image acquisition, the exit gate was opened to release the cow.

### Image Analysis

All raw images were processed in 6 steps (Figure 3) and using the Computer Vision System and Image Processing toolboxes in Matlab (2016a, MathWorks, Natick, MA). Each raw 3-D image (e.g., Figure 4) was a point cloud consisting of a set of data points with xyz coordinates. The coordinates represented the relative position of each point on the object to the center of the camera lens in the x, y, and z directions. The raw 3-D image included the surface of a cow's body, the frames of the selection box, the weighing scale, and image noise.

#### Step 1. Cow Body Segmentation

The body surface of each cow (Figure 5a) was segmented from the raw image by determining the boundaries of a region of interest (ROI) in the x, y, and z directions and selecting points within the ROI as the cow body. The ROI boundaries in the x and y directions were assumed to be the positions of the metal frames of the selection box. These boundaries were determined by measuring the metal frames in an empty image without cows. The boundary in the z direction was set to 1 m to separate the body of each cow from the ground. After cow body segmentation, all points within the ROI boundaries were saved as the cow's body surface.

#### Step 2. Image Noise Removal

The remaining small groups of points or single points, which were isolated from the cow's body in the segmented image, were considered image noise and removed using a noise removal algorithm. The algorithm calculated the mean of the distances between every point in the ROI and its neighbors. Any point with a mean distance greater than the threshold (i.e., mean plus 1 SD of the mean distances of all points) was identified as image noise and discarded from the image (Figure 5b).

#### Step 3. Transformation

To correct for the fact that camera was mounted at a 3-degree angle to the xy plane, the 3-D image was rotated back by 3°. Moreover, the starting point of the z-axis was converted from the center of the camera lens to the surface of the iron plate of the weighing scale. The z-axis conversion made each point's z coordinate the height above the plate (Figure 5c).

#### Step 4. Interpolation

The 3-D image was interpolated into a mesh grid with a grid spacing of 0.005 m in the x and y directions. For each grid point, we assigned its value as the z value of its nearest neighbor in the point cloud (Figure 5d). The mesh grid image was considered a matrix. The columns and rows of the matrix were represented by the mesh grid points in the x and y directions, and the elements of the matrix were the heights of the grid points in the z direction.

#### Step 5. Anatomical Landmark Identification

Vertebrae in the lumbar, sacrum, and coccyx of the spine form a clearly protruding ridge; therefore, they are seen as the highest part of the surface of a cow's rump. To find this ridge in the matrix, we first identified the highest element of each row (Figure 5e). Then, these elements were connected in a line, which represented the spine in the craniocaudal direction. To standardize the mesh grid image (i.e., matrix), we rotated the image in the xy plane to align the spine line perpendicular to the x-axis and parallel to the y-axis. After rotation, the spine was represented as a single column in the matrix.
In addition to spine identification, we located the anatomical landmarks of hip bones (tuber coxae) and pin bones (tuber ischii), which clearly protrude on the lateral sides of a cow's rump. To locate these bones, we first separated the matrix into left and right (in the x direction) by discarding the spine and its adjacent columns (n = 20) on both sides from the matrix. Second, both the left and right parts of the matrix were separated into the front and rear in the y direction by discarding the middle rows (n = 11) from the matrix. Excluding the middle columns and rows will separate the matrix into 4 quadrants (Figure 5f), which ensured that only one protruding anatomical landmark (either a hip or pin bone) could be located in each quadrant. For each quadrant, the row with the greatest mean height was considered to cross the protruding bone. In this row, the farthest element from the spine, which was higher than the mean height of the quadrant, was identified as the center of the protruding bone (Figure 5f).

#### Step 6. Morphological Trait Quantification

Three morphological traits were quantified in the matrix based on the pre-located centers of the anatomical landmarks (Figure 6). Hip height was defined as the mean height of the 2 hip bone centers. Rump length was defined as the mean distance in the y direction between the centers of the hip and pin bones from both sides of the body. Hip width was defined as the distance in the x direction between the 2 hip bone centers.

### Body Weight Prediction Model

A multiple linear regression model was built with the data set of 30 cows to predict dairy cow BW (Equation [1]). This data set included automatically quantified morphological traits (i.e., hip height, rump length, and hip width), DIM, parity, age, and referential BW (i.e., the weight measured using the electronic weighing scale). The model with all 6 traits as input variables was defined as the full model:
$BW=β0+β1×HipHeight+β2×RumpLength+β3×HipWidth+β4×DIMi+β5×Age+β6×Parityi+ɛ,ɛ∼N(0, σɛ2)i.i.d.,$
[1]

where β is a parameter vector, ε is an error term, $σɛ2$ is the error variance, i denotes the ith cow, and i.i.d. indicates independent and identically distributed.
To improve the full model with respect to predictive power, an exhaustive feature selection algorithm was used to build and test intermediate models with all 63 possible input variable combinations. Each intermediate model was trained and validated by leave-one-out cross-validation using the Statistics and Machine Learning toolbox in Matlab. The predictive performances of the full and intermediate models were quantified by the root mean square error (RMSE; Equation [2]) and mean absolute percentage error (MAPE; Equation [3]):
$RMSE=∑i=1n(yi−y¯i)n,$
[2]

$MAPE=1n∑i=1n|yi−yˆiyi|×100%,$
[3]

where yi is the referential BW, $yˆi$ is the estimated BW from the prediction model, n is the total number of cows (i.e., n = 30), and i denotes the ith cow. Of all 64 models, the one with the smallest RMSE was selected as our final (best) model to predict BW.

### Quantification of Variability in Morphological Trait Measurement

For each morphological trait, the variability of the automated measurement was estimated by the standard deviation of the repeated measurements (n = 9) on a life-size model cow. These measurements were conducted by placing the model cow at 9 locations with a position difference of 0.05 m in either the x, y, or both directions in the image acquisition setup.
To compare with the automated measurement, the morphological traits of the same model cow were independently measured by 10 human assessors using a ruler attached to a spirit level and a stadiometer with a measurement precision of 0.005 m for both tools. The 10 assessors were engineers with no experience in quantifying cow morphological traits and were individually introduced to a predefined protocol (Appendix). They independently identified anatomical landmarks (e.g., hip and pin bones) and measured the morphological traits (i.e., distances and heights) of the model cow. The standard deviation of each morphological trait measured by the 10 assessors was calculated as an estimate of the variability of the manual measurement.

### Propagation of Morphological Trait Measurement Error into Body Weight Prediction

To compute the influence of the morphological trait measurement error (estimated by the variability of the measurement) on the BW prediction error, we created 3 artificial data sets (A, B, and C) and referential BW based on the final model (Equation [4]):
BW = β0 + β1 × X1 + β2 × X2 + … + βk × Xk + ε,

$ɛ∼N(0,σɛ2)i.i.d.,$
[4]

where β is a parameter vector, X is the input variable in the final model (including morphological traits and age-related information), k is the number of input variables in the final model, ε is an error term with a normal distribution, and $σɛ2$ is the error variance. All 3 data sets were used to compute and compare the BW predictive performances. Data set A represented a set of morphological traits in the final model without the influence of the measurement error; data set B represented the same set of morphological traits under the influence of automated measurement error; data set C represented the same set of morphological traits under the influence of manual measurement error.
Data set A was created as follows: for each morphological trait, a collection of 1,000 samples was drawn from {XA}1000$N(X¯,σx2),$ where $X¯$ is the mean of the trait in our 30-cow data set and $σx2$ is the variance of the trait calculated based on
$σX2=1n−1∑i=1n(Xi−X¯,),$
[5]

where Xi is the input variable (not including age-related information) of the ith cow, n is the total number of cows (i.e, n = 30), and i denotes the ith cow.
Data set B was created in a similar way as data set A, with only one difference: after creating a collection of 1,000 samples of each of the morphological traits, the samples were artificially disturbed by an error εAM stemming from the automated morphological trait measurement. This error was modeled as εAM$N(0,σAM2),$ where $σAM2$ is the squared value of the automated measurement variability calculated in the Quantification of Variability in Morphological Trait Measurement section. Effectively, the 1,000-sample collection of data set B was drawn from {XB}1000$N(X¯,σX2+σAM2).$
Data set C was created in a similar way as data set B. The samples, however, were artificially disturbed by a manual measurement error εMM$N(0,σMM2),$ where $σMM2$ is the squared value of the manual measurement variability calculated in the Quantification of Variability in Morphological Trait Measurement section. Effectively, the 1,000-sample collection of data set C was drawn from {XC}1000$N(X¯,σX2+σMM2).$
Referential BW was a collection of 1,000 samples calculated based on Equation [4] with the morphological traits in data set A, the means of the age-related information of the 30-cow data set, and error term ε was drawn from ε$N(0,σɛ2)i.i.d.,$ where $σɛ2$ is the error variance of our 30-cow data set testing on the final model based on
$σɛ2=SSEn−(k+1),$
[6]

where SSE is the sum of squared error, n is the number of samples (i.e., n = 30), and k is the number of the input variables in the final model.
For each data set, a multiple linear regression was tested against the referential BW. The BW predictive performance of the data set was quantified with the RMSE and MAPE in the same way as in the Body Weight Prediction Model section. The prediction error differences among the data set were the estimates of the influences of different measurement errors on BW prediction.

## RESULTS

Descriptive statistics of the model input variables, referential BW, and their respective Pearson correlation coefficients for the 30 dairy cows are shown in Table 1. Among the variables, hip width, age, and parity showed significant linear relationships with the referential BW. Additionally, age and parity were highly correlated, with a Pearson correlation coefficient of 0.97 (P < 0.001).
Table 1Descriptive statistics of model variables, referential BW, and their respective Pearson correlation coefficients of 30 dairy cows
Null hypothesis: the population correlation coefficient is not significantly different from 0; alternate hypothesis: the population correlation coefficient is significantly different from 0.
ItemMinimumMeanMaximumSDPCC
PCC = Pearson correlation coefficient.
BW (kg)485.5597.4767.581.0
Hip height (m)1.3021.3591.4140.029−0.05
P < 1
Rump length (m)0.3680.4320.4750.0270.33
P < 0.10
Hip width (m)0.3850.4420.5100.0350.76
P < 0.001.
DIM (d)11363631000.18
P < 1
Age (yr)2.023.668.031.920.81
P < 0.001.
Parity (no.)13720.81
P < 0.001.
1 Null hypothesis: the population correlation coefficient is not significantly different from 0; alternate hypothesis: the population correlation coefficient is significantly different from 0.
2 PCC = Pearson correlation coefficient.
P < 1
P < 0.10
*** P < 0.001.
The variabilities of the automated (n = 9) and manual (n = 10) morphological trait measurements of a life-size model cow are listed in Table 2. In both automated and manual measurements, hip height showed the smallest variability and rump length the largest.
Table 2The variabilities of the automated (n = 9) and manual (n = 10) morphological trait measurements of a life-size model cow
Morphological traitAutomatedManual
Hip height (m)0.0030.001
Rump length (m)0.0120.011
Hip width (m)0.0060.009
The performances of the full, intermediate, and final prediction models with leave-one-out cross-validation are shown in Table 3. The final model consisted of the input variables hip width, DIM, and parity and included prediction errors that were 4.0 kg (RMSE) and 0.3% (MAPE) less than the full model. Moreover, the residuals of the final model were visually inspected and considered to be normally distributed.
Table 3Predictive performances of the final BW prediction model compared those of the full model and 2 intermediate models
RMSE = root mean square error; MAPE = mean absolute percentage error; β = parameter; ε = error term.
Multiple linear regression modelRMSE (kg)MAPE (%)
Full model
BW = β0 + β1 × HipHeight + β2 × RumpLength + β3 × HipWidth + β4 × DIM + β5 × Age + β6 × Parity + ε45.25.5
2 examples of intermediate models
BW=β0 + β1× HipWidth + ε55.47.4
BW=β0 + β1× DIM + β2 × Age + ε49.56.1
Final model
BW=β0 + β1× HipWidth + β2 × DIM + β3 × Parity + ε41.25.2
1 RMSE = root mean square error; MAPE = mean absolute percentage error; β = parameter; ε = error term.
The predictive performances of the final model test on all 3 artificial data sets are shown in Table 4. The automated measurement error increased 0.5 kg (RMSE) and 0.1% (MAPE) in the BW prediction, whereas the manual measurement error increased 0.9 kg (RMSE) and 0.2% (MAPE).
Table 4Body weight prediction errors resulting from the tests on 3 artificial data sets with and without the error of the hip width measurement
RMSE = root mean square error; MAPE = mean absolute percentage error.
Data setRMSE (kg)MAPE (%)
A (without measurement error)38.65.1
B (with automated measurement error)39.15.2
C (with manual measurement error)39.55.3
1 RMSE = root mean square error; MAPE = mean absolute percentage error.

## DISCUSSION

This study predicted dairy cow BW with automatically measured morphological traits using 3-D vision and age-related information. The final multiple linear regression model with input variables of hip width, DIM, and parity predicted BW with an RMSE of 41.2 kg. This predictive performance is similar to studies using manually measured morphological traits in combination with similar models: 36.7 kg from
• Banos G.
• Coffey M.P.
Technical note: Prediction of liveweight from linear conformation traits in dairy cattle.
, 47.0 kg from
• Haile-Mariam M.
• Gonzalez-Recio O.
• Pryce J.E.
Prediction of liveweight of cows from type traits and its relationship with production and fitness traits.
, and 35.9 kg from
• Vanrobays M.-L.
• Vandenplas J.
• Hammami H.
• Froidmont E.
• Gengler N.
Short communication: Novel method to predict body weight of primiparous dairy cows throughout the lactation.
. It is also similar to results of the study of
• Kuzuhara Y.
• Kawamura K.
• Yoshitoshi R.
• Tamaki T.
• Sugai S.
• Ikegami M.
• Kurokawa Y.
• Obitsu T.
• Okita M.
• Sugino T.
• Yasuda T.
A preliminarily study for predicting body weight and milk properties in lactating Holstein cows using a three-dimensional camera system.
, who found an RMSE of 42.6 kg using 3-D vision combined with the manual identification of the anatomical landmarks in the 3-D images.
Although the prediction error is similar to those of other studies, we are aware that an error of 41.2 kg is much larger than the cow's average daily weight change caused by net energy intake, which is less than 1 kg (
• Jensen C.
• Østergaard S.
• Bertilsson J.
• Weisbjerg M.R.
Responses in live weight change to net energy intake in dairy cows.
). This is likely because our prediction model mainly contained variables (hip width, DIM, and parity) that do not fluctuate on a daily basis. This model is not yet suitable for monitoring short-term BW variation or detecting anomalies in a cow's health status. Practical application of automated monitoring, therefore, requires addressing the error sources that significantly influence the prediction performance. We categorize those sources as stemming from the (1) quality of automated morphological trait measurement, (2) choice of model input variables, and (3) type of prediction model.

### Source 1

The integrated system was validated on a life-size cow model with respect to the variance associated with morphological trait measurements. For both automated and manual measurements, the variabilities were no greater than 0.012 m (Table 2). The low variability in the automated measurement could be attributed to the pixel size of 0.003 m (x) × 0.003 m (y) × 0.001 m (z) at a viewing distance of 1 m. This resolution enables consistent identification of anatomical landmarks on the surface of a cow's rump and precise quantification of the morphological traits. Moreover, the low variability in the manual measurement could be attributed to the predefined protocol (Appendix) followed by all the assessors. Although both types of measurement variabilities were low, the influence of measurement quality on BW prediction requires further investigation. First, the variability tests in our study were done on a life-size cow model in an experiment hall using automatic and manual approaches. Thus, we simplified the measuring conditions and ignored the influences (e.g., illumination and fur color difference) of measurements on real cows on a farm. Second, the measurements were repeated on the cow model, whereas measurements on the real cows were not repeated at the farm. Third, when identifying the anatomical landmarks of different cows, the precision of the identification may depend on the shape of a cow. Bones from fat cows protrude less than the ones from thin cows. Last, the manual measurement variability of the cow model was low. However, performing manual measurements on real cows at farms will lead to a larger variability. Thus, further study is required to test the variability and reliability of the measurements on real cows at different farms and to quantify the error propagation from these sources.

### Source 2

The input variables used in our BW prediction model included morphological traits and age-related information. Among all the input variables, hip width had the largest and most significant linear correlation with referential BW. It was also the only morphological trait remaining in the final model. The significance of hip width in BW prediction was also found by
• Enevoldsen C.
• Kristensen T.
Estimation of body weight from body size measurements and body condition scores in dairy cows.
and
• Banos G.
• Coffey M.P.
Technical note: Prediction of liveweight from linear conformation traits in dairy cattle.
.
• Enevoldsen C.
• Kristensen T.
Estimation of body weight from body size measurements and body condition scores in dairy cows.
argued that body width development is the final step in dairy cow body development. In our study, 19 of the 30 cows were in their first or second lactation and therefore were still growing. This factor can likely explain the positive correlation found between hip width and referential BW.
Hip height showed a weak linear correlation with referential BW, which is consistent with the results of
• Enevoldsen C.
• Kristensen T.
Estimation of body weight from body size measurements and body condition scores in dairy cows.
and
• Tasdemir S.
• Urkmez A.
• Inal S.
Determination of body measurements on the Holstein cows using digital image analysis and estimation of live weight with regression analysis.
. However,
• Heinrichs A.J.
• Rogers G.W.
• Cooper J.B.
Predicting body weight and wither height in Holstein heifers using body measurements.
found a strong correlation between body height and weight of dairy calves and heifers. The contradiction between the studies can be explained by the different ages of the studied animals. For young animals (
• Heinrichs A.J.
• Rogers G.W.
• Cooper J.B.
Predicting body weight and wither height in Holstein heifers using body measurements.
), height-related traits are also indicators of early life growth and BW gain. When cows are reaching maturity (e.g., in our study), height-related traits become stable, and this information is less useful for predicting BW and changes.
Rump length also showed a weak correlation with referential BW. This finding is inconsistent with
• Yan T.
• Mayne C.S.
• Patterson D.C.
• Agnew R.E.
Prediction of body weight and empty body composition using body size measurements in lactating dairy cows.
and
• Tasdemir S.
• Urkmez A.
• Inal S.
Determination of body measurements on the Holstein cows using digital image analysis and estimation of live weight with regression analysis.
, who found a high correlation. A possible explanation is that in our image acquisition setup, the 3-D camera focused only on a small part of the length of a cow, the rump, whereas
• Yan T.
• Mayne C.S.
• Patterson D.C.
• Agnew R.E.
Prediction of body weight and empty body composition using body size measurements in lactating dairy cows.
and
• Tasdemir S.
• Urkmez A.
• Inal S.
Determination of body measurements on the Holstein cows using digital image analysis and estimation of live weight with regression analysis.
used multiple cameras to guarantee a full body scan. Compared with full body length, rump length includes too little information on cow length variation. Therefore, incorporating additional morphological traits that correlate with full body length might improve models for BW prediction.
Input variables DIM and parity remained in the final model. This is consistent with
• Enevoldsen C.
• Kristensen T.
Estimation of body weight from body size measurements and body condition scores in dairy cows.
and
• Kuzuhara Y.
• Kawamura K.
• Yoshitoshi R.
• Tamaki T.
• Sugai S.
• Ikegami M.
• Kurokawa Y.
• Obitsu T.
• Okita M.
• Sugino T.
• Yasuda T.
A preliminarily study for predicting body weight and milk properties in lactating Holstein cows using a three-dimensional camera system.
. Although DIM was insignificant correlated with the referential BW, it might be a predictor for BW changes during lactation. Moreover, DIM may also provide additional information related to the pregnancy status of a cow, especially in the later stage of lactation (
• Bereskin B.
• Touchberry R.W.
Some effects of pregnancy on body weight and paunch girth.
). Parity was strongly correlated with the referential BW in the present study and was used as a linear input variable in the prediction model. This is inconsistent with the study of
• Kertz A.F.
• Reutzel L.F.
• Barton B.A.
• Ely R.L.
Body weight, body condition score, and wither height of prepartum Holstein cows and birth weight and sex of calves by parity: A database and summary.
, who constructed different BW prediction models for different parities. Parity was used as a linear input variable because the parities of the cows in our data were unevenly distributed (i.e., 19 cows had a parity of 1 or 2, and 1 cow had a parity of 4). In the future studies, parity could be used as a random effect variable for predicting BW. Age was highly correlated with parity in the present study and, hence, not included in the final model. Age being a linear variable in the prediction model of adult cows is consistent with
• Banos G.
• Coffey M.P.
Technical note: Prediction of liveweight from linear conformation traits in dairy cattle.
. However, to predict BW of young cows (e.g., calf and heifer), the quadratic form of age may be more suitable.
Due to the limitation of camera view, we could not measure all potential relevant input variables. Such variables can include morphological traits not tested in this study but that have shown significant contributions to the BW prediction in previous studies, such as heart girth (
• Heinrichs A.J.
• Erb H.N.
• Rogers G.W.
• Cooper J.B.
• Jones C.M.
Variability in Holstein heifer heart-girth measurements and comparison of prediction equations for live weight.
), chest width (
• Banos G.
• Coffey M.P.
Technical note: Prediction of liveweight from linear conformation traits in dairy cattle.
), paunch girth (
• Sieber M.
• Freeman A.E.
• Kelley D.H.
Relationships between body measurements, body weight, and productivity in Holstein dairy cows.
), udder size (
• Haile-Mariam M.
• Gonzalez-Recio O.
• Pryce J.E.
Prediction of liveweight of cows from type traits and its relationship with production and fitness traits.
), full body length (
• Banos G.
• Coffey M.P.
Technical note: Prediction of liveweight from linear conformation traits in dairy cattle.
), body surface area (
• Brandl N.
• Jørgensen E.
Determination of live weight of pigs from dimensions measured using image analysis.
), and body condition (
• Haile-Mariam M.
• Gonzalez-Recio O.
• Pryce J.E.
Prediction of liveweight of cows from type traits and its relationship with production and fitness traits.
). These variables can also be those containing information about BW changes in the short or mid term, such as milk yield (
• Haile-Mariam M.
• Gonzalez-Recio O.
• Pryce J.E.
Prediction of liveweight of cows from type traits and its relationship with production and fitness traits.
), energy balance (
• Jensen C.
• Østergaard S.
• Bertilsson J.
• Weisbjerg M.R.
Responses in live weight change to net energy intake in dairy cows.
;
• Mäntysaari P.
• Mäntysaari E.A.
Modeling of daily body weights and body weight changes of Nordic Red cows.
), and days in pregnancy (
• Bereskin B.
• Touchberry R.W.
Some effects of pregnancy on body weight and paunch girth.
). These types of variables can be combined with or replace the current input variables to potentially better predict BW and its variations. Thus, to find other and preferably better BW predictors that can be measured automatically is one possible means to improve the current BW prediction.

### Source 3

The prediction model was based on multiple linear regression, as commonly applied in prior research (
• Tasdemir S.
• Urkmez A.
• Inal S.
Determination of body measurements on the Holstein cows using digital image analysis and estimation of live weight with regression analysis.
;
• Haile-Mariam M.
• Gonzalez-Recio O.
• Pryce J.E.
Prediction of liveweight of cows from type traits and its relationship with production and fitness traits.
;
• Kuzuhara Y.
• Kawamura K.
• Yoshitoshi R.
• Tamaki T.
• Sugai S.
• Ikegami M.
• Kurokawa Y.
• Obitsu T.
• Okita M.
• Sugino T.
• Yasuda T.
A preliminarily study for predicting body weight and milk properties in lactating Holstein cows using a three-dimensional camera system.
). Alternatively,
• Banos G.
• Coffey M.P.
Technical note: Prediction of liveweight from linear conformation traits in dairy cattle.
and
• Vanrobays M.-L.
• Vandenplas J.
• Hammami H.
• Froidmont E.
• Gengler N.
Short communication: Novel method to predict body weight of primiparous dairy cows throughout the lactation.
suggested using a mixed-effects model with random effects (e.g., cows, breeds, herds, and so on). In these studies, large data sets were collected from multiple herds and morphological traits were measured over time. As a case study, we limited the image acquisition to 30 cows from one herd with no repeated measurements from the same cow. For future studies, we suggest including data from different breeds and herds, doing time-series measurements of morphological traits (e.g., subcutaneous fat deposit) that vary over time, and investigating different types of models to provide short-term or daily weight changes that are indicative of the physiological status of interest.
Overall, the BW prediction of the final model reached our expectation. We also observed that more input variables were used to predict BW in existing studies. As a case study, we chose 3 commonly used morphological traits to be measured automatically using 3-D vision, which was demonstrated as a technology with great potential in automation. Moreover, our study sets guidelines for follow-up research. We believe that this methodology is relevant for automated monitoring systems in general.

## CONCLUSIONS

Our automated dairy cow BW prediction achieved a performance similar to those of manual and semi-automated methods. The bottleneck in the prediction lies not in the quality of automated morphological trait measurement but in the prediction model. Follow-up research should focus on the selecting predictive traits, improving model structure, or a combination thereof.

## ACKNOWLEDGMENTS

This research was funded by Lely Industries N.V. The authors thank Tomáš Šabata from the Faculty of Information Technology, Czech Technical University in Prague, for his contribution in designing the test and programming for Propagation of Morphological Trait Measurement Error into Body Weight Prediction; Emo van Halsema from Lely Innovation for his contribution in testing a variety of statistical models; and Wouter Beukeboom from Hazerswoude-Dorp, the Netherlands, for the cooperation in collecting data at his farm.

## APPENDIX

### Protocol for a Morphological Trait Measurement in a Life-Size Model Cow

• 1.
Stand behind the cow, in line with the top of the spine.
• 2.
Visually find the contour of the left hip bone and estimate the highest point on the contour.
• 3.
Point out the highest point with a finger and adjust the location on a closer inspection.
• 4.
Label the point with a small sticker.
• 5.
Repeat steps 1 to 4 for the right hip bone.
• 6.
Stand to the left of the cow and face toward the left pin bone, in line with the tail-head.
• 7.
Visually find the contour of the left pin bone and estimate the highest point on the contour.
• 8.
Point out the highest point with a finger and adjust the location on a closer inspection.
• 9.
Label the point with a small sticker.
• 10.
Repeat steps 6 to 9 for the right pin bone.
Use a spirit level with a length measuring function (measurement precision of 0.005 m) for the following distance measurements.
• 11.
Place the level horizontally to measure the distance between the left and right hip bone markers as the hip width.
• 12.
Place the level horizontally to measure the distance between the left hip bone and pin-bone markers as the left rump length.
• 13.
Place the level horizontally to measure the distance between the right hip bone and pin-bone markers as the right rump length.
• 14.
Calculate the mean of the left and right rump lengths.
Use a stadiometer with a ruler (accuracy of 0.005 m) and a sliding horizontal headpiece (including a level indicator) for the following height measurements.
• 15.
Place the ruler of the stadiometer vertically and next to the left hip bone; place the sliding headpiece horizontally on the marker to measure the left hip height.
• 16.
Place the ruler of the stadiometer vertically and next to the right hip bone; place the sliding headpiece horizontally on the marker to measure the right hip height.
• 17.
Calculate the mean of the left and right hip heights.

## REFERENCES

• Alawneh J.I.
• Stevenson M.A.
• Williamson N.B.
• Lopez-Villalobos N.
• Otley T.
Automatic recording of daily walkover liveweight of dairy cattle at pasture in the first 100 days in milk.
J. Dairy Sci. 2011; 94 (21854916): 4431-4440
• Banos G.
• Coffey M.P.
Technical note: Prediction of liveweight from linear conformation traits in dairy cattle.
J. Dairy Sci. 2012; 95 (22459862): 2170-2175
• Barkema H.W.
• Von Keyserlingk M.A.G.
• Kastelic J.P.
• Lam T.J.G.M.
• Luby C.
• Roy J.-P.
Invited review: Changes in the dairy industry affecting dairy cattle health and welfare.
J. Dairy Sci. 2015; 98 (26342982): 7426-7445
• Bereskin B.
• Touchberry R.W.
Some effects of pregnancy on body weight and paunch girth.
J. Dairy Sci. 1967; 50: 220-224
• Brandl N.
• Jørgensen E.
Determination of live weight of pigs from dimensions measured using image analysis.
Comput. Electron. Agric. 1996; 15: 57-72
• Collard B.L.
• Boettcher P.J.
• Dekkers J.C.M.
• Petitclerc D.
• Schaeffer L.R.
Relationships between energy balance and health traits of dairy cattle in early lactation.
J. Dairy Sci. 2000; 83 (11104289): 2683-2690
• CRV
Melkproductieregistratie Statistiek–Rollend Jaargemiddelde Melkproductie Landelijk.
(Accessed Nov. 7, 2016.)
• de Graaf S.
• Van Loo E.J.
• Bijttebier J.
• Vanhonacker F.
• Lauwers L.
• Tuyttens F.A.M.
• Verbeke W.
Determinants of consumer intention to purchase animal-friendly milk.
J. Dairy Sci. 2016; 99 (27474987): 8304-8313
• de Vries M.J.
• van der Beek S.
• Kaal-Lansbergen L.M.
• Ouweltjes W.
• Wilmink J.B.
Modeling of energy balance in early lactation and the effect of energy deficits in early lactation on first detected estrus postpartum in dairy cows.
J. Dairy Sci. 1999; 82 (10509251): 1927-1934
• Dickinson R.A.
• Morton J.M.
• Beggs D.S.
• Anderson G.A.
• Pyman M.F.
• Mansell P.D.
• Blackwood C.B.
An automated walk-over weighing system as a tool for measuring liveweight change in lactating dairy cows.
J. Dairy Sci. 2013; 96 (23684033): 4477-4486
• Enevoldsen C.
• Kristensen T.
Estimation of body weight from body size measurements and body condition scores in dairy cows.
J. Dairy Sci. 1997; 80 (9313139): 1988-1995
• Haile-Mariam M.
• Gonzalez-Recio O.
• Pryce J.E.
Prediction of liveweight of cows from type traits and its relationship with production and fitness traits.
J. Dairy Sci. 2014; 97 (24630649): 3173-3189
• Heinrichs A.J.
• Erb H.N.
• Rogers G.W.
• Cooper J.B.
• Jones C.M.
Variability in Holstein heifer heart-girth measurements and comparison of prediction equations for live weight.
Prev. Vet. Med. 2007; 78 (17157398): 333-338
• Heinrichs A.J.
• Rogers G.W.
• Cooper J.B.
Predicting body weight and wither height in Holstein heifers using body measurements.
J. Dairy Sci. 1992; 75 (1474218): 3576-3581
• Jacobs J.A.
• Siegford J.M.
Invited review: The impact of automatic milking systems on dairy cow management, behavior, health, and welfare.
J. Dairy Sci. 2012; 95 (22541453): 2227-2247
• Jensen C.
• Østergaard S.
• Bertilsson J.
• Weisbjerg M.R.
Responses in live weight change to net energy intake in dairy cows.
Livest. Sci. 2015; 181: 163-170
• Kawasue K.
• Ikeda T.
• Tokunaga T.
Three-dimensional shape measurement system for black cattle using KINECT sensor.
Int. J. Circuits Syst. Signal Process. 2013; 7: 222-230
• Kertz A.F.
• Reutzel L.F.
• Barton B.A.
• Ely R.L.
Body weight, body condition score, and wither height of prepartum Holstein cows and birth weight and sex of calves by parity: A database and summary.
J. Dairy Sci. 1997; 80: 525-529
• Kuzuhara Y.
• Kawamura K.
• Yoshitoshi R.
• Tamaki T.
• Sugai S.
• Ikegami M.
• Kurokawa Y.
• Obitsu T.
• Okita M.
• Sugino T.
• Yasuda T.
A preliminarily study for predicting body weight and milk properties in lactating Holstein cows using a three-dimensional camera system.
Comput. Electron. Agric. 2015; 111: 186-193
• Lowder S.K.
• Skoet J.
• Raney T.
The number, size, and distribution of farms, smallholder farms, and family farms worldwide.
World Dev. 2016; 87: 16-29
• Maltz E.
The body weight of the dairy cow: III. Use for on-line management of individual cows.
Livest. Prod. Sci. 1997; 48: 187-200
• Mäntysaari P.
• Mäntysaari E.A.
Modeling of daily body weights and body weight changes of Nordic Red cows.
J. Dairy Sci. 2015; 98 (26254522): 6992-7002
1. Marinello, F., A. Pezzuolo, D. Cillis, F. Gasparini, and L. Sartori. 2015. Application of Kinect-Sensor for three-dimensional body measurements of cows. Pages 661–669 in 7th European Conference on Precision Livestock Farming, ECPLF 2015. European Conference on Precision Livestock Farming, Milan, Italy.

• Rosell-Polo J.R.
• Cheeinx F.A.
• Gregorio E.
• Andújar D.
• Puigdomènech L.
• Masip J.
• Escolà A.
Advances in structured light sensors applications in precision agriculture and livestock farming.
• Rutten C.J.
• Velthuis A.G.J.
• Steeneveld W.
• Hogeveen H.
Invited review: Sensors to support health management on dairy farms.
J. Dairy Sci. 2013; 96 (23462176): 1928-1952
• Salau J.
• Haas J.H.
• Junge W.
• Thaller G.
Extrinsic calibration of a multi-Kinect camera scanning passage for measuring functional traits in dairy cows.
Biosyst. Eng. 2016; 151: 409-424
• Sieber M.
• Freeman A.E.
• Kelley D.H.
Relationships between body measurements, body weight, and productivity in Holstein dairy cows.
J. Dairy Sci. 1988; 71: 3437-3445
• Stajnko D.
• Brus M.
• Hočevar M.
Estimation of bull live weight through thermographically measured body dimensions.
Comput. Electron. Agric. 2008; 61: 233-240
• Statistics Netherlands
Agriculture; Crops, Livestock and Land Use by General Farm Type, Region.
(Accessed Nov. 7, 2016.)
• Tasdemir S.
• Urkmez A.
• Inal S.
Determination of body measurements on the Holstein cows using digital image analysis and estimation of live weight with regression analysis.
Comput. Electron. Agric. 2011; 76: 189-197
• Thorup V.M.
• Edwards D.
• Friggens N.C.
On-farm estimation of energy balance in dairy cows using only frequent body weight measurements and body condition score.
J. Dairy Sci. 2012; 95 (22459827): 1784-1793
• van der Tol P.P.J.
• van der Kamp A.
Time series analysis of live weight as health indicator.
in: First North American Conference on Precision Dairy Management 2010, Toronto, Canada. Omnipress, Madison, WI2010: 230-231
• Vanrobays M.-L.
• Vandenplas J.
• Hammami H.
• Froidmont E.
• Gengler N.
Short communication: Novel method to predict body weight of primiparous dairy cows throughout the lactation.
J. Dairy Sci. 2015; 98 (25468694): 692-697
• Wolf C.A.
• Tonsor G.T.
• McKendree M.G.S.
• Thomson D.U.
• Swanson J.C.
Public and farmer perceptions of dairy cattle welfare in the United States.
J. Dairy Sci. 2016; 99 (27179876): 5892-5903
• Yan T.
• Mayne C.S.
• Patterson D.C.
• Agnew R.E.
Prediction of body weight and empty body composition using body size measurements in lactating dairy cows.
Livest. Sci. 2009; 124: 233-241