Published August 31, 2022 | Version 2.0
Journal article Open

Detecting dairy cows' lying behaviour using noisy 3D ultra-wide band positioning data

  • 1. Animal Breeding and Genomics,Wageningen University and Research, Droevendaalsesteeg 1, 6708 PB Wageningen, the Netherlands
  • 2. Animal Welfare and Health, Wageningen University and Research, Droevendaalsesteeg 1, 6708 PB Wageningen, the Netherlands
  • 3. Luke, PLF group, Production Systems, Natural Resources Institute Finland (Luke), Latokartanonkaari 9, 00790 Helsinki, Finland


In precision livestock farming, technology-based solutions are used to monitor and manage livestock and support decisions based on on-farm available data. In this study, we developed a methodology to monitor the lying behaviour of dairy cows using noisy spatial positioning data, thereby combining time-series segmentation based on statistical changepoints and a machine learning classification algorithm using bagged decision trees. Position data (x, y, z -coordinates) collected with an ultra-wide band positioning system from 30 dairy cows housed in a freestall barn were used. After the data pre-processing and selection, statistical changepoints were detected per cow-day (no. included = 331) in normalized 'distance from the centre of the barn' and (z) time series. Accelerometer-based lying bout data were used as a practical ground truth. For the segmentation, changepoint detection was compared with getting-up or lying-down events as indicated by the accelerometers. For the classification of segments into lying or non-lying behaviour, two data splitting techniques resulting in 2 different training and test sets were implemented to train and evaluate performance: one based on the data collection day and one based on cow identity. In 85.5% of the lying-down or getting-up events a changepoint was detected in a window of 5 minutes. Of the events where no detection had taken place, 86.2% could be associated with either missing data (large gaps) or a very short lying or non-lying bout. Overall classification and lying behaviour prediction performance was above 91% in both independent test sets, with a very high consistency across cow-days. Per cow-day, the average error in the estimation of the lying durations were 7.1% and 7.8% for the cow-identity and time-based data splits respectively. This resulted in sufficient accuracy for automated quantification of lying behaviour in dairy cows, for example for health or welfare monitoring purposes.



Files (1.2 MB)

Name Size Download all
1.2 MB Preview Download

Additional details

Related works

Is new version of
Preprint: 10.31220/agriRxiv.2022.00132 (DOI)
Is supplemented by
Dataset: 10.5281/zenodo.6373645 (DOI)
Software: 10.5281/zenodo.7016493 (DOI)