Estimation of Pain in Sheep Using Computer Vision

  • Marwa MahmoudEmail author
  • Yiting Lu
  • Xijie Hou
  • Krista McLennan
  • Peter Robinson


Assessing pain levels in animals is a crucial but time-consuming process in maintaining their welfare. Facial expressions in sheep are an efficient and reliable indicator of pain levels. We have extended techniques for recognising human facial expressions to analyse facial expressions of sheep, which can then facilitate automatic estimation of pain levels. In this chapter we describe our multilevel approach that starts with detection of sheep faces in an image, localisation of facial landmarks, normalisation and then extraction of facial features. Using machine learning methods, we then estimate the pain level from the detected change in the facial expressions. Our sheep face detection approach has been shown to be robust in detecting sheep faces in images containing many sheep, in different lighting conditions and with reasonable variation in viewpoints. We argue that our approach to automated pain level assessment can be generalised to other animals.



The authors would like to thank the help of the Department of Veterinary medicine at University of Cambridge.


  1. Brown, L. G. (1992). A survey of image registration techniques (abstract). ACM Computing Surveys Archive, 24, 325–376.CrossRefGoogle Scholar
  2. Brunelli, R. (2009). Template matching techniques in computer vision: Theory and practice. Hoboken: Wiley.CrossRefGoogle Scholar
  3. Burgos-Artizzu, X. P., Perona, P., & Dollar, P. (2013). Robust face landmark estimation under occlusion. In ICCV.Google Scholar
  4. Cortes, C., & Vapnik, V. (1995). Support-vector networks. Machine Learning, 20, 273.Google Scholar
  5. Dalal, N., Triggs, B., & Schmid, C. (2006). Human detection using oriented histograms of flow and appearance. In European Conference on Computer Vision.Google Scholar
  6. Dalla Costa, E., Minero, M., Lebelt, D., Stucke, D., Canali, E., et al. (2014). Development of the Horse Grimace Scale (HGS) as a pain assessment tool in horses undergoing routine castration. PLoS One, 9, e92281.CrossRefGoogle Scholar
  7. Darwin, C., & Prodger, P. (1998). The expression of the emotions in man and animals. New York: Oxford University Press.Google Scholar
  8. Davis E. K. (2009). Dlib-ml: A machine learning toolkit. Journal of Machine Learning Research, 10, 1755–1758.Google Scholar
  9. Davis E. K. (2015). Max-Margin Object Detection. CoRR abs/1502.00046.
  10. Dolan, S., Field, L. C., & Nolan, A. M. (2000). The role of nitric oxide and prostaglandin signalling pathway is spinal nociceptive processing in chronic inflammation. Pain, 86(3), 311–320CrossRefGoogle Scholar
  11. Dolan, S., Kelly, J. G., Monteiro, A. M., & Nolan, A. M. (2003). Up-regulation of metabotropic glutamate receptor subtypes 3 and 5 in spinal cord in a clinical model of persistent inflammation and hyperalgesia. Pain, 106(3), 501–512CrossRefGoogle Scholar
  12. Dollar, P., Welinder, P., & Perona, P. (2010). Cascaded pose regression. In CVPR.Google Scholar
  13. Ekman, P., & Friesen, W. V. (1977). Manual for the facial action coding system. Palo Alto: Consulting Psychologists Press.Google Scholar
  14. Felzenszwalb, P. F., Girshick, R. B., McAllester, D., & Ramanan, D. (2010). Object detection with discriminative trained part based models. IEEE Transactions on Pattern Analysis and Machine Intelligence, 32(9), 1627–1645CrossRefGoogle Scholar
  15. Flecknell, P. (2008). Analgesia from a veterinary perspective. British Journal of Anaesthesia, 101, 121–124.CrossRefGoogle Scholar
  16. Freitas-Magalhes, A. (2012). Microexpression and macroexpression. In V. S. Ramachandran (Ed.), Encyclopedia of human behavior. Oxford: Elsevier.Google Scholar
  17. Huxley, J., & Helen R. W. (2006). Cow based assessments Part 2: Rising restrictions and injuries associated with the lying surface. UK Vet Livestock, 11, 33–38.CrossRefGoogle Scholar
  18. Ison, S. H., & Rutherford, K. M. D. (2014). Attitudes of farmers and veterinarians towards pain and the use of pain relief in pigs. The Veterinary Journal, 202, 622–627.CrossRefGoogle Scholar
  19. Keating S. C. J., Thomas, A. A., Flecknell, P. A., & Leach, M. C. (2012). Evaluation of EMLA cream for preventing pain during tattooing of rabbits: Changes in physiological, behavioural and facial expression responses. PLoS One, 7, e44437.CrossRefGoogle Scholar
  20. King, D. E. (2009). Dlib-ml: A machine learning toolkit. JMLR, 10, 1755–1758.Google Scholar
  21. Langford, D. J., Bailey, A. L., Chanda, M. L., Clarke, S. E., Drummond, T. E., Echols, S., Glick, S., Ingrao, J., Klassen-Ross, T., Lacroix-Fralish, M. L., Matsumiya, L., Sorge, R. E., Sotocinal, S. G., Tabaka, J. M., Wong, D., van den Maagdenberg, A. M., Ferrari, M. D., Craig, K. D., & Mogil, J. S. (2010). Coding of facial expressions of pain in the laboratory mouse. Nature Methods, 7, 447–449.CrossRefGoogle Scholar
  22. Leach, M. C., Klaus, K., Miller, A. L., Scotto di Perrotolo, M., Sotocinal, S. G., & Flecknell, P. A. (2012). The assessment of post-vasectomy pain in mice using behaviour and the mouse grimace scale. PLoS One, 7, e35656.CrossRefGoogle Scholar
  23. Lizarraga, I., & Chambers, J. P. (2012). Use of analgesic drugs for pain management in sheep. New Zealand Veterinary Journal, 60, 87–94.CrossRefGoogle Scholar
  24. Matsumiya, L. C., et al. (2012). Using the Mouse Grimace Scale to reevaluate the efficacy of postoperative analgesics in laboratory mice. Journal of the American Association for Laboratory Animal Science, 51, 42–49.PubMedPubMedCentralGoogle Scholar
  25. McLennan, K. M., et al. (2016). Development of a facial expression scale using footrot and mastitis as models of pain in sheep. Applied Animal Behaviour Science, 176, 19–26.CrossRefGoogle Scholar
  26. Reed, L. I., Sayette, M. A., & Cohn, J. F. (2007). Impact of depression on response to comedy: A dynamic facial coding analysis. Journal of Abnormal Psychology, 116, 804–809.CrossRefGoogle Scholar
  27. Sotocinal S. G., et al. (2011). The rat grimace scale: A partially automated method for quantifying pain in the laboratory rat via facial expressions. Molecular Pain, 7, 1–10.Google Scholar
  28. Van Rysewyk, S. (2016). Nonverbal indicators of pain. Animal Sentience: An Interdisciplinary Journal on Animal Feeling, 1(3), 30.Google Scholar
  29. Viola, P. A., & Jones, M. J. (2001). Rapid object detection using a boosted cascade of simple features. In CVPR, Issue 1.Google Scholar
  30. Yang, H., Zhang, R., & Robinson, P. (2015). Human and sheep facial landmarks localisation by triplet interpolated features. IEEE Winter Conference on Applicants of Computer Vision (WACV), 2016.Google Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  • Marwa Mahmoud
    • 1
    Email author
  • Yiting Lu
    • 1
  • Xijie Hou
    • 1
  • Krista McLennan
    • 2
  • Peter Robinson
    • 1
  1. 1.Department of Computer Science and TechnologyUniversity of CambridgeCambridgeUK
  2. 2.Department of Biological SciencesUniversity of ChesterChesterUK

Personalised recommendations