Next Article in Journal
PS-MADDPG-BGMPOA: Co-Channel Interference Avoidance for LEO Beam-Hopping Satellite Systems via Multi-Parameter Optimization of Beam Geometry
Previous Article in Journal
Beyond Glycemic Control: Precision Medicine in Type 2 Diabetes Using Multi-Output Explainable Artificial Intelligence for Personalized SGLT2 and DPP-4 Therapy Selection
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Stressor-Specific Anomaly Detection System in Group-Housed Growing Pigs Through Combined Computer Vision-Machine Learning Framework: A Pilot Study

1
Animal Nutrition and Feed Science Laboratory, Department of Animal Science and Technology, Sunchon National University, Suncheon 57922, Republic of Korea
2
Interdisciplinary Program in IT-Bio Convergence System (BK21 Plus), Sunchon National University, Suncheon 57922, Republic of Korea
3
Department of Multimedia Engineering, Sunchon National University, Suncheon 57922, Republic of Korea
4
Department of Animal Science and Veterinary Medicine, Gopalganj Science and Technology University, Gopalganj 8105, Bangladesh
5
Department of Poultry Science, Sylhet Agricultural University, Sylhet 3100, Bangladesh
6
Interdisciplinary Program in IT-Bio Convergence System (BK21 Plus), Chonnam National University, Gwangju 61186, Republic of Korea
*
Authors to whom correspondence should be addressed.
AI 2026, 7(6), 184; https://doi.org/10.3390/ai7060184
Submission received: 4 April 2026 / Revised: 11 May 2026 / Accepted: 19 May 2026 / Published: 22 May 2026

Abstract

This study proposed a multi-class anomaly detection framework for group-housed pigs by integrating computer vision and machine learning. Nine classification algorithms were trained to identify five pig conditions—normal, heat stress, poor ventilation, infection, and recovery—using 10 combinations of feeding, drinking, and posture variables. The analysis revealed distinct behavioral patterns across stress conditions. Linear Discriminant Analysis (LDA) using all feeding and drinking variables achieved strong performance, with precision, recall, F1-score, and accuracy of 96.2% (95% confidence interval: 89.5–100%), 96.0% (91.5–100%), 96.0% (89.8–100%), and 96.0% (91.6–100%), respectively, and an AUC of 98.7% (88.2–95.5%). However, Random Forest and XGBoost trained on feeding and drinking variables achieved perfect classification on unseen data. With the present dataset, results indicate that feeding and drinking behaviors alone are sufficient for robust anomaly detection when paired with appropriate classifiers. Overall, this pilot study demonstrated that stressor-specific anomaly detection based on behavioral data is feasible and offers a practical, scalable approach for early stress detection, improved health and welfare monitoring, and more efficient precision livestock management. Future studies should utilize larger and more diverse datasets to further validate and strengthen the generalizability of the proposed framework.

1. Introduction

Over the past decade, research on the application of computer vision in livestock production has increased substantially, driven by its potential as a non-invasive, AI-enabled tool for automated monitoring of animal conditions [1,2,3,4]. Several technologies are available for this purpose; however, compared with wearable and Radio Frequency Identification (RFID)-based sensors, camera-based systems offer significant advantages because they can non-invasively monitor multiple animals simultaneously and capture diverse behavioral data within the same environment, provided that appropriate camera setups and image-processing algorithms are used [5,6,7,8]. These technologies have become essential components of smart farming, supporting real-time data-driven decision-making to improve productivity and enhance animal health and welfare across both livestock and crop production systems [9,10,11].
Because animal behavior is strongly linked to physiological condition and health status, behavioral monitoring has become a key strategy for the early detection of stress and disease [12,13,14,15]. In pig production, commonly monitored behaviors include postures (lying, standing, sitting) and nutritive activities (feeding and drinking), as these behaviors are strongly influenced by environmental and health-related challenges. For instance, lethargy and inappetence are often observed in pigs under heat-stress conditions [16,17] or during infectious conditions [12]. In contrast, increased sternal lying, a behavioral thermoregulatory response, has been associated with cold stress [18] and disease [19,20]. Therefore, systematic monitoring of these behaviors enables the detection of behavioral deviations indicative of stress-related conditions.
Although these behaviors were traditionally assessed through visual observation, recent advances now allow these behaviors to be reliably detected using camera systems integrated with object detection algorithms, which identify and locate objects in images or video frames [21,22]. Advanced models have achieved high performance in this domain; for example, enhanced YOLOv5 architectures have reported accuracies above 99.0% for posture detection [23], whereas Visual Geometry Group 19 (VGG19), MobileNetV2, and Xception have demonstrated strong recall in detecting feeding and drinking behaviors [24]. These improvements strengthen the reliability of behavior-based monitoring, which is vital for data interpretation and more advanced applications, such as anomaly and disease detection.
In pig production, machine learning (ML)-based anomaly detection using behavioral data has been widely explored and has produced promising results. ML provides strong classification capability because it can handle multi-dimensional data and identify new patterns more effectively than traditional statistical methods [25,26,27,28]. Using activity data collected from accelerometer-integrated ear tags, an integrated convolutional neural network (CNN) and long short-term memory (LSTM) architecture classified healthy and unhealthy pigs with an AUC of 90.1% [29]. Similarly, Kavlak et al. [30] reported an AUC of 80.0% using an eXtreme Gradient Boosting (XGB) model trained on feeding behavior data obtained from an automatic RFID system. Collectively, these findings demonstrate that behavioral metrics are reliable indicators of animals’ physiological and health conditions.
Despite these advances, most existing systems remain limited to binary classification (normal/healthy vs. unhealthy) and are unable to identify the specific stressors responsible for abnormal behavior. Maselyne et al. [31] extended this approach by proposing a three-class classification system (no problem, mild problem, and severe problem) based on feeding behavior; however, the reported sensitivity of 58.0% is suboptimal for practical or commercial deployment. Similarly, Kavlak et al. [30] reported a sensitivity of only 67.0%. These limited sensitivities likely result from overlapping behavioral patterns when heterogeneous abnormal conditions are aggregated into a single class. This suggests that abnormal behavior should not be treated as a uniform category.
We hypothesize that pigs, like other animals, exhibit distinct behavioral patterns in response to different stress conditions. Such stressor-specific behavioral signatures can be effectively captured through the integration of computer vision and ML, as camera-based systems enable the simultaneous monitoring of multiple behavioral dimensions. However, research combining computer vision and ML for multi-class, stressor-specific behavioral classification in pigs remains scarce, potentially due to limited data availability. Moreover, incorporating a large number of behavioral features can substantially increase computational demand, thereby limiting real-time implementation. Identifying the most informative combinations of behavioral variables is therefore critical to improving classification performance while maintaining computational efficiency. To address these challenges, this study proposes a computer vision–based ML framework for stressor-specific behavioral classification in pigs based on nutritive and postural behaviors.

2. Materials and Methods

2.1. Overview of the Farm and Animal Conditions

The pigs’ behavioral data at the group level were continuously collected throughout the growing period by analyzing recorded videos from two previous experiments conducted in June 2023 and July–August 2024 that involved four independent pig groups exposed to different environmental and health conditions. These experiments were approved by the Institutional Review Board and Ethics Committee of Sunchon National University, South Korea (SCNU IACUC-2023-19 and SCNU IACUC-2024-23). The pigs’ body weights ranged from 21.40 kg (minimum initial weight) to 58.80 kg (maximum final weight) in the first experiment, and from 20.10 kg (minimum initial weight) to 48.20 kg (maximum final weight) in the second experiment, with initial ages of 9 to 11 weeks. Test data were collected from a different herd of pigs raised from August to September 2024. All pigs were housed in two identical houses at the pig research farm of Sunchon National University. These houses had a climate-controlled system, automated feeders (LFS-120, IONTECH Co., Ltd., Incheon, Republic of Korea), water troughs, and weighing scales (not used for weight data collection). The flooring was fully made of plastic slats, and each pen had a floor area of 5.98 m2. Video recording was conducted using full HD IP cameras (2560 × 1920 resolution at 30 fps) with night-vision capability (PNO-A6081R, Hanwha Vision Co., Ltd., Seongnam, Republic of Korea). Pigs had ad libitum access to corn-soybean-based commercial feed and water, and continuous artificial lighting.

2.2. Proposed Stressor-Specific Pig Anomaly Detection System

The overall architecture of the proposed stressor-specific anomaly detection system based on computer vision is illustrated in Figure 1. Cameras continuously monitor pig behavior in the barn (data acquisition), and processing algorithms quantify feeding-, drinking-, and posture-related behaviors (processor). Multiple feature extraction methods then derive statistical features from the behavioral data (feature extractor). A classification algorithm subsequently uses these features to differentiate pig conditions based on behavioral patterns (anomaly detector). Upon detection of anomalous behavior, the system identifies the likely underlying cause, distinguishing among environmental stressors (e.g., heat stress and poor ventilation), infectious challenges, and post-infection recovery states. The following subsections describe the comprehensive methodology of this research.

2.3. Data Collection and Processing

2.3.1. Overview of Computer Vision Models

We used two YOLOv8 small-variant models from our previous study [32]. These models were specifically trained to detect pig postures (‘Lateral Lying’, ‘Sternal Lying’, ‘Standing’, and ‘Sitting’) and nutritive behaviors (‘Feeding’, ‘Drinking’, and ‘Not Feeding/Drinking’) within the experimental houses described in Section 2.1. The trained weights and learned parameters from the previous study were directly reused for inference in the present work without additional retraining or fine-tuning. Details of the models, including their detection performance and parameter configurations, are presented in Table 1. A sample still image of detected behaviors using the integrated models is shown in Figure 2.

2.3.2. Behavior Percentages

Inference was conducted in Python v3.11.6 using PyTorch (v2.1.0) [33] and OpenCV (v4.8.0) [34] within Visual Studio Code (VSC) v1.100.2. Videos were resized to 800 × 800 pixels, sampled at 1 frame per second, and processed with a 0.45 detection confidence threshold. Predictions were exported as CSV files containing timestamps, group IDs, and behavior counts. Hourly behavior percentages were calculated as:
P c = N c / N t o t a l   ×   100      
where P c ( % ) represents the hourly proportion of a given class, N c denotes the number of occurrences of that class within a specific hour, and N t o t a l is the total number of observations across all classes during the same hour for a given model.
Total lying behavior was derived by summing lateral lying and sternal lying occurrences.

2.3.3. Feeding/Drinking Duration, Interval, and Frequency

Pigs detected as ‘Feeding’ or ‘Drinking’ by the computer-vision system did not necessarily consume feed or water, as some observations represented non-nutritive or brief exploratory visits. Therefore, a custom Python script applied a threshold-based algorithm to identify feeding and drinking bouts from processed 1-second-resolution datasets. A bout was considered to have started when ‘Feeding’ or ‘Drinking’ was detected for ≥10 and ≥4 consecutive seconds, respectively. A bout ended when no corresponding behavior was observed for ≥10 consecutive seconds for ‘Feeding’ and ≥4 consecutive seconds for ‘Drinking’. These thresholds were established during the initial investigation through manual observation and analysis of the collected behavioral data and video recordings. For RFID-integrated feeding systems, Maselyne et al. [35] also identified the 10 s criterion as optimal for recording feeding bouts.
For each detected bout, start and stop times were recorded, and bout duration was computed as the difference between these timestamps. Inter-bout intervals were calculated as the time between the end of the previous bout and the start of the next bout. Bout frequency was obtained by summing the number of bouts that met predefined feeding/drinking criteria. Outputs included duration (seconds and minutes), interval (seconds and minutes), and total frequency per activity on an hourly basis.
The proposed threshold-based approach was intended as an exploratory method for extracting group-level nutritive behavioral patterns from computer vision outputs rather than for precise quantification of individual feed or water intake. Therefore, future studies should incorporate formal validation procedures, inter-rater reliability assessment, sensitivity analysis, and sensor- or RFID-based ground-truth measurements to further optimize and validate the proposed thresholds.

2.3.4. Feeding Classes

To characterize feeding intensity, each identified feeding bout was further classified according to the number of pigs detected feeding per second within the bout window. Feeding activity was categorized into three mutually exclusive classes: Individual, when only one pig was feeding; Few, when more than two pigs but fewer than 50% of the herd were feeding; and Group, when at least 50% of the pigs were feeding simultaneously. This classification framework is based on the premise that healthy herds tend to exhibit synchronous group feeding, whereas compromised or sick pigs are more likely to feed alone or in small numbers. Drinking was not categorized because the drinking trough area was too small to accommodate all the pigs.
The frequency of each feeding class was determined by counting the total seconds during which the class occurred within each feeding bout; the proportion of each class relative to the total feeding duration was then calculated. These feeding-intensity metrics were incorporated into hourly summaries of feeding and drinking bouts. However, because these class boundaries were established as exploratory behavioral indicators, future studies should validate and optimize the thresholds under different stocking densities, group sizes, and commercial production conditions.

2.4. Classification Model Development

2.4.1. Dataset Construction

Behavioral data from two prior experiments were used to develop the training and validation datasets (Table 2). Each observation was classified into five categories based on environmental and health status: Normal (N), Heat Stress (HS), Heat Stress + Poor Ventilation (HSPV), Heat Stress + Infection (HSI), and Heat Stress + Recovery (HSR). In Study 1, N data were obtained from the Control group under optimal housing, whereas HSPV data originated from the Treatment group exposed to high temperature and elevated NH3 and CO2 because of inadequate ventilation and the absence of air conditioning. In Study 2, both groups experienced heat stress caused by air-conditioning failure, but gas concentrations were lower than in Study 1. The HS class included Control pigs and the first 9 days of the Treatment group. Treatment pigs were challenged with Salmonella typhimurium after a 7-day adaptation period, but the HSI class included only periods when diarrhea and a significant increase in ear-base temperature were recorded. An antibiotic against S. typhimurium was administered by submuscular injection to each pig 7 days post-inoculation. Data collected after antibiotic treatment, when clinical improvement was observed, were categorized as HSR. Clinical parameters improved one day after treatment.

