Behavior Tracking and Analyses of Group-Housed Pigs Based on Improved ByteTrack
Simple Summary
Abstract
1. Introduction
- (1)
- We proposed the Pig-ByteTrack algorithm, integrating trajectory interpolation to reduce false alarms and enhance tracking stability, to improve the accuracy of behavior monitoring in pig farming.
- (2)
- We designed a behavioral analysis algorithm to calculate the temporal distribution of behaviors for each pig, leveraging tracking IDs and categories, to enable detailed behavioral analysis within individual enclosures.
- (3)
- We constructed a 10 min long-term pig dataset with real pig house videos and validated our methodology’s effectiveness through comparative tracking experiments, to ensure the practical applicability and reliability of our approach under real-world conditions.
2. Method
2.1. Pig-ByteTrack Algorithm of Group-Housed Pigs
2.1.1. The Original ByteTrack Algorithm
- (1)
- The object detection results are divided into high-score and low-score detection boxes.
- (2)
- The high-scoring detection boxes are matched with the existing tracks for the first IoU data association.
- (3)
- The low score detection boxes are associated with the unmatched trace-in for the second IoU data.
- (4)
- Trajectories creation, deletion, and merging.
2.1.2. The Pig-ByteTrack Algorithm
- (1)
- The design of suitable detection anchor boxes and the improvement of tracking boxes.
- (2)
- The implementation of the trajectory interpolation post-processing strategy for BYTE tracker.
2.2. The Behavioral Analysis Algorithm
- (1)
- An array of a behavioral category named is designed for each track, which creates statistics for the number of all tracks for the four categories of the stand, lie, eat, and other behaviors. The statistic is added as an attribute in each of the tracks.
- (2)
- For each frame of video, the BYTE data association algorithm first obtains information about the YOLOX-X detection results of each BB named D, including the category information mentioned above. Then, the behaviors analysis algorithm creates an array of frames named based on the categories (stand, lie, eat, and other behaviors of each ) for each pig ID. And if the behavior category belongs to stand, a1 is set to 1 and the other parameters are set to 0, and so on.
- (3)
- After Associating with using the BYTE operation, we can revise the values if the tracklet and detection BB match successfully. The formula of revised A is as follows:
Algorithm 1. Pseudo-code of Behavior Category Time Statistics of Pigs |
Input: A video sequence ; object detector ; the frame ; the detection D; includes lie, eat, stand, other; variable and : one-dimensional array including four elements for time statistics; : tracklet information and four behavior category time statistics; tracking score threshold is set 0.75; Frames per second ; |
Output: Tracks of the video |
|
Return T |
3. Experiment
3.1. Dataset
3.2. Experimental Results and Performance Comparison
- (1)
- The YOLOX-X detection model was used for target detection and behavioral recognition in pigs.
- (2)
- The Pig-ByteTrack algorithm was designed to track behavioral information for each pig.
- (3)
- The Automated Behavioral Analysis algorithm was developed to calculate the temporal distribution of behaviors.
3.2.1. Results Comparison of Pig-ByteTrack, ByteTrack, and TransTrack
3.2.2. Results of Pig-ByteTrack for 1 min Video in Private Dataset
3.2.3. Results of Pig-ByteTrack for 10 min Video Dataset
3.2.4. Behavioral Analysis for Four Video Segments in Private Dataset Algorithm
4. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Wang, S.; Jiang, H.; Qiao, Y.; Jiang, S.; Lin, H.; Sun, Q. The Research Progress of Vision-Based Artificial Intelligence in Smart Pig Farming. Sensors 2022, 22, 6541. [Google Scholar] [CrossRef] [PubMed]
- Bewley, A.; Ge, Z.; Ott, L.; Ramos, F.; Upcroft, B. Simple online and realtime tracking. In Proceedings of the IEEE International Conference on Image Processing (ICIP), Phoenix, AZ, USA, 26 September 2016; pp. 3464–3468. [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]
- 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]
- Sun, P.; Jiang, Y.; Zhang, R.; Xie, E.; Cao, J.; Hu, X.; Kong, T.; Yuan, Z.; Wang, C.; Luo, P. TransTrack Multiple Object Tracking with Transformer. arXiv 2020, arXiv:2012.15460. [Google Scholar]
- Zhang, Y.; Sun, P.; Jiang, Y.; Yu, D.; Yuan, Z.; Luo, P.; Liu, W.; Wang, X. ByteTrack: Multi-Object Tracking by Associating Every Detection Box. In Proceedings of the European Conference on Computer Vision, Tel Aviv, Israel, 23–27 October 2022; Springer: Cham, Switzerland, 2022. [Google Scholar]
- Aharon, N.; Orfaig, R.; Bobrovsky, B.-Z.J.A. BoT-SORT: Robust Associations Multi-Pedestrian Tracking. arXiv 2022, arXiv:2206.14651. [Google Scholar]
- Dorum, E.S.; Kaufmann, T.; Alnaes, D.; Richard, G.; Kolskar, K.K.; Engvig, A.; Sanders, A.M.; Ulrichsen, K.; Ihle-Hansen, H.; Nordvik, J.E.; et al. Functional brain network modeling in sub-acute stroke patients and healthy controls during rest and continuous attentive tracking. Heliyon 2020, 6, e04854. [Google Scholar] [CrossRef]
- Arulmozhi, E.; Bhujel, A.; Moon, B.E.; Kim, H.T. The Application of Cameras in Precision Pig Farming: An Overview for Swine-Keeping Professionals. Animals 2021, 11, 2343. [Google Scholar] [CrossRef]
- Bhujel, A.; Arulmozhi, E.; Moon, B.E.; Kim, H.T. Deep-Learning-Based Automatic Monitoring of Pigs’ Physico-Temporal Activities at Different Greenhouse Gas Concentrations. Animals 2021, 11, 3089. [Google Scholar] [CrossRef]
- Pandey, S.; Kalwa, U.; Kong, T.; Guo, B.; Gauger, P.C.; Peters, D.J.; Yoon, K.J. Behavioral Monitoring Tool for Pig Farmers: Ear Tag Sensors, Machine Intelligence, and Technology Adoption Roadmap. Animals 2021, 11, 2665. [Google Scholar] [CrossRef]
- Wang, H.; Zhang, S.; Zhao, S.; Wang, Q.; Li, D.; Zhao, R. Real-time detection and tracking of fish abnormal behavior based on improved YOLOV5 and SiamRPN++. Comput. Electron. Agric. 2022, 192, 106512. [Google Scholar] [CrossRef]
- Ma, J.; Liu, D.; Qin, S.; Jia, G.; Zhang, J.; Xu, Z. An Asymmetric Feature Enhancement Network for Multiple Object Tracking of Unmanned Aerial Vehicle. Remote Sens. 2023, 16, 70. [Google Scholar] [CrossRef]
- Mar, C.C.; Zin, T.T.; Tin, P.; Honkawa, K.; Kobayashi, I.; Horii, Y. Cow detection and tracking system utilizing multi-feature tracking algorithm. Sci. Rep. 2023, 13, 17423. [Google Scholar] [CrossRef]
- Myat Noe, S.; Zin, T.T.; Tin, P.; Kobayashi, I. Comparing State-of-the-Art Deep Learning Algorithms for the Automated Detection and Tracking of Black Cattle. Sensors 2023, 23, 532. [Google Scholar] [CrossRef] [PubMed]
- Xu, Q.; Lin, X.; Cai, M.; Guo, Y.-a.; Zhang, C.; Li, K.; Li, K.; Wang, J.; Cao, D. End-to-End Joint Multi-Object Detection and Tracking for Intelligent Transportation Systems. Chin. J. Mech. Eng. 2023, 36, 138. [Google Scholar] [CrossRef]
- Zhang, K.; Liu, Y.; Mei, F.; Jin, J.; Wang, Y. Boost Correlation Features with 3D-MiIoU-Based Camera-LiDAR Fusion for MODT in Autonomous Driving. Remote Sens. 2023, 15, 874. [Google Scholar] [CrossRef]
- Guo, Q.; Sun, Y.; Orsini, C.; Bolhuis, J.E.; de Vlieg, J.; Bijma, P.; de With, P.H.N. Enhanced camera-based individual pig detection and tracking for smart pig farms. Comput. Electron. Agric. 2023, 211, 108009. [Google Scholar] [CrossRef]
- Zheng, Z.; Qin, L. PrunedYOLO-Tracker: An efficient multi-cows basic behavior recognition and tracking technique. Comput. Electron. Agric. 2023, 213, 108172. [Google Scholar] [CrossRef]
- Lu, J.; Chen, Z.; Li, X.; Fu, Y.; Xiong, X.; Liu, X.; Wang, H. ORP-Byte: A multi-object tracking method of pigs that combines Oriented RepPoints and improved Byte. Comput. Electron. Agric. 2024, 219, 108782. [Google Scholar] [CrossRef]
- Zou, X.; Yin, Z.; Li, Y.; Gong, F.; Bai, Y.; Zhao, Z.; Zhang, W.; Qian, Y.; Xiao, M. Novel multiple object tracking method for yellow feather broilers in a flat breeding chamber based on improved YOLOv3 and deep SORT. Int. J. Agric. Biol. Eng. 2023, 16, 44–55. [Google Scholar] [CrossRef]
- Alameer, A.; Buijs, S.; O’Connell, N.; Dalton, L.; Larsen, M.; Pedersen, L.; Kyriazakis, I. Automated detection and quantification of contact behaviour in pigs using deep learning. Biosyst. Eng. 2022, 224, 118–130. [Google Scholar] [CrossRef]
- Huang, L.; Xu, L.; Wang, Y.; Peng, Y.; Zou, Z.; Huang, P. Efficient Detection Method of Pig-Posture Behavior Based on Multiple Attention Mechanism. Comput. Intell. Neurosci. 2022, 2022, 1759542. [Google Scholar] [CrossRef]
- Huang, Y.; Xiao, D.; Liu, J.; Tan, Z.; Liu, K.; Chen, M. An Improved Pig Counting Algorithm Based on YOLOv5 and DeepSORT Model. Sensors 2023, 23, 6309. [Google Scholar] [CrossRef] [PubMed]
- Tu, S.; Zeng, Q.; Liang, Y.; Liu, X.; Huang, L.; Weng, S.; Huang, Q. Automated Behavior Recognition and Tracking of Group-Housed Pigs with an Improved DeepSORT Method. Agriculture 2022, 12, 1907. [Google Scholar] [CrossRef]
- Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You Only Look Once: Unified, Real-Time Object Detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016; pp. 779–788. [Google Scholar]
- Redmon, J.; Farhadi, A. YOLO9000: Better, Faster, Stronger. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017; pp. 7263–7271. [Google Scholar]
- Psota, E.T.; Schmidt, T.; Mote, B.; Pérez, L.C. Long-Term Tracking of Group-Housed Livestock Using Keypoint Detection and MAP Estimation for Individual Animal Identification. Sensors 2020, 20, 3670. [Google Scholar] [CrossRef] [PubMed]
Dataset | Sequence | Day | Night | Activity Level | Number of Pigs |
---|---|---|---|---|---|
1 min videos | 10 | √ | – | Medium | 11 |
11 | √ | – | High | 10 | |
12 | – | √ | Low | 11 | |
13 | √ | – | High | 11 | |
14 | √ | – | High | 6 | |
15 | √ | – | Medium | 6 | |
16 | √ | – | Medium | 6 | |
17 | – | √ | Low | 6 | |
18 | – | √ | Low | 6 | |
10 min videos | 01 | √ | – | Medium | 7 |
02 | – | √ | Low | 8 | |
03 | √ | – | High | 14 | |
04 | – | √ | Low | 15 |
Algorithms | HOTA(%) ↑ | MOTA(%) ↑ | IDF1(%) ↑ | IDs ↓ |
---|---|---|---|---|
TransTrack | 49.5 | 87.3 | 68 | 255 |
ByteTrack | 71.4 | 90.6 | 87.9 | 55 |
Pig-ByteTrack | 72.9 | 91.7 | 89.0 | 41 |
Video | HOTA(%) ↑ | MOTA(%) ↑ | IDF1(%) ↑ | IDs ↓ |
---|---|---|---|---|
10 | 80.3 | 94.5 | 95.0 | 4 |
11 | 72.5 | 94.9 | 87.8 | 3 |
12 | 63.0 | 88.7 | 84.9 | 10 |
13 | 66.2 | 97.9 | 84.9 | 6 |
14 | 77.1 | 97.9 | 95.0 | 0 |
15 | 81.7 | 97.1 | 90.9 | 1 |
16 | 82.5 | 97.6 | 98.8 | 0 |
17 | 79.6 | 97.9 | 99.0 | 0 |
18 | 56.0 | 67.7 | 64.2 | 17 |
Average | 72.9 | 91.7 | 89.0 | 41 |
Video | HOTA(%) ↑ | MOTA(%) ↑ | IDF1(%) ↑ | IDs ↓ |
---|---|---|---|---|
01 | 66.1 | 90.8 | 47.8 | 14 |
02 | 69.1 | 95.1 | 53.4 | 29 |
03 | 50.8 | 88.4 | 50.8 | 72 |
04 | 59.0 | 87.5 | 67.0 | 83 |
Average | 59.3 | 89.6 | 53.0 | 198 |
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. |
© 2024 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
Tu, S.; Ou, H.; Mao, L.; Du, J.; Cao, Y.; Chen, W. Behavior Tracking and Analyses of Group-Housed Pigs Based on Improved ByteTrack. Animals 2024, 14, 3299. https://doi.org/10.3390/ani14223299
Tu S, Ou H, Mao L, Du J, Cao Y, Chen W. Behavior Tracking and Analyses of Group-Housed Pigs Based on Improved ByteTrack. Animals. 2024; 14(22):3299. https://doi.org/10.3390/ani14223299
Chicago/Turabian StyleTu, Shuqin, Haoxuan Ou, Liang Mao, Jiaying Du, Yuefei Cao, and Weidian Chen. 2024. "Behavior Tracking and Analyses of Group-Housed Pigs Based on Improved ByteTrack" Animals 14, no. 22: 3299. https://doi.org/10.3390/ani14223299
APA StyleTu, S., Ou, H., Mao, L., Du, J., Cao, Y., & Chen, W. (2024). Behavior Tracking and Analyses of Group-Housed Pigs Based on Improved ByteTrack. Animals, 14(22), 3299. https://doi.org/10.3390/ani14223299