Animal Science

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

10.24072/pcjournal.167 - Peer Community Journal, Volume 2 (2022), article no. e55.

Get full text PDF Peer reviewed and recommended by PCI

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.

Published online:
DOI: 10.24072/pcjournal.167
Adriaens, Ines 1; Ouweltjes, Wijbrand 2; Pastell, Matti 3; Ellen, Esther 1; Kamphuis, Claudia 1

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
License: CC-BY 4.0
Copyrights: The authors retain unrestricted copyrights and publishing rights
     author = {Adriaens, Ines and Ouweltjes, Wijbrand and Pastell, Matti and Ellen, Esther and Kamphuis, Claudia},
     title = {Detecting dairy cows' lying behaviour using noisy {3D} ultra-wide band positioning data},
     journal = {Peer Community Journal},
     eid = {e55},
     publisher = {Peer Community In},
     volume = {2},
     year = {2022},
     doi = {10.24072/pcjournal.167},
     url = {}
TI  - Detecting dairy cows' lying behaviour using noisy 3D ultra-wide band positioning data
JO  - Peer Community Journal
PY  - 2022
DA  - 2022///
VL  - 2
PB  - Peer Community In
UR  -
UR  -
DO  - 10.24072/pcjournal.167
ID  - 10_24072_pcjournal_167
ER  - 
%0 Journal Article
%T Detecting dairy cows' lying behaviour using noisy 3D ultra-wide band positioning data
%J Peer Community Journal
%D 2022
%V 2
%I Peer Community In
%R 10.24072/pcjournal.167
%F 10_24072_pcjournal_167
Adriaens, Ines; Ouweltjes, Wijbrand; Pastell, Matti; Ellen, Esther; Kamphuis, Claudia. Detecting dairy cows' lying behaviour using noisy 3D ultra-wide band positioning data. Peer Community Journal, Volume 2 (2022), article  no. e55. doi : 10.24072/pcjournal.167.

Peer reviewed and recommended by PCI : 10.24072/pci.animsci.100015

[1] Adriaens, I.; Ouweltjes, W.; Ellen, E.; Kamphuis, C. dairy_spatial_uwb_lying_behaviour [Data set], Zenodo, 2022 | DOI

[2] Adriaens, I. Detecting dairy cows' lying behavior using noisy 3D ultra-wide band positioning data - code, Zenodo, 2022 | DOI

[3] Adriaens, I.; Saeys, W.; Huybrechts, T.; Lamberigts, C.; François, L.; Geerinckx, K.; Leroy, J.; De Ketelaere, B.; Aernouts, B. A novel system for on-farm fertility monitoring based on milk progesterone, Journal of Dairy Science, Volume 101 (2018) no. 9, pp. 8369-8382 | DOI

[4] Banhazi ,TM; Lehr, H.; Black, J.; Crabtree, H.; Schofield, P.; Tscharke, M.; Berckmans, D. Precision Livestock Farming: An international review of scientific and commercial aspects, International Journal of Agricultural and Biological Engineering, Volume 5 (2012), pp. 1-9 | DOI

[5] Barker, Z.; Vázquez Diosdado, J.; Codling, E.; Bell, N.; Hodges, H.; Croft, D.; Amory, J. Use of novel sensors combining local positioning and acceleration to measure feeding behavior differences associated with lameness in dairy cattle, Journal of Dairy Science, Volume 101 (2018) no. 7, pp. 6310-6321 | DOI

[6] Borchers, M.; Bewley, J. An assessment of producer precision dairy farming technology use, prepurchase considerations, and usefulness, Journal of Dairy Science, Volume 98 (2015) no. 6, pp. 4198-4205 | DOI

[7] Borchers, M.; Chang, Y.; Tsai, I.; Wadsworth, B.; Bewley, J. A validation of technologies monitoring dairy cow feeding, ruminating, and lying behaviors, Journal of Dairy Science, Volume 99 (2016) no. 9, pp. 7458-7466 | DOI

[8] Boyland, N. K.; Mlynski, D. T.; James, R.; Brent, L. J.; Croft, D. P. The social network structure of a dynamic group of dairy cows: From individual to group level patterns, Applied Animal Behaviour Science, Volume 174 (2016), pp. 1-10 | DOI

[9] Breiman, L. Bagging predictors, Machine Learning, Volume 24 (1996) no. 2, pp. 123-140 | DOI

[10] Chopra, K.; Hodges, H. R.; Barker, Z. E.; Vázquez Diosdado, J. A.; Amory, J. R.; Cameron, T. C.; Croft, D. P.; Bell, N. J.; Codling, E. A. Proximity Interactions in a Permanently Housed Dairy Herd: Network Structure, Consistency, and Individual Differences, Frontiers in Veterinary Science, Volume 7 (2020) | DOI

[11] Dietterich, T. Overfitting and undercomputing in machine learning, ACM Computing Surveys, Volume 27 (1995) no. 3, pp. 326-327 | DOI

[12] Eckelkamp, E.; Bewley, J. On-farm use of disease alerts generated by precision dairy technology, Journal of Dairy Science, Volume 103 (2020) no. 2, pp. 1566-1582 | DOI

[13] García, R.; Aguilar, J.; Toro, M.; Pinto, A.; Rodríguez, P. A systematic literature review on the use of machine learning in precision livestock farming, Computers and Electronics in Agriculture, Volume 179 (2020) | DOI

[14] Hendriks, S.; Phyn, C.; Huzzey, J.; Mueller, K.; Turner, S.-A.; Donaghy, D.; Roche, J. Graduate Student Literature Review: Evaluating the appropriate use of wearable accelerometers in research to monitor lying behaviors of dairy cows, Journal of Dairy Science, Volume 103 (2020) no. 12, pp. 12140-12157 | DOI

[15] Hermans, K.; Opsomer, G.; Ranst, B. v.; Hostens, M. Promises and challenges of big data associated with automated dairy cow welfare assessment., Animal welfare in a changing world, CAB International, UK, 2018, pp. 199-207 | DOI

[16] Huhtala, A.; Suhonen, K.; Mäkelä, P.; Hakojärvi, M.; Ahokas, J. Evaluation of Instrumentation for Cow Positioning and Tracking Indoors, Biosystems Engineering, Volume 96 (2007) no. 3, pp. 399-405 | DOI

[17] Huybrechts, T.; Mertens, K.; De Baerdemaeker, J.; De Ketelaere, B.; Saeys, W. Early warnings from automatic milk yield monitoring with online synergistic control, Journal of Dairy Science, Volume 97 (2014) no. 6, pp. 3371-3381 | DOI

[18] Killick, R.; Fearnhead, P.; Eckley, I. A. Optimal Detection of Changepoints With a Linear Computational Cost, Journal of the American Statistical Association, Volume 107 (2012) no. 500, pp. 1590-1598 | DOI

[19] Kok, A.; van Knegsel, A.; van Middelaar, C.; Hogeveen, H.; Kemp, B.; de Boer, I. Technical note: Validation of sensor-recorded lying bouts in lactating dairy cows using a 2-sensor approach, Journal of Dairy Science, Volume 98 (2015) no. 11, pp. 7911-7916 | DOI

[20] Lovarelli, D.; Bacenetti, J.; Guarino, M. A review on dairy cattle farming: Is precision livestock farming the compromise for an environmental, economic and social sustainable production?, Journal of Cleaner Production, Volume 262 (2020) | DOI

[21] Maselyne, J.; Pastell, M.; Thomsen, P. T.; Thorup, V. M.; Hänninen, L.; Vangeyte, J.; Van Nuffel, A.; Munksgaard, L. Daily lying time, motion index and step frequency in dairy cows change throughout lactation, Research in Veterinary Science, Volume 110 (2017), pp. 1-3 | DOI

[22] McDonagh, J.; Tzimiropoulos, G.; Slinger, K. R.; Huggett, Z. J.; Down, P. M.; Bell, M. J. Detecting Dairy Cow Behavior Using Vision Technology, Agriculture, Volume 11 (2021) no. 7 | DOI

[23] Niloofar, P.; Francis, D. P.; Lazarova-Molnar, S.; Vulpe, A.; Vochin, M.-C.; Suciu, G.; Balanescu, M.; Anestis, V.; Bartzanas, T. Data-driven decision support in livestock farming for improved animal health, welfare and greenhouse gas emissions: Overview and challenges, Computers and Electronics in Agriculture, Volume 190 (2021) | DOI

[24] Pastell, M.; Frondelius, L.; Järvinen, M.; Backman, J. Filtering methods to improve the accuracy of indoor positioning data for dairy cows, Biosystems Engineering, Volume 169 (2018), pp. 22-31 | DOI

[25] Piñeiro, J.; Menichetti, B.; Barragan, A.; Relling, A.; Weiss, W.; Bas, S.; Schuenemann, G. Associations of pre- and postpartum lying time with metabolic, inflammation, and health status of lactating dairy cows, Journal of Dairy Science, Volume 102 (2019) no. 4, pp. 3348-3361 | DOI

[26] Porto, S. M.; Arcidiacono, C.; Anguzza, U.; Cascone, G. A computer vision-based system for the automatic detection of lying behaviour of dairy cows in free-stall barns, Biosystems Engineering, Volume 115 (2013) no. 2, pp. 184-194 | DOI

[27] Ren, K.; Alam, M.; Nielsen, P. P.; Gussmann, M.; Rönnegård, L. Interpolation Methods to Improve Data Quality of Indoor Positioning Data for Dairy Cattle, Frontiers in Animal Science, Volume 3 (2022) | DOI

[28] Ren, K.; Nielsen, P. P.; Alam, M.; Rönnegård, L. Where do we find missing data in a commercial real-time location system? Evidence from 2 dairy farms, JDS Communications, Volume 2 (2021) no. 6, pp. 345-350 | DOI

[29] Stygar, A. H.; Gómez, Y.; Berteselli, G. V.; Dalla Costa, E.; Canali, E.; Niemi, J. K.; Llonch, P.; Pastell, M. A Systematic Review on Commercially Available and Validated Sensor Technologies for Welfare Assessment of Dairy Cattle, Frontiers in Veterinary Science, Volume 8 (2021) | DOI

[30] Tucker, C. B.; Jensen, M. B.; de Passillé, A. M.; Hänninen, L.; Rushen, J. Invited review: Lying time and the welfare of dairy cows, Journal of Dairy Science, Volume 104 (2021) no. 1, pp. 20-46 | DOI

[31] Vázquez Diosdado, J. A.; Barker, Z. E.; Hodges, H. R.; Amory, J. R.; Croft, D. P.; Bell, N. J.; Codling, E. A. Classification of behaviour in housed dairy cows using an accelerometer-based activity monitoring system, Animal Biotelemetry, Volume 3 (2015) no. 1 | DOI

[32] Wathes, C.; Kristensen, H.; Aerts, J.-M.; Berckmans, D. Is precision livestock farming an engineer's daydream or nightmare, an animal's friend or foe, and a farmer's panacea or pitfall?, Computers and Electronics in Agriculture, Volume 64 (2008) no. 1, pp. 2-10 | DOI

[33] Weigele, H.; Gygax, L.; Steiner, A.; Wechsler, B.; Burla, J.-B. Moderate lameness leads to marked behavioral changes in dairy cows, Journal of Dairy Science, Volume 101 (2018) no. 3, pp. 2370-2382 | DOI

[34] Zhou, Y.; Law, C. L.; Xia, J. Ultra low-power UWB-RFID system for precise location-aware applications, 2012 IEEE Wireless Communications and Networking Conference Workshops (WCNCW) (2012), pp. 154-158 | DOI

Cited by Sources: