Submitted:
19 June 2025
Posted:
20 June 2025
You are already at the latest version
Abstract
Keywords:
1. Introduction
2. Materials and Methods
2.1. Animal and Housing
2.2. Data Collection
2.3. Model Development
2.4. SwinStar-YOLO: Ears Detection with Enhanced YOLOv8
2.4.1. SwinTransformer-Driven YOLOv8
2.4.2. SwinTransformer-Driven YOLOv8
2.4.3. SwinTransformer-Driven YOLOv8
2.4.4. SwinTransformer-Driven YOLOv8
2.5. Ears Extraction with Morphological Methods
2.6. Automatic Extraction of Ear Temperature
3. Results and Discussion
3.1. Results of the Ears Detection Model Training
3.2. Performance of the Ears Detection Model
3.3. Performance of the Automatic Ear Temperature Extraction
4. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Reza M N, Ali M R, Kabir M S N, et al. Thermal imaging and computer vision technologies for the enhancement of pig husbandry: a review. Journal of Animal Science and Technology, 2024, 66(1): 31.
- Mluba H S, Atif O, Lee J, et al. Pattern Mining-Based pig behavior analysis for health and welfare monitoring. Sensors, 2024, 24(7): 2185.
- Serbessa, T.A.; Geleta, Y.G.; Terfa, I.O. Review on diseases and health management of poultry and swine. Int. Int. J. Avian Wildl. Biol. 2023, 7, 27–38. [Google Scholar] [CrossRef]
- Marić, K.; Gvozdanović, K.; Kušec, I.D.; Kušec, G.; Margeta, V. Smart Pig Farms: Integration and Application of Digital Technologies in Pig Production. Agriculture 2025, 15, 937. [Google Scholar] [CrossRef]
- Xiong, Y.; Li, G.; Willard, N.C.; Ellis, M.; Gates, R.S. Modeling Neonatal Piglet Rectal Temperature with Thermography and Machine Learning. J. Asabe 2023, 66, 193–204. [Google Scholar] [CrossRef]
- Reza M N, Ali M R, Haque M A, et al. A review of sound-based pig monitoring for enhanced precision production. Journal of Animal Science and Technology, 2025, 67(2): 277.
- Li Q, Nie S. Detection of ear root feature region in heterogeneous images based on pig head posture. Acad. J. Comput. Inf. Sci, 2023, 6: 20-32.
- Gómez, Y.; Stygar, A.H.; Boumans, I.J.M.M.; Bokkers, E.A.M.; Pedersen, L.J.; Niemi, J.K.; Pastell, M.; Manteca, X.; Llonch, P. A Systematic Review on Validated Precision Livestock Farming Technologies for Pig Production and Its Potential to Assess Animal Welfare. Front. Veter- Sci. 2021, 8. [Google Scholar] [CrossRef] [PubMed]
- Zhang, C.; Xiao, D.; Yang, Q.; Wen, Z.; Lv, L. Review: Application of Infrared Thermography in Livestock Monitoring. Trans. ASABE 2020, 63, 389–399. [Google Scholar] [CrossRef]
- Schmid, S.M.; Büscher, W.; Steinhoff-Wagner, J. Suitability of Different Thermometers for Measuring Body Core and Skin Temperatures in Suckling Piglets. Animals 2021, 11, 1004. [Google Scholar] [CrossRef] [PubMed]
- 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]
- Siewert, C.; Dänicke, S.; Kersten, S.; Brosig, B.; Rohweder, D.; Beyerbach, M.; Seifert, H. Difference method for analysing infrared images in pigs with elevated body temperatures. Z. Fur Med. Phys. 2014, 24, 6–15. [Google Scholar] [CrossRef] [PubMed]
- Zhu, W.X.; Liu, B.; Yang, J.J.; Ma, C. Pig ear area detection based on adapted active shape model. Transactions of the Chinese Society for Agricultural Machinery 2015, 46, 288–295. [Google Scholar]
- 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]
- 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]
- Wutke, M.; Heinrich, F.; Das, P.P.; Lange, A.; Gentz, M.; Traulsen, I.; Warns, F.K.; Schmitt, A.O.; Gültas, M. Detecting Animal Contacts—A Deep Learning-Based Pig Detection and Tracking Approach for the Quantification of Social Contacts. Sensors 2021, 21, 7512. [Google Scholar] [CrossRef] [PubMed]
- 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]
- Psota, E.T.; Mittek, M.; Pérez, L.C.; Schmidt, T.; Mote, B. Multi-Pig Part Detection and Association with a Fully-Convolutional Network. Sensors 2019, 19, 852. [Google Scholar] [CrossRef] [PubMed]
- Xu, P.; Zhang, Y.; Ji, M.; Guo, S.; Tang, Z.; Wang, X.; Guo, J.; Zhang, J.; Guan, Z. Advanced intelligent monitoring technologies for animals: A survey. Neurocomputing 2024, 585. [Google Scholar] [CrossRef]
- Hussain, M. YOLO-v1 to YOLO-v8, the Rise of YOLO and Its Complementary Nature toward Digital Manufacturing and Industrial Defect Detection. Machines 2023, 11, 677. [Google Scholar] [CrossRef]
- Liu, J.; Zhang, C.; Li, J. Using Anchor-Free Object Detectors to Detect Surface Defects. Processes 2024, 12, 2817. [Google Scholar] [CrossRef]
- Lee S I, Koo K, Lee J H, et al. Vision transformer models for mobile/edge devices: a survey. Multimedia Systems, 2024, 30(2): 109.
- Shah, S.; Tembhurne, J. Object detection using convolutional neural networks and transformer-based models: a review. J. Electr. Syst. Inf. Technol. 2023, 10, 1–35. [Google Scholar] [CrossRef]










