Stressor-Specific Anomaly Detection System in Group-Housed Growing Pigs Through Combined Computer Vision-Machine Learning Framework: A Pilot Study
Abstract
1. Introduction
2. Materials and Methods
2.1. Overview of the Farm and Animal Conditions
2.2. Proposed Stressor-Specific Pig Anomaly Detection System
2.3. Data Collection and Processing
2.3.1. Overview of Computer Vision Models
2.3.2. Behavior Percentages
2.3.3. Feeding/Drinking Duration, Interval, and Frequency
2.3.4. Feeding Classes
2.4. Classification Model Development
2.4.1. Dataset Construction
2.4.2. Feature Models
2.4.3. Feature Extraction
2.4.4. Model Training
2.4.5. Evaluation of Best Models
2.5. Computational Environment
2.6. Exploratory Data Analysis
3. Results
3.1. Behavioral Differences Between Classes
3.2. Machine Learning Models with Various Combinations of Behavioral Variables
3.3. Classification Performance of the Best Model
3.4. Anomaly Detection in Unseen Data
| LR FM-8 | DT FM-3 | RF FM-3 | RF FM-8 | XGB FM-3 | NB FM-7 | LDA FM-5 | |
|---|---|---|---|---|---|---|---|
| Precision 1 | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 | 95.0 | |
| Recall 1 | 13.0 | 100.0 | 100.0 | 95.7 | 100.0 | 82.6 | |
| F1-score 1 | 23.1 | 100.0 | 100.0 | 97.8 | 100.0 | 88.4 | |
| Accuracy 1 | 28.6 | 100.0 | 100.0 | 96.4 | 100.0 | 17.9 | 82.1 |
| Accuracy 2 | 100.0 | 20.0 | 100.0 | 20.0 | 80.0 |



