A method for predicting estrus in sows based on low-cost electronic ear tags

By collecting ear temperature data of sows using low-power electronic ear tags, and combining hourly average body temperature resampling with FOI-GA algorithm optimization of the LightGBM model, the problems of high cost of sow estrus detection and low efficiency of model hyperparameter optimization are solved, achieving efficient and low-cost estrus prediction.

CN122123809APending Publication Date: 2026-06-02JIAXING UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JIAXING UNIV
Filing Date
2026-02-03
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

The high cost and difficulty in promoting estrus detection in sows, as well as the low efficiency of hyperparameter optimization and overfitting of machine learning models when processing complex time-series data, pose challenges.

Method used

By designing an hourly average body temperature resampling strategy and a forced offspring iteration (FOI) mechanism to improve the genetic algorithm (GA), the Lightweight Gradient Boosting Machine (LightGBM) model is optimized. Data is collected using low-power electronic ear tags and a feature sample set is constructed for hyperparameter optimization.

Benefits of technology

It improves the accuracy and convergence efficiency of estrus prediction in sows, reduces detection costs, avoids stress in sows, and is suitable for real-time monitoring in large-scale farms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122123809A_ABST
    Figure CN122123809A_ABST
Patent Text Reader

Abstract

This invention relates to a method for predicting sow estrus based on low-cost electronic ear tags, belonging to the field of smart animal husbandry technology. Addressing the problems of high cost and model overfitting in automated sow estrus detection in large-scale farming, this invention uses low-power electronic ear tags worn on the sow's ear to collect ear temperature data in real time, and performs multiple calibrations to ensure data stability. Its core components include: employing an hourly average body temperature resampling strategy to construct a 48-hour regularized time-series feature sample set to enhance the model's generalization ability; constructing a classification model based on a lightweight gradient boosting machine (LightGBM); and innovatively designing a "Forced Offspring Iteration" (FOI) mechanism to improve the genetic algorithm for global optimization of model hyperparameters. This mechanism improves convergence efficiency while maintaining search capability by cutting off parental gene transmission. This invention can achieve reliable automatic identification of sow estrus using low-cost sensing data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of intelligent monitoring and information processing technology for livestock breeding, specifically involving an intelligent prediction method for sow estrus using time-series data from a low-power wearable ear temperature sensor and an improved genetic algorithm to optimize the LightGBM model. Background Technology

[0002] Determining the estrus status of sows is a binary classification problem. Traditional manual methods such as back pressure testing, boar estrus detection, and vaginal mucus examination rely heavily on subjective human experience and are labor-intensive, making them unsuitable for the efficiency and precision requirements of modern large-scale farming. Automated estrus detection, relying on real-time monitoring equipment and data analysis algorithms, can significantly improve estrus detection efficiency. Based on the type of feature data used, sow estrus identification methods are mainly divided into two categories: those based on physiological characteristics and those based on behavioral characteristics. Among various physiological characteristics, body temperature accurately reflects a sow's health and physiological state and has been widely used in disease detection and estrus prediction. For example, some researchers have found that rectal temperature rises during estrus, reaching its highest point at mating. Additionally, some researchers have found that vaginal temperature in sows reaches its lowest point two days before estrus and peaks two days after estrus. However, invasive methods such as rectal or vaginal temperature measurement can easily cause stress to sows and are difficult to automate and continuously monitor. To address this issue, researchers have turned to non-contact solutions, using infrared thermal imagers to capture images of sow vulvas and employing deep learning models to automatically extract vulvar skin temperature to predict estrus. Some researchers have combined infrared thermal imagers with image analysis technology to identify sows in estrus by locating the areas of the body surface with the greatest temperature changes between the non-pregnant and estrus periods. While non-contact temperature measurement avoids stress, current automated methods based on infrared thermal imagers and other equipment still suffer from limitations such as high cost and susceptibility to harsh pigsty environments, hindering their large-scale application. In contrast, non-contact electronic ear tags are inexpensive, consume little power, are easy to replace, and are simple to maintain, making them suitable for widespread use as real-time temperature measurement devices in farms.

[0003] Electronic ear tags, as wearable devices that are low-power, easy to wear, and support continuous monitoring, have shown great potential in precision animal husbandry. However, how to efficiently extract estrus features from high-dimensional and noisy ear temperature time-series data, and effectively optimize the hyperparameters of machine learning models to improve prediction robustness, remains a key challenge that urgently needs to be addressed. Summary of the Invention

[0004] (a) Technical problems to be solved