2.4.2. Feature Models

Using an insufficient number of behavioral features may limit the model’s ability to accurately classify conditions, whereas incorporating too many features can increase computational cost without necessarily improving performance. To balance these considerations, ten feature models (FMs) with different combinations of primary behavioral variables were constructed. This approach allowed identification of the most informative feature set for accurately distinguishing pigs’ conditions. The feature models are summarized in Table 3.

2.4.3. Feature Extraction

To quantify temporal behavioral patterns across pig classes, a comprehensive feature engineering framework was applied to the behavioral time-series dataset. This procedure was performed independently for each feature model. We developed a custom Python script to calculate the daily mean and standard deviation of each behavioral variable within each group. To obtain finer temporal granularity, we computed additional aggregated metrics by averaging behaviors over 6 h and 12 h segments and integrated these interval-based summaries into the daily feature matrix.
We further characterized short-term behavioral fluctuations and trend evolution using rolling-window statistics spanning 2-, 3-, and 4-day periods, incorporating the current day and the preceding 1 to 3 days. For each window, the derived features included moving averages, moving standard deviations, standardized scores (Z-scores; Equation (2)), lag-difference features capturing day-to-day changes up to three days prior (Equation (3)), and temporal trend coefficients estimated via linear regression within each window (Equation (4)). Collectively, these rolling descriptors supported the identification of progressive behavioral shifts and early-stage anomalies.
Z s c o r e B , g , d ( w ) = B g , d μ B , g , d ( w ) σ B , g , d ( w )
where w   denotes the window length (2-, 3-, or 4-day), B g , d   represents the observed value of behavior B for group g   on day d , and μ B , g , d ( w )   and σ B , g , d ( w ) correspond to the rolling mean and rolling standard deviation over the specified window, respectively.
B , g , d ( k ) = B g , d B g , d k
where k   indicates the lag interval (1, 2, or 3), and B g , d k   is the behavioral value recorded k days prior.
S l o p e B , g , d ( w ) = w i = 0 w i B i i = 0 w i i = 0 w B i w i = 0 w i 2 i = 0 w i 2
where i   denotes the relative time index within the window and B i   represents the behavioral measurement at position i .
To reduce dimensionality and extract behavioral patterns, hourly observations for each feature model were reshaped into a wide-format matrix (behavior variables × 24 h). After z-score normalization, principal component analysis (PCA) was applied, and the first three components (BehaviorPCA_PC1, PC2, PC3) were retained as meta-features for the daily dataset. The top 10 features with the highest positive and negative loadings for these components are listed in Supplementary Table S1. The final CSV dataset included daily, interval-based, rolling, delta, and PCA features for training. The test dataset was processed similarly. The FMs differed in the number of features included, with FM-10 consisting of all extracted behavioral features, for a total of 394 variables (Table 3).

2.4.4. Model Training

Model training was conducted separately for each of the ten feature models. All input variables were standardized using z-score normalization to ensure comparable scaling and prevent bias in algorithms sensitive to feature magnitude. Nine supervised multi-class classification algorithms were evaluated: Logistic Regression (LR), Decision Tree (DT), Random Forest (RF), Extreme Gradient Boosting (XGB), k-Nearest Neighbors (k-NN), Naïve Bayes (NB), Support Vector Machine (SVM) with an RBF kernel, Linear Discriminant Analysis (LDA), and Quadratic Discriminant Analysis (QDA). All models were implemented in Python using scikit-learn (v1.7.1) [36] and XGBoost (v3.0.3) [37] and executed in VSC. Each classifier used the default hyperparameter settings provided by the respective library.
Model evaluation followed a 10-fold stratified cross-validation scheme. The dataset was partitioned into ten equally sized folds, with nine folds used for training and one for validation in each iteration. Stratification ensured that class proportions were preserved across folds. Performance was assessed using accuracy (Equation (5)), precision (Equation (6)), recall (Equation (7)), F1-score (Equation (8)), and area under the ROC (receiver operating characteristic) curve (AUC). Predictions from all folds were pooled to generate overall performance metrics, and 95% confidence intervals (CI) were also calculated for all evaluation metrics. Confusion matrices were also generated and saved for each classifier model.
A c c u r a c y = T P + T N / T P + T N + F P + F N
P r e c i s i o n = T P / T P + F P
R e c a l l = T P / T P + F N
F 1 s c o r e = 2     P r e c i s i o n     R e c a l l / P r e c i s i o n + R e c a l l
where TP (true positives) represents the number of samples correctly predicted, TN (true negatives) represents the number of samples accurately identified as negative, FP (false positives) refers to samples incorrectly predicted as positive, and FN (false negatives) indicates samples incorrectly classified as negative.
To interpret model outputs, SHapley Additive exPlanations (SHAP) analysis was performed for each feature model using the XGB classifier. SHAP values quantified the contribution of each feature to class-specific prediction probabilities. Feature importance rankings were derived from mean absolute SHAP values, and the top five predictors for each class were identified and visualized using SHAP summary plots.

2.4.5. Evaluation of Best Models

Classification models with ≥90% accuracy, along with their corresponding best feature models, were saved and subsequently applied to the independent test dataset for anomaly detection. The test dataset included 28 days of behavioral observations from a separate herd of pigs that experienced a documented heat stress event (mean daily temperatures ranged from 29.25 to 30.18 °C) caused by air-conditioning unit failure during Days 15 to 19 of the growing period. Other stress-condition classes were not included because of data availability limitations.

2.5. Computational Environment

This experiment was conducted on a desktop computer running Windows 10 Education 22H2, featuring an Intel(R) Core(TM) i5-9400F CPU @ 2.90 GHz, 8 GB of RAM, and an NVIDIA GeForce GTX 1050 Ti GPU with 4 GB VRAM. Model training and evaluation used Python 3.11.6 in VSC 1.100.2. The scikit-learn (v1.7.1) library was used to develop the ML models. The XGBoost classifier was built using XGBoost v3.0.2 [37], integrated with scikit-learn for cross-validation, and used with SHAP v0.48.0 [38] to analyze feature importance.

2.6. Exploratory Data Analysis

