Sheep pose estimation via image analysis and body measurements derived from key points
Abstract
Pose estimation and body measurement in livestock play an important role in various agricultural applications such as health monitoring, breeding and management. In this study, we propose a novel approach for body measurement and pose estimation of sheep using object detection and supervised machine learning algorithms. From a dataset of sheep, 40 side-view videos for each class (grazing, standing, and sitting), each lasting approximately 8 seconds, are used for model training. Firstly, pose classification was performed on the sheep images using the YOLOv8 pose object detection framework. Simultaneously, keypoint training was performed on the images to detect key points for anatomical landmarks. Then, using these keypoints, various body measurements of the sheep in the images were measured and a comprehensive dataset was created. Six different supervised machine learning algorithms were trained on this dataset to further improve pose estimation. Furthermore, the models were tested on frontal images to evaluate their performance against different image angles and dataset feature. The experimental results show that the supervised machine learning algorithms trained on the body measurement data perform better for both side and frontal images (mAP; K nearest neighbour algorithm 1.00 for side images, Support vector machines 0.94 for frontal images) outperform state-of-the-art networks such as YOLOv8 (mAP; 0.94, 0.89 for side and frontal images respectively), EfficientNet (mAP; 0.93, 0.91), RetinaNet (mAP; 0.91, 0.88) and Faster R-CNN (mAP; 0.89, 0.87) based on image data only. This approach can play an important role in improving the accuracy and efficiency of livestock management systems by supporting practical applications such as animal welfare monitoring, herd health assessment, and precision agriculture through more accurate position estimation and body measurements.
References
- Alvarenga, F.A.P., Borges, I., Palkovič, L., Rodina, J., Oddy, V.H., Dobos, R.C. 2016. Using a three-axis accelerometer to identify and classify sheep behaviour at pasture. Appl. Anim. Behav. Sci. 181:91-99. DOI: https://doi.org/10.1016/j.applanim.2016.05.026
- Bati, C.T., Ser, G. 2023a. SHEEPFEARNET: Sheep fear test behaviors classification approach from video data based on optical flow and convolutional neural networks. Comput. Electron. Agr. 204:107540. DOI: https://doi.org/10.1016/j.compag.2022.107540
- Bati, C.T., Ser, G. 2023b. Effects of data augmentation methods on YOLO v5s: application of deep learning with Pytorch for individual cattle identification. YYU J. Agr. Sci. 33:363-376. DOI: https://doi.org/10.29133/yyutbd.1246901
- Bati, C.T. Ser, G. 2024. Improved sheep identification and tracking algorithm based on YOLOv5 + SORT methods. SIViP 18:6683–6694. DOI: https://doi.org/10.1007/s11760-024-03344-5
- Castillo, P.E., Macedo, R.J., Arredondo, V., Zepeda, J.L., Valencia-Posadas, M., Haubi, C.U. 2023. Morphological description and live weight prediction from body measurements of Socorro Island Merino lambs. Animal 13:1978. DOI: https://doi.org/10.3390/ani13121978
- Cheng, M., Yuan, H., Wang, Q., Cai, Z., Liu, Y., Zhang, Y. 2022. Application of deep learning in sheep behaviors recognition and influence analysis of training data characteristics on the recognition effect. Comput. Electron. Agric. 198:107010. DOI: https://doi.org/10.1016/j.compag.2022.107010
- Deng, X., Yan, X., Hou, Y., Wu, H., Feng, C., Chen, L., et al. 2021. Detection of behaviour and posture of sheep based on YOLOv3. Inmateh. Agr. Eng. 64:457-466. DOI: https://doi.org/10.35633/inmateh-64-45
- Dutta, T., Dawn, K. 2023. Object keypoint similarity in keypoint detection. Accessed on: 31 July 2024. Available from: https://learnopencv.com/object-keypoint-similarity/#disqus_thread
- Forslund, A., Tibi, A., Schmitt, B., Marajo-Petitzon, E., Debaeke, P., Durand, JL., et al. 2023. Can healthy diets be achieved worldwide in 2050 without farmland expansion? Glob. Food. Secur. 39:100711. DOI: https://doi.org/10.1016/j.gfs.2023.100711
- Gao, G., Wang, C., Wang, J., Lv, Y., Li, Q. Ma, Y., et al. 2023. CNN-Bi-LSTM: A Complex environment-oriented cattle behavior classification network based on the fusion of CNN and Bi-LSTM. Sensors (Basel) 23: 714. DOI: https://doi.org/10.3390/s23187714
- González-Baldizón, Y., Pérez-Patricio, M., Camas-Anzueto, J.L., Rodríguez-Elías, O.M., Escobar-Gómez, E.N., Vazquez-Delgado, H.D., et al. 2022. Lamb behaviors analysis using a predictive CNN model and a single camera. App. Sci. 12:4712. DOI: https://doi.org/10.3390/app12094712
- Hamadani, A., Ganai, N.A. 2023. Artificial intelligence algorithm comparison and ranking for weight prediction in sheep. Sci. Rep. 13: 3242. DOI: https://doi.org/10.1038/s41598-023-40528-4
- He, C., Qiao, Y., Mao, R., Li, M., Wang, M. 2023. Enhanced LiteHRNet based sheep weight estimation using RGB-D images. Comput. Electron. Agr. 206:107667. DOI: https://doi.org/10.1016/j.compag.2023.107667
- Horie, R., Miyasaka, T., Yoshihara, Y. 2023. Grazing behavior of Mongolian sheep under different climatic conditions. J. Arid. Envion. 209:104890. DOI: https://doi.org/10.1016/j.jaridenv.2022.104890
- Hu, T., Yan, R., Jiang, C., Chand, N.V., Bai, T., Guo, L., Qi, J. 2023. Grazing sheep behaviour recognition based on improved YOLOv5. Sensors (Basel) 23:4752. DOI: https://doi.org/10.3390/s23104752
- Jin, Z., Guo, L., Shu, H., Qi, J., Li, Y., Xu, B., et al. 2022. Behavior classification and analysis of grazing sheep on pasture with different sward surface heights using machine learning. Animals (Basel) 12:1744. DOI: https://doi.org/10.3390/ani12141744
- Jocher, G., Chaurasia, A., Qiu, J. 2023. Ultralytics YOLO (Version 8.0.0) [Computer software]. vailable from: https://github.com/ultralytics/ultralytics
- Kelly, N.A., Khan, B.M., Ayub, M.Y., Hussain, A.J., Dajani, K., Hou, Y., Khan, W. 2024. Video dataset of sheep activity for animal behavioral analysis via deep learning. Dat. Brief. 52:110027. DOI: https://doi.org/10.1016/j.dib.2024.110027
- Kenyon, P.R., Maloney, S.K., Blache, D. 2014. Review of sheep body condition score in relation to production characteristics. N. Z. J. Agr. Res. 57:38-64. DOI: https://doi.org/10.1080/00288233.2013.857698
- Khan, B., Kelly, N. 2023a. Video dataset of sheep activity (grazing, running, sitting). Mendeley Data V1. Available from: https://data.mendeley.com/datasets/h5ppwx6fn4/1
- Khan, B., Kelly, N. 2023b. Video dataset of sheep activity (standing and walking). Mendeley Data V1. Available from: https://data.mendeley.com/datasets/w65pvb84dg/1
- Lin, T.Y., Goyal, P., Girshick, R., He, K., Dollár, P. 2017. Focal loss for dense object detection. IEEE T Pattern Anal 42:318-327. DOI: https://doi.org/10.1109/TPAMI.2018.2858826
- Maji, D., Nagori, S., Mathew, M., Poddar, D. 2022. Yolo-pose: Enhancing yolo for multi person pose estimation using object keypoint similarity loss. Proc. IEEE/CVF Conf. on Computer Vision and Pattern Recognition, New Orleans. pp. 2637-2646. DOI: https://doi.org/10.1109/CVPRW56347.2022.00297
- Meckbach, C., Tiesmeyer, V., Traulsen, I. A. 2021. promising approach towards precise animal weight monitoring using convolutional neural networks. Comput. Electron. Agr. 183:106056. DOI: https://doi.org/10.1016/j.compag.2021.106056
- Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., et al. 2019. PyTorch: an imperative style, high-performance deep learning library. Available from: https://proceedings.neurips.cc/paper_files/paper/2019/file/bdbca288fee7f92f2bfa9f7012727740-Paper.pdf
- Pollard, J., Cox, N., Hogan, N., Huddart, F., Webster, J., Chaya, W., et al. 2004. Behavioural and physiological responses of sheep to shade. MAF Policy Project FMA 123.
- Ren, S., He, K., Girshick, R., Sun, J. 2015. Faster R-CNN: Towards real-time object detection with region proposal networks. Available from: https://proceedings.neurips.cc/paper_files/paper/2015/file/14bfa6bb14875e45bba028a21ed38046-Paper.pdf
- Ronchi, R.M., Perona, P. 2017. Benchmarking and error diagnosis in multi-instance pose estimation. Proc. IEEE Int. Conf. on Computer Vision, Venice. pp. 369-378. DOI: https://doi.org/10.1109/ICCV.2017.48
- Schütz, K.E., Saunders, L.R., Huddart, F.J., Watson, T., Latimer, B., Cox, N.R. 2024. Effects of shade on the behaviour and physiology of sheep in a temperate climate. Appl. Anim. Behav. Sci. 272:106185. DOI: https://doi.org/10.1016/j.applanim.2024.106185
- Shalaldeh, A., Page, S., Anthony, P., Charters, S., Safa, M., Logan, C. 2023. Body composition estimation in breeding ewes using live weight and body parameters utilizing image analysis. Animals (Basel) 13:2391. DOI: https://doi.org/10.3390/ani13142391
- Shorten, C., Khoshgoftaar, T.M. 2019. A survey on image data augmentation for deep learning. J. Big Data. 6:1-48. DOI: https://doi.org/10.1186/s40537-019-0197-0
- Sowande, O.S., Sobola, O.S. 2008. Body measurements of West African dwarf sheep as parameters for estimation of live weight. Trop. Anim. Health Pro. 40:433-439. DOI: https://doi.org/10.1007/s11250-007-9116-z
- Stephansen, R.B., Manzanilla-Pech, C.I., Gebreyesus, G., Sahana, G., Lassen, J. 2023. Prediction of body condition in Jersey dairy cattle from 3D-images using machine learning techniques. J. Anim. Sci. 101:skad376. DOI: https://doi.org/10.1093/jas/skad376
- Tan, M., Pang, R., Le, Q.V. 2020. Efficientdet: Scalable and efficient object detection. Proc. IEEE/CVF Conf. Computer Vision and Pattern Recognition, Seattle. pp, 10781-10790. DOI: https://doi.org/10.1109/CVPR42600.2020.01079
- Van Rossum G., Drake, F.L. 2009. Python 3 Reference Manual. Scotts Valley, CreateSpace.
- Waters, B.E., McDonagh, J., Tzimiropoulos, G., Slinger, K.R.., Huggett, Z.J., Bell, M.J. 2021. Changes in sheep behavior before lambing. Agriculture 11:715. DOI: https://doi.org/10.3390/agriculture11080715
- Xu, Y., Nie, J., Cen, H., Wen, B., Liu, S., Li, J., et al. 2023. Spatio-temporal-based identification of aggressive behavior in group sheep. Animals (Basel) 13:2636. DOI: https://doi.org/10.3390/ani13162636
- Yang, S., Xiao, W., Zhang, M., Guo, S., Zhao, J., Shen, F. 2022. Image data augmentation for deep learning: A survey. arXiv:220408610.
Metrics
Citations and online attention from Dimensions, Altmetric and PlumX.
License
Copyright (c) 2025 the Author(s)

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
PAGEPress has chosen to apply the Creative Commons Attribution NonCommercial 4.0 International License (CC BY-NC 4.0) to all manuscripts to be published.