Abstract
On modern dairy farms technologies that are capable of measuring high frequency indicators (e.g. milk yield, milk flow-rates, and electrical conductivity) at every milking can play an important role in helping farmers manage animal health. The most modern dairy farms use milk meters that provide detailed, high-frequency data about the flow of milk during every milking (cows are typically milked twice daily). This forms a time series that we call a milk flow profile. As cows are milked twice per day, every day this data forms a series of time series collected in a relatively controlled way that offers detailed insights into cow milking performance and cow health. In this paper we show that milk flow profiles act as a finger print for cows in a herd and offer opportunities for extracting useful insights about cow health that are unexplored. We demonstrate that unsupervised time series clustering approaches, particularly those that utilize the shape of time series, can be used to characterize a herd and that supervised approaches applied to milk flow profiles can be used for automated mastitis detection. In the latter case it is interesting that approaches using standard machine learning methods applied to features extracted from milk flow profiles, out-perform approaches specifically designed for time series.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
This is typically known as milk recording data and includes information such as the percentage of fat and lactose contained in the milk.
- 2.
A milk meter is a device inserted into the milk pipeline that records the individual animal milk yield during milking.
- 3.
A midi-line 30 unit Dairymaster herringbone, swing-over milking system (Dairymaster, Ireland) was used to milk the cows twice per day. The milking system utilised simultaneous pulsation and was fitted with automatic cluster removers and weigh-all milk meters (Dairymaster, Ireland). The standard farm milk flow rate switch-point of the automatic cluster removers was 0.2 kg/min.
- 4.
The majority of cows were from the Holstein-Friesian breed. 92 of the cows were at parity of 1 (meaning they had given birth to just one calf, or were primiparous) and the remaining 201 were at parity of 2 or greater (meaning they had given birth to just one calf, or were multiparous).
- 5.
Milk composition analysis, often know as milk recording, is used to analyse the content of milk. Typically the percentage of fat, protein, and lactose in the milk is measured as well as the amount of casein and urea (both important in cheese making) present. The number of somatic cells, usually white blood cells, is also measured and typically referred to as somatic cell count (SCC). SCC is the most used and studied indicator in mastitis detection research, especially for sub-clinical mastitis detection [36]. A Fossomatic machine (Foss, Denmark) was used to measure SCC and other indicators of milk composition.
- 6.
All features were extracted from flow profile data using the tsfresh package in Python [5].
References
Abdoli, A., Murillo, A.C., Yeh, C.C.M., Gerry, A.C., Keogh, E.J.: Time series classification to improve poultry welfare. In: 2018 17TH IEEE International Conference on Machine Learning and Applications (ICMLA), pp. 635–642. IEEE (2018)
Anglart, D., Hallén-Sandgren, C., Emanuelson, U., Rönnegård, L.: Comparison of methods for predicting cow composite somatic cell counts. J. Dairy Sci. 103(9), 8433–8442 (2020)
Atif Qureshi, M., Miralles-Pechuán, L., Payne, J., O’Malley, R., Namee, B.M.: Valve health identification using sensors and machine learning methods. In: Gama, J., et al. (eds.) ITEM/IoT Streams -2020. CCIS, vol. 1325, pp. 45–60. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-66770-2_4
Berndt, D.J., Clifford, J.: Using dynamic time warping to find patterns in time series. In: KDD Workshop, Seattle, WA, USA, vol. 10, pp. 359–370 (1994)
Christ, M., Braun, N., Neuffer, J., Kempa-Liehr, A.W.: Time series feature extraction on basis of scalable hypothesis tests (tsfresh-a Python package). Neurocomputing 307, 72–77 (2018)
Cogato, A., Brščić, M., Guo, H., Marinello, F., Pezzuolo, A.: Challenges and tendencies of automatic milking systems (AMS): a 20-years systematic review of literature and patents. Animals 11(2), 356 (2021)
De Mol, R., Kroeze, G., Achten, J., Maatje, K., Rossing, W.: Results of a multivariate approach to automated oestrus and mastitis detection. Livest. Prod. Sci. 48(3), 219–227 (1997)
Dempster, A., Petitjean, F., Webb, G.I.: Rocket: exceptionally fast and accurate time series classification using random convolutional kernels. Data Min. Knowl. Disc. 34(5), 1454–1495 (2020)
Ebrahimi, M., Mohammadi-Dehcheshmeh, M., Ebrahimie, E., Petrovski, K.R.: Comprehensive analysis of machine learning models for prediction of sub-clinical mastitis: deep learning and gradient-boosted trees outperform other models. Comput. Biol. Med. 114, 103456 (2019)
Ebrahimie, E., Ebrahimi, F., Ebrahimi, M., Tomlinson, S., Petrovski, K.R.: A large-scale study of indicators of sub-clinical mastitis in dairy cattle by attribute weighting analysis of milk composition features: highlighting the predictive power of lactose and electrical conductivity. J. Dairy Res. 85(2), 193–200 (2018)
Friedman, J.H.: Greedy function approximation: a gradient boosting machine. Ann. Stat. 29, 1189–1232 (2001)
Frizzarin, M., et al.: Classification of cow diet based on milk Mid Infrared Spectra: a data analysis competition at the “International Workshop on Spectroscopy and Chemometrics 2022’’. Chemometr. Intell. Lab. Syst. 234, 104755 (2023)
Frössling, J., Ohlson, A., Hallén-Sandgren, C.: Incidence and duration of increased somatic cell count in Swedish dairy cows and associations with milking system type. J. Dairy Sci. 100(9), 7368–7378 (2017)
Good, P.: Permutation Tests: A Practical Guide to Resampling Methods for Testing Hypotheses. Springer Science & Business Media, New York (2013). https://doi.org/10.1007/978-1-4757-2346-5
Grindal, R.J., Hillerton, J.E.: Influence of milk flow rate on new intramammary infection in dairy cows. J. Dairy Res. 58(3), 263–268 (1991)
Japertiene, R., Juozaitiene, V., Kriauziene, J., Rudejeviene, J., Japertas, S.: The interrelationships between milkability traits and subclinical mastitis in cows. Pol. J. Vet. Sci. 10(4), 255–261 (2007)
Jensen, D.B., van der Voort, M., Hogeveen, H.: Dynamic forecasting of individual cow milk yield in automatic milking systems. J. Dairy Sci. 101(11), 10428–10439 (2018)
Kamilaris, A., Prenafeta-Boldú, F.X.: Deep learning in agriculture: a survey. Comput. Electron. Agric. 147, 70–90 (2018)
Khatun, M., et al.: Development of a new clinical mastitis detection method for automatic milking systems. J. Dairy Sci. 101(10), 9385–9395 (2018)
Khatun, M., et al.: Early detection of clinical mastitis from electrical conductivity data in an automatic milking system. Anim. Prod. Sci. 57(7), 1226–1232 (2017)
Liu, G., Zhong, K., Li, H., Chen, T., Wang, Y.: A state of art review on time series forecasting with machine learning for environmental parameters in agricultural greenhouses. Inf. Process. Agric. (2022)
Lobo, J.M., Jiménez-Valverde, A., Real, R.: AUC: a misleading measure of the performance of predictive distribution models. Glob. Ecol. Biogeogr. 17(2), 145–151 (2008)
Lubba, C.H., et al.: catch22: CAnonical Time-series CHaracteristics: selected through highly comparative time-series analysis. Data Min. Knowl. Disc. 33(6), 1821–1852 (2019)
Middlehurst, M., et al.: HIVE-COTE 2.0: a new meta ensemble for time series classification. Mach. Learn. 110(11–12), 3211–3243 (2021)
Middlehurst, M., Schäfer, P., Bagnall, A.: Bake off redux: a review and experimental evaluation of recent time series classification algorithms. arXiv preprint arXiv:2304.13029 (2023)
Müller, M.: Dynamic time warping. In: Information Retrieval for Music and Motion, pp. 69–84. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-74048-3_4
Neethirajan, S.: The role of sensors, big data and machine learning in modern animal farming. Sens. Bio-Sens. Res. 29, 100367 (2020)
Pakrashi, A., et al.: Early detection of subclinical mastitis in lactating dairy cows using cow-level features. J. Dairy Sci. 106(7), 4978–4990 (2023). https://doi.org/10.3168/jds.2022-22803, https://www.sciencedirect.com/science/article/pii/S0022030223002977
Panchal, I., Sawhney, I., Sharma, A., Dang, A.: Classification of healthy and mastitis Murrah buffaloes by application of neural network models using yield and milk quality parameters. Comput. Electron. Agric. 127, 242–248 (2016)
Pyörälä, S.: Indicators of inflammation in the diagnosis of mastitis. Vet. Res. 34(5), 565–578 (2003)
Ruiz, A.P., Flynn, M., Large, J., Middlehurst, M., Bagnall, A.: The great multivariate time series classification bake off: a review and experimental evaluation of recent algorithmic advances. Data Min. Knowl. Disc. 35(2), 401–449 (2021)
Rutten, C.J., Velthuis, A., Steeneveld, W., Hogeveen, H.: Invited review: sensors to support health management on dairy farms. J. Dairy Sci. 96(4), 1928–1952 (2013)
Santman-Berends, I., Riekerink, R.O., Sampimon, O., Van Schaik, G., Lam, T.: Incidence of subclinical mastitis in Dutch dairy heifers in the first 100 days in lactation and associated risk factors. J. Dairy Sci. 95(5), 2476–2484 (2012)
Seegers, H., Fourichon, C., Beaudeau, F.: Production effects related to mastitis and mastitis economics in dairy cattle herds. Vet. Res. 34(5), 475–491 (2003)
Senin, P.: Dynamic time warping algorithm review. Information and Computer Science Department University of Hawaii at Manoa Honolulu, USA, vol. 855, no. 1-23, p. 40 (2008)
Sharma, N., Singh, N., Bhadwal, M.: Relationship of somatic cell count and mastitis: an overview. Asian Australas. J. Anim. Sci. 24(3), 429–438 (2011)
Sitkowska, B., Piwczynski, D., Aerts, J., Kolenda, M., Özkaya, S.: Detection of high levels of somatic cells in milk on farms equipped with an automatic milking system by decision trees technique. Turkish J. Vet. Anim. Sci. 41(4), 532–540 (2017)
Slob, N., Catal, C., Kassahun, A.: Application of machine learning to improve dairy farm management: a systematic literature review. Prev. Vet. Med. 187, 105237 (2021)
Stafford, J.V.: Implementing precision agriculture in the 21st century. J. Agric. Eng. Res. 76(3), 267–275 (2000)
Upton, J., Penry, J., Rasmussen, M., Thompson, P., Reinemann, D.: Effect of pulsation rest phase duration on teat end congestion. J. Dairy Sci. 99(5), 3958–3965 (2016)
Xi, X., Keogh, E., Shelton, C., Wei, L., Ratanamahatana, C.A.: Fast time series classification using numerosity reduction. In: Proceedings of the 23rd International Conference on Machine Learning, pp. 1033–1040 (2006)
Acknowledgements
This publication has emanated from research conducted with the financial support of Science Foundation Ireland (SFI) and the Department of Agriculture, Food and Marine on behalf of the Government of Ireland under Grant Number [16/RC/3835]. Further financial and technical support was provided by Dairymaster.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Jin, C., Upton, J., Mac Namee, B. (2023). Do Cows Have Fingerprints? Using Time Series Techniques and Milk Flow Profiles to Characterise Cow Milking Performance and Detect Health Issues. In: Ifrim, G., et al. Advanced Analytics and Learning on Temporal Data. AALTD 2023. Lecture Notes in Computer Science(), vol 14343. Springer, Cham. https://doi.org/10.1007/978-3-031-49896-1_15
Download citation
DOI: https://doi.org/10.1007/978-3-031-49896-1_15
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-49895-4
Online ISBN: 978-3-031-49896-1
eBook Packages: Computer ScienceComputer Science (R0)