The differences between the classes were evaluated to determine significant behavioral variations between conditions. The daily behavioral data were first tested for normality using the Shapiro–Wilk test and for homogeneity of variance with Levene’s test. Variables that were significant (p < 0.05) in either of these tests were analyzed using the Kruskal–Wallis H test; otherwise, Analysis of Variance (ANOVA) was used. Tukey’s honest significant test was performed for post hoc analysis to determine differences between classes. All tests were conducted in SPSS (v20).
Beyond conventional statistical comparisons, principal component analysis (PCA) was applied to examine and visualize the multivariate structure of behavioral traits across different classes. Two PCA plots were generated: one based on nutritive behavior variables and the other based on posture behavior variables. Before PCA, all behavioral variables were standardized using z-score transformation to ensure comparable scaling among features. The analysis was limited to behavioral indicators collected during defined observation windows, focusing specifically on selected core variables. PCA was implemented in Python using the scikit-learn package within Visual Studio Code, and the first two principal components were retained according to their cumulative explained variance. The projected component scores were presented through a two-dimensional biplot. To facilitate interpretation, loading vectors were superimposed to represent the relative contribution and orientation of selected behavioral variables with respect to the principal component axes. Graphical outputs were generated using the matplotlib (v3.10.5) [39] and seaborn (v0.13.2) [40] libraries.

3. Results

3.1. Behavioral Differences Between Classes

All feeding, drinking, and postural behavior variables differed significantly among classes (p ≤ 0.012), as shown in Table 4. Feeding frequency increased under heat stress alone (HS) and during recovery (HSR), while feeding intervals were longest under heat stress combined with poor ventilation (HSPV) or infection (HSI). Feeding duration was highest under normal conditions (N) and decreased under stress conditions. Individual feeding was predominant in HS, HSI, and HSR, whereas group feeding declined markedly. Drinking frequency increased progressively across stress conditions, with the highest values (34.82) observed in HSR. The relative feeding activity was highest under normal conditions and significantly decreased under all stress conditions. In contrast, relative drinking activity was higher than feeding activity under heat stress alone and during recovery. Postural behavior was also affected, with increased total lying in HSPV and HSI compared with normal and other stress conditions. However, these classes were characterized by different lying postures, with high lateral lying in HSPV and high sternal lying in HSI. Notably, the proportion of sternal lying was similar in normal conditions and during S. typhimurium infection. The proportion of standing and sitting behaviors increased during recovery. Furthermore, these behavioral differences were reflected in the PCA plots, where classes formed distinct clusters that accounted for 74.99% and 79.85% of the total variance based on nutritive behavior variables (Figure 3a) and posture behavior variables (Figure 3b), respectively. Notably, increased dispersion of data points was evident in HSI and HSR.

3.2. Machine Learning Models with Various Combinations of Behavioral Variables

A total of 17 behavioral variables were extracted, comprising 12 feeding- and drinking-related variables and 5 posture-related variables. Ten feature models (FMs), each representing different combinations of these variables, were constructed and used to train the nine classification models.
Table 5 summarizes the classification accuracy of the ML models across different feature models (see Supplementary Tables S2 and S3 for the full performance metrics, including 95% confidence interval). LR achieved its highest accuracy with FM-8 (93.3%; 95% CI = 88.7–98.4%). DT, RF, and XGB performed best with FM-3, yielding accuracies of 92.0% (86.0–98.7%), 90.7% (83.9–98.6%), and 90.7% (83.4–98.4%), respectively; RF also showed strong performance with FM-8. The k-NN model showed lower performance, with a maximum accuracy of 85.9% using FM-6 (76.2–95.9%) and FM-7 (75.8–96.0%), while SVM reached its highest accuracy (87.2%) with FM-6 (81.3–93.3%). LDA achieved the highest overall performance, attaining accuracies of 96.0% (91.9–100%) with FM-5 and 94.7% (90.0–99.6%) with FM-10. In contrast, QDA was the poorest-performing model, with a maximum accuracy of only 40.0% for FM-2 (22.1–45.7%) and FM-3 (22.4–45.4%).
On average, FM-3, FM-5, and FM-10 yielded the highest accuracies (80.7%, 80.9%, and 80.6%, respectively). A common characteristic of FM-3 and FM-5, which was absent in most other feature models, was the inclusion of feeding class variables (Feeding Individual (%), Feeding Few (%), and Feeding Group (%)), underscoring their importance for classification. Although FM-10 incorporated all 17 behavioral variables, it did not produce the best-performing models and did not consistently improve classification performance.

3.3. Classification Performance of the Best Model

Table 6 presents the full class-wise performance metrics of the LDA model with FM-5, and Figure 4 illustrates the corresponding confusion matrix. Supplementary Table S4 presents the performance metrics across the five classes of all models with ≥90% accuracy, with their corresponding best feature models. The LDA FM-5 demonstrated excellent overall performance, with an average precision, recall, F1-score, accuracy, and AUC values of 96.2% (89.5–100%), 96.0% (91.5–100%), 96.0% (89.8–100%), and 98.7% (88.2–95.5%), respectively. Perfect classification was achieved for the N and HSR classes, with precision, recall, and F1-scores of 100.0%. The Heat Stress class was also well classified, with balanced precision (95.7%) and recall (91.7%), yielding an F1-score of 93.6%. The model’s predictions for the HSPV class achieved perfect recall (100.0%) and a precision of 90.9%, resulting in an F1-score of 95.2%. Slightly lower recall was observed for the Heat Stress + Infection class (85.7%), despite perfect precision (100.0%). Similar trends were also observed with other models, indicating occasional misclassification of this condition as other classes. However, misclassifications were limited and occurred primarily between physiologically related stress conditions.
The SHAP plots in Figure 5 provide detailed insights into the top five features that strongly differentiate the five classes and illustrate their positive and negative contributions to model predictions. Positive SHAP values indicate that a feature increases the likelihood of a class prediction, whereas negative SHAP values indicate a decreasing contribution. For example, as shown in Figure 5a, the N class was primarily characterized by a low mean drinking frequency over 3 days, indicating that lower drinking frequency positively contributed to the prediction of the N class, which is consistent with the group comparison analysis (Table 4). The HS alone class (Figure 5b) was mainly associated with increased morning activity (6:00–11:00), high individual feeding activity (Feeding Individual_mean_2d), and low and consistent few feeding activity (low Feeding Few_mean_2d, _4d, and _std). In contrast, high group feeding and early-morning shifts in feeding and drinking activities were strongly associated with the HSPV class (Figure 5c). High values of Feeding Group_mean_3d at early morning (0:00–5:00) and BehaviorPCA_PC3, reflecting increased early (0:00–2:00) drinking frequency and duration (Supplementary Table S1), strongly increased the probability of this class. Additionally, elevated and persistent inactivity (high Not Feeding/Drinking_mean_4d and low Not Feeding/Drinking_std) further contributed to the classification, indicating chronic behavioral suppression under poor ventilation. Moreover, HSI was characterized by high variability in feeding duration (Feeding Duration_std_3d) and inactivity (Not Feeding/Drinking_std_4d), reduced feeding and drinking activity during the late-night hours (20:00–23:00) (BehaviorPCA_PC2), and low afternoon activity (Not Feeding/Drinking_6h_12:00–17:00). A decreasing or stagnant trend in individual feeding over 4 days (Feeding Individual_slope_4d) further distinguished this class (Figure 5d). Finally, the HSR class was characterized by high feeding (Feeding Few_mean_3d, Feeding Individual, and Feeding Frequency_6h_0:00–5:00) and drinking activities (Drinking Frequency_12h_00–11 and _mean_4d), as shown in Figure 5e, suggesting compensatory feed intake during recovery.
For LDA FM-10, incorporating posture variables did not improve classification performance; however, it yielded meaningful and interpretable behavioral responses across condition classes (Figure 6). For instance, consistently high total lying, up to a 4-day window, was positively associated with HSPV. In contrast, high lateral lying between 12:00 and 17:00, unstable total lying, and 4-day lateral lying were indicators of HSI. Additionally, high variability in sternal lying within 4 days and low lateral lying in the early morning (0:00–5:00) strongly increased the probability of the HSR class.

