Dynamic coupling analysis of group-housed pig behaviors and pigsty environmental factors based on the PIG-Net model
Keywords:
pig behavior detection, environmental dynamics, PIG-Net, cloud–edge collaboration, animal welfare assessment.Abstract
Behavioral responses of group-housed pigs are strongly influenced by pigsty environmental conditions, yet their dynamic coupling is difficult to quantify under commercial farming scenarios. This difficulty arises from high inter-pig similarity, complex interactions, and rapidly changing environmental conditions, which pose significant challenges for existing vision-based multi-pig behavior detection and tracking methods. To address these challenges, this study proposes a PIG-Net–based dynamic coupling analysis framework that integrates behavior detection, multi-pig tracking, and behavior-environment interaction analysis. The model uses an EfficientRepBiFusion backbone with bidirectional feature fusion and a lightweight LSDGCD detection head, achieving mean Average Precision (mAP) of 93.5% for PIG YOLO on four pig behaviors—standing, dog-sitting, lateral lying, and prone lying. The integrated PIG-Net system achieves stable tracking performance with identification average rate (IDF1) of 90.7%, multiple object tracking accuracy (MOTA) of 88.6%, and a real-time processing speed of 26 FPS, while environmental sensors continuously record temperature, humidity, and CO2 levels for long-term correlation analysis. Based on long-term monitoring, Pearson correlation analysis was applied to quantify the associations between pig behaviors and environmental factors, highlighting significant correlations with coefficients r ranging from 0.65 to 0.76. By combining these quantitative results with temporal and dimensionality reduction analyses, temperature, humidity, and CO2 were identified as the primary environmental drivers. Active behaviors decreased under elevated temperature and humidity and increased during cooler and drier periods, whereas prone lying and lateral lying increased under thermal and moisture stress. Elevated CO2 concentrations further suppressed activity, reflecting inhibitory effects of degraded air quality. These findings provide a quantitative basis for behavior-environment coupling assessment and early health warning in group-housed pigs.
Keywords: pig behavior detection, environmental dynamics, PIG-Net, behavior–environment coupling, animal welfare assessment
DOI: 10.25165/j.ijabe.20261901.10337
Citation: Zhang W, Zhang X Z, Shi Z X, Lin H, Gao Z, Shao M X, et al. Dynamic coupling analysis of group-housed pig behaviors and pigsty environmental factors based on the PIG-Net model. Int J Agric & Biol Eng, 2026; 19(1): 47–58.
References
[1] Beaulieu M, Masilkova M. Plugging biologging into animal welfare: An opportunity for advancing wild animal welfare science. Methods in Ecology and Evolution, 2024; 15(12): 2172–2188.
[2] Hårstad R M B. The politics of animal welfare: A scoping review of farm animal welfare governance. Review of Policy Research, 2024; 41(4): 679–702.
[3] Martinez C, James-Aldridge V, McWhorter T J, Fernandez E J. Understanding animal introductions and welfare in zoos: A scoping review. Applied Animal Behaviour Science, 2025; 291: 106737.
[4] Mora M, Piles M, David I, Rosa G J M. Integrating computer vision algorithms and RFID system for identification and tracking of group-housed animals: an example with pigs. Journal of Animal Science, 2024; 102: skae174.
[5] van Weeghel H J E, Bos A P B, Spoelstra S F, Koerkamp P W G. Involving the animal as a contributor in design to overcome animal welfare related trade-offs: The dust bath unit as an example. Biosystems Engineering, 2016; 145: 76–92.
[6] Cordeiro A F S, de Alencar Nääs I, da Silva Leitão F, de Almeida A C M, de Moura D J. Use of vocalisation to identify sex, age, and distress in pig production. Biosystems Engineering, 2018; 173: 57–63. doi: 10.1016/j. biosystemseng.2018.03.007.
[7] Larsen M L V, Wang M Q, Willems S, Liu D, Norton T. Automatic detection of locomotor play in young pigs: A proof of concept. Biosystems Engineering, 2023; 229: 154–166.
[8] Kang D Y, Moon B E, Kang M Y, Kook J H, Deb N C, Tamrakar N, et al. Analysis of pig tendencies to stay specific sections within the pig barn according to environmental parameters and facilities features. Agriculture, 2025; 15(12): 1282.
[9] Kim Y J, Song M H, Lee S I, Lee J H, Oh H J, An J W, et al. Evaluation of pig behavior changes related to temperature, relative humidity, volatile organic compounds, and illuminance. J Anim Sci Technol, 2021; 63: 790–798.
[10] Tang M F, Jian Y, Zhu J M, Tian K, Tan Q, Zhao R. Analysis of the morphological characteristics of PM2.5 and its microbiological composition in a fattening pig house. Sustainability, 2024; 16(23): 10249.
[11] Chen F E, Liang X M, Chen L H, Liu B Y, Lan Y B. Novel method for real–time detection and tracking of pig body and its different parts. Int J Agric & Biol Eng, 2020; 13(6): 144–149.
[12] Xiao D Q, Feng A J, Liu J. Detection and tracking of pigs in natural environments based on video analysis. Int J Agric & Biol Eng, 2019; 12: 116–126.
[13] Alghamdi S, Zhao Z Q, Ha D S, Morota G, Ha S S. Improved pig behavior analysis by optimizing window sizes for individual behaviors on acceleration and angular velocity data. Journal of Animal Science, 2022; 100(11): skac293.
[14] Lin J Y, Wu R K, Yin L, Wang X Y, Chen H Y, Cai G Y, et al. Hierarchical model with integrated probabilistic strategy for classifying pig behaviors using active electronic ear tags. Computers and Electronics in Agriculture, 2025; 230: 109915.
[15] Achour B, Belkadi M, Aoudjit R, Laghrouche M. Unsupervised automated monitoring of dairy cows’ behavior based on Inertial Measurement Unit attached to their back. Computers and Electronics in Agriculture, 2019; 167: 105068.
[16] Zhang Z T, Zhang H, He Y X, Liu T H. A review in the automatic detection of pigs behavior with sensors. Journal of Sensors, 2022; 2022(1): 4519539.
[17] Andersen H M L, Dybkjær L, Herskin M S. Growing pigs’ drinking behaviour: number of visits, duration, water intake and diurnal variation. Animal, 2014; 8(11): 1881–1888.
[18] Chen C, Zhu W X, Norton T. Behaviour recognition of pigs and cattle: Journey from computer vision to deep learning. Computers and Electronics in Agriculture, 2021; 187: 106255.
[19] Hao W L, Han W W, Han M, Li F Z. A novel improved yolov3-sc model for individual pig detection. Sensors, 2022; 22(22): 8792.
[20] Bhoj S, Tarafdar A, Chauhan A, Singh M, Gaur G K. Image processing strategies for pig liveweight measurement: Updates and challenges. Computers and Electronics in Agriculture, 2022; 193: 106693.
[21] Alameer A, Kyriazakis I, Dalton H A, Miller A L, Bacardit J. Automatic recognition of feeding and foraging behaviour in pigs using deep learning. Biosystems Engineering, 2020; 197: 91–104.
[22] Ma C, Deng M H, Yin Y L. Pig face recognition based on improved YOLOv4 lightweight neural network. Information Processing in Agriculture, 2024; 11: 356–371.
[23] Tong Z M, Xu T Z, Shi C M, Li S Z, Xie Q J, Rong L H. Pig behavior recognition based on CBCW-YOLO v8 model. Transactions of the Chinese Society for Agricultural Machinery, 2025; 56(2): 411–419.
[24] Zhang M J, Hong D, Wu J B, Zhu Y F, Zhao Q N, Zhang X S, et al. Sheep-YOLO: improved and lightweight YOLOv8n for precise and intelligent recognition of fattening lambs’ behaviors and vitality statuses. Computers Electronics in Agriculture, 2025; 236: 110413. doi: 10.1016/j.compag.2025.110413.
[25] Luo Y Z, Lin K, Xiao Z X, Lv E L, Wei X Y, Li B, et al. PBR-YOLO: A lightweight piglet multi-behavior recognition algorithm based on improved yolov8. Smart Agricultural Technology, 2025; 10: 100785.
[26] Matthews S G, Miller A L, Clapp J, Plötz T, Kyriazakis I. Early detection of health and welfare compromises through automated detection of behavioural changes in pigs. Veterinary Journal, 2016; 217: 43–51.
[27] Tu S Q, Cai Y F, Liang Y, Lei H, Huang Y F, Liu H X, et al. Tracking and monitoring of individual pig behavior based on YOLOv5-Byte. Computers and Electronics in Agriculture, 2024; 221. doi: 10.1016/j.compag.2024.108997.
[28] Li Q F, Zhuo Z Y, Gao R H, Wang R, Zhang N, Shi Y, et al. A pig behavior-tracking method based on a multi-channel high-efficiency attention mechanism. Agriculture Communications, 2024; 2(4): 100062. doi: 10.1016/j.agrcom.2024.100062.
[29] Yin J J, Chen Y F, Huang Y G, Xiao D Q. Analysis and classification of pig health status using hourly activity data: Combining statistical analysis and machine learning. Applied Animal Behaviour Science, 2025; 282: 106488.
[30] Yang Q M, Chen M B, Xiao D Q, Huang S P, Hui X Y. Long-term video activity monitoring and anomaly alerting of group-housed pigs. Computers and Electronics in Agriculture, 2024; 224: 109205.
[31] Franz A, Deimel I, Spiller A. Concerns about animal welfare: A cluster analysis of German pig farmers. British Food Journal, 2012; 114(10): 1445–1462.
[32] Tong C H, Yang X H, Huang Q, Qian F Y. NGIoU loss: Generalized intersection over union loss based on a new bounding box regression. Applied Sciences, 2022; 12(24): 12785.
[33] Zhang Y F, Sun P Z, Jiang Y, Yu D D, Weng F C, Yuan Z H, et al. Bytetrack: Multi-object tracking by associating every detection box. In: Computer Vision–ECCV 2022, Tel Aviv, Israel: Springer Cham, 2022; pp.1–21. doi: 10.1007/978-3-031-20047-2_1.
[34] Luiten J, Os̆ep A, Dendorfer P, Torr P, Geiger A, Leal-Taixé L, et al. A higher order metric for evaluating multi-object tracking. International Journal of Computer Vision, 2021; 129: 548–578.
[35] Wu J Y, Yang Q M, Xiao D Q, Wu M T, Chen Z Z, Hong Q W. Quantifying behavioural patterns for group-housed pigs based on deep learning and statistical analysis. Computers and Electronics in Agriculture, 2025; 237: 110521.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 International Journal of Agricultural and Biological Engineering

This work is licensed under a Creative Commons Attribution 4.0 International License.
IJABE is an international peer reviewed, open access journal, adopting Creative Commons Copyright Notices as follows.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).