Body Temperature Detection of Group-Housed Pigs Based on the Pairing of Left and Right Ear Roots in Thermal Images
Simple Summary
Abstract
1. Introduction
2. Materials and Methods
2.1. Image Dataset
2.1.1. Thermal Image Collection
2.1.2. Dataset Construction
2.1.3. Experimental Platform and Parameter Settings
2.2. Method
2.3. YOLO v11m-OBB Ear Roots Detection Model
2.4. Two-Stage Left and Right Ear Root Pairing Algorithm (TEPA)
2.4.1. Rough Pairing Algorithm Based on the Minimum Center Distance of Left and Right Ear Root Predicted Bounding Boxes
2.4.2. Precise Pairing Algorithm for Left and Right Ear Roots Based on Polar Coordinate System
2.5. Temperature Extraction from Ear Root Regions
2.5.1. Temperature Extraction Using Grayscale Linear Interpolation
2.5.2. Ear Root Temperature Representation
3. Results and Discussion
3.1. Evaluation Metrics for Algorithm Performance
3.2. Ear Root Prediction Performance
3.3. Left and Right Ear Root Pairing Performance
3.4. Body Temperature Detection Accuracy
4. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Tzanidakis, C.; Simitzis, P.; Arvanitis, K.; Panagakis, P. An Overview of the Current Trends in Precision Pig Farming Technologies. Livest. Sci. 2021, 249, 104530. [Google Scholar] [CrossRef]
- Wang, M.; Larsen, M.L.V.; Liu, D.; Winters, J.F.M.; Rault, J.-L.; Norton, T. Towards Re-Identification for Long-Term Tracking of Group Housed Pigs. Biosyst. Eng. 2022, 222, 71–81. [Google Scholar] [CrossRef]
- 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]
- Godyń, D.; Herbut, P. Applications of Continuous Body Temperature Measurements in Pigs—A Review. Ann. Wars. Univ. Life Sci.-SGGW-Anim. Sci. 2018, 56, 209–220. [Google Scholar] [CrossRef]
- Albernaz-Gonçalves, R.; Olmos, G.; Hötzel, M.J. My Pigs Are Ok, Why Change?—Animal Welfare Accounts of Pig Farmers. Animal 2021, 15, 100154. [Google Scholar] [CrossRef]
- Yang, Q.; Hui, X.; Huang, Y.; Chen, M.; Huang, S.; Xiao, D. A Long-Term Video Tracking Method for Group-Housed Pigs. Animals 2024, 14, 1505. [Google Scholar] [CrossRef]
- Zhang, Z.; Zhang, H.; Liu, T. Study on Body Temperature Detection of Pig Based on Infrared Technology: A Review. Artif. Intell. Agric. 2019, 1, 14–26. [Google Scholar] [CrossRef]
- Jia, G.; Li, W.; Meng, J.; Tan, H.; Feng, Y. Non-Contact Evaluation of Pigs’ Body Temperature Incorporating Environmental Factors. Sensors 2020, 20, 4282. [Google Scholar] [CrossRef] [PubMed]
- Zhao, H. Pig Body Temperature Detection and Key Temperature Measurement Part Recognition. Master’s Thesis, Huazhong Agricultural University, Wuhan, China, 2019. [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] [PubMed]
- Hentzen, M.; Hovden, D.; Jansen, M.; van Essen, G. Design and Validation of a Wireless Temperature Measurement System for Laboratory and Farm Animals. Proc. Meas. Behav. 2012, 2012, 466–471. [Google Scholar]
- Zhang, Z. Detected Onset of Estrus and Behavior in the Different Varieties of Gilts Using the New Electronic Chip. Master’s Thesis, Sichuan Agricultural University, Chengdu, China, 2015. Available online: https://kns.cnki.net/kcms2/article/abstract?v=YHRUfPYi6NNR3IFGqWDx9ko65KtbLltl6e_d1JTbvuhlkXgr1td-1ccmG-UU7RIURevbYvYNrIczvEN2LFqxuqzF4BiTwJydgLgDFly3S5ghYvz-mHyafMoHWi7-3ifMmwUg5AH9x-05grOr_5G3mu_1beuN_j4Fhur5GGwld0IQxvjDZ5N4nWlpvPg92ExKtZ80wgiQcVCDzs9iKpYFLw==&uniplatform=NZKPT (accessed on 9 September 2023).
- McManus, C.; Tanure, C.B.; Peripolli, V.; Seixas, L.; Fischer, V.; Gabbi, A.M.; Menegassi, S.R.O.; Stumpf, M.T.; Kolling, G.J.; Dias, E.; et al. Infrared Thermography in Animal Production: An Overview. Comput. Electron. Agric. 2016, 123, 10–16. [Google Scholar] [CrossRef]
- Zhang, B.; Xiao, D.; Liu, J.; Huang, S.; Huang, Y.; Lin, T. Pig Eye Area Temperature Extraction Algorithm Based on Registered Images. Comput. Electron. Agric. 2024, 217, 108549. [Google Scholar] [CrossRef]
- Zheng, S.; Zhou, C.; Jiang, X.; Huang, J.; Xu, D. Progress on Infrared Imaging Technology in Animal Production: A Review. Sensors 2022, 22, 705. [Google Scholar] [CrossRef]
- Pacheco, V.M.; Sousa, R.V.; Sardinha, E.J.S.; Rodrigues, A.V.S.; Brown-Brandl, T.M.; Martello, L.S. Deep Learning-Based Model Classifies Thermal Conditions in Dairy Cows Using Infrared Thermography. Biosyst. Eng. 2022, 221, 154–163. [Google Scholar] [CrossRef]
- Gao, L.; Duan, G.; Yin, G.; Zou, F.; Ynag, L.; Yang, F. Trial Results of Infrared Thermometer in the Application of Ante-mortem Body Temperature Screening in the Pig Slaughterhouse. China Anim. Husb. Vet. Med. 2010, 37, 235–237. [Google Scholar]
- Soerensen, D.D.; Pedersen, L.J. Infrared Skin Temperature Measurements for Monitoring Health in Pigs: A Review. Acta Vet. Scand. 2015, 57, 5. [Google Scholar] [CrossRef] [PubMed]
- Zhong, Z. A Novel Visible and Infrared Image Fusion Method Based on Convolutional Neural Network for Pig-Body Feature Detection. Multimed. Tools Appl. 2022, 81, 2757–2775. [Google Scholar] [CrossRef]
- Yamsakul, P.; Yano, T.; Na Lampang, K.; Khamkong, M.; Srikitjakarn, L. Infrared Temperature Sensor for Use Among Sow Herds. Vet. Integr. Sci. 2022, 21, 49–59. [Google Scholar] [CrossRef]
- Mazur-Milecka, M.; Ruminski, J. Deep Learning Based Thermal Image Segmentation for Laboratory Animals Tracking. Quant. InfraRed Thermogr. J. 2021, 18, 159–176. [Google Scholar] [CrossRef]
- Zhang, Z.; Wang, H.; Liu, T.; Wang, Y.; Zhang, H.; Yuan, F.; Yang, X.; Xu, S.; Meng, Y. Accurate Detection Method of Pig’s Temperature Based on Non-point Source Thermal Infrared Image. CAAI Trans. Intell. Technol. 2021, 6, 312–323. [Google Scholar] [CrossRef]
- Jiao, L.; Dong, D.; Zhao, X.; Han, P. Compensation Method for the Influence of Angle of View on Animal Temperature Measurement Using Thermal Imaging Camera Combined with Depth Image. J. Therm. Biol. 2016, 62, 15–19. [Google Scholar] [CrossRef] [PubMed]
- Feng, Y.; Kang, X.; Wang, Y.; Li, M.; Liu, G. Detecting Method of Surface Temperature of Pig Ear Root Based on Thermal Infrared Video. Trans. Chin. Soc. Agric. Mach. 2021, 52 (Suppl. S1), 284–290. [Google Scholar] [CrossRef]
- Xiao, D.; Lin, S.; Liu, Q.; Huang, Y.; Zeng, R.; Chen, L. Automatic Ear Temperature Extraction Algorithm for Live Pigs Based on Infrared Thermography. Trans. Chin. Soc. Agric. Mach. 2021, 52, 255–262. [Google Scholar] [CrossRef]
- Xie, Q.; Wu, M.; Bao, J.; Zheng, P.; Liu, W.; Liu, X.; Yu, H. A Deep Learning-Based Detection Method for Pig Body Temperature Using Infrared Thermography. Comput. Electron. Agric. 2023, 213, 108200. [Google Scholar] [CrossRef]
- Liu, X.; Zeng, X.; Li, T.; Liu, G.; Ding, X.; Mi, Y. Automatic Detection Method of Body Temperature in Herd of Pigs Based on Improved YOLO v7. Trans. Chin. Soc. Agric. Mach. 2023, 54 (Suppl. S1), 267–274. [Google Scholar] [CrossRef]
- Tabuaciri, P.; Bunter, K.; Graser, H.-U. Thermal Imaging as a Potential Tool for Identifying Piglets at Risk. AGBU Pig Genet. Workshop 2016, 5, 23–30. [Google Scholar] [CrossRef]
- Tian, H.; Hua, J.; Zhang, S.; Liu, L. Research on the measurement of sow body temperature based on infrared thermography and linear regression fitting. J. Intell. Agric. Mech. 2023, 4, 36–41. [Google Scholar] [CrossRef]
- Brown-Brandl, T.M.; Hayes, M.D.; Rohrer, G.A.; Eigenberg, R.A. Thermal Comfort Evaluation of Three Genetic Lines of Nursery Pigs Using Thermal Images. Biosyst. Eng. 2023, 225, 1–12. [Google Scholar] [CrossRef]
- Lu, M.; He, J.; Chen, C.; Okinda, C.; Shen, M.; Liu, L.; Yao, W.; Norton, T.; Berckmans, D. An Automatic Ear Base Temperature Extraction Method for Top View Piglet Thermal Image. Comput. Electron. Agric. 2018, 155, 339–347. [Google Scholar] [CrossRef]
- Mu, Y.; Hu, J.; Wang, H.; Li, S.; Zhu, H.; Luo, L.; Wei, J.; Ni, L.; Chao, H.; Hu, T.; et al. Research on the Behavior Recognition of Beef Cattle Based on the Improved Lightweight CBR-YOLO Model Based on YOLOv8 in Multi-Scene Weather. Animals 2024, 14, 2800. [Google Scholar] [CrossRef] [PubMed]
- Guarnido-Lopez, P.; Ramirez-Agudelo, J.-F.; Denimal, E.; Benaouda, M. Programming and Setting Up the Object Detection Algorithm YOLO to Determine Feeding Activities of Beef Cattle: A Comparison between YOLOv8m and YOLOv10m. Animals 2024, 14, 2821. [Google Scholar] [CrossRef]
- Hu, F. Research on Identification Method of Group-Housed Nursery Pigs with Abnormal Body Temperature Using Infrared Thermography. Master’s Thesis, Zhejiang University, Hangzhou, China, 2023. [Google Scholar] [CrossRef]
- Huang, Y. Analysis of Pig Activity Level and Body Temperature Variation Based on Ear Tag Data. Comput. Electron. Agric. 2024, 219, 108768. [Google Scholar] [CrossRef]
- Wang, X.; Hu, F.; Yang, R.; Wang, K. An Infrared Temperature Correction Method for the Skin Temperature of Pigs in Infrared Images. Agriculture 2023, 13, 520. [Google Scholar] [CrossRef]
- 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. [Google Scholar] [CrossRef] [PubMed]
- Xiao, D.; Lin, S.; Liu, Y.; Yang, Q.; Wu, H. Group-Housed Pigs and Their Body Parts Detection with Cascade Faster R-CNN. Int. J. Agric. Biol. Eng. 2022, 15, 203–209. [Google Scholar] [CrossRef]
- Jiang, S.; Zhang, G.; Shen, Z.; Zhong, P.; Tan, J.; Liu, J. Pig Weight Estimation Method Based on a Framework Combining Mask R-CNN and Ensemble Regression Model. Animals 2024, 14, 2122. [Google Scholar] [CrossRef] [PubMed]
Component Name | Configuration |
---|---|
CPU | Intel(R) Core (TM) i5-12400f |
Memory | 16 GB |
GPU | NVIDIA GeForce RTX 3060 12 GB |
GPU Acceleration | CUDA11.8, CUDNN8.9.2 |
Operating System | Windows 10 Professional (64-bit) |
Algorithm Environment | Python 3.9.20, Torch 2.2.1, Ultralytics 8.3.25 |
Model | P (%) | R (%) | mAP (%) |
---|---|---|---|
YOLO v8nano-OBB | 91.1 | 91.1 | 93.4 |
YOLO v8medium-OBB | 94.7 | 93.1 | 96.3 |
YOLO v11nano-OBB | 95.5 | 95.3 | 97.6 |
YOLO v11 medium-OBB | 98.7 | 98.4 | 98.7 |
Statistic | YOLO TEPA-OBB | Ear Root Pairing Results (Pairs) | Total Ear Roots (Pairs) | Pairing Accuracy (%) | |
---|---|---|---|---|---|
Incorrect | Correct | ||||
All Test Images | Rough Pairing | 56 | 313 | 371 | 84.8% |
Precise Pairing | 5 | 364 | 98.1% | ||
Single-Pig Images | Rough Pairing | 0 | 233 | 233 | 100% |
Precise Pairing | 0 | 0 | 0 | 0% | |
Multi-Pig Images | Rough Pairing | 56 | 80 | 138 | 58% |
Precise Pairing | 5 | 131 | 94.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
Xiang, R.; Zhang, Y.; Lin, H.; Fu, Y.; Rao, X.; Pan, J.; Pan, C. Body Temperature Detection of Group-Housed Pigs Based on the Pairing of Left and Right Ear Roots in Thermal Images. Animals 2025, 15, 642. https://doi.org/10.3390/ani15050642
Xiang R, Zhang Y, Lin H, Fu Y, Rao X, Pan J, Pan C. Body Temperature Detection of Group-Housed Pigs Based on the Pairing of Left and Right Ear Roots in Thermal Images. Animals. 2025; 15(5):642. https://doi.org/10.3390/ani15050642
Chicago/Turabian StyleXiang, Rong, Yi Zhang, Hongjian Lin, Yingchun Fu, Xiuqin Rao, Jinming Pan, and Chenghao Pan. 2025. "Body Temperature Detection of Group-Housed Pigs Based on the Pairing of Left and Right Ear Roots in Thermal Images" Animals 15, no. 5: 642. https://doi.org/10.3390/ani15050642
APA StyleXiang, R., Zhang, Y., Lin, H., Fu, Y., Rao, X., Pan, J., & Pan, C. (2025). Body Temperature Detection of Group-Housed Pigs Based on the Pairing of Left and Right Ear Roots in Thermal Images. Animals, 15(5), 642. https://doi.org/10.3390/ani15050642