
sify stress levels in sows based on facial features in
a realistic farming environment, aiming to improve
animal welfare and reduce antimicrobial resistance
(AMR) risks in pig farming. The results showed
that the original pretrained model struggled to identify
low-stressed (LS) sows in a real-world scenario due to
its inability to capture subtle stress indicators, while
fine-tuning improved performance. The YOLO8l-cls
model exhibited the highest overall performance, with
an F1-score of 0.74, Cohen’s Kappa of 0.63, and
MCC of 0.60, indicating stronger agreement and bet-
ter generalization across both LS and high-stressed
(HS) categories. Its ability to balance precision and
recall and accurately identify subtle stress markers in
the facial regions underscores its potential.
These findings highlight YOLO8l-cls as a practi-
cal tool for real-time monitoring of sow stress, en-
abling early intervention and improving health man-
agement in farming environments. The model’s abil-
ity to detect stress markers, particularly in facial re-
gions, demonstrates its relevance for enhancing an-
imal welfare and addressing AMR concerns. How-
ever, the relatively small number of sows in this study
limits the model’s generalizability. Future work will
focus on expanding the dataset, incorporating more
diverse stress conditions, and testing the model on
cross-generational data, including both parents and
offspring, to explore the potential heritability of stress
markers. Further research will also assess the model’s
scalability in larger farming environments to validate
its reliability and applicability across different setups.
ACKNOWLEDGEMENTS
The authors would like to acknowledge the finan-
cial support provided by the Joint Programming Ini-
tiative on Antimi-crobial Resistance (JPIAMR) for
the FARM-CARE project, ‘FARM interventions to
Control Antimicrobial ResistancE - Full Stage’ (ID:
7429446), and the Medical Research Council (MRC)
for funding the UK part of the project (MRC re-
search grant number: MR/W031264/1). This project
is part of a collaboration between the University of
the West of England, Scotland’s Rural College, Uni-
versity of Copenhagen, Teagasc, University Hospital
Bonn, Statens Serum Institut (SSI), and Porkcolombia
Association.
REFERENCES
Alpaydin, K., Ucar, Y. S., and Devrim, M. E. (2020). Deep
learning-based approaches for animal behavior analy-
sis: A review. Computers and Electronics in Agricul-
ture, 170.
Arjun, G. S. R. D. D., Mary, S. A., and Daniel, M. K. S. A.
(2020). Antibiotic use in agriculture and its impact on
antimicrobial resistance. Environmental Science and
Pollution Research, 27(6):6021–6031.
Arriaga, S. D. R. M., Doe, J., and Smith, A. (2021). Ma-
chine learning techniques for fish behavior analysis.
Aquaculture Reports, 20.
Bartolom
´
e, E., Puigdueta, I., Gu
`
ardia, M., Estevez, M., and
Gomis, J. (2004). Effect of chronic transportation
stress on welfare and meat quality of weaned piglets.
Meat Science, 67(2):337–342.
Broom, D. (2011). Assessing welfare based on biological
principles. Journal of Agricultural and Environmental
Ethics, 24(1):215–227.
Dwyer, D. M. M., Ison, S. C., and Lawrence, S. A. (2000).
The use of a food competition test to assess social
rank in pigs. Applied Animal Behaviour Science,
66(4):297–308.
Hansen, M. F., Baxter, E. M., Rutherford, K. M. D., Futro,
A., Smith, M. L., and Smith, L. N. (2021). Towards
facial expression recognition for on-farm welfare as-
sessment in pigs. Agriculture, 11(9):847.
He, K., Gkioxari, G., Doll
´
ar, P., and Girshick, R. (2017).
Mask r-cnn. In Proceedings of the IEEE International
Conference on Computer Vision (ICCV), pages 2961–
2969. IEEE.
Janssens, C. J., Helmond, F. A., and Wiegant, V. M. (1995).
The effect of chronic stress on plasma cortisol concen-
trations in cyclic female pigs depends on the time of
day. Domest. Anim. Endocrinol., 12(2):167–177.
Jong, I. C. D., Ekkel, E. D., Burgwal, J. A. V. D., Lambooij,
E., Korte, S. M., Ruis, M. A., Koolhaas, J. M., and
Blokhuis, H. J. (1998). Effects of strawbedding on
physiological responses to stressors and behavior in
growing pigs. Physiol. Behav., 64(3):303–310.
Liu, X., Wu, H., Chen, S., and Li, H. (2020). Automatic
recognition of stress in broiler chickens based on deep
learning. Sensors, 20(15):4251.
Manteca, X. and Alonso, D. (2000). Stress and meat quality
of pigs. Livestock Production Science, 65(2-3):239–
248.
Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J.,
Chanan, G., Killeen, T., Lin, Z., Gimelshein, N.,
Antiga, L., Desmaison, A., K
¨
op, A., Yang, E. Z., De-
Vito, Z., Raison, M., Tejani, A., Chilamkurthy, S.,
Steiner, B., Fang, L., Bai, J., and Chintala, S. (2019).
Pytorch: An imperative style, high-performance deep
learning library. CoRR, abs/1912.01703. [Online].
Available: http://arxiv.org/abs/1912.01703.
Ruijven, T. and Oliehoek, K. (2017). Prenatal stress and
(neuro)epigenetic programming: Consequences for
behavior and social development. Neuroscience &
Biobehavioral Reviews, 80:604–616.
Ultralytics (2024). YOLOv8 Classification. [Online]. Avail-
able: https://docs.ultralytics.com/tasks/classify/.
Wang, H., Wu, S., and Zhang, Y. (2020a). Facial expres-
sion recognition for pig welfare assessment: A deep
learning approach. Animals, 10(12):2261.
Deep Learning-Based Classification of Stress in Sows Using Facial Images
395