Motion-Status-Driven Piglet Tracking Method for Monitoring Piglet Movement Patterns Under Sow Posture Changes
Simple Summary
Abstract
1. Introduction
2. Materials and Methods
2.1. Data Collection
2.2. The Overall Framework of Behavior Exploration
2.3. Motion-Status-Driven Piglet Tracking
2.3.1. Problem Formulation
2.3.2. Overall Architecture of MSHMTracker for Piglet Tracking
2.3.3. Cross-Temporal Feature Extraction
2.3.4. Spatio-Temporal Information Acquisition
2.3.5. Score–Time-Driven Hierarchical Matching (STHM)
- (1)
- First matching for continuously appearing objects
- (2)
- Second matching for reappeared objects
- (3)
- Third matching for newly emerging or reappearing piglets with significantly altered appearance
2.4. Behavioral Monitoring
2.5. Evaluation Metrics
2.6. Experimental Details
3. Results
3.1. The Results of Piglet Tracking
3.1.1. Comparison of Different Improvement Strategies Proposed in Our Tracking Model
3.1.2. Comparison with Different Tracking Methods
3.2. Study on Behavioral Patterns Between Lactating Sow and Piglets
3.2.1. The Results of Aggregation and Dispersion Behavior Recognition of Piglet Groups
3.2.2. The Exploration of Piglet Group Behavior Responses to Sow Posture Changes
4. Discussion
4.1. Performance Analysis of the Proposed Model for Piglet Tracking
4.2. Analysis and Exploration of Behavior Patterns Between Sow and Piglets
4.3. Limitations and Potential Applications
4.3.1. Limitations
- (1)
- The current validation was conducted exclusively on pig data collected from a single farm, limiting the generalizability of the findings. Although our multi-object tracking algorithm has shown good generalization across varying illumination conditions, occlusions, and high-density environments (see Section 4.1), its performance on other livestock species, pen structures, and atypical behavioral states has not been validated yet.
- (2)
- Our tracking module still faces the challenges of ID loss and ID switching when piglets reappear but have undergone severe deformation or occlusion. Although we have implemented a temporary retention-and-iteration mechanism to address this issue, this approach is only effective when piglets regain their original shape or become non-occluded within a very short time frame. Moreover, the mechanism introduces non-negligible latency. Figure 13 presents several examples where our tracking module failed. At the top of Figure 13, occlusion led to the tracking failure of Target 2 in frame 262, followed by an ID switching event between Targets 2 and 3 in frame 267 due to severe shape deformation. Similarly, at the bottom of Figure 13, under low-light conditions, the tracking system lost Target 3 in frame 230 and incurred an identity mismatch in frame 245 due to a blurred appearance.
- (3)
- The piglet group behavior recognition, the mean distance difference, and the most frequent movement direction of piglets were calculated to assess the individual behavior of piglets in the overall video. These metrics are sensitive to noise. For example, the unconscious wandering or body swaying of piglets may affect the overall mean distance difference and the most frequent movement direction due to the generated displacement and movement direction.
4.3.2. Potential Applications
- (1)
- The proposed tracking method can reduce ID losses and switches under crowding, occlusion, and deformation conditions, which can be used for other animals’ tracking.
- (2)
- Our system can be expanded to maternal behavior detection, such as nursing refusal, hostile chasing, or aggression, by remodeling the trajectory information of individual movements.
- (3)
- Individual-level tracking of individual stress behavior responses to sow posture changes could reduce piglet crushing. In future work, we will focus on individual-level monitoring to provide farmers with piglet-specific welfare indicators.
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviations
STHM | Score- and time-driven hierarchical matching mechanism |
JDT | Joint detection and tracking |
MSHMTracker | Motion-status-driven hierarchical multi-object tracking method |
MOT | Multi-object tracking |
References
- Clouard, C.; Resmond, R.; Prunier, A.; Tallet, C.; Merlot, E. Exploration of early social behaviors and social styles in relation to individual characteristics in suckling piglets. Sci. Rep. 2022, 12, 2318. [Google Scholar] [CrossRef] [PubMed]
- Zeng, F.; Zhang, S. Impacts of sow behaviour on reproductive performance: Current understanding. J. Appl. Anim. Res. 2023, 51, 256–264. [Google Scholar] [CrossRef]
- Cui, S.Q.; Chen, D.H.; Li, J.H.; Li, X.; Yin, G.A.; Bao, J. A comparison of postural changes and maternal responsiveness during early lactation in Landrace and Minpig sows. Appl. Anim. Behav. Sci. 2011, 131, 40–47. [Google Scholar] [CrossRef]
- Blackshaw, J.K.; Hagelsø, A.M. Getting-up and lying-down behaviours of loose-housed sows and social contacts between sows and piglets during Day 1 and Day 8 after parturition. Appl. Anim. Behav. Sci. 1990, 25, 61–70. [Google Scholar] [CrossRef]
- Van Nieuwamerongen, S.E.; Bolhuis, J.E.; Van Der Peet-Schwering, C.; Soede, N.M. A review of sow and piglet behaviour and performance in group housing systems for lactating sows. Animal 2014, 8, 448–460. [Google Scholar] [CrossRef]
- Melisová, M.; Illmann, G.; Chaloupková, H.; Bozdechová, B. Sow postural changes, responsiveness to piglet screams, and their impact on piglet mortality in pens and crates. J. Anim. Sci. 2014, 92, 3064–3072. [Google Scholar] [CrossRef]
- Knap, P.W. Pig breeding for increased sustainability. In Animal Breeding and Genetics; Springer: Berlin/Heidelberg, Germany, 2022; pp. 139–179. [Google Scholar]
- Zhang, Y.; Yang, X.; Liu, Y.; Zhou, J.; Huang, Y.; Li, J.; Zhang, L.; Ma, Q. A time-series neural network for pig feeding behavior recognition and dangerous detection from videos. Comput. Electron. Agr. 2024, 218, 108710. [Google Scholar] [CrossRef]
- Luo, Y.; Xia, J.; Lu, H.; Luo, H.; Lv, E.; Zeng, Z.; Li, B.; Meng, F.; Yang, A. Automatic Recognition and Quantification Feeding Behaviors of Nursery Pigs Using Improved YOLOV5 and Feeding Functional Area Proposals. Animals 2024, 14, 569. [Google Scholar] [CrossRef]
- Zhang, Z.; Xu, S.; Lu, S.; Chen, L. Advancing Precision Pig Behavior Recognition through Real-Time Detection Transformer. In Proceedings of the 2024 4th International Conference on Neural Networks, Information and Communication (NNICE), Guangzhou, China, 19–21 January 2024. [Google Scholar]
- Liang, Z.; Xu, A.; Ye, J.; Zhou, S.; Weng, X.; Bao, S. An Automatic Movement Monitoring Method for Group-Housed Pigs. Animals 2024, 14, 2985. [Google Scholar] [CrossRef]
- Cui, Y.; Wang, R.; Shen, D.; Mao, R. DACN-YOLO: An Improved Abnormal Behavior Recognition Model for Pigs. In Proceedings of the 2024 5th International Conference on Computer Vision, Image and Deep Learning (CVIDL), Zhuhai, China, 19–21 April 2024. [Google Scholar]
- Chen, C.; Zhu, W.; Steibel, J.; Siegford, J.; Wurtz, K.; Han, J.; Norton, T. Recognition of aggressive episodes of pigs based on convolutional neural network and long short-term memory. Comput. Electron. Agr. 2020, 169, 105166. [Google Scholar] [CrossRef]
- 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. Biosyst. Eng. 2020, 195, 27–41. [Google Scholar] [CrossRef]
- Li, Q.; Zhuo, Z.; Gao, R.; Wang, R.; Zhang, N.; Shi, Y.; Wu, T.; Ma, W. A Pig Behavior-tracking Method Based on a Multi-Channel High-Efficiency Attention Mechanism. Agric. Commun. 2024, 2, 100062. [Google Scholar] [CrossRef]
- Ariza-Sentís, M.; Vélez, S.; Martínez-Peña, R.; Baja, H.; Valente, J. Object detection and tracking in Precision Farming: A systematic review. Comput. Electron. Agr. 2024, 219, 108757. [Google Scholar] [CrossRef]
- Liu, L.; Chen, J.; Ding, Q.; Zhao, R.; Shen, M.; Liu, L. Detection and analysis of sow nursing behavior based on the number and location of piglets outside the suckling area using YOLOv5s. Comput. Electron. Agr. 2025, 235, 110324. [Google Scholar] [CrossRef]
- Li, B.; Xu, W.; Chen, T.; Cheng, J.; Shen, M. Recognition of fine-grained sow nursing behavior based on the SlowFast and hidden Markov models. Comput. Electron. Agr. 2023, 210, 107938. [Google Scholar] [CrossRef]
- Gan, H.; Xu, C.; Hou, W.; Guo, J.; Liu, K.; Xue, Y. Spatiotemporal graph convolutional network for automated detection and analysis of social behaviours among pre-weaning piglets. Biosyst. Eng. 2022, 217, 102–114. [Google Scholar] [CrossRef]
- Zhao, T.; Yang, G.; Li, Y.; Lu, M.; Sun, H. Multi-object tracking using score-driven hierarchical association strategy between predicted tracklets and objects. Image Vis. Comput. 2024, 152, 105303. [Google Scholar] [CrossRef]
- Liu, Y.; Li, W.; Liu, X.; Li, Z.; Yue, J. Deep learning in multiple animal tracking: A survey. Comput. Electron. Agr. 2024, 224, 109161. [Google Scholar] [CrossRef]
- Wang, Y.; Aijun, X.U.; Zhou, S.; Junhua, Y.E. Multi-object tracking of pig behavior using byte algorithm. Trans. Chin. Soc. Agric. Eng. 2025, 41, 145–155. [Google Scholar]
- Redmon, J.; Farhadi, A. YOLOv3: An Incremental Improvement. arXiv 2018, arXiv:1804.02767. [Google Scholar]
- Zhang, Y.; Sun, P.; Jiang, Y.; Yu, D.; Weng, F.; Yuan, Z.; Luo, P.; Liu, W.; Wang, X. Bytetrack: Multi-object tracking by associating every detection box. In European Conference on Computer Vision; Springer Nature: Cham, Switzerland, 2022. [Google Scholar]
- Wojke, N.; Bewley, A.; Paulus, D. Simple online and realtime tracking with a deep association metric. In Proceedings of the 2017 IEEE International Conference on Image Processing (ICIP), Beijing, China, 17–20 September 2017; pp. 3645–3649. [Google Scholar]
- Tu, S.; Cai, Y.; Liang, Y.; Lei, H.; Huang, Y.; Liu, H.; Xiao, D. Tracking and monitoring of individual pig behavior based on YOLOv5-Byte. Comput. Electron. Agr. 2024, 221, 108997. [Google Scholar] [CrossRef]
- Tran, D.D.; Thanh, N.D. Pig Health Abnormality Detection Based on Behavior Patterns in Activity Periods using Deep Learning. Int. J. Adv. Comput. Sci. Appl. 2023, 14. [Google Scholar] [CrossRef]
- Odo, A.; Muns, R.; Boyle, L.; Kyriazakis, I. Video analysis using deep learning for automated quantification of ear biting in pigs. IEEE Access 2023, 11, 59744–59757. [Google Scholar] [CrossRef]
- Krhenbühl, P.; Koltun, V.; Zhou, X. Tracking Objects as Points. In Proceedings of the European Conference on Computer Vision, Glasgow, UK, 23–28 August 2020. [Google Scholar]
- Zhang, Y.; Wang, C.; Wang, X.; Zeng, W.; Liu, W. FairMOT: On the Fairness of Detection and Re-identification in Multiple Object Tracking. Int. J. Comput. Vis. 2021, 129, 3069–3087. [Google Scholar] [CrossRef]
Dataset | Video | Pen |
---|---|---|
Training set | 72 | Pen 1, Pen 2, Pen 4, Pen 7, Pen 8, Pen 9, Pen 10, Pen 11 |
Validation set | 8 | Pen 1, Pen 2, Pen 4, Pen 7, Pen 8, Pen 9, Pen 10, Pen 11 |
Test set | 30 | Pen 3, Pen 5, Pen 6 |
Sow behavior | Video | Description |
Upward posture change | 52 | Such as sitting-to-standing, lying-to-standing, lying-to-sitting |
Downward posture change | 34 | Such as standing-to-sitting, standing-to-lying, sitting-to-lying |
Rolling posture change | 14 | Such as ventral lying-to-lateral lying, lateral lying-to-ventral lying |
Piglet group behavior | Video | Description |
Aggregation | 41 | Over 50% of piglet population exhibits movement towards the sow |
Dispersion | 36 | Over 50% of piglets exhibit movement away from the sow |
Others | 23 | No obvious gathering or dispersing behavior |
Method | Evaluation Metrics | ||||
---|---|---|---|---|---|
FM | SM | TM | IDF1 ↑ | MOTA ↑ | IDs ↓ |
√ | - | - | 91.5% | 91.6% | 0.1% |
√ | √ | - | 92.5% | 94.1% | 0.2% |
√ | √ | √ | 92.9% | 93.8% | 0.1% |
Video ID | Piglet ID | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0.991 | 0.981 |
2 | 0.97 | 1 | 0.99 | 1 | 1 | 1 | 1 | 1 | - | - | - | - |
3 | 0.92 | 1 | 1 | 0.96 | 1 | 1 | 1 | 1 | 1 | 0.82 | 1 | 1 |
4 | 1 | 1 | 1 | 1 | 1 | 1 | 0.9812 | 0.975 | - | - | - | - |
5 | 1 | 1 | 0.99 | 1 | 0.99 | 1 | 1 | 1 | - | - | - | - |
6 | 0.94 | 1 | 0.94 | 1 | 1 | 0.961 | 1 | 0.99 | 1 | - | - | - |
7 | 1 | 0.94 | 0.99 | 1 | 1 | 0.99 | 0.99 | 0.99 | 0.99 | 1 | 1 | 0.99 |
8 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0.99 | 0.97 | 1 | 0.96 |
9 | 1 | 0.99 | 0.98 | 1 | 0.76 | 1 | 1 | 1 | 1 | 0.911 | 0.98 | 0.981 |
10 | 1 | 1 | 1 | 1 | 1 | 0.99 | 1 | 1 | - | - | - | - |
11 | 1 | 1 | 1 | 0.99 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
12 | 1 | 1 | 1 | 1 | 1 | 0.96 | 1 | 1 | - | - | - | - |
13 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0.95 | 1 |
14 | 0.99 | 1 | 1 | 1 | 1 | 1 | 1 | 0.99 | - | - | - | - |
15 | 1 | 0.941 | 1 | 0.98 | 0.97 | 1 | 0.91 | - | - | - | - | - |
16 | 0.99 | 1 | 1 | 1 | 1 | 1 | 0.99 | 1 | - | - | - | - |
17 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
18 | 1 | 0.99 | 1 | 1 | 1 | 0.95 | 1 | 0.85 | 1 | 1 | 0.99 | 0.89 |
19 | 1 | 0.99 | 1 | 1 | 1 | 1 | 1 | 1 | 0.94 | - | - | - |
20 | 1 | 1 | 1 | 0.99 | 1 | 0.94 | 1 | 0.98 | - | - | - | - |
21 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0.99 | 1 | 0.951 | 0.58 | - |
22 | 1 | 1 | 1 | 1 | 0.97 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
23 | 0.86 | 1 | 1 | 1 | 0.99 | 1 | 1 | 1 | 1 | 1 | 0.99 | 1 |
24 | 1 | 1 | 1 | 1 | 1 | 1 | 0.99 | 0.954 | - | - | - | - |
25 | 0.99 | 1 | 1 | 1 | 1 | 1 | 1 | 0.902 | 1 | 1 | 1 | 0.77 |
26 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | - | - | - | - |
27 | 0.69 | 0.99 | 1 | 1 | 1 | 0.99 | 0.91 | 1 | 1 | 1 | 0.994 | 0.761 |
28 | 1 | 0.96 | 1 | 1 | 1 | 0.99 | 0.94 | 1 | 0.04 | 0.861 | 0.781 | 1 |
29 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0.98 |
30 | 0.91 | 1 | 1 | 1 | 1 | 1 | 0.99 | 0.96 | 1 | 0.99 | 0 | 1 |
Methods | IDF1 ↑ | MOTA ↑ | IDs ↓ | FP ↓ | FN ↓ |
---|---|---|---|---|---|
Motdt | 55.1% | 84.7% | 4.7% | 5.7% | 4.9% |
FairMot | 61.7% | 86.6% | 2.3% | 4.6% | 6.6% |
DeepSort | 74.2% | 80.1% | 1.1% | 10.4% | 9.4% |
ByterTrack | 86.6% | 79.1% | 0.1% | 11.0% | 9.8% |
Sort | 87.6% | 90.4% | 0.4% | 5.7% | 3.6% |
Centertrack | 90.8% | 91.5% | 0.1% | 6.0% | 2.4% |
MSHMTracker (Ours) | 92.9% | 93.8% | 0.1% | 2.4% | 3.4% |
Recognition | Ground Truth | ||
---|---|---|---|
Aggregation | Dispersion | Others | |
Aggregation | 37 | 1 | 0 |
Dispersion | 0 | 26 | 0 |
Others | 4 | 9 | 23 |
Accuracy/% | 90.24 | 72.22 | 100.00 |
Total accuracy/% | 87.49% |
Classification of Sow Posture Changes | Aggregation Videos (95% CI) | Dispersion Videos (95% CI) | Others Videos (95% CI) |
---|---|---|---|
Upward posture changes | 14 [8, 20] | 27 [20, 34] | 11 [5, 17] |
Downward posture changes | 21 [16, 27] | 6 [2, 10] | 7 [2, 12] |
Rolling posture changes | 6 [3, 10] | 3 [1, 6] | 5 [2, 9] |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Yang, A.; Li, S.; Tu, S.; Han, N.; Zhang, L.; Luo, Y.; Xue, Y. Motion-Status-Driven Piglet Tracking Method for Monitoring Piglet Movement Patterns Under Sow Posture Changes. Vet. Sci. 2025, 12, 616. https://doi.org/10.3390/vetsci12070616
Yang A, Li S, Tu S, Han N, Zhang L, Luo Y, Xue Y. Motion-Status-Driven Piglet Tracking Method for Monitoring Piglet Movement Patterns Under Sow Posture Changes. Veterinary Sciences. 2025; 12(7):616. https://doi.org/10.3390/vetsci12070616
Chicago/Turabian StyleYang, Aqing, Shimei Li, Shuqin Tu, Na Han, Lei Zhang, Yizhi Luo, and Yueju Xue. 2025. "Motion-Status-Driven Piglet Tracking Method for Monitoring Piglet Movement Patterns Under Sow Posture Changes" Veterinary Sciences 12, no. 7: 616. https://doi.org/10.3390/vetsci12070616
APA StyleYang, A., Li, S., Tu, S., Han, N., Zhang, L., Luo, Y., & Xue, Y. (2025). Motion-Status-Driven Piglet Tracking Method for Monitoring Piglet Movement Patterns Under Sow Posture Changes. Veterinary Sciences, 12(7), 616. https://doi.org/10.3390/vetsci12070616