[0005] This application aims to address the problems of high cost and difficulty in widespread adoption of estrus detection in large-scale pig farming, as well as the low efficiency of hyperparameter optimization and overfitting of machine learning models when processing complex time-series data. By designing an hourly average body temperature resampling strategy to enhance generalization ability and proposing a forced offspring iteration (FOI) mechanism to improve the genetic algorithm (GA), the prediction accuracy and convergence efficiency of the Lightweight Gradient Boosting Machine (LightGBM) model are significantly improved.

[0006] (II) Technical Solution

[0007] To achieve the above objectives, this application provides the following technical solution:

[0008] 1. Low-power electronic ear tags worn on the sow's ears are used to continuously collect ear temperature data in real time through a multi-calibration mechanism.

[0009] 2. The collected raw ear temperature data are preprocessed to construct a feature sample set containing a 48-hour temperature sequence. The sample set includes estrus samples and non-estrus samples.

[0010] 3. Determine the Lightweight Gradient Boosting Machine (LightGBM) as the base classifier and select its hyperparameter combination.

[0011] Fourth, a genetic algorithm is introduced to optimize parameters, and a Forced Offspring Iteration (FOI) mechanism is designed to improve the genetic algorithm (GA), forming the FOI-GA algorithm.

[0012] 5. Use the FOI-GA algorithm to optimize the LightGBM hyperparameter combination selected in step 3, obtain the optimal hyperparameter combination, and train the final LightGBM prediction model.

[0013] 6. Input the 48-hour ear temperature vector to be measured into the final LightGBM prediction model, and determine estrus based on the probability value output by the model. A probability value greater than 0.5 is considered as estrus.

[0014] 2. The method for predicting estrus in sows based on low-cost electronic ear tags as described in item 1, characterized in that the multi-calibration mechanism in step one refers to: the electronic ear tag sending data to multiple gateways, and the multiple gateways complementing and calibrating each other to prevent data loss due to the failure of a single gateway.

