Data processing method, device and equipment in cow oestrus detection and medium
By preprocessing and analyzing the characteristic parameters of cow head posture data, the problems of poor specificity and high false alarm/false negative rates in cow estrus detection have been solved, achieving high-precision estrus detection that is suitable for low-cost operation in small and medium-sized farms.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- EAST CHINA UNIV OF SCI & TECH
- Filing Date
- 2025-12-16
- Publication Date
- 2026-04-14
AI Technical Summary
Existing estrus detection technologies for dairy cows have poor specificity, high false alarm and false negative rates, and high hardware costs or are affected by exercise levels, making them unable to meet the low-cost operation needs of small and medium-sized farms.
By acquiring initial head posture data of dairy cows, preprocessing it, determining the characteristic parameters of static head-raising state and dynamic head-raising changes, dividing the time window and filtering the data, extracting effective data, determining the target judgment parameter combination based on the benchmark data, calculating the real-time behavior index, and determining whether the dairy cow is in estrus.
It improves the accuracy and specificity of estrus detection in dairy cows, reduces false alarms and false negatives, lowers hardware costs, and is suitable for the low-cost operation needs of small and medium-sized farms.
Smart Images

Figure CN121844982A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of animal husbandry technology, and in particular to a data processing method, apparatus, equipment and medium for detecting estrus in dairy cows. Background Technology
[0002] Currently, estrus detection in dairy cows is a crucial aspect of farm reproductive management. Timely and accurate estrus identification can effectively improve mating success rates, shorten calving intervals, and directly impact the farm's economic benefits.
[0003] Currently, mainstream dairy cow estrus detection technologies are mainly divided into two categories. One type is based on multi-source data fusion detection using wearable devices, which simultaneously collects vital sign data and image data to improve the detection rate. However, this type of technology requires the deployment of multiple types of sensors and data transmission modules, resulting in high hardware costs and energy consumption, which does not meet the low-cost operation needs of small and medium-sized farms. The other type is based on the detection of a single amount of movement, which uses accelerometers to obtain the amount of movement of dairy cows to determine estrus. However, the amount of movement is easily affected by the size of the farm and individual differences of dairy cows, and it ignores the head-raising posture characteristics unique to dairy cows during estrus, resulting in poor detection specificity and a high rate of false alarms and false negatives. Summary of the Invention
[0004] This application provides a data processing method, apparatus, equipment, and medium for estrus detection in dairy cows, in order to solve the problems of poor detection specificity and high false alarm and false negative rates in existing estrus detection technologies for dairy cows.
[0005] Firstly, this application provides a data processing method for detecting estrus in dairy cows, including:
[0006] Acquire the initial head posture data of the cow and preprocess the initial head posture data to obtain the target posture data;
[0007] Based on the target posture data, characteristic parameters representing the static head-raising state of the cow and difference parameters representing the dynamic head-raising changes of the cow are determined.
[0008] The data streams corresponding to the feature parameters and the difference parameters are divided into time windows and filtered to obtain effective data;
[0009] Extract the effective data within a preset period as benchmark data, and determine the target judgment parameter combination based on the benchmark data, as well as the benchmark behavior index corresponding to the benchmark data;
[0010] Based on the target determination parameter combination, the real-time behavior index of the non-benchmark data is determined, and the head-up behavior offset is determined by the real-time behavior index and the corresponding benchmark behavior index.
[0011] If the deviation of the head-raising behavior exceeds the preset estrus determination threshold, the cow is determined to be in estrus.
[0012] In one possible design, acquiring the initial head pose data of the cow and preprocessing the initial head pose data to obtain the target pose data includes:
[0013] Initial triaxial acceleration data of the cow's head is acquired using a wearable triaxial accelerometer and used as the initial head posture data.
[0014] The initial triaxial acceleration data is subjected to mean filtering to eliminate noise and instantaneous jitter;
[0015] The three-axis acceleration data processed by mean filtering is normalized to obtain the target attitude data.
[0016] In one possible design, the determination of feature parameters characterizing the static head-raising state of the cow and difference parameters characterizing the dynamic head-raising changes of the cow, based on the target posture data, includes:
[0017] Based on the triaxial acceleration components in the target attitude data, the pitch angle is calculated using the arctangent function, and the pitch angle is used as the characteristic parameter characterizing the static head-raising state of the cow.
[0018] The difference in pitch angle between adjacent acquisition times is calculated, and the pitch angle difference is used as the difference parameter characterizing the dynamic head tilting change.
[0019] In one possible design, the step of dividing the data stream corresponding to the feature parameters and the difference parameters into time windows and filtering the data to obtain effective data includes:
[0020] The data streams corresponding to the feature parameters and the difference parameters are segmented according to a preset time length to obtain multiple data windows;
[0021] Calculate the mean, median deviation, and percentage of data points whose absolute value of the difference parameter is greater than a preset value within each data window;
[0022] If the mean is within a preset mean range, the median deviation is within a preset deviation range, and the proportion of data points is not lower than a preset proportion threshold, then the corresponding data window is determined to be a valid data window and retained, and the data within the valid data window is the valid data.
[0023] In one possible design, determining the target determination parameter combination based on the benchmark data includes:
[0024] Kernel density estimation is performed on the feature parameters in the benchmark data to obtain the feature parameter kernel density distribution;
[0025] The static judgment threshold is determined based on the kernel density distribution of the aforementioned feature parameters;
[0026] Based on the feature discrimination evaluation function, the discrimination score corresponding to multiple preset dynamic threshold candidate values is calculated.
[0027] The preset dynamic threshold candidate value with the highest discrimination score is used as the dynamic judgment threshold, and the static judgment threshold and the dynamic judgment threshold together form the target judgment parameter combination.
[0028] In one possible design, determining the real-time behavior index of non-benchmark data based on the target determination parameter combination includes:
[0029] Divide the data window of non-baseline data into multiple sub-units of fixed duration;
[0030] For each of the sub-units, it is determined whether the feature parameter satisfies the static judgment threshold in the target judgment parameter combination, and whether the difference parameter satisfies the dynamic judgment threshold in the target judgment parameter combination. If so, it is determined as a valid head-up event.
[0031] The weight levels are determined based on the numerical values of the feature parameters corresponding to the valid head-up events;
[0032] Calculate the sum of weighted scores for valid head-up events within the data window corresponding to non-benchmark data, and use the sum of weighted scores as the real-time behavior index.
[0033] In one possible design, determining the head-up behavior offset by comparing the real-time behavior index with the corresponding baseline behavior index includes:
[0034] Extract the benchmark behavior index from the benchmark data that is consistent with the time dimension of the data window of the non-benchmark data;
[0035] The difference between the real-time behavior index of the data window corresponding to the non-baseline data and the baseline behavior index is calculated to obtain the head-up behavior offset.
[0036] Secondly, this application provides a data processing device for detecting estrus in dairy cows, comprising:
[0037] The acquisition module is used to acquire the initial head posture data of the cow and preprocess the initial head posture data to obtain the target posture data.
[0038] The determination module is used to determine, based on the target posture data, the characteristic parameters characterizing the static head-raising state of the cow and the difference parameters characterizing the dynamic head-raising changes of the cow.
[0039] The filtering module is used to divide the data stream corresponding to the feature parameters and the difference parameters into time windows and filter the data to obtain effective data.
[0040] The determining module is further configured to extract the effective data within a preset period as benchmark data, determine the target judgment parameter combination based on the benchmark data, and determine the benchmark behavior index corresponding to the benchmark data.
[0041] The determining module is also used to determine the real-time behavior index of non-benchmark data based on the target determination parameter combination, and to determine the head-up behavior offset by the real-time behavior index and the corresponding benchmark behavior index.
[0042] The determination module is used to determine that the cow is in estrus when the head-raising behavior offset exceeds a preset estrus determination threshold.
[0043] Thirdly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0044] The memory stores computer-executed instructions;
[0045] The processor executes computer execution instructions stored in the memory to implement the method as described in any of the first aspects.
[0046] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any of the first aspects.
[0047] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method described in any of the first aspects.
[0048] This application provides a data processing method, apparatus, equipment, and medium for detecting estrus in dairy cows. By acquiring and preprocessing the initial head posture data of dairy cows, noise and interference information can be effectively removed to obtain more accurate target posture data. Then, based on the target posture data, characteristic parameters representing the static head-raising state of the dairy cow and difference parameters representing the dynamic changes in head-raising are determined, comprehensively capturing key information about the head-raising posture during estrus and fully considering the dynamic changes in estrus behavior. The data streams corresponding to the characteristic parameters and difference parameters are divided into time windows and data filtered to further extract effective data, ensuring the representativeness and reliability of the data used in the analysis. Based on this, effective data within a preset period is extracted as benchmark data, and the target judgment parameter combination and the corresponding benchmark behavior index are determined accordingly, providing an accurate reference standard for subsequent real-time detection. During real-time detection, the real-time behavior index of non-benchmark data is determined based on the target judgment parameter combination, and the head-raising behavior offset is calculated by comparing it with the corresponding benchmark behavior index. When the head-raising behavior offset exceeds the preset estrus judgment threshold, the dairy cow can be accurately determined to be in estrus. The method described in this application, by comprehensively considering the head-raising posture characteristics of dairy cows during estrus, effectively overcomes the problem of inaccurate detection caused by neglecting key information or interference from multiple factors in existing technologies, thereby improving the accuracy and specificity of dairy cow estrus detection and reducing false alarm and false negative rates. Attached Figure Description
[0049] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0050] Figure 1 This application provides a flowchart illustrating a data processing method for detecting estrus in dairy cows, based on one embodiment.
[0051] Figure 2 A pitch angle time-series diagram of a dairy cow during estrus and non-estrus periods, provided as an embodiment of this application;
[0052] Figure 3 A time-series diagram of pitch angle elevation during and outside the estrus period of a dairy cow, provided as an embodiment of this application;
[0053] Figure 4 A schematic diagram of kernel density estimation of the pitch angle of a dairy cow provided in an embodiment of this application;
[0054] Figure 5 A schematic diagram of kernel density estimation of pitch angle difference of dairy cows provided in an embodiment of this application;
[0055] Figure 6A heatmap of the discrimination ability of dairy cows under a combination of static and dynamic judgment thresholds provided in an embodiment of this application;
[0056] Figure 7 An optimal parameter distribution diagram for multiple dairy cows provided in an embodiment of this application;
[0057] Figure 8 A comparison diagram of head-raising behavior offset of a dairy cow during an estrus cycle before and after correction, provided in an embodiment of this application;
[0058] Figure 9 This is a schematic diagram of the structure of a data processing device for detecting estrus in dairy cows, provided in one embodiment of this application;
[0059] Figure 10 This is a structural example diagram of an electronic device provided in an embodiment of this application.
[0060] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0061] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0062] To clearly understand the technical solution of this application, the solutions of the prior art will be described in detail first.
[0063] Estrus detection in dairy cows is a crucial aspect of farm reproductive management. Timely and accurate estrus identification can effectively improve mating success rates, shorten calving intervals, and directly impact farm economic benefits.
[0064] Currently, mainstream dairy cow estrus detection technologies are mainly divided into two categories. One type is based on multi-source data fusion detection using wearable devices, which simultaneously collects vital signs data and image data to improve the detection rate. However, this type of technology requires the deployment of multiple types of sensors and data transmission modules, resulting in high hardware costs and energy consumption, which does not meet the low-cost operation needs of small and medium-sized farms. The other type is based on the detection of a single amount of movement, which uses accelerometers to obtain the amount of movement of dairy cows to determine estrus. However, the amount of movement is easily affected by the scale of the farm (such as the difference in activity space between free-range and intensive farming) and individual differences of dairy cows (such as the difference in activity ability due to age and health status). Furthermore, it ignores the unique head-raising posture characteristics of dairy cows during estrus (such as sniffing, chin-touching, and hindquarters-mounting behaviors, all of which are accompanied by head-raising movements), resulting in poor detection specificity and a high rate of false alarms and false negatives.
[0065] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0066] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.
[0067] Figure 1 A flowchart illustrating a data processing method for detecting estrus in dairy cows, as provided in one embodiment of this application, is shown below. Figure 1 As shown, the execution subject of this embodiment is a data processing device for detecting estrus in dairy cows. This device can be implemented through a computer program, or through a medium storing the relevant computer program, such as a USB flash drive and / or optical disc; alternatively, it can be implemented through a physical device integrating or installing the relevant computer program, such as a chip or electronic device. The electronic device may be a computer or a server, etc. The data processing method for detecting estrus in dairy cows provided in this embodiment includes the following steps:
[0068] S201. Obtain the initial head posture data of the cow and preprocess the initial head posture data to obtain the target posture data.
[0069] It should be noted that the core behaviors of dairy cows during estrus (sniffing, chin nudging, and mounting) are all accompanied by head lifting movements. These head lifting movements cause changes in the vertical posture of the head, which can be captured by a three-axis accelerometer.
[0070] Optionally, the steps of acquiring initial head posture data of the cow and preprocessing the initial head posture data to obtain target posture data specifically include: acquiring initial triaxial acceleration data of the cow's head using a wearable triaxial acceleration acquisition device as initial head posture data; performing mean filtering on the initial triaxial acceleration data to eliminate noise and instantaneous jitter; and normalizing the mean-filtered triaxial acceleration data to obtain target posture data.
[0071] Optionally, a neck-mounted wearable device (worn around the cow's neck, close to its head) is used to collect initial triaxial acceleration data, with a sampling frequency set to 12.5Hz (i.e., one set of data is collected every 0.08 seconds) to ensure complete capture of details of head posture changes, while avoiding energy waste caused by high-frequency sampling.
[0072] It should be noted that the initial triaxial acceleration data contains noise (such as sensor errors and slight vibrations when the cow walks) and instantaneous jitter (such as sudden movements like the cow shaking its head or scratching itself). If it is used directly for feature calculation, it will lead to distortion of subsequent parameters. Therefore, two-step preprocessing is required.
[0073] Optionally, for mean filtering, a 2-second mean filter can be used (corresponding to 25 sampling points; since the sampling frequency is 12.5Hz, 2 seconds × 12.5Hz = 25 points). Mean filtering can smooth high-frequency noise while preserving the core posture change trend of head tilting.
[0074] It should be noted that due to differences in the hardware sensitivity of different accelerometers, the range of collected acceleration values may vary (e.g., some devices output 0-2g, while others output 0-3g). Normalization is necessary to map the triaxial acceleration data uniformly to the [-1,1] interval. Normalization eliminates the influence of device differences, ensuring consistency in subsequent feature calculations. The preprocessed triaxial acceleration data is the target attitude data.
[0075] S202. Based on the target posture data, determine the characteristic parameters that characterize the static head-raising state of the dairy cow and the difference parameters that characterize the dynamic head-raising changes of the dairy cow.
[0076] Among them, the feature parameters are used to characterize the features of the cow's head in a static head-raising state. The static head-raising state refers to the head-raising angle at a certain moment (e.g., the angle is high when raising the head and low when lowering the head). When the pitch angle is greater than 30°, it is determined to enter the head-raising state, and the pitch angle value at this time is the head-raising angle.
[0077] Optionally, based on the target attitude data, characteristic parameters representing the static head-raising state of the cow and difference parameters representing the dynamic head-raising changes of the cow are determined, including: calculating the pitch angle based on the triaxial acceleration components in the target attitude data using the arctangent function, and using the pitch angle as a characteristic parameter representing the static head-raising state of the cow; calculating the difference in pitch angles at adjacent acquisition times, and using the pitch angle difference as a difference parameter representing the dynamic head-raising changes of the cow.
[0078] It should be noted that there is a fixed geometric relationship between the projection of gravitational acceleration onto the triaxial acceleration and the head pitch angle. When the cow raises its head, the forward and backward components of the gravitational projection increase, while the sum of the squares of the left-right and up-down components decrease. Therefore, the pitch angle can be calculated using the arctangent function, as shown in the formula:
[0079]
[0080] In the formula, the negative sign is used to unify the angle definition (so that when looking up) When the head is lowered, the value is positive. (negative value) This represents the projected component of gravity in the forward and backward directions. These are the left-right projected components of gravity. The vertical component of gravity is the projected component. This is the resultant vector of accelerations along the y and z axes, ensuring that the calculation results only reflect the gravity projection and are not affected by the acceleration of the cow's linear motion (such as walking).
[0081] It should be noted that, compared to attitude calculation methods based on gyroscope angular velocity fusion, directly estimating the pitch angle using gravitational acceleration components is more stable under low sampling rate conditions. Furthermore, since gravitational acceleration is much greater than linear acceleration, this method does not require separate filtering of the linear component, simplifying the processing flow of the experimental algorithm.
[0082] It should be noted that the pitch angle directly represents the degree to which the cow's head is statically raised. During estrus, cows frequently sniff and mount, so their pitch angle is mostly in the high angle range of [15°, 45°]. During non-estrus, cows are mostly in a state of rumination with their heads down and walking, so their pitch angle is mostly concentrated in the low angle range of [-10°, 10°].
[0083] Figure 2 This is a time-series diagram of pitch angles during and outside estrus periods of dairy cows, provided as an embodiment of this application. Figure 2 (a) is a time-series distribution diagram of the pitch angle of experimental dairy cow 21102 during the estrus period. Figure 2 (b) is a time-series distribution of pitch angles of experimental dairy cow 21102 during non-estrus periods. Figure 2 (a) andFigure 2 (b) The horizontal axis represents time, and the vertical axis represents pitch angle. It can be observed that the pitch angle is significantly higher overall during estrus, indicating that the cows maintain their head-up position for a relatively long time during this period. A small number of high pitch angle segments also exist during the non-estrus phase, which may be related to short-term routine behaviors such as head shaking, scratching, drinking, and climbing fences.
[0084] Figure 3 This is a time-series diagram of the pitch angle of a dairy cow during and outside of estrus, provided as an embodiment of this application. Figure 3 (a) is a time-series diagram of the pitch angle of experimental dairy cow 21102 during its non-estrus period. Figure 3 (b) is a time-series distribution diagram of the pitch angle height of experimental dairy cow 21102 during the estrus period.
[0085] Among them, the pitch angle reflects the degree to which the cow raises its head, and is a static characteristic. During the experiment, observation of synchronized video recordings revealed that cows also exhibit head-raising behavior when lying down or ruminating; in these situations, the pitch angle tends to remain at a high, stable angle for a considerable period (e.g., ...). Figure 3 (a) shows that this persistent, stable head-raising is not due to estrus. In contrast, dairy cows exhibit more frequent and sudden behavioral characteristics during estrus, such as sniffing, chin-butting, and mounting (e.g., Figure 3 (b) shows that the pitch angle is not stable at a high angle, but fluctuates significantly over a short period of time. This indicates that relying solely on static pitch angle characteristics is insufficient to effectively distinguish estrus behavior, and dynamic characteristics need to be introduced as a supplement.
[0086] Therefore, to more accurately extract head movement behavior during estrus, a pitch angle difference is introduced in addition to the static pitch angle. The pitch angle difference is the difference between two adjacent sampling points (e.g., 0.08 seconds apart). The pitch angle difference reflects the intensity and frequency of head-raising movements. During estrus, behaviors such as sniffing and chin-butting in dairy cows are accompanied by rapid changes in pitch angle within a short period, with pitch angle differences typically fluctuating within a large range of ±5° to ±15°. In contrast, during non-estrus, head movements in dairy cows are slow (e.g., head down while grazing), and pitch angle differences tend to fluctuate within a small range of ±0° to ±3°. Figure 3 (a) and (b) are shown.
[0087] S203. Divide the data streams corresponding to the feature parameters and difference parameters into time windows and filter the data to obtain effective data.
[0088] It should be noted that the feature parameters and difference parameters are continuous data streams (e.g., one data point every 0.08 seconds). If they are used directly for subsequent analysis, it will result in an excessive amount of data, low computational efficiency, and individual data points are easily affected by random errors.
[0089] It should be noted that the sensor may lose data or become abnormal due to the cow rubbing against it or the sensor becoming loose (e.g., the pitch angle is always 0° or the pitch angle difference is always ±90°). If invalid data is included in subsequent benchmark modeling or real-time detection, it will lead to distorted judgment results (e.g., the benchmark value is too high, resulting in missed estrus detection).
[0090] Optionally, the data streams corresponding to the feature parameters and difference parameters are divided into time windows and the data is filtered to obtain valid data. Specifically, this includes: segmenting the data streams corresponding to the feature parameters and difference parameters according to a preset time length to obtain multiple data windows; calculating the mean, median deviation, and percentage of data points with absolute values of difference parameters greater than preset values within each data window; if the mean is within a preset mean range, the median deviation is within a preset deviation range, and the percentage of data points is not lower than a preset percentage threshold, then the corresponding data window is determined to be a valid data window and retained, and the data within the valid data window is considered valid data.
[0091] Optionally, the preset time length is a pre-set time value, which can be 2 hours. Alternatively, the data window can be divided into 2-hour units to ensure that each window can cover the complete activity cycle of the cow (such as the alternation of rumination, walking, and resting) while controlling the amount of data to reduce transmission and computing energy consumption.
[0092] Optionally, the mean pitch angle (mean_pitch), the median deviation of the feature parameters (mad_pitch), and the percentage of active points (active_ratio) are automatically calculated every 2 hours. The percentage of active points is the proportion of data points whose absolute value of the difference parameter is greater than a preset value.
[0093] Optionally, the validity of the data window can be verified by the mean of the feature parameters, the median deviation of the feature parameters, and the percentage of active points.
[0094] The mean pitch of the feature parameter is the average of all pitch angles within the data window, reflecting the overall level of head posture during that period. Based on a large amount of experimental data, the reasonable range for the mean pitch of the feature parameter during normal wear is [-20.0°, 10.0°]. If the mean pitch of the feature parameter is <-20°, it may be due to sensor inversion; if the mean pitch of the feature parameter is >10°, it may be due to sensor detachment causing data abnormalities.
[0095] Therefore, in this embodiment, the preset mean range is set to [-20.0°, 10.0°].
[0096] The median deviation of the characteristic parameter (mad_pitch) is the median of the absolute deviations of all pitch angles from the median within the data window, reflecting the dispersion of the pitch angles. During normal operation, the reasonable range for the median deviation of the characteristic parameter is [2.0°, 25.0°]. If the median deviation is <2°, it indicates that the pitch angle is almost unchanged, which may be due to sensor malfunction. If the median deviation is >25°, it indicates excessive fluctuation in the pitch angle, which may be due to data interference.
[0097] Therefore, in this embodiment, the preset deviation range is set to [2.0°, 25.0°].
[0098] The active point percentage (active_ratio) is the proportion of data points with a pitch angle difference greater than 2° within the data window. During normal activity, the active point percentage is ≥35%. If it is <35%, it means that the cow has almost no head movement, which may be due to sensor failure or abnormality in the cow.
[0099] Therefore, in this embodiment, the preset percentage threshold is set to 35%.
[0100] Optionally, if a data window simultaneously satisfies the following conditions: the mean value of the feature parameter ∈ [-20.0°, 10.0°], the median deviation of the feature parameter ∈ [2.0°, 25.0°], and the percentage of data points with an absolute value of the difference parameter greater than a preset value is ≥35%, then it is determined to be a valid data window, and the data within the window is valid data; otherwise, the data window is discarded to avoid invalid data affecting subsequent processes.
[0101] S204. Extract valid data within a preset period as benchmark data, determine the target judgment parameter combination based on the benchmark data, and determine the benchmark behavior index corresponding to the benchmark data.
[0102] It should be noted that cows exhibit a daily activity pattern in their head-raising behavior (e.g., higher frequency of head-raising in the morning and evening, and lower frequency at night). If a fixed threshold is used directly to determine estrus, it is easy to misinterpret daily routines as estrus.
[0103] Therefore, optionally, the effective data from the first 3 days can be extracted as the baseline data (3 days can cover the complete daily activity cycle of the cows and avoid the impact of abnormal data on a single day), and only 12 2-hour effective data windows from 0:00 to 2:00, 2:00 to 4:00, ..., 22:00 to 24:00 each day are retained (aligned with the window time of subsequent real-time detection).
[0104] Among them, the target determination parameter combination is used to distinguish between valid head-raising events (estrus-related) and invalid head-raising events (non-estrus-related), and needs to be calculated based on baseline data (non-estrus period data).
[0105] Optionally, determining the target determination parameter combination based on benchmark data includes: estimating the kernel density of the feature parameters in the benchmark data to obtain the kernel density distribution of the feature parameters; determining the static determination threshold based on the kernel density distribution of the feature parameters; calculating the discrimination score corresponding to multiple preset dynamic threshold candidate values based on the feature discrimination evaluation function, and taking the preset dynamic threshold candidate value with the highest discrimination score as the dynamic determination threshold. The static determination threshold and the dynamic determination threshold together form the target determination parameter combination.
[0106] Optionally, kernel density estimation (KDE) is performed on the pitch angles in the baseline data to obtain the kernel density distribution of the pitch angles (reflecting the probability distribution of pitch angles during the non-estrus period, such as...). Figure 4 (As shown).
[0107] Figure 4 A schematic diagram of kernel density estimation of the pitch angle of a dairy cow provided in an embodiment of this application; Figure 4 The pitch angle kernel density estimates for cows numbered 21102, 20735, 20734 and 22320 are shown in the figure. Figure 4 In each subplot, the horizontal axis represents pitch angles, and the vertical axis represents probability density. The red line represents the estrus state, and the blue line represents the non-estrus state.
[0108] like Figure 4 As shown, in the non-estrus state, the main activity postures of dairy cows are concentrated around 0°, reflecting that their daily behavior is mainly low-angle activity. In contrast, the density curve during estrus shows increased density and delayed tail extension in the high pitch angle range, indicating that cows in estrus exhibit more frequent and longer head-raising behaviors. Furthermore, different individuals show significant differences in the lower limit of the distribution in the high pitch angle range. For example, the main change in the high pitch angle range during estrus begins at approximately 15° for cow number 21102, while for 20734 it is approximately 7°. This trend verifies the feasibility of using pitch angle in estrus behavior identification.
[0109] Based on the pitch angle distribution, the kernel density distribution of the pitch angle difference was further analyzed, and some results are as follows: Figure 5 As shown. Figure 5 A schematic diagram of kernel density estimation of pitch angle difference of dairy cows provided in an embodiment of this application; Figure 5 The table shows the pitch angle difference kernel density estimates for cows numbered 21102, 20735, 20734, and 22320. Figure 5In the graphs, the horizontal axis represents the pitch angle difference in degrees, and the vertical axis represents the probability density. The red line represents the estrus state, and the blue line represents the non-estrus state.
[0110] Overall, the pitch angle difference distribution curves for both estrus and non-estrus periods reached their main peaks near 0°, indicating that the cows' heads remained relatively stable for most of the time. In contrast, the estrus curve showed a slightly higher tail density on both sides of the main peak, exhibiting a wider distribution bandwidth and reflecting more frequent small-amplitude dynamic changes. Unlike pitch angle, which mainly reflects static posture differences, pitch angle difference focuses more on characterizing the amplitude and volatility of head movements. The main difference between estrus and non-estrus periods lies in the overall expansion of the kernel density function, rather than the frequency difference in specific high-angle intervals. Furthermore, the pitch angle difference kernel density distribution showed that the four experimental cows exhibited similar performance in this pitch angle difference kernel density, with small individual differences. All cows showed a steep and concentrated single-peak distribution in the non-estrus state, while in the estrus state, the curves generally showed characteristics such as a wider main peak and upward movement of the left and right tails, reflecting more frequent and more volatile head movements during estrus.
[0111] Therefore, pitch angle is a powerful indicator of static posture changes during estrus, but there are significant differences among different dairy cows; pitch angle difference can effectively capture the dynamic characteristics of head movement and has stronger cross-individual stability.
[0112] Optionally, the pitch angle values corresponding to kernel density values of 0.005, 0.01, 0.02, and 0.03 can be selected as the lower limit threshold for the pitch angle of dairy cows to accommodate individual differences among cows and ensure that high-frequency daily posture behaviors are effectively filtered. Simultaneously, to avoid misjudging non-estrus behaviors such as head shaking, scratching, and drinking as estrus head-raising behaviors, all angle values within the effective pitch angle range for each cow are sorted in ascending order, and the 99th percentile value is selected as the upper limit threshold instead of the fixed upper limit threshold of 90°. The 99th percentile is a statistical concept, indicating that in a set of data, 99% of the data are less than or equal to this value, while the remaining 1% are greater than this value.
[0113] Optionally, in this embodiment, the pitch angle corresponding to a kernel density value of 0.005 is selected as the static judgment threshold. This static judgment threshold is the upper limit of the high-frequency range of pitch angles during non-estrus periods. Pitch angles exceeding this static judgment threshold are mostly high-angle head-raising related to estrus (such as pitch angle > static judgment threshold during mounting). It should be noted that the static judgment threshold is a personalized threshold (the kernel density distribution is different for different cows, such as the static judgment threshold of cow 21102 ≈ 15°, and the static judgment threshold of cow 20734 ≈ 7°), which can solve the problem of individual differences.
[0114] Optionally, in this embodiment, pitch angle differences of 0°, 5°, 10°, and 15° are selected as lower threshold values for head-raising movements to identify behaviors typical of estrus, accompanied by vigorous head movements. Within the empirical threshold range, selecting a larger pitch angle difference parameter can effectively avoid interference from slight or occasional head movements on the recognition results, thereby improving the specificity and robustness of estrus behavior detection.
[0115] Optionally, to further evaluate the discriminative ability of different parameter combinations in identifying estrus behavior, the discriminative ability of different dynamic thresholds can be quantified based on a feature discrimination evaluation function. The formula for the feature discrimination evaluation function is as follows:
[0116]
[0117] In the formula, Score is the feature discrimination score, θ is the pitch angle; Δθ is the pitch angle difference; d is the preset dynamic threshold candidate value; θ∈Range indicates that the pitch angle is within the preset effective head-up interval; Pr(Δθ>d|θ∈Range) represents the conditional probability of head-up action under the premise of satisfying the head-up posture.
[0118] Specifically, a higher Score indicates a stronger ability of the preset dynamic threshold candidate value to distinguish head-raising movements between estrus and non-estrus periods. Calculations show that the Score is highest when the preset dynamic threshold candidate value is 5°. Therefore, in this embodiment, the preset dynamic threshold candidate value can be set to 5°, which effectively eliminates slight head movements during non-estrus periods while capturing effective dynamic changes during estrus. The preset dynamic threshold candidate value is a pre-selected pitch angle difference, which can be 0°, 5°, 10°, or 15°.
[0119] Specifically, the static judgment threshold and the dynamic judgment threshold constitute the target judgment parameter combination.
[0120] Figure 6 A heatmap showing the discrimination ability of dairy cows under a combination of static and dynamic judgment thresholds, provided in an embodiment of this application. Figure 6 In each subplot, the horizontal axis represents the static decision threshold (KDE density), and the vertical axis represents the dynamic decision threshold (pitch angle difference). Each cell in each subplot uses a different color to represent the estrus score, with the color gradient from blue to red, where blue represents a lower score and red represents a higher score. The specific value is marked in the center of each cell.
[0121] like Figure 6As shown, as the static decision threshold decreased from 0.03 to 0.005, meaning the static attitude determination based on pitch angle became more stringent, the model's discriminative ability generally improved, and the scores increased significantly. At dynamic decision thresholds of 5° or 10°, most cows achieved relatively high scores, indicating that this range effectively captured the more frequent, moderate-intensity head movements during estrus. Extremely low (0°) or extremely high (15°) dynamic decision thresholds typically performed poorly; 0° easily introduced slight movements from non-estrus states, reducing accuracy; 15° might miss low-amplitude but frequent head-raising behaviors during estrus, reducing recall.
[0122] Figure 7 This is a diagram illustrating the optimal parameter distribution for multiple dairy cows according to an embodiment of this application. Figure 7 As shown in the figure, the horizontal axis represents the static decision threshold, and the vertical axis represents the dynamic decision threshold. The static decision threshold is 0.005, and the dynamic decision threshold is 5°. This combination aggregates the optimal points of the most individuals and spans the three ranches of Zhangjiagang, Liangfeng, and Chuzhou, demonstrating good robustness and environmental generalization ability. Figure 7 The gray circular areas highlight the main clustering areas, indicating a concentrated overall distribution. From a practical perspective, the parameter combination of a static judgment threshold of 0.005 and a dynamic judgment threshold of 5° selects the most stringent head-up angle range at the static feature level, while simultaneously choosing a moderate motion intensity threshold at the dynamic feature level, achieving a good balance between robustness and sensitivity.
[0123] Among them, the baseline behavior index is used to characterize the level of normal head-raising activity in dairy cows outside of estrus.
[0124] Optionally, based on the target judgment parameter combination, a real-time behavior index for non-benchmark data is determined, specifically including: dividing the data window of non-benchmark data into multiple sub-units of fixed duration; for each sub-unit, determining whether the feature parameters meet the static judgment threshold in the target judgment parameter combination, and whether the difference parameters meet the dynamic judgment threshold in the target judgment parameter combination; if so, determining it as a valid head-up event; assigning weight levels according to the numerical value of the feature parameters corresponding to the valid head-up event; calculating the sum of weighted scores of valid head-up events within the data window corresponding to the non-benchmark data, and using the sum of weighted scores as the real-time behavior index.
[0125] Optionally, for each 2-hour effective data window of the baseline data, the number of effective head-up events is counted based on the target determination parameter combination. Within each 2-second sub-unit, if the pitch angle is greater than the static determination threshold and the pitch angle difference is greater than the dynamic determination threshold, it is recorded as 1 effective head-up event.
[0126] Optionally, valid head-raising events can be weighted according to their pitch angle. Optionally, the higher the pitch angle, the greater the weight. For example, if the pitch angle is greater than the static judgment threshold but less than 25°, the weight is 1; if the pitch angle is greater than 25° but less than 35°, the weight is 2; and if the pitch angle is greater than 35° but less than 90°, the weight is 3. This is because a higher pitch angle corresponds to a behavior with greater estrus detection value. For example, the pitch angle of mounting is >35°, so the weight is 3; while the pitch angle of sniffing is <25°, so the weight is 1.
[0127] Optionally, the weighted score sum for each 2-hour data window (the sum of the number of valid headshot events × the corresponding weights) is calculated, and the average of the weighted score sums for the same time period in the previous 3 days (e.g., 08:00 to 10:00 each day) is taken as the baseline behavior index for that time period (e.g., if the weighted score sums for the previous 3 days from 08:00 to 10:00 in the baseline data are 120, 130, and 125 respectively, then the baseline behavior index is (120+130+125) / 3=125). This ultimately forms a baseline behavior index sequence (12 values in total) indexed by 2 hours, covering the entire 24 hours of the day.
[0128] S205. Based on the combination of target determination parameters, determine the real-time behavior index of non-benchmark data, and determine the head-up behavior offset by comparing the real-time behavior index with the corresponding benchmark behavior index.
[0129] Non-benchmark data is real-time monitoring data. The calculation logic for the real-time behavior index of non-benchmark data is the same as that of the benchmark behavior index. Specifically, the 2-hour data window of non-benchmark data is divided into 2-second sub-units (each window contains 3600 2-second sub-units). For each sub-unit, if the pitch angle is greater than or equal to the static judgment threshold and the pitch angle difference is greater than or equal to the dynamic judgment threshold, it is determined as one valid head-up event, and a weight level is assigned according to the pitch angle magnitude. The weighted sum of all valid head-up events within the data window is calculated, which is the real-time behavior index. For example, if the weighted sum of valid head-up events in a real-time data window is 380, then the real-time behavior index = 380.
[0130] Among them, the head-up behavior offset is used to reflect the degree of abnormality of the real-time head-up activity level relative to the normal level.
[0131] Optionally, the step of determining the head-up behavior offset by comparing the real-time behavior index with the corresponding baseline behavior index includes: extracting the baseline behavior index from the baseline data that has the same time dimension as the data window of the non-baseline data; calculating the difference between the real-time behavior index of the data window corresponding to the non-baseline data and the baseline behavior index to obtain the head-up behavior offset.
[0132] Optionally, a benchmark behavior index can be matched by a time index. For example, if the real-time data is a window from 08:00 to 10:00 on the same day, then the benchmark value corresponding to 08:00 to 10:00 in the benchmark behavior index sequence can be matched.
[0133] Optionally, the head-up behavior offset is the difference between the real-time behavior index and the baseline behavior index.
[0134] Optionally, if the head-raising behavior offset is <0, it indicates that the real-time head-raising activity level is below the normal level, and there is no possibility of estrus; therefore, it is corrected to 0. If the head-raising behavior offset is ≥0, it is directly used as the final head-raising behavior offset. Optionally, this correction operation can eliminate invalid cases where the real-time level is below the baseline, ensuring that the head-raising behavior offset only reflects an abnormal increase in head-raising activity.
[0135] Figure 8 This is a comparison image showing the head-raising behavior offset of a dairy cow during an estrus cycle before and after correction, as provided in an embodiment of this application. Figure 8 (a) represents the state before correction. Figure 8 (b) represents the corrected version, where Figure 8 (a) and Figure 8 (b) The horizontal axis represents timestamps in 2-hour intervals, and the vertical axis represents the offset of the head-up behavior.
[0136] Figure 8 (a) shows several small peaks corresponding to daily activities. Figure 8 (b) shows the corrected head-up behavior offset over the same time period. It is evident that periodic noise from daily activities is significantly suppressed, and the single large peak associated with the actual estrus event becomes more prominent and easier to detect.
[0137] S206. If the deviation of the head-raising behavior exceeds the preset estrus determination threshold, the cow is determined to be in estrus.
[0138] Optionally, to avoid false alarms caused by a single abnormal data point (such as a cow accidentally climbing a fence causing a sudden increase in offset), a preset estrus detection threshold needs to be set based on baseline data.
[0139] Optionally, the maximum value in the baseline behavioral index sequence is calculated, and twice that maximum value is set as the preset estrus detection threshold (e.g., if the maximum value in the baseline behavioral index sequence is 150, then the preset estrus detection threshold is 300). Since the head-raising activity level of dairy cows in estrus is usually more than twice the peak value in non-estrus periods, and the dynamic threshold can adapt to the baseline differences among different dairy cows (avoiding underreporting of high-benchmark dairy cows and false reporting of low-benchmark dairy cows caused by a fixed threshold).
[0140] Optionally, since the estrus behavior of dairy cows is continuous (usually lasting 4-12 hours), it is necessary to verify the head-raising behavior offset over a continuous time period.
[0141] Optionally, if the head-raising behavior offset of at least two consecutive 2-hour data windows exceeds the preset estrus determination threshold (e.g., window 1 offset = 320, window 2 offset = 350, both > 300), then the cow is determined to be in estrus and an alarm is triggered (e.g., sending an SMS or APP push to the ranch management terminal); if only a single window offset exceeds the preset estrus determination threshold (e.g., window 1 offset = 320, window 2 offset = 180) or no window exceeds the preset estrus determination threshold, then the cow is determined not to be in estrus and no alarm is triggered.
[0142] This application provides a data processing method for detecting estrus in dairy cows. By acquiring and preprocessing the initial head posture data of the cows, noise and interference are effectively removed, resulting in more accurate target posture data. Then, based on the target posture data, characteristic parameters representing the static head-raising state of the cows and difference parameters representing dynamic head-raising changes are determined, comprehensively capturing key information about the head-raising posture during estrus and fully considering the dynamic changes in estrus behavior. The data streams corresponding to the characteristic parameters and difference parameters are divided into time windows and filtered to further extract effective data, ensuring the representativeness and reliability of the data used in the analysis. Based on this, effective data within a preset period is extracted as baseline data, and the target judgment parameter combination and the corresponding baseline behavior index are determined accordingly, providing an accurate reference standard for subsequent real-time detection. During real-time detection, the real-time behavior index of non-baseline data is determined based on the target judgment parameter combination, and the head-raising behavior offset is calculated by comparing it with the corresponding baseline behavior index. When the head-raising behavior offset exceeds the preset estrus judgment threshold, the cow can be accurately determined to be in estrus.
[0143] The method described in this application, by comprehensively considering the head-raising posture characteristics of dairy cows during estrus, effectively overcomes the problem of inaccurate detection caused by neglecting key information or interference from multiple factors in existing technologies, thereby improving the accuracy and specificity of dairy cow estrus detection and reducing false alarm and false negative rates.
[0144] It should be noted that, compared to existing detection schemes that rely on multiple sensors, the data processing method for detecting estrus in dairy cows provided in this application embodiment only requires a single neck-mounted triaxial accelerometer to achieve core data acquisition, reducing hardware costs and eliminating the need for additional image acquisition equipment or vital sign monitoring modules, thus avoiding the financial burden of large-scale farm equipment investment. By filtering invalid data (such as sensor detachment or abnormal jitter data) through a data window, combined with lightweight algorithms (mean filtering, arctangent pitch angle calculation, requiring no complex deep learning computing power), data transmission energy consumption and terminal computing energy consumption are reduced. This reduces the operating costs of small and medium-sized farms and avoids the energy burden of large-scale deployment in large farms.
[0145] It should also be noted that, in response to the shortcomings of existing exercise detection schemes that ignore individual differences and are easily affected by the environment, the data processing method for detecting estrus in dairy cows provided in this application embodiment has the following advantages. On the one hand, based on the baseline data of each dairy cow during the previous 3 days of non-estrus period, a personalized combination of target judgment parameters is constructed. The static pitch angle threshold is adapted to the individual head-raising behavior characteristics through kernel density estimation, and the dynamic pitch angle threshold is determined to the optimal value through the feature discrimination evaluation function, thus eliminating individual misjudgments caused by the "one-size-fits-all" threshold. On the other hand, the offset is calculated by comparing the real-time head-raising index with the baseline index of the same time period, effectively eliminating the interference of daily activity patterns (such as frequent head-raising in the morning and sparse head-raising at night), and highlighting the abnormal head-raising behavior unique to the estrus period.
[0146] The test was conducted on 128 dairy cows across three farms and verified that the accuracy of estrus detection reached 84.2% to 100%, and the recall rate reached 71.1% to 100%. Compared with the traditional method, the specificity was improved by more than 40%, and the false alarm rate was reduced by more than 35%, ensuring the reliability of the test results.
[0147] It should also be noted that this proposed solution requires no manual intervention throughout the entire process from data collection to estrus detection. The neck-mounted sensor can be quickly and mass-produced to automatically collect triaxial acceleration data. Mean filtering, normalization, pitch angle and pitch angle difference calculation, data screening, baseline index calculation, offset calculation, and estrus detection are all automatically executed through algorithms. Once estrus is detected, an alarm can be pushed to the farm management terminal in real time, eliminating the need for staff to conduct 24-hour manual patrols or observe cow behavior. This reduces the labor costs of estrus monitoring on farms and is suitable for the operational scenarios of large-scale farms with "few staff and many cows."
[0148] Figure 9 This is a schematic diagram of the structure of a data processing device for detecting estrus in dairy cows, provided in an embodiment of this application. Figure 9As shown, the data processing device for detecting estrus in dairy cows provided in this embodiment is located in an electronic device. The data processing device 30 for detecting estrus in dairy cows provided in this embodiment includes: an acquisition module 31, a determination module 32, a filtering module 33, and a judgment module 34.
[0149] Specifically, the acquisition module 31 is used to acquire the initial head posture data of the cow and preprocess the initial head posture data to obtain the target posture data; the determination module 32 is used to determine the feature parameters characterizing the static head-raising state of the cow and the difference parameters characterizing the dynamic head-raising changes of the cow based on the target posture data; the filtering module 33 is used to divide the data streams corresponding to the feature parameters and difference parameters into time windows and filter the data to obtain valid data; the determination module 32 is also used to extract valid data within a preset period as benchmark data, and determine the target judgment parameter combination based on the benchmark data, and determine the benchmark behavior index corresponding to the benchmark data; the determination module 32 is also used to determine the real-time behavior index of non-benchmark data based on the target judgment parameter combination, and determine the head-raising behavior offset by comparing the real-time behavior index with the corresponding benchmark behavior index; the judgment module 34 is used to determine that the cow is in estrus when the head-raising behavior offset exceeds the preset estrus judgment threshold.
[0150] Optionally, the acquisition module 31, when acquiring the initial head posture data of the cow and preprocessing the initial head posture data to obtain the target posture data, specifically performs the following: acquiring the initial three-axis acceleration data of the cow's head through a wearable three-axis acceleration acquisition device as the initial head posture data; performing mean filtering on the initial three-axis acceleration data to eliminate noise and instantaneous jitter; and performing normalization processing on the mean-filtered three-axis acceleration data to obtain the target posture data.
[0151] Optionally, the determining module 32, when determining the feature parameters characterizing the static head-raising state of the cow and the difference parameters characterizing the dynamic head-raising changes of the cow based on the target attitude data, is specifically used for: calculating the pitch angle based on the triaxial acceleration components in the target attitude data through the arctangent function, and using the pitch angle as the feature parameter characterizing the static head-raising state of the cow; calculating the difference in pitch angles at adjacent acquisition times, and using the pitch angle difference as the difference parameter characterizing the dynamic head-raising changes of the cow.
[0152] Optionally, the filtering module 33, when dividing the data stream corresponding to the feature parameters and difference parameters into time windows and filtering the data to obtain valid data, specifically performs the following: segmenting the data stream corresponding to the feature parameters and difference parameters according to a preset time length to obtain multiple data windows; calculating the mean, median deviation, and percentage of data points with absolute values of difference parameters greater than preset values within each data window; if the mean is within a preset mean range, the median deviation is within a preset deviation range, and the percentage of data points is not lower than a preset percentage threshold, then the corresponding data window is determined to be a valid data window and retained, and the data within the valid data window is valid data.
[0153] Optionally, the determining module 32, when determining the target determination parameter combination based on the benchmark data, is specifically used for: estimating the kernel density of the feature parameters in the benchmark data to obtain the kernel density distribution of the feature parameters; determining the static determination threshold based on the kernel density distribution of the feature parameters; calculating the discrimination score corresponding to multiple preset dynamic threshold candidate values based on the feature discrimination evaluation function, taking the preset dynamic threshold candidate value with the highest discrimination score as the dynamic determination threshold, and the static determination threshold and the dynamic determination threshold together form the target determination parameter combination.
[0154] Optionally, the determining module 32, when determining the real-time behavior index of non-benchmark data based on the target determination parameter combination, is specifically used for: dividing the data window of non-benchmark data into multiple sub-units of fixed duration; for each sub-unit, determining whether the feature parameters meet the static determination threshold in the target determination parameter combination, and whether the difference parameters meet the dynamic determination threshold in the target determination parameter combination; if so, determining it as a valid head-up event; classifying the weight levels according to the numerical value of the feature parameters corresponding to the valid head-up event; calculating the sum of weighted scores of valid head-up events within the data window corresponding to the non-benchmark data, and using the sum of weighted scores as the real-time behavior index.
[0155] Optionally, when determining the head-up behavior offset by using the real-time behavior index and the corresponding benchmark behavior index, the determining module 32 is specifically used to: extract the benchmark behavior index in the benchmark data that is consistent with the time dimension of the data window of the non-benchmark data; calculate the difference between the real-time behavior index of the data window corresponding to the non-benchmark data and the benchmark behavior index to obtain the head-up behavior offset.
[0156] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, as shown below. Figure 10 As shown, the electronic device 40 provided in this embodiment includes: a processor 41 and a memory 42 communicatively connected to the processor 41.
[0157] The memory 42 stores computer execution instructions; the processor 41 executes the computer execution instructions stored in the memory 42 to implement the method provided in any of the above embodiments.
[0158] The program may include program code, which includes computer-executable instructions. Memory 42 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device.
[0159] In this embodiment, the memory 42 and the processor 41 are connected via a bus. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 10 The bus is represented by a single straight line, but this does not mean that there is only one bus or one type of bus.
[0160] This application also provides a computer-readable storage medium, including computer-executable instructions stored in the computer-readable storage medium, which, when executed by a processor, are used to implement the method provided in any of the above embodiments.
[0161] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method provided in any of the above embodiments.
[0162] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to implement the solution of this embodiment according to actual needs.
[0163] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit composed of the above modules can be implemented in hardware or in the form of hardware plus software functional units.
[0164] The integrated modules described above, implemented as software functional modules, can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods of the various embodiments of this application.
[0165] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.
[0166] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.
[0167] The aforementioned storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0168] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. The processor and storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic control unit or main control device.
[0169] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0170] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A data processing method for detecting estrus in dairy cows, characterized in that, include: Acquire the initial head posture data of the cow and preprocess the initial head posture data to obtain the target posture data; Based on the target posture data, characteristic parameters representing the static head-raising state of the cow and difference parameters representing the dynamic head-raising changes of the cow are determined. The data streams corresponding to the feature parameters and the difference parameters are divided into time windows and filtered to obtain effective data; Extract the effective data within a preset period as benchmark data, and determine the target judgment parameter combination based on the benchmark data, as well as the benchmark behavior index corresponding to the benchmark data; Based on the target determination parameter combination, the real-time behavior index of the non-benchmark data is determined, and the head-up behavior offset is determined by the real-time behavior index and the corresponding benchmark behavior index. If the deviation of the head-raising behavior exceeds the preset estrus determination threshold, the cow is determined to be in estrus.
2. The method according to claim 1, characterized in that, The process of acquiring initial head posture data of the cow and preprocessing the initial head posture data to obtain target posture data includes: Initial triaxial acceleration data of the cow's head is acquired using a wearable triaxial accelerometer and used as the initial head posture data. The initial triaxial acceleration data is subjected to mean filtering to eliminate noise and instantaneous jitter; The three-axis acceleration data processed by mean filtering is normalized to obtain the target attitude data.
3. The method according to claim 2, characterized in that, Based on the target posture data, the characteristic parameters characterizing the static head-raising state of the cow and the difference parameters characterizing the dynamic head-raising changes of the cow are determined, including: Based on the triaxial acceleration components in the target attitude data, the pitch angle is calculated using the arctangent function, and the pitch angle is used as the characteristic parameter characterizing the static head-raising state of the cow. The difference in pitch angle between adjacent acquisition times is calculated, and the pitch angle difference is used as the difference parameter characterizing the dynamic head tilting change.
4. The method according to claim 1, characterized in that, The step of dividing the data stream corresponding to the feature parameters and the difference parameters into time windows and filtering the data to obtain effective data includes: The data streams corresponding to the feature parameters and the difference parameters are segmented according to a preset time length to obtain multiple data windows; Calculate the mean, median deviation, and percentage of data points whose absolute value of the difference parameter is greater than a preset value within each data window; If the mean is within a preset mean range, the median deviation is within a preset deviation range, and the proportion of data points is not lower than a preset proportion threshold, then the corresponding data window is determined to be a valid data window and retained, and the data within the valid data window is the valid data.
5. The method according to claim 1, characterized in that, The determination of the target determination parameter combination based on the benchmark data includes: Kernel density estimation is performed on the feature parameters in the benchmark data to obtain the feature parameter kernel density distribution; The static judgment threshold is determined based on the kernel density distribution of the aforementioned feature parameters; Based on the feature discrimination evaluation function, the discrimination score corresponding to multiple preset dynamic threshold candidate values is calculated. The preset dynamic threshold candidate value with the highest discrimination score is used as the dynamic judgment threshold, and the static judgment threshold and the dynamic judgment threshold together form the target judgment parameter combination.
6. The method according to claim 1, characterized in that, The determination of the real-time behavior index of non-benchmark data based on the target determination parameter combination includes: Divide the data window of non-baseline data into multiple sub-units of fixed duration; For each of the sub-units, it is determined whether the feature parameter satisfies the static judgment threshold in the target judgment parameter combination, and whether the difference parameter satisfies the dynamic judgment threshold in the target judgment parameter combination. If so, it is determined as a valid head-up event. The weight levels are determined based on the numerical values of the feature parameters corresponding to the valid head-up events; Calculate the sum of weighted scores for valid head-up events within the data window corresponding to non-benchmark data, and use the sum of weighted scores as the real-time behavior index.
7. The method according to claim 6, characterized in that, The step of determining the head-up behavior offset by comparing the real-time behavior index with the corresponding baseline behavior index includes: Extract the benchmark behavior index from the benchmark data that is consistent with the time dimension of the data window of the non-benchmark data; The difference between the real-time behavior index of the data window corresponding to the non-baseline data and the baseline behavior index is calculated to obtain the head-up behavior offset.
8. A data processing device for detecting estrus in dairy cows, characterized in that, include: The acquisition module is used to acquire the initial head posture data of the cow and preprocess the initial head posture data to obtain the target posture data. The determination module is used to determine, based on the target posture data, the characteristic parameters characterizing the static head-raising state of the cow and the difference parameters characterizing the dynamic head-raising changes of the cow. The filtering module is used to divide the data stream corresponding to the feature parameters and the difference parameters into time windows and filter the data to obtain effective data. The determining module is further configured to extract the effective data within a preset period as benchmark data, determine the target judgment parameter combination based on the benchmark data, and determine the benchmark behavior index corresponding to the benchmark data. The determining module is also used to determine the real-time behavior index of non-benchmark data based on the target determination parameter combination, and to determine the head-up behavior offset by the real-time behavior index and the corresponding benchmark behavior index. The determination module is used to determine that the cow is in estrus when the head-raising behavior offset exceeds a preset estrus determination threshold.
9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.