Machine Learning Techniques for Classification of Livestock Behavior

  • Natasa KleanthousEmail author
  • Abir HussainEmail author
  • Alex Mason
  • Jennifer Sneddon
  • Andy Shaw
  • Paul Fergus
  • Carl Chalmers
  • Dhiya Al-Jumeily
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11304)


Animal activity recognition is in the interest of agricultural community, animal behaviorists, and conservationists since it acts as an indicator of the animal’s health in addition to their nutrition intake when the observation is performed during the circadian circle. Machine learning techniques and tools are used to help identify the activities of livestock. These techniques are helpful to discriminate between complex patterns for classifying animal behaviors during the day; human observation alone is labor intensive and time consuming. This research proposes a robust machine learning method to classify five activities of livestock. To prove the concept, a dataset was utilized based on the observation of two sheep and four goats. A feature selection technique, namely Boruta, was tested with multilayer perceptron, random forests, extreme gradient boosting, and k-Nearest neighbors algorithms. The best results were obtained with random forests achieving accuracy of 96.47% and kappa value of 95.41%. The results showed that the method can classify grazing, lying, scratching or biting, standing, and walking with high sensitivity and specificity.


Machine learning Feature extraction Feature selection Animal behavior Signal processing Accelerometer Gyroscope Magnetometer 