[0015] 3. The method for predicting estrus in sows based on low-cost electronic ear tags as described in item 1, characterized in that the sample dataset (X, y) construction steps in step two are as follows: First, resampling is performed on the original high-frequency sampling data, the average ear temperature of all sampling points within one hour is calculated, and a regular 1-hour step sequence is constructed; then, manual estrus detection data is labeled; then, for the positive estrus sample (x... e For sows in estrus (y=1), a sample is formed by extracting ear temperature data for 48 consecutive hours prior to the manually confirmed estrus time; for non-estrus negative samples (x... ne (y=0), within the effective detection period of non-estrus sows, multiple random cuts are performed according to the preset strategy. Each cut consists of 48 consecutive hours of ear temperature data to form a sample, so as to balance the number of positive and negative samples. Finally, the cut samples are processed for missing values. If the number of missing time points in the sample exceeds the preset threshold, the sample is discarded.

[0016] 4. The method for predicting estrus in sows based on low-cost electronic ear tags as described in item 1, characterized in that the LightGBM hyperparameter combination to be optimized in step three includes at least: the maximum number of leaf nodes in the tree, the learning rate, the maximum tree depth, and the minimum leaf weight.

[0017] 5. The sow estrus prediction method based on low-cost electronic ear tags as described in item 1 is characterized in that the forced offspring iteration (FOI) mechanism in step four refers to: in the crossover operation of the genetic algorithm, all offspring individuals generated by the crossover are forcibly retained, and the parent individuals participating in the crossover are completely eliminated, so that the offspring individuals directly enter the next generation population, thereby cutting off the direct transmission of parent genes. By cutting off the direct transmission of parent genes in the population, the population is forced to update, thereby improving the global exploration ability and accelerating convergence.

[0018] 6. The sow estrus prediction method based on low-cost electronic ear tags as described in item 5, characterized in that the GA population update logic under the FOI mechanism is expressed by the following formula:

[0019]

[0020] In the formula P t For the current population, C is the selection operator, and C is the crossover operator. For crossover offspring, M is the mutation operator, and P is the offspring. t+1 This is the updated, new generation of the species.

[0021] 7. The method for predicting estrus in sows based on low-cost electronic ear tags as described in item 1, characterized in that step five specifically includes: constructing a nested optimization framework, which includes an inner-layer evolutionary search and an outer-layer performance monitoring; in the inner-layer evolutionary search, modeling is performed by modifying LightGBM hyperparameters based on candidate individuals decoded by FOI-GA, and a logarithmic loss function is calculated using a validation set to evaluate fitness; in the outer-layer performance monitoring, the accuracy of the validation set is continuously tracked, and an early stopping mechanism is introduced. If the accuracy does not improve after a preset number of iterations, the optimization is deemed to have converged, and the globally optimal hyperparameter combination θ is output. * ; using the optimal parameter combination θ * The model is trained on the training set to obtain the final LightGBM prediction model. The ear temperature vector of the 48-hour test is input into the model. When the output probability is greater than 0.5, the current state is determined to be estrus; otherwise, it is determined to be non-estrus.

[0022] This application also provides a method for constructing a high-quality physiological time-series database of sows. The database integrates multi-source sensor data, standardized cleaning procedures, and expert annotation systems, which can provide benchmark data support for livestock behavior and health analysis research.

[0023] This application also provides a feature normalization processing method applicable to time-series physiological data, characterized by including a resampling strategy based on physiological rhythms and a sliding window sample construction method for classification tasks. This method can be generalized to other livestock and poultry periodic physiological state recognition tasks.

[0024] This application also provides an improved evolutionary algorithm hyperparameter optimization framework, characterized in that the framework significantly improves convergence efficiency while ensuring search breadth through a nested monitoring structure and a forced population update mechanism, and is suitable for automated parameter tuning of various machine learning models.

[0025] This application also provides a lightweight estrus monitoring system deployment scheme for farms, characterized in that the scheme is based on low-cost hardware and a cloud-edge collaborative algorithm model, which can realize real-time, automatic and low-stress monitoring of the estrus status of sows in large-scale farms.

[0026] (III) Beneficial Effects

[0027] Compared with existing technologies, this application provides a method for predicting estrus in sows based on low-cost electronic ear tags, which has the following advantages:

[0028] 1. This application discloses a method for predicting estrus in sows based on low-cost electronic ear tags. By collecting ear temperature through low-power electronic ear tags, it avoids the stress problems caused by the high cost of infrared thermal imaging equipment and invasive temperature measurement (such as rectal temperature measurement) in sows.

[0029] 2. The present application proposes a method for predicting estrus in sows based on low-cost electronic ear tags. By employing an hourly average body temperature resampling strategy, the random fluctuations (noise) caused by individual activity or instantaneous stress can be effectively eliminated, making the model more robust in capturing the physiological cycle characteristics of estrus.

[0030] 3. The present application proposes a method for predicting estrus in sows based on low-cost electronic ear tags. The provided FOI mechanism eliminates evaluation redundancy in traditional genetic algorithms by forcibly eliminating parent generations, thereby improving computational efficiency. Attached Figure Description

[0031] Figure 1 This is a general framework diagram of a low-cost electronic ear tag-based method for predicting estrus in sows, illustrating a specific implementation.

[0032] Figure 2 This is a schematic diagram illustrating the preprocessing and construction of sow estrus body temperature sample data proposed in this application. Detailed Implementation

[0033] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0034] This application provides a method for predicting estrus in sows based on low-cost electronic ear tags. It uses a multi-calibration mechanism to collect data, constructs a body temperature sample dataset of sows with estrus imbalance by manually confirmed estrus sows and non-estrus sows to reflect the actual production scenario, and uses the proposed FOI-GA algorithm to globally optimize the hyperparameters of the LightGBM model.

[0035] In some implementations, the multiple calibration mechanism in step one is specifically as follows: one gateway is set up every 10m in the pigsty (coverage radius of 30m) to ensure network overlap coverage; each ear tag sends data to multiple gateways, and there are differences in the sending time to avoid signal conflict; the gateways use a time synchronization mechanism to realize parallel data acquisition, and multiple gateways complement and calibrate each other.

[0036] In this application, the manual confirmation of estrus and non-estrus sows is based on the standardized management process of the farm: manual estrus checks are conducted twice a day at 8:30 am and 3:30 pm, and the results of the manual estrus checks are used as the true label (y) of the sample, where estrus status is marked as 1 and non-estrus status is marked as 0.

[0037] In some implementations, the step of constructing the sow estrus ear temperature sample dataset in step two is as follows: First, the original irregular ear temperature data is resampled at an hourly granularity, and the mean ear temperature of all sampling points within each hour is calculated to construct a regular time series feature. The use of a uniform temperature sampling strategy aims to stably reflect the overall physiological trend of the sow and effectively suppress the risk of overfitting caused by short-term stress or acquisition noise. Then, for the positive estrus samples (x... e For sows in estrus (y=1), ear temperature data for 48 hours prior to the manually confirmed estrus time are extracted to form an estrus sample; for non-estrus negative samples (x... ne For non-estrus sows (y=0), sample expansion was performed based on the effective monitoring duration. If the data length was ≥144 rows, 4 samples were randomly generated; if the data length was 96–144 rows, 3 samples were randomly generated; if the data length was 72–96 rows, 2 samples were randomly generated; and if the data length was 48–72 rows, 1 sample was randomly generated. Finally, if a single sample contained ≥5 missing time points, it was discarded; otherwise, forward imputation was used to handle missing values ​​in each sample.

[0038] Figure 1 The following is a general framework diagram of a low-cost electronic ear tag-based method for predicting estrus in sows, which is a specific embodiment of this application. The method includes the following steps:

[0039] First, we begin data preprocessing, such as... Figure 2As shown. To address the issue of inconsistent hourly data volumes in the original ear temperature data due to transmission interference or occasional equipment failures, this embodiment constructs a regular and uniform time series. The average of all readings within each hour is taken as the final ear temperature value for that hour, and the data is labeled based on manual estrus detection results. Then, estrus and non-estrus samples are constructed. For sows in estrus, continuous data from 48 hours before estrus to the time of estrus (48 hours in total) is extracted. For non-estrus sows, the sample is expanded based on the effective monitoring duration: if the data length is ≥144 rows, 4 samples are randomly generated; if the data length is 96–144 rows, 3 samples are randomly generated; if the data length is 72–96 rows, 2 samples are randomly generated; and if the data length is 48–72 rows, 1 sample is randomly generated. The sample selection window length is fixed at 48 hours. Next, the samples are cleaned: for samples with 4 or fewer missing ear temperature data points, ear temperature data from the hour preceding the missing value is used to fill in the gaps. Samples with 5 or more missing ear temperature data points are discarded. The ear temperature data was then dimensionality-transformed, changing the data for each sample from (48,1) to (1,48) to facilitate subsequent model input. Simultaneously, the estrus label y at the end of the corresponding time window was extracted. Finally, all samples were stacked row-wise to construct a standard input matrix (X, y) of dimension (N, 49), where the first 48 dimensions represent the ear temperature time-series features over 48 hours, and the last dimension is the classification label.

[0040] After data preprocessing, the overall framework of this application's method for predicting sow estrus based on low-cost electronic ear tags is based on the preprocessed standardized time-series dataset (X, y) as input. The core logic lies in establishing an optimization architecture: the inner evolutionary search layer, which introduces a FOI mechanism, is responsible for searching for the optimal hyperparameter combination θ within a predefined parameter space. t In each iteration of evolution, the decoded candidate individuals θ i The model is input into LightGBM, and the LightGBM base classifier follows the additive model principle, at θ i Under defined structural constraints, the internal structural parameters ω of each decision tree are learned by minimizing the negative gradient direction. m The performance of each generation of individuals is inferred from the validation set, and their fitness scores are calculated using log loss. The outer performance monitoring layer ensures the robustness of the model's performance and the quality of convergence through performance monitoring mechanisms and early stopping strategies. Once convergence is satisfied, the final determined combination of hyperparameters θ is output. * Finally, using θ * The final prediction model is built on the training set and its performance is evaluated in multiple dimensions on the independent test set.

[0041] In the inner evolutionary search phase, the population is first binary-coded and initialized, establishing a parameter search space containing θ = (num_leaves, learning_rate, max_depth, min_child_weight). In each evolutionary iteration, the decoded individual θ is used as the basis for the search. i Train the model by modifying the hyperparameters corresponding to the LightGBM base classifier, and then use the validation set (X). verify y verify Calculate log loss And convert it into fitness scores

[0042] When the inner loop ends, the algorithm will output the current optimal candidate parameter θ. t The algorithm then enters the outer performance monitoring phase. The core of this phase is to continuously track the model's classification accuracy on the validation set. To balance search depth and computational cost and enhance the robustness of the results, an early stopping mechanism is introduced. This mechanism monitors the improvement of validation set accuracy using a counter. If the accuracy does not improve for S consecutive times (in this embodiment, the threshold for the early stopping mechanism is preset to 3 times, i.e., S is set to 3), the algorithm is considered to have converged, and the current parameter is recorded as the globally optimal solution θ. * Subsequently, using θ * Retrain on the training set to build the final lightGBM prediction model.

[0043] This application describes a low-cost electronic ear tag-based method for predicting estrus in sows. During the testing phase, the generalization performance of the final lightGBM prediction model will be evaluated on the independent test set (X...). test y test A comprehensive evaluation is conducted, with key metrics including accuracy, recall, and AUC.

[0044] Although embodiments of this application have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for predicting estrus in sows based on low-cost electronic ear tags, characterized in that, Includes the following steps:

1. Low-power electronic ear tags worn on the sow's ears are used to continuously collect ear temperature data in real time through a multi-calibration mechanism.

2. The collected raw ear temperature data are preprocessed to construct a feature sample set containing a 48-hour temperature sequence. The sample set includes estrus samples and non-estrus samples.

3. Determine the Lightweight Gradient Boosting Machine (LightGBM) as the base classifier and select its hyperparameter combination. Fourth, a genetic algorithm is introduced to optimize parameters, and a Forced Offspring Iteration (FOI) mechanism is designed to improve the genetic algorithm (GA), forming the FOI-GA algorithm.

5. Use the FOI-GA algorithm to optimize the LightGBM hyperparameter combination selected in step 3, obtain the optimal hyperparameter combination, and train the final LightGBM prediction model.

6. Input the 48-hour ear temperature vector to be measured into the final LightGBM prediction model, and determine estrus based on the probability value output by the model. A probability value greater than 0.5 is considered as estrus.

2. The method for predicting estrus in sows based on low-cost electronic ear tags according to claim 1, characterized in that, The multi-calibration mechanism in step one refers to the electronic ear tag sending data to multiple gateways, and the multiple gateways complementing and calibrating each other to prevent data loss due to the failure of a single gateway.

3. The method for predicting estrus in sows based on low-cost electronic ear tags according to claim 1, characterized in that, The steps for constructing the sample dataset (X, y) in step two are as follows: First, resample the original high-frequency sampling data, calculate the average ear temperature of all sampling points within each hour, and construct a regular 1-hour step sequence; then, manually label the estrus data; next, for the positive estrus samples (x... e For sows in estrus (y=1), a sample is formed by extracting ear temperature data for 48 consecutive hours prior to the manually confirmed estrus time; for non-estrus negative samples (x... ne (y=0), within the effective detection period of non-estrus sows, multiple random cuts are performed according to the preset strategy. Each cut consists of 48 consecutive hours of ear temperature data to form a sample, so as to balance the number of positive and negative samples. Finally, the cut samples are processed for missing values. If the number of missing time points in the sample exceeds the preset threshold, the sample is discarded.

4. The method for predicting estrus in sows based on low-cost electronic ear tags according to claim 1, characterized in that, The LightGBM hyperparameter combination to be optimized in step three includes at least the following: maximum number of leaf nodes in the tree, learning rate, maximum tree depth, and minimum leaf weight.

5. The method for predicting estrus in sows based on low-cost electronic ear tags according to claim 1, characterized in that, The Forced Offspring Iteration (FOI) mechanism in step four refers to the following: In the crossover operation of the genetic algorithm, all offspring individuals generated by the crossover are forcibly retained, and the parent individuals participating in the crossover are completely eliminated, so that the offspring individuals directly enter the next generation of the population. This interrupts the direct transmission of parent genes, forces population renewal by cutting off the direct transmission of parent genes in the population, thereby improving the global exploration capability and accelerating convergence.

6. The method for predicting estrus in sows based on low-cost electronic ear tags according to claim 5, characterized in that, The GA population update logic under the FOI mechanism is expressed by the following formula: In the formula P t For the current population, C is the selection operator, and C is the crossover operator. For crossover offspring, M is the mutation operator, and P is the offspring. t+1 This is the updated, new generation of the species.

7. The method for predicting estrus in sows based on low-cost electronic ear tags according to claim 1, characterized in that, Step five specifically includes: constructing a nested optimization framework, which includes an inner evolutionary search and an outer performance monitoring layer; in the inner evolutionary search, modeling is performed by modifying the LightGBM hyperparameters based on the candidate individuals decoded by FOI-GA, and the logarithmic loss function is calculated using the validation set to evaluate fitness; in the outer performance monitoring layer, the accuracy of the validation set is continuously tracked, and an early stopping mechanism is introduced. If the accuracy does not improve after a preset number of iterations, the optimization is considered to have converged, and the globally optimal hyperparameter combination θ is output. * ; using the optimal parameter combination θ * The model is trained on the training set to obtain the final LightGBM prediction model. The ear temperature vector of the 48-hour test is input into the model. When the output probability is greater than 0.5, the current state is determined to be estrus; otherwise, it is determined to be non-estrus.