New Issue: Orbital Catastrophe Ahead? Read Now

Why This AI Gazes into Goat Faces

AI-based systems can help identify livestock’s early signs of distress

Goat staring

Nitin Prabhudesai/Getty Images

Join Our Community of Science Lovers!

The patient grumbled and grimaced, but he refused to speak to his doctor.

The patient was a goat.

Recognizing animal pain is notoriously difficult. To do so, humans must rely on subtle body language or behavioral changes. But a new artificial-intelligence model automates this process by identifying pain in goats—using only their facial expressions. The model, described in Scientific Reports, achieved 80 percent accuracy and offers a promising avenue for automatically monitoring livestock health.


On supporting science journalism

If you're enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.


Traditionally, detecting animal pain involves analyzing photos or videos by hand for specific cues—a raised lip, a flared nostril—and creating pain scales tailored to individual species. But as humans, we both detect and interpret animals’ pain through a biased lens, says University of Florida veterinary anesthesiologist Ludovica Chiavaccini, the new study’s lead author. When detection is automated, “the computer just picks up the patterns.”

Chiavaccini and her team videotaped 40 goats of various breeds and ages with different medical conditions at a veterinary hospital, generating more than 5,000 fixed frames. Using a behavioral pain scale, clinical history and physical exams, they classified each goat as in pain or not. The team tried three approaches, training an algorithm on different groupings of images while reserving others to test that training. The most balanced model, similarly adept at detecting pained and not-pained goats, was trained on four fifths of the frames, fine-tuned using the remaining fifth and tested on videos of two additional goats. Repeating this process five times with varying groupings yielded an average accuracy of 80 percent. Such training “essentially builds 30 years of clinical experience in 30 minutes,” Chiavaccini says.

Similar AI tools exist for cats, which have better-established expression-based pain scales, but the only such pain scale for goats had been validated solely in young, healthy males undergoing castration. Chiavaccini was inspired by the lack of goat pain scales, in addition to a graduate student’s enthusiasm for the animals after presenting them at an agricultural show.

AI-powered tools built with similar methods could someday help veterinarians make quicker and more accurate diagnoses or alert farmers to early stages of livestock distress. “This study shows the potential for broader adoption of AI in animal care and highlights the need for further exploration across diverse species,” says University of Glasgow computer scientist Marwa Mahmoud, who specializes in human and animal behavioral AI.

Expression-based pain-assessment tools already exist for nonverbal human patients, but these systems’ effectiveness can be limited by poor image quality or suboptimal camera angles. “Many of the engineering problems we solved, like adapting to messy, real-world conditions, could be helpful to human medicine,” Chiavaccini says. “Doctors worry about perfect lighting or head alignment. Meanwhile I’m out here racing after a goat with my camera.”

Lucy Tu is a freelance writer and a Rhodes Scholar studying reproductive medicine and law. She was a 2023 AAAS Mass Media Fellow at Scientific American.

More by Lucy Tu
Scientific American Magazine Vol 332 Issue 3This article was published with the title “Facing Pain” in Scientific American Magazine Vol. 332 No. 3 (), p. 16
doi:10.1038/scientificamerican032025-6rLWwYIWhTcgBBhDhZFDzQ

Subscribe to Support Independent Journalism

Great science journalism requires human expertise, time, effort and creativity. And it costs money. That’s why I and the journalists here at Scientific American hope you’ll join our community.

When you subscribe, you are supporting staff and freelance journalists who are passionate about telling science stories that are true, important and compelling. Our editors and reporters are often experts in their fields, which means they understand the nuances of big discoveries and can untangle the breakthroughs from the hype. With a subscription, you are also supporting rigorous fact-checking to ensure the words we publish are precise and accurate. And you’re supporting original illustrations, graphics and photos that bring you closer to an advanced laboratory, an ice sheet in Antarctica or a space mission in orbit. You’re helping us craft other types of high-quality journalism as well: Our newsletters are carefully written, edited and curated by staffers you have or will come to know and love. Our Science Quickly podcast is based on original reporting, collaboration with editors and scientists and exacting production.

Subscriptions keep this engine running so we can continue to deliver thoughtful, rigorous and independent science journalism to you. In an era of viral misinformation, this work is crucial. If you value what we do, I hope you’ll consider joining us as a subscriber

Thank you,

Jeanna Bryner, Editor in Chief, Scientific American

Subscribe