journal article·2024-11-05Open access

YOLOv5DA: An Improved YOLOv5 Model for Posture Detection of Grouped Pigs

Wenhui Shi, Xiaopin Wang, Xuan Li, Yuhua Fu, Xiaolei Liu, Haiyan Wang

Applied Sciences· Volume 14· Issue 22

Abstract

Accurate posture detection is the foundation for analyzing animal behavior, which can promote animal welfare. With the development of computer vision, such technology has been widely used in analyzing animal behavior without physical contact. However, computer vision technology for pig posture detection often suffers from problems of missed or false detection due to complex scenarios. To solve the problem, this study proposed a novel object detection model YOLOv5DA, which was based on YOLOv5s and designed for pig posture detection from 2D camera video. Firstly, we established the annotated dataset (7220 images) including the training set (5776 images), validation set (722 images), and test set (722 images). Secondly, an object detection model YOLOv5DA based on YOLOv5s was proposed to recognize pig postures (standing, prone lying, and side lying), which incorporated Mosaic9 data augmentation, deformable convolution, and adaptive spatial feature fusion. The comparative and ablation experiments were conducted to verify the model’s effectiveness and reliability. Finally, we used YOLOv5DA to detect the posture distribution of pigs. The results revealed that the standing posture was more frequent in the morning and afternoon and the side-lying posture was most common at noon. This observation demonstrated that the posture of pigs is influenced by temperature variations. The study demonstrated that YOLOv5DA could accurately identify three postures of standing, prone lying, and side lying with an average precision (AP) of 99.4%, 99.1%, and 99.1%, respectively. Compared with YOLOv5s, YOLOv5DA could effectively handle occlusion while increasing the mean precision (mAP) by 1.7%. Overall, our work provided a highly accurate, effective, low-cost, and non-contact strategy of posture detection in grouped pigs, which can be used to monitor pig behavior and assist in the early prevention of disease.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Industrial Vision Systems and Defect Detection · Animal Behavior and Welfare Studies · Effects of Environmental Stressors on Livestock

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Key Laboratory of Smart Farming for Agricultural Animals, Ministry of Agriculture and Rural Affairs, College of Informatics, Huazhong Agricultural University, Wuhan 430070, China

Engineering Research Center of Intelligent Technology for Agriculture, Ministry of Education, Huazhong Agricultural University, Wuhan 430070, China

Shenzhen Institute of Nutrition and Health, Huazhong Agricultural University, Wuhan 430070, China

Shenzhen Branch, Guangdong Laboratory for Lingnan Modern Agriculture, Genome Analysis Laboratory of the Ministry of Agriculture, Agricultural Genomics Institute at Shenzhen, Chinese Academy of Agricultural Sciences, Shenzhen 518000, China

Key Laboratory of Agricultural Animal Genetics, Breeding and Reproduction, Ministry of Education, Huazhong Agricultural University, Wuhan 430070, China

Funding

the National key research and development program of China · the HZAU-AGIS Cooperation Fund · the Fundamental Research Funds for the Central Universities of China

References (50)