3.4. Anomaly Detection in Unseen Data

The seven best-performing models with at least 90% accuracy were tested to detect anomalies in unseen data. The unseen data had documented heat-stress periods on days 15–19. The LDA FM-5, with 96.0% accuracy on the validation set, correctly predicted 4 out of 5 anomalies but misclassified 4 normal days (Figure 7). This resulted in precision, recall, F1-score, and accuracy of 95.0%, 82.6%, 88.4%, and 82.1%, respectively (Table 7). Models using FM-3 generally outperformed LDA FM-5. DT FM-3 achieved perfect classification of normal and abnormal days; however, all HS instances were misclassified as HSI, indicating poor robustness and generalization on unseen data. In contrast, RF FM-3 and XGB FM-3 accurately classified all normal and abnormal days and correctly identified all HS events. NB FM-7 and LR FM-8 exhibited the poorest performance, correctly predicting only 1 and 3 days, respectively, across the 28-day unseen dataset.
Table 7. Prediction performance (%) of the top 7 best models on unseen data.
Table 7. Prediction performance (%) of the top 7 best models on unseen data.
LR FM-8DT FM-3RF FM-3RF FM-8XGB FM-3NB FM-7LDA FM-5
Precision 1100.0100.0100.0100.0100.0 95.0
Recall 113.0100.0100.095.7100.0 82.6
F1-score 123.1100.0100.097.8100.0 88.4
Accuracy 128.6100.0100.096.4100.017.982.1
Accuracy 2 100.020.0100.020.080.0
1 Metrics for classifying Normal and Abnormal classes. 2 Accuracy for the heat stress periods (days 15 to 19) only. LR = Logistic Regression; DT = Decision Tree; RF = Random Forest; XGB = Extreme Gradient Boosting; NB = Naïve Bayes; LDA = Linear Discriminant Analysis; FM = feature model.
Figure 5. SHAP plots of each class using the Linear Discriminant Analysis model with FM-5. (a) Normal; (b) Heat Stress; (c) Heat Stress + Poor Ventilation; (d) Heat Stress + Infection; (e) Heat Stress + Recovery. Each point represents a sample, with red and blue indicating high and low feature values, respectively. Positive SHAP values indicate that the feature increases the likelihood of the corresponding class prediction.
Figure 5. SHAP plots of each class using the Linear Discriminant Analysis model with FM-5. (a) Normal; (b) Heat Stress; (c) Heat Stress + Poor Ventilation; (d) Heat Stress + Infection; (e) Heat Stress + Recovery. Each point represents a sample, with red and blue indicating high and low feature values, respectively. Positive SHAP values indicate that the feature increases the likelihood of the corresponding class prediction.
Ai 07 00184 g005
Figure 6. SHAP plots of each class using the Linear Discriminant Analysis model with FM-10. (a) Normal; (b) Heat Stress; (c) Heat Stress + Poor Ventilation; (d) Heat Stress + Infection; (e) Heat Stress + Recovery. Each point represents a sample, with red and blue indicating high and low feature values, respectively. Positive SHAP values indicate that the feature increases the likelihood of the corresponding class prediction.
Figure 6. SHAP plots of each class using the Linear Discriminant Analysis model with FM-10. (a) Normal; (b) Heat Stress; (c) Heat Stress + Poor Ventilation; (d) Heat Stress + Infection; (e) Heat Stress + Recovery. Each point represents a sample, with red and blue indicating high and low feature values, respectively. Positive SHAP values indicate that the feature increases the likelihood of the corresponding class prediction.
Ai 07 00184 g006
Figure 7. Comparison of prediction results using the test data with heat stress conditions from day 15 to 19. FM = feature model; LR = Logistic Regression; DT = Decision Tree; RF = Random Forest; XGB = XGBoost; NB = Naïve Bayes; LDA = Linear Discriminant Analysis. Colors indicate classes: white for Normal; red for Heat Stress; green for Heat Stress + Poor Ventilation; purple for Heat Stress + Infection.
Figure 7. Comparison of prediction results using the test data with heat stress conditions from day 15 to 19. FM = feature model; LR = Logistic Regression; DT = Decision Tree; RF = Random Forest; XGB = XGBoost; NB = Naïve Bayes; LDA = Linear Discriminant Analysis. Colors indicate classes: white for Normal; red for Heat Stress; green for Heat Stress + Poor Ventilation; purple for Heat Stress + Infection.
Ai 07 00184 g007

4. Discussion

