1. Introduction
Artificial insemination in sow (
Sus scrofa domesticus Erxleben) reproduction systems has the potential to enhance productivity, fertility, and labor efficiency [
1]. Successful artificial insemination must be performed within 24 h of ovulation. Ovulation occurs after approximately two-thirds of the estrus period and lasts for an average of 40–60 h [
2]. Estimating the optimal ovulation and insemination timing requires first determining whether the sow is in estrus by conducting a backpressure test (BPT) or observing changes in the vulva. Sows in estrus exhibit a fixed posture during the BPT, with their hind legs and back muscles becoming rigid [
3] and their vulva becoming swollen and reddened [
4].
Determining the estrus status of sows is laborious. As continuous real-time monitoring is impossible, workers can identify estrus at specific times during their working hours. For sows identified as being in estrus, workers perform artificial insemination after a certain period based on their personal experience. However, this approach is subjective and varies according to the worker’s expertise, and makes the uniform management of large-scale farms challenging.
Therefore, precision livestock farming has attracted increasing attention. Automatic monitoring of sow activity can support data-driven decision-making, improving production efficiency [
5]. Sows exhibit distinct behavioral characteristics, such as increased activity, reduced feed intake, erected ears, and frequent visits to boars, during estrus [
6,
7]. Unlike previous sensor-based approaches that require physical attachment to animals, our vision-based system provides non-invasive, continuous monitoring capability suitable for large-scale commercial operations. To observe these behavioral traits, sensors can be attached to the sow’s body to effectively measure activity levels. However, body-attached sensors require a sufficiently long battery life and must be periodically replaced [
2,
8].
In our previous study [
9], sows were detected, and their postures were estimated using camera footage and an object detection model. The detected sow posture changes were accumulated as time series, and a recurrent neural network (RNN) was used to classify the estrus status. The ground truth was defined as the time window of 24 h preceding the worker’s estrus assessment. Despite using only postural changes, the model achieved an accuracy of 86% in estrus classification. These results are consistent with those of a previous study [
10], which reported that sows tend to stand or sit for longer durations during estrus.
However, the timing of a worker’s estrus assessment is subjective and varies depending on individual experience and skill level. Moreover, estrus detection was only conducted at specific times (08:00 and 16:00) during working hours. Consequently, estrus prediction accuracy in the previous study was evaluated using a dataset labeled according to worker assessments, introducing uncertainty regarding whether the detected state accurately reflected the sow’s actual estrus status. Furthermore, the previous model treated estrus detection as a binary classification task, thus failing to account for the diverse behavioral trajectories exhibited during estrus. This oversimplification limits the model’s ability to determine the optimal timing for artificial insemination, which requires recognizing subtle temporal patterns and individual variability in estrus behavior.
Similarly to the previous study [
9], we observe changes in sow posture using cameras and an object detection model. After constructing a time series of sow postures, the estrus status is determined, and the optimal timing for artificial insemination is predicted. However, an RNN is not used in the study. The proposed model is compared with the actual insemination timing selected by the workers, and the number of piglets born is analyzed to evaluate its effectiveness.
3. Proposed Method
The study in this manuscript only included non-invasive observation on animals through ceiling-mounted cameras. No physical contact, handling, or intervention was involved. According to Article 3 of the Korean Laboratory Animal Act, ethical approval from an IACUC is not legally required for this study. In addition, continuous video monitoring is considered minimally intrusive, as ceiling-mounted cameras do not interfere with the animals’ daily activities or cause additional stress.
Figure 1 shows the proposed method for predicting the optimal timing of artificial insemination. First, the system receives video input, detects the sows, and estimates their postures. Using the bounding box (Bbox) coordinates of the detected sows, each sow is assigned an identification (ID) based on its location. When a sow’s posture changes, both the posture and the duration for which it is maintained are stored as time series data (
). These data are sampled at fixed intervals (
t) to construct a regularly spaced time series dataset (
TSD).
A double moving average is then applied to the generated to produce the . If the most recent values in the generated () show a continuously increasing trend, the system determines that the sow is in estrus.
3.1. Data Collection and Preprocessing
We detected sows in video footage recorded by a ceiling-mounted rear-angle camera, following the approach used by [
9].
Sow postures were categorized as either not-standing or standing (
Figure 2). Objects were distinguished based on the center coordinates of the detected bounding box, and whenever a sow’s posture changed, both the posture and the duration for which it was maintained were recorded.
This event-based sequence of posture changes constituted the time series data (
), which was inherently unevenly spaced because posture transitions occurred at irregular intervals (
Figure 3). To facilitate quantitative analysis, the
was resampled at fixed 1 min intervals, thereby generating a regularly spaced time series (
).
A double moving average was applied to the
, as shown in Equation (1), to generate a new
,
.
and
represent the window sizes for the moving averages, set to 1440 and 720, respectively. These values correspond to 24 h and 12 h windows, chosen to smooth daily cyclical noise and capture the underlying multi-hour activity trends effectively.
denotes a single value in the
. By applying a double moving average, the noise was reduced, and the overall trend of the data was extracted.
3.2. Estrus Detection and Optimal Timing Prediction for Artificial Insemination
When the length of the with the applied double moving average () exceeds a certain threshold (), the average value of the most recent period is compared with the average value of the preceding period. If the recent average is higher, a binary array is generated with a value of 1; otherwise, it is set to zero. Thus, a value of 1 in the binary array indicates that activity has increased in the most recent period compared to the preceding period. If the activity continues to increase, the binary array takes the form [1, 1, 1, 1, ..., 1].
If the number of consecutive 1 s in the binary array, starting from the most recent time point, exceeds
, the sow is classified as being in estrus. For example, if the binary array is [0, 0, 1, 1, 1], the number of consecutive 1 s at the most recent time step is 3. After determining estrus, the optimal timing for artificial insemination is predicted as
hours after the estrus detection point. The values of
and
are determined based on the hypothesis discussed in
Section 3.3.
3.3. Problem Definition and Hypothesis
This study aims to identify sow estrus and predict the optimal insemination timing based on posture-derived activity trends
As shown in
Figure 4, sows tend to seek boars more frequently during estrus [
23]. The estrus period (
) lasts 40–60 h [
2].
Ovulation (
) occurs after two-thirds of the estrus period has passed [
2].
The optimal timing for artificial insemination (
) is within 24 h of ovulation (
).
Workers determine sow estrus status using the BPT and predict based on the onset of estrus (first detected time, ). To predict , we estimate the onset of estrus () by observing changes in sow posture and use it to determine .
To estimate and predict , the following hypotheses are established, and the values of and are set accordingly: 1. Sows sleep for approximately 8 h. 2. There is a warm-up period of approximately 24 h before , during which activity levels increase.
Based on this hypothesis, the activity levels were expected to increase for approximately 16.7 h, excluding sleep time. Therefore, is set to 16.7 h. If activity levels continuously increase for 16.7 h, the sow is classified as being in estrus (). The optimal timing for artificial insemination () is then predicted 20 h after , excluding the 8 h sleep period ().
If lasts 60 h, falls within the range of to . If lasts 40 h, falls within the range of to . Setting at satisfies Equations (2)–(4), as well as Hypotheses 1 and 2. Thus, is set to 1000, and is set to 28 h. Since our data is sampled at 1 min intervals, this corresponds to 960 data points. We set to 1000, slightly longer than 960, to conservatively ensure a sustained increase in activity is detected. Therefore, if activity levels continuously increase for approximately 16.7 h (1000 min), the sow is classified as being in estrus ().
While these biological principles provide a theoretical range for insemination timing, we adopted a data-driven approach to determine the final, precise values for our model’s key parameters, and . We analyzed the activity patterns from a preliminary dataset of successfully inseminated sows (those categorized in the high-similarity groups and , in our results). This empirical analysis revealed that a sustained increase in activity, lasting approximately 16–17 h, consistently preceded the optimal insemination window determined by experienced farm workers.
Based on this data-driven evidence, we set to 1000 min (~16.7 h) to conservatively capture this sustained activity. Furthermore, the analysis showed that the average time from the start of this detected activity increase to the actual insemination event was 28 h, leading us to set to 28 h. This dual approach ensures our model is not only biologically plausible but also empirically validated against the specific behavioral patterns observed on the farm, strengthening the foundation of our prediction method.
Workers determine sow estrus status using the BPT and predict insemination timing based on the first detected estrus onset (λ). In this study, λ was defined according to the farm’s routine workflow, where sows were exposed to a boar twice daily (08:00 and 16:00) for a limited duration. Our objective is to demonstrate that automated posture-based monitoring could provide insemination timing results comparable to those determined by skilled workers in real farm settings. Therefore, we assessed our model against the insemination timing determined by skilled workers using established farm practices, focusing on sows that eventually farrowed.
5. Discussion
Table 1 presents a sample dataset on tracked sows, including parity, insemination timing, and litter size.
Experimental validation demonstrated that the proposed method achieved 70% concordance with farm worker decisions, with predicted insemination timings differing by less than 24 h from actual implementation times. This level of agreement suggests practical viability for field deployment in commercial swine operations. Among the
to
groups, the total litter size was consistently 14 or more (
Table 2). The ‘Fail’ category represents cases where the prediction error exceeded the maximum defined range (
), indicating a significant deviation from the worker’s decision.
It is important to reconcile the non-significant ANOVA result (p = 0.207) with the significant negative correlation. We intentionally employed two complementary statistical approaches to evaluate the model from two different perspectives: macroscopic utility and microscopic precision. The ANOVA test assesses the model’s utility at a macroscopic level by categorizing prediction errors into broad groups, such as L1 (a window of <16.7 h). The non-significant result from this analysis suggests that, from a practical standpoint, predictions falling within these wide windows yield comparable reproductive outcomes. In contrast, the correlation analysis performs a microscopic assessment, using the precise, continuous prediction error (Δd) in minutes. The significant negative correlation revealed by this analysis (r = −0.23, p < 0.05) demonstrates that even within a ‘successful’ window, smaller errors (i.e., higher precision) are systematically associated with a higher number of live-born piglets.
Figure 7 shows the clustering results of time series activity data from 60 sows. In
Figure 7, the
x-axis represents the time axis over one week, identical to the
x-axis used in
Figure 5, with activity values smoothed using a double moving average. The
y-axis indicates the activity level of each sow, calculated from posture transitions in the same manner as the blue line in
Figure 5. Clusters 1 and 3 exhibited a pattern of sharply increasing activity at an early stage. The proportion of (L
1 + L
2) in Clusters 1 and 3 was relatively low, at 66.66% and 59.25%, respectively. Our clustering analysis of activity patterns reveals distinct estrus phenotypes among sows. Notably, the model demonstrated the high accuracy for sows in Cluster 2, which exhibited a classic rise-and-fall activity pattern consistent with established biological models of estrus (
Figure 4). This suggests that our posture-based model is particularly effective for identifying the optimal insemination window in sows with this ‘classic’ estrus behavior. For other patterns, such as the early-peaking activity in Clusters 1 and 3, the model was less precise, indicating that different behavioral phenotypes may require tailored prediction algorithms in the future. Although the clustering analysis is descriptive, it underscores that estrus behaviors vary across sows. This finding highlights the potential of our system not only to predict insemination timing but also to classify sows according to their estrus behavior profiles, thereby providing a foundation for developing phenotype-specific prediction models.
Several limitations warrant consideration in interpreting these findings. Environmental factors including dust, ammonia, and humidity periodically compromised camera visibility, potentially affecting detection accuracy. Furthermore, the relatively modest sample size (n = 60) and uneven distribution across similarity groups (~: 5, 8 and 1 sow(s), respectively) limit the statistical power for comprehensive subgroup analyses. Furthermore, as our clustering analysis revealed, the model’s prediction accuracy varied across different estrus behavior phenotypes, showing higher precision for sows with ‘classic’ activity patterns.
Furthermore, correlation analysis between the prediction error (Δd) and the number of live-born piglets, focusing on sows with
(Δd within 16 h), revealed a negative relationship in
Figure 8. This suggests that higher temporal precision in estrus prediction contributes positively to reproductive outcomes, reinforcing the practical value of our approach for field deployment.
It is important to reconcile the non-significant ANOVA result (
p = 0.207) with the clear negative correlation found between prediction error and live-born piglets (
Figure 8). The ANOVA test categorized prediction errors into broad groups (e.g.,
spans errors from 0 to 16 h), which may have masked the more subtle, continuous relationship between insemination timing accuracy and productivity. In contrast, the correlation analysis uses the precise, continuous prediction error (Δd), revealing that even within the ‘good’ prediction window (e.g., under 24 h), smaller errors are systematically associated with higher numbers of live-born piglets. This suggests that the model’s strength lies not only in identifying the general 24 h window but more importantly in pinpointing the optimal timing within that window, but more importantly, in pinpointing a more precise, optimal time within that window. Therefore, the granular correlation analysis provides stronger evidence for the practical, reproductive benefits of our system than the binned ANOVA analysis.
Although this study analyzed 60 sows, which may be considered a limited dataset, the results nevertheless suggest the potential of camera-based deep learning for non-invasive estrus detection and insemination timing prediction. The study was also conducted in a single farm under controlled conditions, which may restrict the external validity of the findings. Furthermore, only Landrace × Yorkshire F1 crossbred sows were included, which may limit the applicability of the results to other breeds. Future work should validate these findings with larger-scale and multi-farm datasets, including diverse layouts, lighting, and management practices, and also extend to multiple breeds to improve generalizability.
In addition, practical constraints such as the economic cost of deployment, limited internet connectivity, and the need for constant electricity may hinder adoption in smallholder or resource-poor farms. Behavioral variability related to sow age or body condition (e.g., gilts vs. multiparous sows) could also affect posture-based predictions, and occasional misclassification of postures may be mistaken for estrus. Addressing these issues in future research will be essential for robust and widely applicable implementation.
6. Conclusions
We proposed a method for predicting sow estrus and recommended the optimal timing for artificial insemination using camera footage and deep learning-based object detection technology. Sow posture information and posture duration, detected using camera footage and the YOLOv5 model, were stored as time series data. The stored were analyzed to observe sow activity and predict estrus.
Our experimental validation demonstrated that 70% of predictions (42/60 sows) achieved temporal concordance within 24 h of farm worker decisions, indicating substantial promise for automated estrus detection systems. Furthermore, our analysis suggests that higher temporal precision in estrus prediction contributes positively to reproductive outcomes, reinforcing the practical value of our approach. These findings underscore the potential of computer vision-based behavioral monitoring to enhance reproductive management in intensive swine production systems while reducing labor dependency.
Future work should focus on (1) expanding the dataset to include multiple breeds and seasonal variations, (2) developing adaptive algorithms that can learn individual sow behavior patterns, and (3) integrating multiple behavioral indicators beyond posture analysis for improved accuracy.