4. Discussion
5. Study Limitations and Recommendations
6. Conclusions
Supplementary Materials
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviations
| AUC | Area Under the ROC Curve |
| CNN | Convolutional Neural Network |
| DT | Decision Tree |
| FM | Feature Model |
| FN | False negative |
| FP | False positive |
| HS | Heat Stress |
| HSI | Heat Stress with Infection |
| HSPV | Heat Stress with Poor Ventilation |
| HSR | Heat Stress with Recovery |
| k-NN | k-Nearest Neighbors |
| LDA | Linear Discriminant Analysis |
| LR | Linear Regression |
| LSTM | Long Short-Term Memory |
| ML | Machine Learning |
| N | Normal |
| NB | Naïve Bayes |
| PCA | Principal Component Analysis |
| QDA | Quadratic Discriminant Analysis |
| RF | Random Forest |
| RFID | Radio Frequency Identification |
| ROC | Receiver Operating Characteristic |
| SHAP | SHapley Additive exPlanations |
| SVM | Support Vector Machine |
| TN | True negative |
| TP | True positive |
| VGG19 | Visual Geometry Group 19 |
| VSC | Visual Studio Code |
| XGB | eXtreme Gradient Boosting |
| YOLO | You Only Look Once |
References
- Abd Aziz, N.S.N.; Mohd Daud, S.; Dziyauddin, R.A.; Adam, M.Z.; Azizan, A. A Review on Computer Vision Technology for Monitoring Poultry Farm—Application, Hardware, and Software. IEEE Access 2021, 9, 12431–12445. [Google Scholar] [CrossRef]
- Bhuiyan, M.R.; Wree, P. Animal Behavior for Chicken Identification and Monitoring the Health Condition Using Computer Vision: A Systematic Review. IEEE Access 2023, 11, 126601–126610. [Google Scholar] [CrossRef]
- Borges Oliveira, D.A.; Ribeiro Pereira, L.G.; Bresolin, T.; Pontes Ferreira, R.E.; Reboucas Dorea, J.R. A Review of Deep Learning Algorithms for Computer Vision Systems in Livestock. Livest. Sci. 2021, 253, 104700. [Google Scholar] [CrossRef]
- Okinda, C.; Nyalala, I.; Korohou, T.; Okinda, C.; Wang, J.; Achieng, T.; Wamalwa, P.; Mang, T.; Shen, M. A Review on Computer Vision Systems in Monitoring of Poultry: A Welfare Perspective. Artif. Intell. Agric. 2020, 4, 184–208. [Google Scholar] [CrossRef]
- Gan, H.; Ou, M.; Huang, E.; Xu, C.; Li, S.; Li, J.; Liu, K.; Xue, Y. Automated Detection and Analysis of Social Behaviors among Preweaning Piglets Using Key Point-Based Spatial and Temporal Features. Comput. Electron. Agric. 2021, 188, 106357. [Google Scholar] [CrossRef]
- Nasirahmadi, A.; Sturm, B.; Olsson, A.-C.; Jeppsson, K.-H.; Müller, S.; Edwards, S.; Hensel, O. Automatic Scoring of Lateral and Sternal Lying Posture in Grouped Pigs Using Image Processing and Support Vector Machine. Comput. Electron. Agric. 2019, 156, 475–481. [Google Scholar] [CrossRef]
- Riekert, M.; Klein, A.; Adrion, F.; Hoffmann, C.; Gallmann, E. Automatically Detecting Pig Position and Posture by 2D Camera Imaging and Deep Learning. Comput. Electron. Agric. 2020, 174, 105391. [Google Scholar] [CrossRef]
- van der Zande, L.E.; Guzhva, O.; Rodenburg, T.B. Individual Detection and Tracking of Group Housed Pigs in Their Home Pen Using Computer Vision. Front. Anim. Sci. 2021, 2, 669312. [Google Scholar] [CrossRef]
- Cao, Z.; Sun, S.; Bao, X.; Cao, Z.; Sun, S.; Bao, X. A Review of Computer Vision and Deep Learning Applications in Crop Growth Management. Appl. Sci. 2025, 15, 8438. [Google Scholar] [CrossRef]
- Petrovic, B.; Tunguz, V.; Bartos, P. Application of Computer Vision in Livestock and Crop Production—A Review. Comput. Artif. Intell. 2023, 1, 360. [Google Scholar] [CrossRef]
- Tian, H.; Wang, T.; Liu, Y.; Qiao, X.; Li, Y. Computer Vision Technology in Agricultural Automation—A Review. Inf. Process. Agric. 2020, 7, 1–19. [Google Scholar] [CrossRef]
- Ahmed, S.T.; Mun, H.-S.; Yoe, H.; Yang, C.-J. Monitoring of Behavior Using a Video-Recording System for Recognition of Salmonella Infection in Experimentally Infected Growing Pigs. Animal 2015, 9, 115–121. [Google Scholar] [CrossRef] [PubMed]
- Jacobs, L.; Blatchford, R.A.; de Jong, I.C.; Erasmus, M.A.; Levengood, M.; Newberry, R.C.; Regmi, P.; Riber, A.B.; Weimer, S.L. Enhancing Their Quality of Life: Environmental Enrichment for Poultry. Poult. Sci. 2023, 102, 102233. [Google Scholar] [CrossRef] [PubMed]
- Matthews, S.G.; Miller, A.L.; PlÖtz, T.; Kyriazakis, I. Automated Tracking to Measure Behavioural Changes in Pigs for Health and Welfare Monitoring. Sci. Rep. 2017, 7, 17582. [Google Scholar] [CrossRef]
- Xiao, L.; Ding, K.; Gao, Y.; Rao, X. Behavior-Induced Health Condition Monitoring of Caged Chickens Using Binocular Vision. Comput. Electron. Agric. 2019, 156, 254–262. [Google Scholar] [CrossRef]
- de Oliveira, M.J.K.; Valk, M.; Melo, A.D.B.; Marçal, D.A.; Silva, C.A.; Valini, G.A.d.C.; Arnaut, P.R.; Gonçalves, J.P.R.; Andretta, I.; Hauschild, L. Feeding Behavior of Finishing Pigs under Diurnal Cyclic Heat Stress. Animals 2023, 13, 908. [Google Scholar] [CrossRef]
- Serviento, A.M.; Labussière, E.; Castex, M.; Renaudeau, D. Effect of Heat Stress and Feeding Management on Growth Performance and Physiological Responses of Finishing Pigs. J. Anim. Sci. 2020, 98, skaa387. [Google Scholar] [CrossRef]
- George, T.R.; Davis, J.; Anil, K.; Unnikrishnan, M.; Mathew, J. Behavioural Responses of Large White Yorkshire Weanling Piglets to Cold Stress. J. Veter. Anim. Sci. 2024, 55, 78–82. [Google Scholar] [CrossRef]
- Rymut, H.E.; Bolt, C.R.; Caputo, M.P.; Houser, A.K.; Antonson, A.M.; Zimmerman, J.D.; Villamil, M.B.; Southey, B.R.; Rund, L.A.; Johnson, R.W.; et al. Long-Lasting Impact of Maternal Immune Activation and Interaction with a Second Immune Challenge on Pig Behavior. Front. Vet. Sci. 2020, 7, 561151. [Google Scholar] [CrossRef]
- Veit, C.; Janczak, A.M.; Ranheim, B.; Vas, J.; Valros, A.; Sandercock, D.A.; Piepponen, P.; Dulgheriu, D.; Nordgreen, J. The Effect of LPS and Ketoprofen on Cytokines, Brain Monoamines, and Social Behavior in Group-Housed Pigs. Front. Vet. Sci. 2021, 7, 617634. [Google Scholar] [CrossRef]
- Shetty, A.K.; Saha, I.; Sanghvi, R.M.; Save, S.A.; Patel, Y.J. A Review: Object Detection Models. In Proceedings of the 2021 6th International Conference for Convergence in Technology (I2CT), Maharashtra, India, 2–4 April 2021; pp. 1–8. [Google Scholar]
- Sultana, F.; Sufian, A.; Dutta, P. A Review of Object Detection Models Based on Convolutional Neural Network. In Intelligent Computing: Image Processing Based Applications; Mandal, J.K., Banerjee, S., Eds.; Springer: Singapore, 2020; pp. 1–16. ISBN 978-981-15-4288-6. [Google Scholar]
- Shi, W.; Wang, X.; Li, X.; Fu, Y.; Liu, X.; Wang, H. YOLOv5DA: An Improved YOLOv5 Model for Posture Detection of Grouped Pigs. Appl. Sci. 2024, 14, 10104. [Google Scholar] [CrossRef]
- Zhuang, Y.; Zhou, K.; Zhou, Z.; Ji, H.; Teng, G. Systems to Monitor the Individual Feeding and Drinking Behaviors of Growing Pigs Based on Machine Vision. Agriculture 2023, 13, 103. [Google Scholar] [CrossRef]
- Huang, J.-C.; Ko, K.-M.; Shu, M.-H.; Hsu, B.-M. Application and Comparison of Several Machine Learning Algorithms and Their Integration Models in Regression Problems. Neural Comput. Appl. 2020, 32, 5461–5469. [Google Scholar] [CrossRef]
- Iwase, S.; Nakada, T.; Shimada, T.; Oami, T.; Shimazui, T.; Takahashi, N.; Yamabe, J.; Yamao, Y.; Kawakami, E. Prediction Algorithm for ICU Mortality and Length of Stay Using Machine Learning. Sci. Rep. 2022, 12, 12912. [Google Scholar] [CrossRef]
- Sharma, P.; Dadheech, P.; Aneja, N.; Aneja, S. Predicting Agriculture Yields Based on Machine Learning Using Regression and Deep Learning. IEEE Access 2023, 11, 111255–111264. [Google Scholar] [CrossRef]
- Sikora, A.; Zhang, T.; Murphy, D.J.; Smith, S.E.; Murray, B.; Kamaleswaran, R.; Chen, X.; Buckley, M.S.; Rowe, S.; Devlin, J.W. Machine Learning vs. Traditional Regression Analysis for Fluid Overload Prediction in the ICU. Sci. Rep. 2023, 13, 19654. [Google Scholar] [CrossRef]
- Yin, J.; Chen, Y.; Huang, Y.; Xiao, D. Analysis and Classification of Pig Health Status Using Hourly Activity Data: Combining Statistical Analysis and Machine Learning. Appl. Anim. Behav. Sci. 2025, 282, 106488. [Google Scholar] [CrossRef]
- Kavlak, A.T.; Pastell, M.; Uimari, P. Disease Detection in Pigs Based on Feeding Behaviour Traits Using Machine Learning. Biosyst. Eng. 2023, 226, 132–143. [Google Scholar] [CrossRef]
- Maselyne, J.; Van Nuffel, A.; Briene, P.; Vangeyte, J.; De Ketelaere, B.; Millet, S.; Van den Hof, J.; Maes, D.; Saeys, W. Online Warning Systems for Individual Fattening Pigs Based on Their Feeding Pattern. Biosyst. Eng. 2018, 173, 143–156. [Google Scholar] [CrossRef]
- Lagua, E.B.; Mun, H.-S.; Ampode, K.M.B.; Sharifuzzaman, M.; Hasan, M.K.; Kim, Y.-H.; Yang, C.-J. Characterising Responses in Group-Housed Pigs to Salmonella Typhimurium Infection through Integrated Computer Vision–Based Behavioural Monitoring and Statistical Analyses. Porc. Health Manag. 2026, 12, 13. [Google Scholar] [CrossRef]
- Paszke, A.; Gross, S.; Massa, F.; Lerer, A.; Bradbury, J.; Chanan, G.; Killeen, T.; Lin, Z.; Gimelshein, N.; Antiga, L.; et al. PyTorch: An Imperative Style, High-Performance Deep Learning Library. In Proceedings of the 33rd Conference on Neural Information Processing Systems (NeurIPS 2019), Vancouver, BC, Canada, 8–14 December 2019. [Google Scholar]
- Bradski, G.; Kaehler, A. Learning OpenCV: Computer Vision with the OpenCV Library; O’Reilly Media, Inc.: Sebastopol, CA, USA, 2008; ISBN 978-0-596-55404-0. [Google Scholar]
- Maselyne, J.; Saeys, W.; Briene, P.; Mertens, K.; Vangeyte, J.; De Ketelaere, B.; Hessel, E.F.; Sonck, B.; Van Nuffel, A. Methods to Construct Feeding Visits from RFID Registrations of Growing-Finishing Pigs at the Feed Trough. Comput. Electron. Agric. 2016, 128, 9–19. [Google Scholar] [CrossRef]
- Pedregosa, F.; Varoquaux, G.; Gramfort, A.; Michel, V.; Thirion, B.; Grisel, O.; Blondel, M.; Prettenhofer, P.; Weiss, R.; Dubourg, V.; et al. Scikit-Learn: Machine Learning in Python. J. Mach. Learn. Res. 2011, 12, 2825–2830. Available online: https://dl.acm.org/doi/10.5555/1953048.2078195 (accessed on 18 May 2026).
- Chen, T.; Guestrin, C. XGBoost: A Scalable Tree Boosting System. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; ACM: New York, NY, USA, 2016; pp. 785–794. [Google Scholar]
- Lundberg, S.; Lee, S.-I. A Unified Approach to Interpreting Model Predictions. In NIPS’17: Proceedings of the 31st International Conference on Neural Information Processing Systems; Curran Associates Inc.: Red Hook, NY, USA, 2017. [Google Scholar]
- Hunter, J.D. Matplotlib: A 2D Graphics Environment. Comput. Sci. Eng. 2007, 9, 90–95. [Google Scholar] [CrossRef]
- Waskom, M.L. Seaborn: Statistical Data Visualization. J. Open Source Softw. 2021, 6, 3021. [Google Scholar] [CrossRef]
- Mayorga, E.J.; Renaudeau, D.; Ramirez, B.C.; Ross, J.W.; Baumgard, L.H. Heat Stress Adaptations in Pigs. Anim. Front. 2019, 9, 54–61. [Google Scholar] [CrossRef]
- Pearce, S.C.; Gabler, N.K.; Ross, J.W.; Escobar, J.; Patience, J.F.; Rhoads, R.P.; Baumgard, L.H. The Effects of Heat Stress and Plane of Nutrition on Metabolism in Growing Pigs1. J. Anim. Sci. 2013, 91, 2108–2118. [Google Scholar] [CrossRef]
- Renaudeau, D.; Frances, G.; Dubois, S.; Gilbert, H.; Noblet, J. Effect of Thermal Heat Stress on Energy Utilization in Two Lines of Pigs Divergently Selected for Residual Feed Intake1,2. J. Anim. Sci. 2013, 91, 1162–1175. [Google Scholar] [CrossRef] [PubMed]
- Waltz, X.; Baillot, M.; Connes, P.; Bocage, B.; Renaudeau, D. Effects of Hydration Level and Heat Stress on Thermoregulatory Responses, Hematological and Blood Rheological Properties in Growing Pigs. PLoS ONE 2014, 9, e102537. [Google Scholar] [CrossRef]
- Huynh, T.T.T.; Aarnink, A.J.A.; Gerrits, W.J.J.; Heetkamp, M.J.H.; Canh, T.T.; Spoolder, H.A.M.; Kemp, B.; Verstegen, M.W.A. Thermal Behaviour of Growing Pigs in Response to High Temperature and Humidity. Appl. Anim. Behav. Sci. 2005, 91, 1–16. [Google Scholar] [CrossRef]
- Mun, H.-S.; Lagua, E.; Ampode, K.M.B.; Chem, V.; Park, H.-R.; Kim, Y.-H.; Yang, C.-J. Interactions of Environmental Conditions, Day-Night Cycles, and Growing Periods on Postural Behavior of Pigs. J. Anim. Behav. Biometeorol. 2023, 11, 2023035. [Google Scholar] [CrossRef]
- Parois, S.P.; Cabezón, F.A.; Schinckel, A.P.; Johnson, J.S.; Stwalley, R.M.; Marchant-Forde, J.N. Effect of Floor Cooling on Behavior and Heart Rate of Late Lactation Sows Under Acute Heat Stress. Front. Vet. Sci. 2018, 5, 223. [Google Scholar] [CrossRef] [PubMed]
- Lagua, E.B.; Mun, H.-S.; Ampode, K.M.B.; Park, H.-R.; Sharifuzzaman, M.; Hasan, M.K.; Kim, Y.-H.; Yang, C.-J. Minimum Carbon Dioxide Is a Key Predictor of the Respiratory Health of Pigs in Climate-Controlled Housing Systems. Porc. Health Manag. 2024, 10, 59. [Google Scholar] [CrossRef]
- Peiffer-Smadja, N.; Rawson, T.M.; Ahmad, R.; Buchard, A.; Georgiou, P.; Lescure, F.-X.; Birgand, G.; Holmes, A.H. Machine Learning for Clinical Decision Support in Infectious Diseases: A Narrative Review of Current Applications. Clin. Microbiol. Infect. 2020, 26, 584–595. [Google Scholar] [CrossRef] [PubMed]
- Luise, D.; Lauridsen, C.; Bosi, P.; Trevisi, P. Methodology and Application of Escherichia Coli F4 and F18 Encoding Infection Models in Post-Weaning Pigs. J. Anim. Sci. Biotechnol. 2019, 10, 53. [Google Scholar] [CrossRef] [PubMed]
- Casto-Rebollo, C.; Nuñez, P.; Gol, S.; Reixach, J.; Ibáñez-Escriche, N. Variability of Daily Feed Intake as an Indicator of Resilience in Pietrain Pigs. Animal 2025, 19, 101415. [Google Scholar] [CrossRef]
- Bus, J.D.; de Mol, R.M.; Webb, L.E.; Bokkers, E.A.M.; Boumans, I.J.M.M. Co-Occurrence of Sudden Feeding Behaviour Deviations and Welfare Issue Onsets in Growing-Finishing Pigs. Porc. Health Manag. 2025, 11, 44. [Google Scholar] [CrossRef]
- Munsterhjelm, C.; Nordgreen, J.; Aae, F.; Heinonen, M.; Olstad, K.; Aasmundstad, T.; Janczak, A.M.; Valros, A. To Be Blamed or Pitied? The Effect of Illness on Social Behavior, Cytokine Levels and Feed Intake in Undocked Boars. Physiol. Behav. 2017, 179, 298–307. [Google Scholar] [CrossRef]
- Nguyen-Ba, H.; Taghipoor, M.; Milgen, J. van Modelling the Feed Intake Response of Growing Pigs to Diets Contaminated with Mycotoxins. Animal 2020, 14, s303–s312. [Google Scholar] [CrossRef]
- Li, Q.; Patience, J.F. Factors Involved in the Regulation of Feed and Energy Intake of Pigs. Anim. Feed Sci. Technol. 2017, 233, 22–33. [Google Scholar] [CrossRef]
- Patience, J.F.; Rossoni-Serão, M.C.; Gutiérrez, N.A. A Review of Feed Efficiency in Swine: Biology and Application. J. Anim. Sci. Biotechnol. 2015, 6, 33. [Google Scholar] [CrossRef]
- Pierozan, C.R.; Agostini, P.S.; Gasa, J.; Novais, A.K.; Dias, C.P.; Santos, R.S.K.; Pereira, M., Jr.; Nagi, J.G.; Alves, J.B.; Silva, C.A. Factors Affecting the Daily Feed Intake and Feed Conversion Ratio of Pigs in Grow-Finishing Units: The Case of a Company. Porc. Health Manag. 2016, 2, 7. [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]
- 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, 603–610. [Google Scholar] [CrossRef]
- Gertz, M.; Große-Butenuth, K.; Junge, W.; Maassen-Francke, B.; Renner, C.; Sparenberg, H.; Krieter, J. Using the XGBoost Algorithm to Classify Neck and Leg Activity Sensor Data Using On-Farm Health Recordings for Locomotor-Associated Diseases. Comput. Electron. Agric. 2020, 173, 105404. [Google Scholar] [CrossRef]
- Thomas, J.; Rousselière, Y.; Marcon, M.; Hémonic, A. Early Detection of Diarrhea in Weaned Piglets from Individual Feed, Water and Weighing Data. Front. Anim. Sci. 2021, 2, 688902. [Google Scholar] [CrossRef]
- Chung, Y.; Oh, S.; Lee, J.; Park, D.; Chang, H.-H.; Kim, S. Automatic Detection and Recognition of Pig Wasting Diseases Using Sound Data in Audio Surveillance Systems. Sensors 2013, 13, 12929–12942. [Google Scholar] [CrossRef] [PubMed]
- Yang, Q.; Chen, M.; Xiao, D.; Huang, S.; Hui, X. Long-Term Video Activity Monitoring and Anomaly Alerting of Group-Housed Pigs. Comput. Electron. Agric. 2024, 224, 109205. [Google Scholar] [CrossRef]