Show source-provided references
1. Larsen, M.L., Wang, M., and Norton, T. (2021). Information technologies for welfare monitoring in pigs and their relation to Welfare Quality®. Sustainability, 13.10.3390/su13020692 ↗
2. Using floor cooling as an approach to improve the thermal environment in the sleep area in an open pig house10.1016/j.biosystemseng.2005.12.012 ↗
3. Chen, Z., Lu, J., and Wang, H. (2023). A Review of Posture Detection Methods for Pigs Using Deep Learning. Appl. Sci., 13.10.3390/app13126997 ↗
4. Automatic scoring of postures in grouped pigs using depth image and CNN-SVM10.1016/j.compag.2022.106746 ↗
5. Porcine lie detectors: Automatic quantification of posture state and transitions in sows using inertial sensors10.1016/j.compag.2016.07.017 ↗
6. A computer vision approach based on deep learning for the detection of dairy cows in free stall barn10.1016/j.compag.2021.106030 ↗
7. Xie, J., Peng, J., Wang, J., Chen, B., Jing, T., Sun, D., Gao, P., Wang, W., Lu, J., and Yetan, R. (2022). Litchi Detection in a Complex Natural Environment Using the YOLOv5-Litchi Model. Agronomy, 12.10.3390/agronomy12123054 ↗
8. Lei, K., Zong, C., Yang, T., Peng, S., Zhu, P., Wang, H., Teng, G., and Du, X. (2022). Detection and analysis of sow targets based on image vision. Agriculture, 12.10.3390/agriculture12010073 ↗
9. Tail posture predicts tail damage among weaned piglets10.1016/j.applanim.2009.09.002 ↗
10. Can Tail and Ear Postures Be Suitable to Capture the Affective State of Growing Pigs?10.1080/10888705.2020.1846535 ↗
11. The pascal visual object classes (voc) challenge10.1007/s11263-009-0275-4 ↗
12. Multi-target detection based on feature pyramid attention and deep convolution network for pigs
13. Application of deep learning in sheep behaviors recognition and influence analysis of training data characteristics on the recognition effect10.1016/j.compag.2022.107010 ↗
14. Teat detection of dairy cows based on deep learning neural network FS-YOLOv4 model10.1016/j.compag.2022.107224 ↗
15. Nasirahmadi, A., Sturm, B., Edwards, S., Jeppsson, K.-H., Olsson, A.-C., Müller, S., and Hensel, O. (2019). Deep learning and machine vision approaches for posture detection of individual pigs. Sensors, 19.10.3390/s19173738 ↗
16. Automatic recognition of lactating sow postures from depth images by deep learning detector10.1016/j.compag.2018.01.023 ↗
17. Automatically detecting pig position and posture by 2D camera imaging and deep learning10.1016/j.compag.2020.105391 ↗
18. Huang, Y., Liu, J., Tan, Z., Liu, K., and Chen, M. (2023). An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model. Sensors, 23.10.3390/s23146309 ↗
19. Witte, J.-H., and Gómez, J.M. (2022, January 4–7). Introducing a new Workflow for Pig Posture Classification based on a combination of YOLO and EfficientNet. Proceedings of the Hawaii International Conference on System Sciences, Honolulu, HI, USA.10.24251/HICSS.2022.140 ↗
20. Efficient Detection Method of Pig-Posture Behavior Based on Multiple Attention Mechanism
21. Ji, H., Yu, J., Lao, F., Zhuang, Y., Wen, Y., and Teng, G. (2022). Automatic position detection and posture recognition of grouped pigs based on deep learning. Agriculture, 12.10.3390/agriculture12091314 ↗
22. Ultralytics (2024, August 01). YOLOv5 2020. Available online: https://github.com/ultralytics/yolov5.
23. Dai, J., Qi, H., Xiong, Y., Li, Y., Zhang, G., Hu, H., and Wei, Y. (2017, January 22–29). Deformable convolutional networks. Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy.10.1109/ICCV.2017.89 ↗
24. Liu, S., Huang, D., and Wang, Y. (2019). Learning spatial fusion for single-shot object detection. arXiv.
25. Labelme: Online image annotation and applications10.1109/JPROC.2010.2050290 ↗
26. A Review of Yolo algorithm developments10.1016/j.procs.2022.01.135 ↗
27. Apple detection during different growth stages in orchards using the improved YOLO-V3 model10.1016/j.compag.2019.01.012 ↗
28. Faster-YOLO: An accurate and faster object detection method10.1016/j.dsp.2020.102756 ↗
29. Redmon, J., Divvala, S., Girshick, R., and Farhadi, A. (2016, January 27–30). You Only Look Once: Unified, Real-Time Object Detection. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA.10.1109/CVPR.2016.91 ↗
30. Redmon, J., and Farhadi, A. (2017, January 21–26). YOLO9000: Better, Faster, Stronger. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA.10.1109/CVPR.2017.690 ↗
31. Yolov3: An incremental improvement
32. Bochkovskiy, A., Wangm, C.-Y., and Liao, H.-Y.M. (2020, January 14–19). Yolov4: Optimal Speed and Accuracy of Object Detection. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA.
33. Performance analysis of YOLO versions for automatic vehicle detection from UAV images
34. Lin, T.Y., Dollár, P., Girshick, R., He, K., Hariharan, B., and Belongie, S. (2017, January 21–26). Feature pyramid networks for object detection. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA.10.1109/CVPR.2017.106 ↗
35. Liu, S., Qi, L., Qin, H., Shi, J., and Jia, J. (2018, January 18–22). Path aggregation network for instance segmentation. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA.10.1109/CVPR.2018.00913 ↗
36. Wang, Z., Wu, L., Li, T., and Shi, P. (2022). A smoke detection model based on improved YOLOv5. Mathematics, 10.10.3390/math10071190 ↗
37. Pacal, I., and Karaboga, D. (2021). A robust real-time deep learning based automatic polyp detection system. Comput. Biol. Med., 134.10.1016/j.compbiomed.2021.104519 ↗
38. A lightweight dead fish detection method based on deformable convolution and YOLOV410.1016/j.compag.2022.107098 ↗
39. Cheng, L., Yan, J., Chen, M., Lu, Y., Li, Y., and Hu, L. (2021, January 18–20). A multi-scale deformable convolution network model for text recognition. Proceedings of the Thirteenth International Conference on Graphics and Image Processing (ICGIP 2021), Kunming, China.10.1117/12.2623370 ↗
40. Attention-based fusion factor in FPN for object detection10.1007/s10489-022-03220-0 ↗
41. RetinaNet with difference channel attention and adaptively spatial feature fusion for steel surface defect detection
42. Cattle body detection based on YOLOv5-ASFF for precision livestock farming10.1016/j.compag.2022.107579 ↗
43. Dhiman, P., Kukreja, V., Manoharan, P., Kaur, A., Kamruzzaman, M.M., Ben Dhaou, I., and Iwendi, C. (2022). A novel deep learning model for detection of severity level of the disease in citrus fruits. Electronics, 11.10.3390/electronics11030495 ↗
44. Semantic segmentation for multiscale target based on object recognition using the improved Faster-RCNN model10.1016/j.future.2021.04.019 ↗
45. Zhang, F., Fan, Y., Cai, T., Liu, W., Hu, Z., Wang, N., and Wu, M. (2019). OTL-classifier: Towards imaging processing for future un-manned overhead transmission line maintenance. Electronics, 8.10.3390/electronics8111270 ↗
46. Zhang, Y., Cai, W., Fan, S., Song, R., and Jin, J. (2022). Object Detection Based on YOLOv5 and GhostNet for Orchard Pests. Information, 13.10.3390/info13110548 ↗
47. Gadosey, P.K., Li, Y., Agyekum, E.A., Zhang, T., Liu, Z., Yamak, P.T., and Essaf, F. (2020). SD-UNET: Stripped down U-net for seg-mentation of biomedical images on platforms with low computational budgets. Diagnostics, 10.10.3390/diagnostics10020110 ↗
48. Tian, Z., Shen, C., Chen, H., and He, T. (November, January 27). Fcos: Fully convolutional one-stage object detection. Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea.
49. Effect of increasing temperature on space requirements of group housed finishing pigs10.1016/j.applanim.2012.02.010 ↗
50. Thermal behaviour of growing pigs in response to high temperature and humidity10.1016/j.applanim.2004.10.020 ↗