A Deep Learning Framework for Detecting Cross-Generational Facial Markers Associated with Stress in Pigs

Research output: Contribution to journalArticlepeer-review

1 Downloads (Pure)

Abstract

Maternal stress during gestation can alter offspring physiology, behaviour, and immune function. In pigs, such ‘prenatal stress’ is known to increase stress sensitivity, but the potential to automatically detect such sensitivity has remained unexplored. Automatic detection of facial expression has successfully identified differences in pigs dependent on their stress status. This study progresses this work by demonstrating that, for the first time, using a deep learning framework applied to facial analysis, stress-linked phenotypes can be learned from one generation and detected in the next. Using a dataset of over 7000 facial images from 18 gestating sows and 53 of their daughters, we trained and evaluated five state-of-the-art deep learning architectures across six independent daughter cohorts. Attention-based models significantly outperformed CNN-based models, with the Vision Transformer (ViT) model achieving a mean accuracy of 0.78 and an average F1-score of 0.76. Grad-CAM visualisations showed that the ViT consistently attended to biologically relevant facial regions, such as the eyes and snout, whereas CNNs often focused on diffuse or non-informative areas, resulting in reduced low-stress recall and greater batch sensitivity. Models trained on maternal facial images successfully predicted stress responsiveness in daughters from unrelated lineages, indicating that the model captured generalisable facial cues of stress rather than familial resemblance. This approach supports previous work showing that machine vision can detect putatively stress-related alterations to facial expression in pigs. Future application of this approach could offer a scalable, non-invasive tool for early detection of stress in livestock production systems, opening new avenues for welfare-oriented precision livestock management and informed breeding strategies aimed at improving stress resilience.
Original languageEnglish
Article number2253
JournalAgriculture (Switzerland)
Volume15
Issue number21
Early online date29 Oct 2025
DOIs
Publication statusPrint publication - Nov 2025

Bibliographical note

Publisher Copyright:
© 2025 by the authors.

Keywords

  • precision livestock farming
  • stress biomarkers
  • pig welfare
  • deep learning
  • computer vision
  • facial expression analysis

Fingerprint

Dive into the research topics of 'A Deep Learning Framework for Detecting Cross-Generational Facial Markers Associated with Stress in Pigs'. Together they form a unique fingerprint.

Cite this