| Parameters | Values |
|---|---|
| initial learning rate | 0.01 |
| optimizer weight decay | 0.0005 |
| momentum | 0.937 |
| Close_mosaic | 10 |
| epochs | 100 |
| batch-size | 32 |
| Losstr(10) | Lossval(10) | losstr(50) | Lossval(50) | losstr(90) | Lossval(90) | Lossval_min | Epochval |
|---|---|---|---|---|---|---|---|
| 2.1025 | 1.7647 | 1.5760 | 1.4681 | 1.4022 | 1.3755 | 1.3080 | 92 |
| 2.2470 | 2.6962 | 1.6126 | 1.4313 | 1.4267 | 1.3405 | 1.3088 | 91 |
| 2.0575 | 1.8134 | 1.6511 | 1.4920 | 1.3510 | 1.3219 | 1.3042 | 88 |
| 2.0651 | 1.7510 | 1.5161 | 1.41011 | 1.3902 | 1.3511 | 1.3008 | 92 |
| 2.1003 | 1.9810 | 1.52381 | 1.45901 | 1.4001 | 1.3412 | 1.3124 | 88 |
| Model | Params(M) | FLOPs(G) | recall/% | F1-score | Map@0.5/% | Map@0.5:0.95/% | Latency(ms) |
|---|---|---|---|---|---|---|---|
| YOLOv5-m | 25.1 | 64.6 | 81.97 | 81.98 | 89.89 | 61.07 | 9.5 |
| YOLOv6-m | 52.0 | 161.3 | 82.13 | 81.87 | 89.88 | 61.44 | 11.8 |
| YOLOv8-m | 25.9 | 78.9 | 85.48 | 85.25 | 90.03 | 64.87 | 9.7 |
| YOLOv8-l | 43.6 | 165 | 87.81 | 87.90 | 92.13 | 66.59 | 15.3 |
| SwinStar-YOLO-m(Ours) | 42 | 112.5 | 89.66 | 90.04 | 93.74 | 69.38 | 11.6 |
| Parameters | Talg | Tmanu |
|---|---|---|
| Maximum temperature/℃ | 37.94 | 37.93 |
| Average temperature/℃ | 36.70 | 36.81 |
| δmax/% | 0.02 | |
| δmean /% | 0.30 | |
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 (http://creativecommons.org/licenses/by/4.0/).