| Models (Classes) | Detection Metrics | Size (MB) | PARAM (M) | Speed (FPS) 1 | |||
|---|---|---|---|---|---|---|---|
| Precision | Recall | F1 Score | mAP50 | ||||
| Posture Detection Model | 21.980 | 11.137 | 131.23 | ||||
| Lateral Lying | 92.4 | 92.0 | 92.2 | 96.3 | |||
| Sternal Lying | 91.2 | 90.0 | 90.6 | 94.8 | |||
| Standing | 97.9 | 98.2 | 98.0 | 99.2 | |||
| Sitting | 92.0 | 90.4 | 91.2 | 94.9 | |||
| Average | 93.4 | 92.6 | 93.0 | 96.3 | |||
| Feeding and Drinking Detection Model | 21.979 | 11.137 | 134.05 | ||||
| Feeding | 96.0 | 93.8 | 94.9 | 96.9 | |||
| Drinking | 89.4 | 90.6 | 90.0 | 95.3 | |||
| Not Feeding/Drinking | 96.8 | 96.7 | 96.7 | 98.5 | |||
| Average | 94.1 | 93.7 | 93.9 | 96.9 | |||
| Study | Groups | Conditions | Pigs per Frame (n) | Duration (d) | Data Classification |
|---|---|---|---|---|---|
| 1 | Control | Normal environment | 13 | 23 | N |
| Treatment | Poor environment (heat-stressed and high toxic gases) | 13 | 23 | HSPV | |
| 2 | Control | Heat-stressed | 8 | 22 | HS |
| Treatment | Heat-stressed (adaptation period) | 8 | 9 | HS | |
| Bacterial challenged | 8 | 7 | HSI | ||
| Antibiotic treatment | 8 | 6 | HSR | ||
| Regular | Normal environment + heat stress conditions from day 15 to 19 | 5 | 28 | Test set |
| Model | Primary Behavioral Variables | Total Extracted Features |
|---|---|---|
| 1 | Feeding (%), Drinking (%), Not Feeding/Drinking (%) | 72 |
| 2 | Feeding & Drinking Duration (min), Feeding & Drinking Interval (min), Feeding & Drinking Frequency | 141 |
| 3 | Model 2 + Feeding Individual (%), Feeding Few (%), Feeding Group (%) | 156 |
| 4 | Model 1 + Model 2 | 210 |
| 5 | Model 1 + Model 3 | 279 |
| 6 | Lateral Lying (%), Sternal Lying (%), Total Lying (%), Standing (%), Sitting (%) | 118 |
| 7 | Model 1 + 6 | 187 |
| 8 | Model 2 + 6 | 233 |
| 9 | Model 1 + 2 + 6 | 325 |
| 10 | Model 1 + 3 + 6 | 394 |
| Values | N | HS | HSPV | HSI | HSR | SEM | p-Value |
|---|---|---|---|---|---|---|---|
| Feeding Frequency | 8.53 bc | 10.70 a | 8.15 c | 8.68 bc | 10.41 ab | 0.203 | <0.001 |
| Feeding Interval (min) | 49.66 ab | 48.61 ab | 53.69 a | 53.50 a | 45.50 b | 0.754 | 0.012 |
| Feeding Duration (min) | 15.90 a | 13.12 ab | 11.68 b | 12.50 ab | 13.74 ab | 0.373 | <0.001 |
| Relative Feeding Classes | |||||||
| Feeding Individual (%) | 53.88 b | 72.11 a | 57.11 b | 72.37 a | 68.24 a | 1.225 | <0.001 |
| Feeding Few (%) | 31.98 a | 20.14 b | 25.55 ab | 25.37 ab | 28.43 a | 0.777 | <0.001 |
| Feeding Group (%) | 14.14 a | 7.75 b | 17.33 a | 2.26 b | 3.33 b | 0.830 | <0.001 |
| Drinking Frequency | 13.87 c | 28.35 b | 28.35 b | 25.35 b | 34.82 a | 0.849 | <0.001 |
| Drinking Interval (min) | 57.90 a | 42.32 bc | 44.31 bc | 45.15 b | 39.43 c | 0.860 | <0.001 |
| Drinking Duration (s) | 5.47 c | 17.15 ab | 16.59 ab | 13.27 b | 19.93 a | 0.688 | <0.001 |
| Relative Nutritive Behavior | |||||||
| Feeding (%) | 6.75 a | 4.31 b | 4.64 b | 3.88 b | 4.68 b | 0.167 | <0.001 |
| Drinking (%) | 0.96 c | 4.98 a | 2.97 b | 3.84 b | 5.75 a | 0.207 | <0.001 |
| Not Feeding/Drinking (%) | 92.29 a | 90.71 b | 92.39 a | 92.28 a | 89.57 b | 0.188 | <0.001 |
| Relative of Postural Behavior | |||||||
| Lateral Lying (%) | 54.55 c | 59.62 ab | 60.63 a | 56.98 bc | 56.89 bc | 0.389 | <0.001 |
| Sternal Lying (%) | 30.05 a | 24.86 d | 27.35 bc | 29.23 ab | 26.23 cd | 0.288 | <0.001 |
| Total Lying (%) | 84.61 bc | 84.48 bc | 87.98 a | 86.20 ab | 83.11 c | 0.264 | <0.001 |
| Standing (%) | 11.69 ab | 11.54 ab | 8.73 c | 10.27 bc | 12.40 a | 0.237 | <0.001 |
| Sitting (%) | 3.71 b | 3.98 b | 3.29 b | 3.52 b | 4.48 a | 0.066 | <0.001 |
| ML Algorithms | Feature Models | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | |
| Logistic Regression | 82.1 (72.0–93.0) | 88.0 (81.7–95.1) | 88.0 (79.7–97.5) | 88.0 (80.7–96.4) | 92.0 (86.0–98.7) | 92.3 (86.2–98.8) | 91.0 (85.2–97.3) | 93.3 (88.7–98.4) | 92.0 (86.0–98.7) | 92.0 (87.6–97.1) |
| Decision Tree | 73.1 (67.2–79.6) | 66.7 (58.2–74.6) | 92.0 (86.0–98.7) | 69.3 (63.5–75.5) | 86.7 (81.0–93.0) | 71.8 (64.8–78.8) | 75.6 (62.5–89.6) | 81.3 (68.3–95.3) | 81.3 (67.1–96.8) | 80.0 (67.7–93.4) |
| Random Forest | 83.3 (79.2–87.6) | 84.0 (74.7–95.0) | 90.7 (83.9–98.6) | 84.0 (76.3–92.6) | 89.3 (83.9–95.4) | 88.5 (80.2–96.6) | 88.5 (81.9–95.2) | 90.7 (85.0–97.2) | 88.0 (81.7–95.1) | 89.3 (82.5–96.8) |
| XGB | 85.9 (78.9–92.9) | 89.3 (80.3–98.9) | 90.7 (83.4–98.4) | 84.0 (75.3–93.6) | 82.7 (78.9–86.8) | 83.3 (74.5–91.9) | 87.2 (79.5–94.8) | 88.0 (78.8–97.3) | 89.3 (81.1–97.8) | 86.7 (78.9–94.3) |
| k-NN | 71.8 (60.4–83.9) | 77.3 (72.1–83.3) | 76.0 (68.6–84.3) | 78.7 (72.9–84.9) | 81.3 (72.5–91.4) | 85.9 (76.2–95.9) | 85.9 (75.8–96.0) | 81.3 (72.5–91.4) | 78.7 (71.0–87.6) | 78.7 (71.0–87.6) |
| Naïve Bayes | 87.2 (83.1–91.6) | 86.7 (81.0–93.0) | 85.3 (77.0–94.8) | 85.3 (77.0–94.8) | 85.3 (76.8–94.6) | 89.7 (84.1–95.5) | 92.3 (87.9–97.1) | 86.7 (77.9–96.8) | 89.3 (82.7–96.9) | 88.0 (78.7–98.4) |
| SVM | 80.8 (74.8–87.0) | 78.7 (72.1–86.2) | 77.3 (68.8–86.9) | 80.0 (74.5–86.2) | 78.7 (72.1–86.2) | 87.2 (81.3–93.3) | 82.1 (77.7–86.6) | 81.3 (74.5–89.1) | 80.0 (74.5–86.2) | 78.7 (72.1–86.2) |
| LDA | 78.2 (64.6–92.5) | 81.3 (70.0–93.2) | 86.7 (77.9–96.8) | 80.0 (71.4–89.3) | 96.0 (91.9–100.0) | 64.1 (55.9–72.3) | 84.6 (76.6–93.0) | 82.7 (72.3–94.5) | 84.0 (78.8–89.8) | 94.7 (90.0–99.6) |
| QDA | 34.6 (23.2–51.1) | 40.0 (22.1–45.7) | 40.0 (22.4–45.4) | 18.7 (8.9–36.5) | 36.0 (23.2–49.7) | 33.3 (15.4–57.8) | 33.3 (27.6–43.8) | 30.7 (19.8–34.5) | 37.3 (24.6–46.5) | 37.3 (28.4–48.8) |
| Average | 75.2 | 76.9 | 80.7 | 74.2 | 80.9 | 77.3 | 80.1 | 79.6 | 80.0 | 80.6 |
| Classes | Precision | Recall | F1-Score | Accuracy | AUC |
|---|---|---|---|---|---|
| Normal | 100.0 | 100.0 | 100.0 | ||
| Heat Stress | 95.7 | 91.7 | 93.6 | ||
| Heat Stress + Poor Ventilation | 90.9 | 100.0 | 95.2 | ||
| Heat Stress + Infection | 100.0 | 85.7 | 92.3 | ||
| Heat Stress + Recovery | 100.0 | 100.0 | 100.0 | ||
| Average | 96.2 | 96.0 | 96.0 | 96.0 | 98.7 |
| 95% Confidence Interval | 89.5–100 | 91.5–100 | 89.8–100 | 91.6–100 | 88.2–95.5 |
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. |
© 2026 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.
Share and Cite
Lagua, E.B.; Mun, H.-S.; Sharifuzzaman, M.; Hasan, M.K.; Mehtab, A.; Kang, J.-G.; Park, H.-R.; Kim, Y.-H.; Yang, C.-J. Stressor-Specific Anomaly Detection System in Group-Housed Growing Pigs Through Combined Computer Vision-Machine Learning Framework: A Pilot Study. AI 2026, 7, 184. https://doi.org/10.3390/ai7060184
Lagua EB, Mun H-S, Sharifuzzaman M, Hasan MK, Mehtab A, Kang J-G, Park H-R, Kim Y-H, Yang C-J. Stressor-Specific Anomaly Detection System in Group-Housed Growing Pigs Through Combined Computer Vision-Machine Learning Framework: A Pilot Study. AI. 2026; 7(6):184. https://doi.org/10.3390/ai7060184
Chicago/Turabian StyleLagua, Eddiemar B., Hong-Seok Mun, Md Sharifuzzaman, Md Kamrul Hasan, Ahsan Mehtab, Jin-Gu Kang, Hae-Rang Park, Young-Hwa Kim, and Chul-Ju Yang. 2026. "Stressor-Specific Anomaly Detection System in Group-Housed Growing Pigs Through Combined Computer Vision-Machine Learning Framework: A Pilot Study" AI 7, no. 6: 184. https://doi.org/10.3390/ai7060184
APA StyleLagua, E. B., Mun, H.-S., Sharifuzzaman, M., Hasan, M. K., Mehtab, A., Kang, J.-G., Park, H.-R., Kim, Y.-H., & Yang, C.-J. (2026). Stressor-Specific Anomaly Detection System in Group-Housed Growing Pigs Through Combined Computer Vision-Machine Learning Framework: A Pilot Study. AI, 7(6), 184. https://doi.org/10.3390/ai7060184

