New! Sign up for our free email newsletter.
Science News
from research organizations

AI system to diagnose pain levels in sheep

May 31, 2017
University of Cambridge
An artificial intelligence system is able to detect pain levels in sheep, which could aid in early diagnosis and treatment of common, but painful, conditions in animals.

The researchers have developed an AI system which uses five different facial expressions to recognise whether a sheep is in pain, and estimate the severity of that pain. The results could be used to improve sheep welfare, and could be applied to other types of animals, such as rodents used in animal research, rabbits or horses.

Building on earlier work which teaches computers to recognise emotions and expressions in human faces, the system is able to detect the distinct parts of a sheep's face and compare it with a standardised measurement tool developed by veterinarians for diagnosing pain. Their results will be presented today (1 June) at the 12th IEEE International Conference on Automatic Face and Gesture Recognition in Washington, DC.

Severe pain in sheep is associated with conditions such as foot rot, an extremely painful and contagious condition which causes the foot to rot away; or mastitis, an inflammation of the udder in ewes caused by injury or bacterial infection. Both of these conditions are common in large flocks, and early detection will lead to faster treatment and pain relief. Reliable and efficient pain assessment would also help with early diagnosis.

As is common with most animals, facial expressions in sheep are used to assess pain. In 2016, Dr Krista McLennan, a former postdoctoral researcher at the University of Cambridge who is now a lecturer in animal behaviour at the University of Chester, developed the Sheep Pain Facial Expression Scale (SPFES). The SPFES is a tool to measure pain levels based on facial expressions of sheep, and has been shown to recognise pain with high accuracy. However, training people to use the tool can be time-consuming and individual bias can lead to inconsistent scores.

In order to make the process of pain detection more accurate, the Cambridge researchers behind the current study used the SPFES as the basis of an AI system which uses machine learning techniques to estimate pain levels in sheep. Professor Peter Robinson, who led the research, normally focuses on teaching computers to recognise emotions in human faces, but a meeting with Dr McLennan got him interested in exploring whether a similar system could be developed for animals.

"There's been much more study over the years with people," said Robinson, of Cambridge's Computer Laboratory. "But a lot of the earlier work on the faces of animals was actually done by Darwin, who argued that all humans and many animals show emotion through remarkably similar behaviours, so we thought there would likely be crossover between animals and our work in human faces."

According to the SPFES, when a sheep is in pain, there are five main things which happen to their faces: their eyes narrow, their cheeks tighten, their ears fold forwards, their lips pull down and back, and their nostrils change from a U shape to a V shape. The SPFES then ranks these characteristics on a scale of one to 10 to measure the severity of the pain.

"The interesting part is that you can see a clear analogy between these actions in the sheep's faces and similar facial actions in humans when they are in pain -- there is a similarity in terms of the muscles in their faces and in our faces," said co-author Dr Marwa Mahmoud, a postdoctoral researcher in Robinson's group. "However, it is difficult to 'normalise' a sheep's face in a machine learning model. A sheep's face is totally different in profile than looking straight on, and you can't really tell a sheep how to pose."

To train the model, the Cambridge researchers used a small dataset consisting of approximately 500 photographs of sheep, which had been gathered by veterinarians in the course of providing treatment. Yiting Lu, a Cambridge undergraduate in Engineering and co-author on the paper, trained the model by labelling the different parts of the sheep's faces on each photograph and ranking their pain levels according to SPFES.

Early tests of the model showed that it was able to estimate pain levels with about 80% degree of accuracy, which means that the system is learning. While the results with still photographs have been successful, in order to make the system more robust, they require much larger datasets.

The next plans for the system are to train it to detect and recognise sheep faces from moving images, and to train it to work when the sheep is in profile or not looking directly at the camera. Robinson says that if they are able to train the system well enough, a camera could be positioned at a water trough or other place where sheep congregate, and the system would be able to recognise any sheep which were in pain. The farmer would then be able to retrieve the affected sheep from the field and get it the necessary medical attention.

"I do a lot of walking in the countryside, and after working on this project, I now often find myself stopping to talk to the sheep and make sure they're happy," said Robinson.

Story Source:

Materials provided by University of Cambridge. The original story is licensed under a Creative Commons License. Note: Content may be edited for style and length.

Cite This Page:

University of Cambridge. "AI system to diagnose pain levels in sheep." ScienceDaily. ScienceDaily, 31 May 2017. <>.
University of Cambridge. (2017, May 31). AI system to diagnose pain levels in sheep. ScienceDaily. Retrieved July 24, 2024 from
University of Cambridge. "AI system to diagnose pain levels in sheep." ScienceDaily. (accessed July 24, 2024).

Explore More

from ScienceDaily