Abstract
Sheep behaviour can reflect their growth and health. However, the current sheep behaviour recognition studies have yet to focus on statistics on the duration of various behaviours for individual sheep. Traditional behavioural recognition methods can overlook abnormal sheep behaviour such as prolonged lying or not eating. Therefore, we propose an advanced framework for statistically analyzing the duration of sheep behaviours within a farm environment. This paper constructed a dataset of sheep behaviour images collected from a natural farm environment, including walking, standing, eating, lame, lying, licking, and attacking. Based on the Vision Transformer (ViT) method and the YOLOv8 model, a sheep tracking model, ViTSORT, and a sheep behaviour recognition model, YOLOv8-MS, are presented for the duration of sheep behaviours. The experimental results show that ViTSORT can solve the problem of tracking target loss when sheep cover each other. Meanwhile, the YOLOv8-MS model achieves a precision of 96.9% mAP on our sheep behaviour dataset, and the detection speed is 196 FPS, higher than previous methods.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Arcidiacono, C., Porto, S., Mancino, M., Cascone, G.: Development of a threshold-based classifier for real-time recognition of cow feeding and standing behavioural activities from accelerometer data. Comput. Electron. Agric. 134, 124–134 (2017)
Bewley, A., Ge, Z., Ott, L., Ramos, F., Upcroft, B.: Simple online and realtime tracking. In: 2016 IEEE International Conference on Image Processing (ICIP), pp. 3464–3468. IEEE (2016)
Chelotti, J.O., Vanrell, S.R., Rau, L.S.M., Galli, J.R., Planisich, A.M., Utsumi, S.A., Milone, D.H., Giovanini, L.L., Rufiner, H.L.: An online method for estimating grazing and rumination bouts using acoustic signals in grazing cattle. Comput. Electron. Agric. 173, 105443 (2020)
Chen, C., Zhu, W., Norton, T.: Behaviour recognition of pigs and cattle: Journey from computer vision to deep learning. Comput. Electron. Agric. 187, 106255 (2021)
Chen, C., Zhu, W., Steibel, J., Siegford, J., Han, J., Norton, T.: Classification of drinking and drinker-playing in pigs by a video-based deep learning method. Biosys. Eng. 196, 1–14 (2020)
Fuentes, A., Yoon, S., Park, J., Park, D.S.: Deep learning-based hierarchical cattle behavior recognition with spatio-temporal information. Comput. Electron. Agric. 177, 105627 (2020)
Gao, Y., Yan, K., Dai, B., Sun, H., Yin, Y., Liu, R., Shen, W.: Recognition of aggressive behavior of group-housed pigs based on cnn-gru hybrid model with spatio-temporal attention mechanism. Comput. Electron. Agric. 205, 107606 (2023)
Gu, Z., Zhang, H., He, Z., Niu, K.: A two-stage recognition method based on deep learning for sheep behavior. Comput. Electron. Agric. 212, 108143 (2023)
Han, K., Wang, Y., Tian, Q., Guo, J., Xu, C., Xu, C.: Ghostnet: More features from cheap operations. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1580–1589 (2020)
Hou, Q., Jiang, Z., Yuan, L., Cheng, M.M., Yan, S., Feng, J.: Vision permutator: a permutable mlp-like architecture for visual recognition. IEEE Trans. Pattern Anal. Mach. Intell. 45(1), 1328–1334 (2022)
Howard, A.G., Zhu, M., Chen, B., Kalenichenko, D., Wang, W., Weyand, T., Andreetto, M., Adam, H.: Mobilenets: efficient convolutional neural networks for mobile vision applications (2017). arXiv preprint arXiv:1704.04861
Jiang, B., Yin, X., Song, H.: Single-stream long-term optical flow convolution network for action recognition of lameness dairy cow. Comput. Electron. Agric. 175, 105536 (2020)
Li, C., Li, L., Jiang, H., Weng, K., Geng, Y., Li, L., Ke, Z., Li, Q., Cheng, M., Nie, W., et al.: Yolov6: a single-stage object detection framework for industrial applications (2022). arXiv preprint arXiv:2209.02976
Lin, W., Wu, Z., Chen, J., Huang, J., Jin, L.: Scale-aware modulation meet transformer. In: Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6015–6026 (2023)
Liu, C., Ye, H., Wang, L., Lu, S., Li, L.: Novel tracking method for the drinking behavior trajectory of pigs. Int. J. Agric. Biol. Eng. 16(6), 67–76 (2024)
Liu, D., Oczak, M., Maschat, K., Baumgartner, J., Pletzer, B., He, D., Norton, T.: A computer vision-based method for spatial-temporal action recognition of tail-biting behaviour in group-housed pigs. Biosys. Eng. 195, 27–41 (2020)
Lyu, C., Zhang, W., Huang, H., Zhou, Y., Wang, Y., Liu, Y., Zhang, S., Chen, K.: Rtmdet: an empirical study of designing real-time object detectors (2022). arXiv preprint arXiv:2212.07784
Meunier, B., Pradel, P., Sloth, K.H., Cirié, C., Delval, E., Mialon, M.M., Veissier, I.: Image analysis to refine measurements of dairy cow behaviour from a real-time location system. Biosys. Eng. 173, 32–44 (2018)
Shane, D.D., White, B.J., Larson, R.L., Amrine, D.E., Kramer, J.L.: Probabilities of cattle participating in eating and drinking behavior when located at feeding and watering locations by a real time location system. Comput. Electron. Agric. 127, 460–466 (2016)
Wang, C.Y., Bochkovskiy, A., Liao, H.Y.M.: Yolov7: trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7464–7475 (2023)
Wang, J., He, Z., Zheng, G., Gao, S., Zhao, K.: Development and validation of an ensemble classifier for real-time recognition of cow behavior patterns from accelerometer data and location data. PLoS ONE 13(9), e0203546 (2018)
Wojke, N., Bewley, A., Paulus, D.: Simple online and realtime tracking with a deep association metric. In: 2017 IEEE International Conference on Image Processing (ICIP), pp. 3645–3649. IEEE (2017)
Wu, D., Wang, Y., Han, M., Song, L., Shang, Y., Zhang, X., Song, H.: Using a CNN-LSTM for basic behaviors detection of a single dairy cow in a complex environment. Comput. Electron. Agric. 182, 106016 (2021)
Wu, D., Wu, Q., Yin, X., Jiang, B., Wang, H., He, D., Song, H.: Lameness detection of dairy cows based on the yolov3 deep learning algorithm and a relative step size characteristic vector. Biosyst. Eng. 189, 150–163 (2020)
Xu, T., Zhu, X.F., Wu, X.J.: Learning spatio-temporal discriminative model for affine subspace based visual object tracking. Visual Intell. 1(1), 4 (2023)
Yan, P., Liu, X., Zhang, P., Lu, H.: Learning convolutional multi-level transformers for image-based person re-identification. Visual Intell. 1(1), 24 (2023)
Zhang, H., Ma, Y., Wang, X., Mao, R., Wang, M.: Lightweight real-time detection model for multi-sheep abnormal behaviour based on yolov7-tiny. In: 2023 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 4191–4196. IEEE (2023)
Zhang, X., Liu, C., Yang, D., Song, T., Ye, Y., Li, K., Song, Y.: Rfaconv: innovating spatial attention and standard convolutional operation (2023). arXiv preprint arXiv:2304.03198
Zhao, W., Xu, L.: Weakly supervised target detection based on spatial attention. Visual Intell. 2(1), 2 (2024)
Zheng, A., Liu, J., Wang, Z., Huang, L., Li, C., Yin, B.: Visible-infrared person re-identification via specific and shared representations learning. Visual Intell. 1(1), 29 (2023)
Zheng, Z., Zhang, X., Qin, L., Yue, S., Zeng, P.: Cows’ legs tracking and lameness detection in dairy cattle using video analysis and siamese neural networks. Comput. Electron. Agric. 205, 107618 (2023)
Acknowledgements
This work was partially funded by the Construction of the National Key Research and Development Program of China (2022ZD04014), "Scientist and Engineer" team of Qin Chuang Yuan in Shaanxi Province of China (2023KXJ-109), Qinchuangyuan Project for the Team Development of Scientists and Engineers in Shaanxi Province of China (2022KXJ-67).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2025 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.
About this paper
Cite this paper
Shi, Y., Li, Q., Wang, G., Wang, M. (2025). A Temporal Recognition Framework for Multi-sheep Behaviour Using ViTSORT and YOLOv8-MS. In: Lin, Z., et al. Pattern Recognition and Computer Vision. PRCV 2024. Lecture Notes in Computer Science, vol 15043. Springer, Singapore. https://doi.org/10.1007/978-981-97-8493-6_15
Download citation
DOI: https://doi.org/10.1007/978-981-97-8493-6_15
Published:
Publisher Name: Springer, Singapore
Print ISBN: 978-981-97-8492-9
Online ISBN: 978-981-97-8493-6
eBook Packages: Computer ScienceComputer Science (R0)