The authors would like to acknowledge and thank the Douglas Bomford Trust for the financial and moral support during the project. Additionally, we thank the authors who made their dataset publicly available for use by the community [23].


  1. 1.
    McLennan, K.M., et al.: Technical note: validation of an automatic recording system to assess behavioural activity level in sheep (Ovis aries). Small Rumin. Res. 127, 92–96 (2015)CrossRefGoogle Scholar
  2. 2.
    Barwick, J., Lamb, D., Dobos, R., Schneider, D., Welch, M., Trotter, M.: Predicting lameness in sheep activity using tri-axial acceleration signals. Animals 8 (2018)CrossRefGoogle Scholar
  3. 3.
    Shepard, E.L.C., et al.: Identification of animal movement patterns using tri-axial accelerometry. Endanger. Species Res. 10, 47–60 (2008)CrossRefGoogle Scholar
  4. 4.
    Gougoulis, D.A., Kyriazakis, I., Fthenakis, G.C.: Diagnostic significance of behaviour changes of sheep: a selected review. Small Rumin. Res. 92, 52–56 (2010)CrossRefGoogle Scholar
  5. 5.
    Krahnstoever, N., Rittscher, J., Tu, P., Chean, K., Tomlinson, T.: Activity recognition using visual tracking and RFID. In: Seventh IEEE Workshops on Application of Computer Vision, WACV/MOTIONS 2005, vol. 1, pp. 494–500 (2005)Google Scholar
  6. 6.
    Cangar, Ö., et al.: Automatic real-time monitoring of locomotion and posture behaviour of pregnant cows prior to calving using online image analysis. Comput. Electron. Agric. 64, 53–60 (2008)CrossRefGoogle Scholar
  7. 7.
    Schlecht, E., Hülsebusch, C., Mahler, F., Becker, K.: The use of differentially corrected global positioning system to monitor activities of cattle at pasture. Appl. Anim. Behav. Sci. 85, 185–202 (2004)CrossRefGoogle Scholar
  8. 8.
    Ungar, E.D., Henkin, Z., Gutman, M., Dolev, A., Genizi, A., Ganskopp, D.: Inference of animal activity from gps collar data on free-ranging cattle. Rangel. Ecol. Manag. 58, 256–266 (2005)CrossRefGoogle Scholar
  9. 9.
    Schwager, M., Anderson, D.M., Butler, Z., Rus, D.: Robust classification of animal tracking data. Comput. Electron. Agric. 56, 46–59 (2007)CrossRefGoogle Scholar
  10. 10.
    Giovanetti, V., et al.: Automatic classification system for grazing, ruminating and resting behaviour of dairy sheep using a tri-axial accelerometer. Livest. Sci. 196, 42–48 (2017)CrossRefGoogle Scholar
  11. 11.
    González, L.A., Bishop-Hurley, G.J., Handcock, R.N., Crossman, C.: Behavioral classification of data from collars containing motion sensors in grazing cattle. Comput. Electron. Agric. 110, 91–102 (2015)CrossRefGoogle Scholar
  12. 12.
    Gutierrez-Galan, D., et al.: Embedded neural network for real-time animal behavior classification. Neurocomputing 272, 17–26 (2018)CrossRefGoogle Scholar
  13. 13.
    Nadimi, E.S., Jørgensen, R.N., Blanes-Vidal, V., Christensen, S.: Monitoring and classifying animal behavior using ZigBee-based mobile ad hoc wireless sensor networks and artificial neural networks. Comput. Electron. Agric. 82, 44–54 (2012)CrossRefGoogle Scholar
  14. 14.
    Kamminga, J.W., Bisby, H.C., Le, D.V., Meratnia, N., Havinga, P.J.M.: Generic online animal activity recognition on collar tags. In: Proceedings of the 2017 ACM International Joint Conference on Pervasive and Ubiquitous Computing and Proceedings of the 2017 ACM International Symposium on Wearable Computers on - UbiComp 2017, pp. 597–606. ACM, New York (2017)Google Scholar
  15. 15.
    Umstätter, C., Waterhouse, A., Holland, J.P.: An automated sensor-based method of simple behavioural classification of sheep in extensive systems. Comput. Electron. Agric. 64, 19–26 (2008)CrossRefGoogle Scholar
  16. 16.
    Arcidiacono, C., Porto, S.M.C.C., Mancino, M., Cascone, G.: Development of a threshold-based classifier for real-time recognition of cow feeding and standing behavioural activities from accelerometer data. Comput. Electron. Agric. 134, 124–134 (2017)CrossRefGoogle Scholar
  17. 17.
    le Roux, S.P., Marias, J., Wolhuter, R., Niesler, T.: Animal-borne behaviour classification for sheep (Dohne Merino) and Rhinoceros (Ceratotherium simum and Diceros bicornis). Anim. Biotelemetry. 5, 25 (2017)CrossRefGoogle Scholar
  18. 18.
    Radeski, M., Ilieski, V.: Gait and posture discrimination in sheep using a tri-axial accelerometer. Animal. 11, 1249–1257 (2017)CrossRefGoogle Scholar
  19. 19.
    Le Roux, S., Wolhuter, R., Niesler, T.: An overview of automatic behaviour classification for animal-borne sensor applications in South Africa (2017)Google Scholar
  20. 20.
    Anderson, D.M., Estell, R.E., Holechek, J.L., Ivey, S., Smith, G.B.: Virtual herding for flexible livestock management - a review. Rangel. J. 36, 205–221 (2014)CrossRefGoogle Scholar
  21. 21.
    Norton, B.E., Barnes, M., Teague, R.: Grazing management can improve livestock distribution: increasing accessible forage and effective grazing capacity. Rangelands 35, 45–51 (2013)CrossRefGoogle Scholar
  22. 22.
    Rutter, S.M.: 13 - Advanced livestock management solutions. In: Ferguson, D.M., Lee, C., Fisher, A. (eds.) Advances in Sheep Welfare, pp. 245–261. Woodhead Publishing (2017)Google Scholar
  23. 23.
    Kamminga, J.W.: Generic online animal activity recognition on collar tags (2017)Google Scholar
  24. 24.
    Mitra, S.K.: Digital Signal Processing: A Computer-Based Approach. McGraw-Hill School Education Group (2001)Google Scholar
  25. 25.
    Rabiner, L.R., Gold, B.: Theory and Application of Digital Signal Processing (1975)Google Scholar
  26. 26.
    Guyon, I., Elisseeff, A.: An introduction to variable and feature selection. J. Mach. Learn. Res. 3, 1157–1182 (2003)zbMATHGoogle Scholar
  27. 27.
    Kursa, M.B., Rudnicki, W.: Feature Selection with Boruta Package (2010)Google Scholar
  28. 28.
    Bishop, C.M.: Neural Networks for Pattern Recognition. Oxford University Press, New York (1995)zbMATHGoogle Scholar
  29. 29.
    Breiman, L.: Random forests. Mach. Learn. 45, 5–32 (2001)CrossRefGoogle Scholar
  30. 30.
    Chen, T., Guestrin, C.: XGBoost: A Scalable Tree Boosting System. arXiv1603.02754 [cs], pp. 785–794 (2016)Google Scholar
  31. 31.
    Kramer, O.: K-nearest neighbors. In: Dimensionality Reduction with Unsupervised Nearest Neighbors, pp. 13–23. Springer, Heidelberg (2013). Scholar
  32. 32.
    Rifkin, R., Klautau, A.: In defense of one-vs-all classification. J. Mach. Learn. Res. 5, 101–141 (2004)MathSciNetzbMATHGoogle Scholar
  33. 33.
    Scheibe, K.M., et al.: ETHOSYS (R)—new system for recording and analysis of behaviour of free-ranging domestic animals and wildlife. Appl. Anim. Behav. Sci. 55, 195–211 (1998)CrossRefGoogle Scholar
  34. 34.
    Alvarenga, F.A.P., Borges, I., Palkovič, L., Rodina, J., Oddy, V.H., Dobos, R.C.: Using a three-axis accelerometer to identify and classify sheep behaviour at pasture. Appl. Anim. Behav. Sci. 181, 91–99 (2018)CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2018

Authors and Affiliations

  • Natasa Kleanthous
    • 1
    Email author
  • Abir Hussain
    • 1
    Email author
  • Alex Mason
    • 2
    • 4
  • Jennifer Sneddon
    • 3
  • Andy Shaw
    • 4
  • Paul Fergus
    • 1
  • Carl Chalmers
    • 1
  • Dhiya Al-Jumeily
    • 1
  1. 1.Department of Computer ScienceLiverpool John Moores UniversityLiverpoolUK
  2. 2.Animalia ASNorwegian Meat and Poultry Research InstituteOsloNorway
  3. 3.Department of Natural Sciences and PsychologyLiverpool John Moores UniversityLiverpoolUK
  4. 4.Department of Built EnvironmentLiverpool John Moores UniversityLiverpoolUK

Personalised recommendations