Maheen Rashid, doctoral student at UC Davis' Department of Computer Science. Photos courtesy Maheen Rashid, UC Davis All day every day 50 horses from the University of California, Davis herd are under surveillance. The observations aren’t intended to catch the horses engaging in exotic behavior; rather, they are intended to help veterinarians, students, technicians and owners detect expressions of pain on horses’ faces. Like humans, horses exhibit involuntary facial expressions to communicate stress, fear and pain. Also like humans, animals can display those expressions in subtle ways, according to Claudia Sonder, DVM, of the UC Davis School of Veterinary Medicine. “A change in the shape of the eye, the mouth or the nose can tell us whether the animal is in pain,” said Dr. Sonder. “So if we had a way to objectively recognize those changes we could address pain issues better. “ Sonder became interested in the connection between a horse’s facial expressions and its condition when a team of visiting Scandinavian veterinarians arrived at the university in search of a large herd to participate in its own study of how horses express pain. The horses at UC Davis seemed perfect for their project. “We have a herd of about 200 horses that are here because they have some condition that makes them unridable, whether it’s arthritis or laminitis, or they are navicular—we even have a horse with a clubbed foot,” Sonder said. “And most of our horses have pain that is chronic.” When one of the visiting veterinarians zeroed in on one mare’s subtle expression of her chronic pain, Sonder was convinced take up a study of her own. “One of the vets approached a mare and said, ‘Look, she’s in pain,’” Sonder said. “The mare was just grazing, she was relaxed and alert, but the vet could see just from the shape of her eye that she was in pain.” After that, Sonder decided to use the university’s resources to collaborate on creating a system to objectively assess how horses subtly display expressions of pain. A subsequent search led Sonder to the school’s Department of Computer Science, where doctoral student Maheen Rashid became involved in the project. Teaching computers to read expressions Maheen Rashid and her advisor find key points for horses (eyes, nose, mouth) in different poses and settings, and for different ages. It began when Rashid and her team set out to create software that would first map horses faces, then “teach” a computer to read those faces and the expressions they display. She began by first studying what features the faces of humans and horses could share. “We understand the expressions of human beings, and we can probably figure out what those expressions are,” Rashid said. “Then we figure points on the horse’s face—noses, mouths, eyes—that correspond with human faces.” The team then used photographs of humans to map key points on human faces, including eyes, mouths and noses. Similarly, they used photographs to map corresponding key points on the faces of horses. Once the key points were established and the animals’ faces were mapped, corresponding data was stored in the computer, and the machine was ready to “learn” how to recognize the faces of horses. Sonder participated in the so-called “machine learning” portion of the study by using 16 horses that already were being used in a study examining how equine-assisted therapy might help humans cope with dementia. “We took videos of the horses’ faces before they interacted with the people, during their interaction and afterward,” Sonder said. “Those videos were fed into the computer to help the machine learn.” Coincidentally, the videos also captured signs of stress, fear, boredom and anxiety in the animals’ faces. At the same time, video cameras were mounted at strategic points in paddocks where 50 horses in the UC Davis herd regularly roam. The goal was to film the horses as unobtrusively as possible and to record an involuntary expressions of pain, Rashid said. “We tried to be very consistent scanning the horses’ faces,” she explains. “And then we tried to get the computer to scan the faces without any human intervention.” That’s because observing the horses from a distance is critical to detecting the presence of pain, said Sonder. “Horses often do not blatantly display pain—especially before their owners or regular handlers—they’ll square right up no matter what,” she said. “So this will objectively tell us about their chronic pain.” Fine-tuning emerging science So far, the cameras have recorded hundreds of videos and have run them through the study’s computer system. But recording every single involuntary expression will take time. “We need a lot more data that will have to be analyzed, and all this information must be put into context,” Sonder said. “This is an emerging science.” Detractors worry that computerizing clinic observations will diminish the role experience plays in diagnosis. According to Sonder, such a technical aspect is intended to enhance replace a hands-on examination by an experienced practitioner, not replace it. “Right now, the eye of the beholder is the method we use,” she said. “We are not replacing experience, but we are saying that the video tapes can pick up expressions that a human might miss.” Sonder saw the combination’s benefit first-hand when she and a horse owner deliberated over whether to perform an invasive procedure on a mare brought to her for treatment. According to Sonder, the animal was alert, its ears were forward, and it showed no obvious sign of pain. “But when I looked at her nostrils, their shape indicated that she was in pain,” Sonder recalled. “The owner chose to have the procedure done, and we found out that she had a much bigger problem than we initially thought.” As a result, Sonder believes that the combination of technology and experience will indispensable to veterinarians. “Not only can this technology address pain, but it can also help us treat the animal faster,” Sonder said. Clara Mason, DVM, of the American Association of Equine Practitioners Equine Welfare Committee, agreed, adding that eventually, she would like to see a computer program that equine veterinarians can use in their own clinics. “I can see it being a very useful tool for us,” Dr. Mason said. Small animal specialist Bronya M. Redden, DVM, also believes that such a program could increase the efficiency of her practice. According to Dr. Redden, the availability of a pain-detecting computer program would enhance her initial examinations and inform her decisions about which pain medication she prescribes and how frequently it should be administered. At the same time, such a program would also allow technicians to better manage care throughout the patient’s stay. “You have a lot of people handling the animals, and sometimes, an animal’s pain medication will wear off sooner than expected, ” Redden said. “If the technicians had something to follow, it would be wonderful. Also, we’d like to see programs that would help us identify fear or nervousness or stress, too.” In fact, Rashid envisions that similar systems will be developed for veterinarians who treat small animals, as well as for use with primates, cattle and other livestock. “I can imagine it being used to scan the faces of cats and dogs as long as they develop a way to distinguish those expressions in graphics,” she said. For now, Sonder believes that the pain study is at the cutting edge of merging technology with the science of veterinary medicine. Ultimately, it will help us all be better veterinarians, she said. For Rashid, the project provides a rare opportunity to see the effect of her work. “As a computer scientist, you usually are far removed from the application,” Rashid said. “It’s really nice to know how this might help animals.”