The present study proposed a multi-class anomaly detection framework in group-housed growing pigs by integrating computer vision-based behavior monitoring and ML techniques. Despite the limited size of the training data, the nine classification algorithms were able to distinguish multiple stress- and health-related conditions in pigs based on patterns in feeding, drinking, and posture, with LDA achieving precision, recall, F1-score, accuracy, and AUC values of up to 96.2%, 96.0%, 96.0%, 96.0%, and 98.7%, respectively. Additionally, RF and XGB, using optimal behavioral features (FM-3), correctly identified all normal and abnormal data points in the unseen data. These findings highlight the sensitivity of behavior as an early and integrative indicator of pig health and welfare and underscore the potential of behavior-based multi-class anomaly detection for precision livestock health management.
Furthermore, the present study confirmed that pigs display distinct responses under stress conditions, and these behavioral differences across different condition classes were consistent with many previous studies using manual observation. Heat stress is known to cause notable behavioral changes in pigs, including reduced feeding activity [16,41,42], increased water intake [43,44], and lateral lying [45,46,47] as responses that help maintain thermal balance. Shifting feeding activity toward cooler periods is one of the compensatory responses under heat-stress conditions [16,45], which aligns with the present findings, in which high nutritive activity from 6:00 to 11:00 was a strong predictor of HS, and high feeding activity from 0:00 to 5:00 was a strong predictor of HSPV (Figure 5). These findings suggest that changes in the timing and intensity of feeding behavior may serve as practical behavioral signatures for differentiating environmental stress conditions. Additionally, the observed prolonged periods of low nutritive activity in HSPV may be due to the synergistic interaction of heat stress and poor ventilation, particularly when accompanied by elevated concentrations of noxious gases such as ammonia, which are known to further suppress appetite and activity [48]. Pigs infected with S. typhimurium under heat stress conditions exhibited high variability in both nutritive activities and posture-related behaviors. This behavioral variability may be attributed to the infection stages [49], as inappetence and lethargy are typically evident during the acute phase of infection [12]. Moreover, individual variation in immune competence, genetic background, and prior exposure history likely contributed to differences in the behavioral expression of infection [50,51,52]. Increased feeding and drinking activities, particularly high few- and individual-feeding activity, were strongly associated with the post-infection recovery condition (HSR). These behavioral changes likely represent compensatory feeding responses, whereby pigs increase feed intake more than their target intake after treatment [53] or after conditions normalize [54].
One of the key findings of this study was the strong classification performance achieved using feeding- and drinking-related behavioral variables, with the LDA model demonstrating the highest overall performance. These findings indicate that nutritive behavioral features provided sufficient discriminatory power to differentiate among the multiple stress and health conditions investigated, and suggest that simplified commercial implementations could prioritize nutritive behavior monitoring to reduce computational costs. Feeding and drinking behaviors are strongly influenced by environmental stress and disease [17,48,55,56,57]. Previous studies have similarly reported successful classification of healthy and unhealthy pigs using individual feeding behavior collected through an RFID-integrated feeding system. Maselyne et al. [31] achieved an accuracy of 96.7% when classifying pigs’ conditions into three categories (no problem, mild problem, and severe problem); however, their reported sensitivity was only 58.0%, potentially leading to a high rate of false alerts. In contrast, Kavlak et al. [30] reported lower overall performance, with an AUC of 80.0%, F1-score of 7.0%, sensitivity of 67.0%, specificity of 73.0%, and precision of 4.0%. However, direct comparisons among studies should be interpreted cautiously due to substantial differences in dataset size, class definitions, behavioral features, monitoring systems, pig populations, and experimental conditions. In particular, previous studies commonly grouped diverse conditions, such as lameness, skin damage, coughing, tail infection, and slow growth, into a single ‘unhealthy’ class, whereas the present study evaluated multiple condition-specific classes. These methodological differences likely contributed to variations in classification performance across studies. Notably, the inclusion of feeding classes in the feature set (FM-3, FM-5, and FM-10) significantly improved classification performance across models (Table 5).
Although posture-related variables did not consistently improve classification accuracy, their inclusion enhanced the biological interpretability of behavioral responses, which is particularly valuable for research and comprehensive welfare assessment. The findings suggest that these variables may be omitted in practical anomaly detection applications; however, further validation across different pig conditions and diverse commercial settings is still required. Changes in lying, standing, and overall activity provide context to nutritive behavior alterations and reflect adaptive strategies employed by pigs under stress [58]. A similar study that integrated computer vision to track individual pigs and detect sick pigs based on their feeding and posture achieved up to 93.0% accuracy [59]. Moreover, they found that sick pigs spent more time lying during the feeding periods, which aligns with the present findings, as shown in Figure 6d. The limited impact of posture variables on predictive performance in the present study may be attributed to the posture variables employed, which were restricted to posture proportions. Additional data, including time spent in each posture and time spent transitioning between postures, may provide greater discriminative power and may be informative for other health and welfare conditions. Furthermore, future studies integrating combined behavioral states, such as ‘Standing Feeding’ or ‘Sternal Lying Drinking,’ rather than evaluating posture and nutritive behaviors separately, may further improve discriminative performance and behavioral interpretation.
Most existing behavior-based anomaly detection studies have focused on binary classification, typically distinguishing between healthy and unhealthy animals [30,59,60,61]. In contrast, the present study demonstrates the feasibility of multi-class classification, enabling differentiation between multiple stressors and recovery states. However, the findings also highlight the importance of developing a more balanced dataset, as minority classes generally exhibited lower detection performance than majority classes. Nevertheless, the relatively limited sample size may have increased the risk of overfitting and reduced model generalizability. The unseen dataset was collected from a different group of pigs under different stocking densities, which likely introduced additional behavioral variability. Therefore, future models should use larger and more diverse datasets from commercial environments. Furthermore, although LDA, DT, RF, and XGB showed strong performance under the present dataset conditions, their relative performance may vary when trained on larger and more diverse datasets. Therefore, the objective of the present study was not to identify a universally superior model, but rather to demonstrate the importance of model selection in developing robust and reliable multi-class anomaly detection systems for pig health and welfare monitoring.
The multi-class anomaly detection is highly relevant for livestock health management, as different conditions require distinct interventions, such as environmental adjustments to mitigate heat stress or targeted treatments for disease. Furthermore, most previously proposed anomaly detection frameworks have not explicitly categorized disease stages [62,63]. Distinguishing between stages of disease or infection can facilitate the learning of more meaningful and condition-specific behavioral patterns [49], as evidenced by the clear differentiation observed between HSI and HSR in the present study. Importantly, incorporating recovery states into the detection framework may provide valuable indicators of treatment effectiveness and support more informed and timely health management decisions.

5. Study Limitations and Recommendations

The present study has several limitations that should be considered when interpreting the findings. First, the training dataset was relatively limited in size, with a small number of pig groups and a short data collection period restricted to the growing stage.
Second, there was an environmental bias between normal and abnormal conditions, which may have influenced model performance and generalizability. The infection- and poor-ventilation-related classes were evaluated only under concurrent heat stress conditions, as these were the only available experimental scenarios from previous datasets. However, in real commercial pig production systems, infection and poor ventilation can occur independently without heat stress. Therefore, the ability of the proposed framework to detect these conditions in the absence of heat stress was not assessed and remains to be validated in future studies.
Third, although several ML models achieved near-perfect classification performance under controlled experimental conditions, their robustness in commercial farming environments is still uncertain. Practical farm conditions often involve variations in pen design, stocking density, camera positioning, lighting conditions, and management practices, all of which may affect model performance.
Furthermore, the independent test dataset used for unseen-data evaluation primarily consisted of heat stress events caused by air-conditioning failure. As a result, although the framework was designed for multi-class, stressor-specific anomaly detection, its effectiveness in identifying unseen infection- and poor-ventilation-related conditions has not yet been fully validated.
To address these limitations, future studies should expand the dataset to include a broader range of health and environmental conditions under diverse commercial farm settings. Such expansion will improve model robustness and enhance its practical applicability in real-world production systems. Additionally, when data availability is limited, grouping stress conditions based on physiological or environmental similarities—such as digestive and respiratory infections, heat stress, and exposure to noxious gases—may provide a practical strategy for implementing multi-class anomaly detection in commercial pig production. Finally, future work should establish a standardized, publicly accessible database to accelerate the development, benchmarking, and broader adoption of computer vision–based multi-class anomaly detection systems in livestock farming.

6. Conclusions

