A Swin-Transformer and LSTM-based method for cow behaviour recognition in diverse environments

Read full text
Authors: Xiumei Che, Longjiang Wang, Silei Tang, Qing Zhai, Jinjun Yu, Zhi Wang, Zongwei Jia
Cited by: 1
References: 24

Abstract

This study employs deep learning technology to assist in the identification of dairy cows’ daily activities in video surveillance scenarios. First, to overcome environmental limitations, data was collected under various lighting and weather conditions (daytime, night-time, light changes, rainy days). Second, the YOLOv5-SF algorithm was proposed: the Swin-Transformer self-attention mechanism was introduced into the C3 module of YOLOv5 to optimise parameters and improve computational efficiency, while the SiLU activation function in the convolutional layer was replaced with FReLU to enhance the model’s ability to capture spatial features. Experiments show that the model achieves an mAP value of 0.965 for five main daily behaviours and demonstrates excellent robustness in different environments. Furthermore, the StrongSORT multi-object tracking algorithm was combined to assign a unique and consistent ID to each cow, and the LSTM time series model was used to predict the behaviour data. Through comparison and analysis with manual statistics, the behaviour patterns of dairy cows were deeply revealed. This study provides an efficient and reliable technical solution for animal behaviour monitoring in precision animal husbandry.

Fields of Study & Subjects

Animal Behavior and Welfare Studies Food Supply Chain Traceability Effects of Environmental Stressors on Livestock

Publication details

Journal / source
Italian Journal of Animal Science
Publisher
Informa UK Limited
Volume
25
Issue
1
Pages
492–508
Publication date
9 May 2026
Language
EN