This study demonstrated a multi-class anomaly detection framework for group-housed pigs by integrating computer vision–based behavioral monitoring with machine learning classification. Distinct and condition-specific changes in feeding, drinking, and posture behaviors were observed across normal, heat stress–related, infection, and recovery states. Models trained exclusively on feeding and drinking behavior variables achieved robust, high classification performance, demonstrating that nutritive behaviors alone are sufficient for reliable anomaly detection when paired with an appropriate classification algorithm. Although posture-related variables did not consistently improve predictive accuracy, they enhanced behavioral interpretability by providing insights into pigs’ adaptive and recovery responses under stress. Further refinement and validation under commercial farm conditions are required to improve system robustness and generalizability. Nevertheless, the proposed framework represents a practical, scalable, and non-invasive approach for precision livestock farming, with strong potential to support early stress detection, improve animal welfare, and enhance management efficiency in pig production systems.

Supplementary Materials

The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/ai7060184/s1, Table S1: Top 10 features with the highest positive and negative loadings for the top 3 principal components (PCs); Table S2: Classification performance of different machine learning models with different feature models; Table S3: 95% confidence intervals of the classification performance of different machine learning algorithms across feature models; Table S4: Classification performance of the best machine learning models.

Author Contributions

Conceptualization: E.B.L., H.-S.M. and C.-J.Y.; Data curation: E.B.L.; Formal analysis: E.B.L., H.-S.M., M.S., M.K.H., A.M., J.-G.K., H.-R.P. and Y.-H.K.; Investigation: E.B.L., H.-S.M., M.S., M.K.H., A.M., J.-G.K., H.-R.P. and Y.-H.K.; Methodology: E.B.L., H.-S.M., M.S., M.K.H., A.M., J.-G.K., Y.-H.K., H.-R.P. and C.-J.Y.; Software: E.B.L.; Validation: E.B.L., H.-S.M., M.S., M.K.H., A.M., J.-G.K., H.-R.P., Y.-H.K. and C.-J.Y.; Visualization: E.B.L. and H.-S.M.; Resources and Supervision: C.-J.Y. and H.-S.M.; Writing—original draft: E.B.L.; Writing—review and editing: E.B.L., H.-S.M., M.S., M.K.H., A.M., J.-G.K., H.-R.P., Y.-H.K. and C.-J.Y. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

The animal study protocols were conducted in accordance with local and institutional guidelines and were approved by the Institutional Animal Care and Use Committee (IACUC) of Sunchon National University, Republic of Korea (Approval Nos. SCNU IACUC-2023-19 (Date: 29 August 2023) and SCNU IACUC-2024-23 (Date: 15 November 2024).

Informed Consent Statement

Not applicable.

Data Availability Statement

Data will be made available on request.

Acknowledgments

This work was supported by Korea Institute of Planning and Evaluation for Technology in Food, Agriculture and Forestry (IPET) and Korea Smart Farm R&D Foundation through Smart Farm Innovation Technology Development Program, funded by Ministry of Agriculture, Food and Rural Affairs (MAFRA) and Ministry of Science and ICT (MSIT) and Rural Development Administration (RDA) (RS-2025-02216184, RS-2021-IP421023).

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
AUCArea Under the ROC Curve
CNNConvolutional Neural Network
DTDecision Tree
FMFeature Model
FNFalse negative
FPFalse positive
HSHeat Stress
HSIHeat Stress with Infection
HSPVHeat Stress with Poor Ventilation
HSRHeat Stress with Recovery
k-NNk-Nearest Neighbors
LDALinear Discriminant Analysis
LRLinear Regression
LSTMLong Short-Term Memory
MLMachine Learning
NNormal
NBNaïve Bayes
PCAPrincipal Component Analysis
QDAQuadratic Discriminant Analysis
RFRandom Forest
RFIDRadio Frequency Identification
ROCReceiver Operating Characteristic
SHAPSHapley Additive exPlanations
SVMSupport Vector Machine
TNTrue negative
TPTrue positive
VGG19Visual Geometry Group 19
VSCVisual Studio Code
XGBeXtreme Gradient Boosting
YOLOYou Only Look Once

References

  1. 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]
  2. 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]
  3. 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]
  4. 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]
  5. 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]
  6. 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]
  7. 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]
  8. 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]
  9. 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]
  10. 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]
  11. 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]
  12. 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]
  13. 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]
  14. 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]
  15. 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]
  16. 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]
  17. 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]
  18. 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]
  19. 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]
  20. 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]
  21. 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]
  22. 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]
  23. 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]
  24. 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]
  25. 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]
  26. 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]
  27. 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]
  28. 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]
  29. 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]
  30. 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]
  31. 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]
  32. 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]
  33. 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]
  34. 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]
  35. 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]
  36. 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).
  37. 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]
  38. 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]
  39. Hunter, J.D. Matplotlib: A 2D Graphics Environment. Comput. Sci. Eng. 2007, 9, 90–95. [Google Scholar] [CrossRef]
  40. Waskom, M.L. Seaborn: Statistical Data Visualization. J. Open Source Softw. 2021, 6, 3021. [Google Scholar] [CrossRef]
  41. 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]
  42. 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]
  43. 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]
  44. 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]
  45. 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]
  46. 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]
  47. 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]
  48. 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]
  49. 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]
  50. 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]
  51. 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]
  52. 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]
  53. 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]
  54. 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]
  55. 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]
  56. 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]
  57. 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]
  58. 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]
  59. 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]
  60. 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]
  61. 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]
  62. 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]
  63. 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]
Figure 1. Overall structure of the proposed computer vision-based stressor-specific anomaly detection system in growing pigs.
Figure 1. Overall structure of the proposed computer vision-based stressor-specific anomaly detection system in growing pigs.
Ai 07 00184 g001
Figure 2. Detection of pigs’ nutritive and postural behaviors using two pretrained YOLOv8 models. The feeding system (LFS-120, IONTECH Co., Ltd., Incheon, Republic of Korea) is labeled as 1, and the water trough as 2.
Figure 2. Detection of pigs’ nutritive and postural behaviors using two pretrained YOLOv8 models. The feeding system (LFS-120, IONTECH Co., Ltd., Incheon, Republic of Korea) is labeled as 1, and the water trough as 2.
Ai 07 00184 g002
Figure 3. Principal component analysis of the pig behaviors in different conditions: (a) based on nutritive behavior variables and (b) based on postural behavior variables. N = Normal; HS = Heat Stress; HSPV = Heat Stress + Poor Ventilation; HSI = Heat Stress + Infection; HSR = Heat Stress + Recovery.
Figure 3. Principal component analysis of the pig behaviors in different conditions: (a) based on nutritive behavior variables and (b) based on postural behavior variables. N = Normal; HS = Heat Stress; HSPV = Heat Stress + Poor Ventilation; HSI = Heat Stress + Infection; HSR = Heat Stress + Recovery.
Ai 07 00184 g003
Figure 4. Confusion metrics of the Linear Discriminant Analysis model with FM-5. Numerical values represent the number of predictions assigned to each class, where diagonal values indicate correctly classified samples and off-diagonal values indicate misclassified samples. N = Normal; HS = Heat Stress; HSPV = Heat Stress + Poor Ventilation; HSI = Heat Stress + Infection; HSR = Heat Stress + Recovery.
Figure 4. Confusion metrics of the Linear Discriminant Analysis model with FM-5. Numerical values represent the number of predictions assigned to each class, where diagonal values indicate correctly classified samples and off-diagonal values indicate misclassified samples. N = Normal; HS = Heat Stress; HSPV = Heat Stress + Poor Ventilation; HSI = Heat Stress + Infection; HSR = Heat Stress + Recovery.
Ai 07 00184 g004
Table 1. Details and performance of the pretrained YOLOv8s models, including total processing speed, parameter count (PARAM), and model size.
Table 1. Details and performance of the pretrained YOLOv8s models, including total processing speed, parameter count (PARAM), and model size.
Models (Classes) Detection MetricsSize (MB)PARAM (M)Speed (FPS) 1
PrecisionRecallF1 ScoremAP50
Posture Detection Model 21.98011.137131.23
     Lateral Lying92.492.092.296.3
     Sternal Lying91.290.090.694.8
     Standing97.998.298.099.2
     Sitting92.090.491.294.9
     Average93.492.693.096.3
Feeding and Drinking Detection Model 21.97911.137134.05
     Feeding96.093.894.996.9
     Drinking89.490.690.095.3
     Not Feeding/Drinking96.896.796.798.5
     Average94.193.793.996.9
1 Total processing speed based on 50 iterations at a batch size of 1. FPS = frames per second.
Table 2. Data information.
Table 2. Data information.
StudyGroupsConditionsPigs per Frame (n)Duration (d)Data Classification
1ControlNormal environment1323N
TreatmentPoor environment (heat-stressed and high toxic gases) 1323HSPV
2ControlHeat-stressed822HS
TreatmentHeat-stressed (adaptation period)89HS
Bacterial challenged87HSI
Antibiotic treatment86HSR
Regular Normal environment + heat stress conditions from day 15 to 19528Test set
N = Normal; HS = Heat Stress; HSPV = Heat Stress + Poor Ventilation; HSI = Heat Stress + Infection; HSR = Heat Stress + Recovery.
Table 3. Feature models constructed from different combinations of behavioral variables.
Table 3. Feature models constructed from different combinations of behavioral variables.
ModelPrimary Behavioral VariablesTotal Extracted Features
1Feeding (%), Drinking (%), Not Feeding/Drinking (%)72
2Feeding & Drinking Duration (min), Feeding & Drinking Interval (min), Feeding & Drinking Frequency141
3Model 2 + Feeding Individual (%), Feeding Few (%), Feeding Group (%)156
4Model 1 + Model 2210
5Model 1 + Model 3279
6Lateral Lying (%), Sternal Lying (%), Total Lying (%), Standing (%), Sitting (%)118
7Model 1 + 6187
8Model 2 + 6233
9Model 1 + 2 + 6325
10Model 1 + 3 + 6394
Table 4. Comparison of behavioral variables between different scenarios.
Table 4. Comparison of behavioral variables between different scenarios.
ValuesNHSHSPVHSIHSRSEMp-Value
Feeding Frequency8.53 bc10.70 a8.15 c8.68 bc10.41 ab0.203<0.001
Feeding Interval (min)49.66 ab48.61 ab53.69 a53.50 a45.50 b0.7540.012
Feeding Duration (min)15.90 a13.12 ab11.68 b12.50 ab13.74 ab0.373<0.001
Relative Feeding Classes
Feeding Individual (%)53.88 b72.11 a57.11 b72.37 a68.24 a1.225<0.001
Feeding Few (%)31.98 a20.14 b25.55 ab25.37 ab28.43 a0.777<0.001
Feeding Group (%)14.14 a7.75 b17.33 a2.26 b3.33 b0.830<0.001
Drinking Frequency13.87 c28.35 b28.35 b25.35 b34.82 a0.849<0.001
Drinking Interval (min)57.90 a42.32 bc44.31 bc45.15 b39.43 c0.860<0.001
Drinking Duration (s)5.47 c17.15 ab16.59 ab13.27 b19.93 a0.688<0.001
Relative Nutritive Behavior
Feeding (%)6.75 a4.31 b4.64 b3.88 b4.68 b0.167<0.001
Drinking (%)0.96 c4.98 a2.97 b3.84 b5.75 a0.207<0.001
Not Feeding/Drinking (%)92.29 a90.71 b92.39 a92.28 a89.57 b0.188<0.001
Relative of Postural Behavior
Lateral Lying (%)54.55 c59.62 ab60.63 a56.98 bc56.89 bc0.389<0.001
Sternal Lying (%)30.05 a24.86 d27.35 bc29.23 ab26.23 cd0.288<0.001
Total Lying (%)84.61 bc84.48 bc87.98 a86.20 ab83.11 c0.264<0.001
Standing (%)11.69 ab11.54 ab8.73 c10.27 bc12.40 a0.237<0.001
Sitting (%)3.71 b3.98 b3.29 b3.52 b4.48 a0.066<0.001
N = Normal; HS = Heat Stress; HSPV = Heat Stress + Poor Ventilation; HSI = Heat Stress + Infection; HSR = Heat Stress + Recovery; SEM = standard error of the mean. Means with different superscripts differ significantly (p < 0.05).
Table 5. Average accuracy (%) with 95% confidence intervals (in parentheses) of different machine learning algorithms across feature models.
Table 5. Average accuracy (%) with 95% confidence intervals (in parentheses) of different machine learning algorithms across feature models.
ML AlgorithmsFeature Models
12345678910
Logistic Regression82.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 Tree73.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 Forest83.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)
XGB85.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-NN71.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 Bayes87.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)
SVM80.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)
LDA78.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)
QDA34.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)
Average75.276.980.774.280.977.380.179.680.080.6
ML = machine learning; XGB = Extreme Gradient Boosting; k-NN = k-Nearest Neighbors; SVM = Support Vector Machine; LDA = Linear Discriminant Analysis; QDA = Quadratic Discriminant Analysis.
Table 6. Classification performance (%) of the Linear Discriminant Analysis model using FM-5.
Table 6. Classification performance (%) of the Linear Discriminant Analysis model using FM-5.
ClassesPrecisionRecallF1-ScoreAccuracyAUC
Normal100.0100.0100.0
Heat Stress95.791.793.6
Heat Stress + Poor Ventilation90.9100.095.2
Heat Stress + Infection100.085.792.3
Heat Stress + Recovery100.0100.0100.0
Average96.296.096.096.098.7
95% Confidence Interval89.5–10091.5–10089.8–10091.6–10088.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.

Share and Cite

MDPI and ACS Style

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

AMA Style

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 Style

Lagua, 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 Style

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. (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

Article Metrics

Back to TopTop