Cow oestrus and basic motion detection method, device and equipment and medium
By using computer vision and deep learning technology, a dairy cow estrus detection model was constructed, which solved the image acquisition problem caused by the complex dairy cow breeding environment, improved the accuracy and efficiency of estrus detection, and realized real-time monitoring and efficient detection of dairy cow estrus behavior.
Patent Information
- Application Number
- CN202510608486.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2025-09-23
AI Technical Summary
The complexity of the existing dairy cow breeding environment affects the quality of image acquisition, and the robustness of the dairy cow estrus detection model is poor. The existing technology is difficult to effectively solve the problem that the existing dairy cow estrus detection model is difficult to extract the characteristics of dairy cow estrus mounting behavior, resulting in low detection efficiency and poor effect.
A computer vision-based approach was used to build a dairy cow estrus detection model through image enhancement processing and deep learning technology. The model was trained and validated to improve detection accuracy, including image acquisition, frame processing, sample construction, model training and test optimization.
The accuracy and robustness of estrus detection in dairy cows are improved, and non-contact real-time monitoring of estrus behavior in dairy cows is realized, which reduces detection costs and improves reproductive efficiency and milk production performance.
Smart Images

Figure CN120689901A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of precision animal husbandry technology, and in particular to a method, device, equipment and medium for detecting estrus and basic movements of dairy cows. Background Art
[0002] Healthy dairy cows typically experience estrus between 6 and 12 months of age. Only after experiencing estrus, ovulation, insemination, and healthy embryonic development, and successfully giving birth to a calf, do cows begin producing milk, secreting large quantities of milk. Therefore, the economic benefits of dairy farming are primarily determined by their reproductive capacity, and the estrus detection rate and breeding conception rate, in turn, influence the cow's reproductive performance. Therefore, estrus identification is a crucial step and key element in the entire breeding process. Large-scale farming relies on artificial insemination to increase milk production. Therefore, timely and accurate estrus identification can determine the cow's estrus stage, providing the optimal timing for artificial insemination and ensuring timely breeding. This allows for timely conception, calving, and prolonged lactation, thereby improving reproductive efficiency and milk production while reducing farming costs. At the same time, since healthy dairy cows of appropriate age generally have periodic estrus, if dairy cows have uterine inflammation, hormone disorders, physiological defects and other problems, it will affect the normal estrus and reproduction of dairy cows. Therefore, in dairy cow breeding management, it is of great significance to monitor the estrus behavior of dairy cows.
[0003] The earliest basis for determining estrus in dairy cows was through body temperature detection. Since the error of judgment based on temperature alone is very large, subsequent research has added step counting or three-coordinate motion acceleration cluster analysis to extract the characteristics of greater exercise volume in estrus cows. Currently, there is technology for monitoring estrus in dairy cows using images, but the existing image monitoring estrus recognition background is a single background in an experimental environment. According to field surveys of dairy farms, dairy cows are raised in a natural environment. The external natural light conditions change constantly throughout the day, and weather factors such as fog, haze, and rain have a great impact on the quality of video surveillance images of cows. Light changes and bad weather will also greatly shorten the effective video distance of monitoring, making the collected images blurred and the quality reduced, thereby affecting the further recognition and processing of cow video surveillance images. Furthermore, traditional machine learning is not easy to extract the characteristics of estrus cow mounting behavior, and there are problems with poor universality and robustness in cow estrus detection. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method, device, equipment and medium for detecting estrus and basic movements of dairy cows, so as to solve the problems in the prior art that the complex dairy cow breeding environment affects the image recognition, the existing dairy cow estrus detection model is difficult to extract the estrus mounting behavior characteristics of dairy cows, and the detection efficiency is low and the effect is poor.
[0005] In a first aspect, the present invention provides a method for detecting estrus and basic movements of dairy cows, comprising the following steps:
[0006] S1: Collect videos of cow activities, extract images by frame, and then perform image enhancement processing based on lighting and weather conditions and camera recording conditions;
[0007] S2. Construct positive samples and negative samples; the positive samples are manually selected images of different estrus behaviors, and the negative samples are manually selected images of different non-estrus behaviors, such as standing, lying, drinking, eating, and walking; randomly extract samples from the positive samples and the negative samples to construct a training set, a validation set, and a test set;
[0008] S3, training a dairy cow estrus detection model, inputting the training set and the validation set into the neural network of the dairy cow estrus detection model for training and parameter verification, and using the test set to verify the model training effect;
[0009] S4. The trained dairy cow estrus detection model is put into a real environment for testing to obtain the optimal model of the dairy cow estrus detection model and generate a standard data set.
[0010] Furthermore, the ratio of the positive samples to the negative samples is 2:1; 80% of the positive samples and the negative samples are randomly extracted to construct a training set, 20% are constructed as a validation set, and the remaining positive samples after extraction are constructed as a test set.
[0011] Furthermore, the cow estrus detection model training is specifically as follows:
[0012] S01. Input the data values of the training set and the validation set into the neural network for forward propagation to obtain a score. Specifically, the data value is input into each neuron of the neural network, weighted and accumulated, and then input into the activation function to obtain an output value, which is the score.
[0013] S02. Setting an expected value, inputting the score into an error function, comparing the score with the expected value to obtain at least one error, summing the at least one error to obtain an error sum, and using the error sum to determine the degree of recognition of the cow estrus behavior by the cow estrus detection model;
[0014] S03, reversely deriving the error function and each activation function in the neural network to obtain a gradient vector for each neuron;
[0015] S04. Update the data value of each neuron input using the gradient vector, wherein the updating method is: if the current gradient vector is negative and has a large absolute value, reduce the data value; if the gradient vector of the data value is positive, increase the data value;
[0016] S05. Determine whether the number of cycles reaches the set number, or whether the average value of the error sum no longer decreases. If so, obtain the final cow estrus detection model. If not, input the updated data value into the neural network forward propagation to obtain a score, and repeat steps S02 to S04.
[0017] Furthermore, the step S4 is specifically as follows:
[0018] The evaluation indicators used are F1, mAP, P, and R in descending order of priority; F1, mAP, P, and R are F1 score, mean average precision, precision, and recall respectively;
[0019] Record the curves of the evaluation indicators of the dairy cow estrus detection model changing with the iteration cycle during the test;
[0020] Refer to the four evaluation indicators of F1, mAP, P, and R, and select the cow estrus detection model with the highest F1 value and save it as the optimal model of the cow estrus detection model;
[0021] Check the data values of the optimal model:
[0022] Determine whether the description of the object being measured, the description of the measurement method, the correct measurement method, and the traceability of uncertainty are met. If not, reject; if so, proceed to the next step;
[0023] Determine whether the accuracy and reproducibility are met. If not, list it as reference data; if so, proceed to the next step;
[0024] Determine whether consistency is met. If so, proceed to the next step;
[0025] Conduct expert review and build a standard data set for the data values that pass the expert review.
[0026] In a second aspect, the present invention provides a device for detecting estrus and basic movements of dairy cows, which is characterized by comprising:
[0027] The image sampling and enhancement module collects videos of cow activities, extracts images by frame, and then performs image enhancement processing based on lighting and weather conditions and camera recording conditions;
[0028] A data set establishment module constructs positive samples and negative samples; the positive samples are manually selected images of different estrus behaviors, and the negative samples are manually selected images of different non-estrus behaviors, such as standing, lying, drinking, eating, and walking; samples are randomly extracted from the positive and negative samples to construct training sets, validation sets, and test sets;
[0029] A cow estrus detection model training module inputs the training set and the validation set into the neural network of the cow estrus detection model for training and parameter verification, and uses the test set to verify the model training effect;
[0030] The model testing and optimization module tests the trained dairy cow estrus detection model in a real environment to obtain the optimal model of the dairy cow estrus detection model and generate a standard data set.
[0031] Furthermore, the ratio of the positive samples to the negative samples is 2:1; 80% of the positive samples and the negative samples are randomly extracted to construct a training set, 20% are constructed as a validation set, and the remaining positive samples after extraction are constructed as a test set.
[0032] Furthermore, the cow estrus detection model training is specifically as follows:
[0033] S01. Input the data values of the training set and the validation set into the neural network for forward propagation to obtain a score. Specifically, the data value is input into each neuron of the neural network, weighted and accumulated, and then input into the activation function to obtain an output value, which is the score.
[0034] S02. Setting an expected value, inputting the score into an error function, comparing the score with the expected value to obtain at least one error, summing the at least one error to obtain an error sum, and using the error sum to determine the degree of recognition of the cow estrus behavior by the cow estrus detection model;
[0035] S03, reversely deriving the error function and each activation function in the neural network to obtain a gradient vector for each neuron;
[0036] S04. Update the data value of each neuron input using the gradient vector, wherein the updating method is: if the current gradient vector is negative and has a large absolute value, reduce the data value; if the gradient vector of the data value is positive, increase the data value;
[0037] S05. Determine whether the number of cycles reaches the set number, or whether the average value of the error sum no longer decreases. If so, obtain the final cow estrus detection model. If not, input the updated data value into the neural network forward propagation to obtain a score, and repeat steps S02 to S04.
[0038] Furthermore, the step S4 is specifically as follows:
[0039] The evaluation indicators used are F1, mAP, P, and R in descending order of priority; F1, mAP, P, and R are F1 score, mean average precision, precision, and recall respectively;
[0040] Record the curves of the evaluation indicators of the dairy cow estrus detection model changing with the iteration cycle during the test;
[0041] Refer to the four evaluation indicators of F1, mAP, P, and R, and select the cow estrus detection model with the highest F1 value and save it as the optimal model of the cow estrus detection model;
[0042] Check the data values of the optimal model:
[0043] Determine whether the description of the object being measured, the description of the measurement method, the correct measurement method, and the traceability of uncertainty are met. If not, reject; if so, proceed to the next step;
[0044] Determine whether the accuracy and reproducibility are met. If not, list it as reference data; if so, proceed to the next step;
[0045] Determine whether consistency is met. If so, proceed to the next step;
[0046] Conduct expert review and build a standard data set for the data values that pass the expert review.
[0047] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.
[0048] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the method described in the first aspect when the program is executed by a processor.
[0049] One or more technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages:
[0050] 1. The present invention provides a method, device, equipment, and medium for detecting estrus and basic movements of dairy cows. The method identifies estrus behavior of cows based on computer vision and performs image enhancement processing according to different lighting and weather conditions, so that the collected video data has less noise and low blur.
[0051] 2. Based on deep learning technology, the present invention constructs a detection model specifically for identifying estrus behavior of dairy cows by analyzing the external mounting behavior characteristics of dairy cows in estrus. At the same time, it can also detect and study other postures of dairy cows, improve the accuracy of estrus identification of dairy cows, and realize non-contact real-time monitoring of dairy cow mounting behavior in estrus.
[0052] 3. The present invention controls the quality of milk from the source, combining intelligence and manual labor, which not only saves costs but also improves efficiency and quality.
[0053] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0055] Figure 1 This is a flowchart of the method in Example 1 of the present invention;
[0056] Figure 2 This is a schematic diagram of the structure of the device in Example 2 of the present invention. DETAILED DESCRIPTION
[0057] The embodiments of the present application provide a method, device, equipment and medium for detecting estrus and basic movements of dairy cows, thereby solving the problems in the prior art of complex dairy cow breeding environment affecting image recognition, difficulty in extracting the estrus mounting behavior characteristics of dairy cows in existing dairy cow estrus detection models, low detection efficiency and poor results.
[0058] Example 1
[0059] like Figure 1 As shown, this embodiment provides a method for detecting estrus and basic movements of dairy cows, comprising the following steps:
[0060] S1. Collect videos of cow activities, extract images by frame processing, and then perform image enhancement processing based on lighting and weather conditions and camera recording conditions. Specifically, the cameras in the dairy farm activity area capture and collect partial video images of different time periods, different weather conditions, different video angles, and different camera resolutions for research. The images collected by video monitoring are divided into early morning, morning, noon, afternoon, evening, night, cloudy days, foggy days, etc. for enhancement processing;
[0061] In the early morning and evening, sunlight becomes weaker, resulting in darker images, sudden changes in illumination, and the appearance of bright and dark areas. On cloudy, foggy, or hazy days, images are generally darker, blurry, with poor contrast and color pollution. At night, to reduce stress and discomfort in cows, the light in the dairy farm is weaker, so cameras are generally monitored in infrared mode, resulting in blurred images. In the clear afternoon, sunlight is stronger, resulting in strong reflected light or shadows on the surface of the images.
[0062] By analyzing video images collected from dairy farms under different lighting and meteorological conditions, it was found that lighting has a certain impact on the recognition of images, so data enhancement of the collected images is required. The present invention adopts an image enhancement algorithm based on dual-domain decomposition, and uses dual-domain filtering to replace the Gaussian filtering of the traditional algorithm.
[0063] S2. Construct positive and negative samples; the positive samples are manually selected images of different estrus behaviors, and the negative samples are manually selected images of different non-estrus behaviors, such as standing, lying, drinking, eating, and walking; the ratio of positive to negative samples is 2:1; 80% of the positive and negative samples are randomly selected to form a training set, 20% are selected to form a validation set, and the remaining positive samples are used to form a test set;
[0064] Manual selection can avoid the monotony of samples and can also select images of different mounting postures with estrus behavior to make the trained network more robust.
[0065] In order to verify the recognition performance of the model, the constructed training data and test data do not overlap.
[0066] S3, training a dairy cow estrus detection model, inputting the training set and the validation set into the neural network of the dairy cow estrus detection model for training and parameter verification, and using the test set to verify the model training effect;
[0067] The cow estrus detection model training is specifically as follows:
[0068] S01. Input the data values of the training set and the validation set into the neural network for forward propagation to obtain a score. Specifically, the data value is input into each neuron of the neural network, weighted and accumulated, and then input into the activation function to obtain an output value, which is the score.
[0069] S02. Setting an expected value, inputting the score into an error function (regularization penalty to prevent overfitting), comparing the score with the expected value to obtain at least one error, summing the at least one error to obtain an error sum, and using the error sum to determine the degree of recognition of the cow estrus detection model for the cow estrus behavior. The smaller the recognition degree loss value, the better.
[0070] S03, reversely deriving the error function and each activation function in the neural network (the ultimate goal is to minimize the error sum) to obtain the gradient vector of each neuron;
[0071] S04, updating the data value of each neuron input by the gradient vector, with the purpose of adjusting the error toward 0 or convergence;
[0072] The updating method is: if the current gradient vector is negative and has a large absolute value, then the data value is reduced; if the gradient vector of the data value is positive, then the data value is increased (updating in the opposite direction of the gradient vector to minimize the loss);
[0073] S05. Determine whether the number of cycles reaches the set number, or whether the average value of the error sum no longer decreases (obtain the lowest point of the error sum value). If so, obtain the final cow estrus detection model. If not, input the updated data value into the neural network forward propagation to obtain a score, and repeat steps S02 to S04.
[0074] S4. The trained dairy cow estrus detection model is put into the real environment of the cowshed for testing and called on the hardware equipment. To better evaluate the performance of the model, it is necessary to clarify the priority of each evaluation indicator, specifically:
[0075] The evaluation indicators used are F1, mAP, P, and R in descending order of priority;
[0076] The mAP is the mean average precision, which is a commonly used indicator for multi-category target detection;
[0077] The P is the precision rate, P = TPTP + FPP = \frac{\text{TP}}{\text{TP}+
[0078] FP = TP + FPTP, where TP is the number of positive samples correctly predicted by the model, and FP is the number of negative samples incorrectly predicted by the model.
[0079] The R is the recall rate, R = TPTP + FNR = \frac{\text{TP}}{\text{TP}+
[0080] FN R = TP + FNTP, where FN is the number of positive samples that the model incorrectly predicts as negative.
[0081] The F1 is the F1 score, that is, the harmonic mean of the comprehensive precision and recall rate, F1=2×P×RP+RF1=2\times\frac{P\times R}{P+R}F1=2×P+RP×R;
[0082] Record the curves of the evaluation indicators of the dairy cow estrus detection model changing with the iteration cycle during the test;
[0083] Refer to the four evaluation indicators of F1, mAP, P, and R, and select the cow estrus detection model with the highest F1 value and save it as the optimal model of the cow estrus detection model;
[0084] At this point, the model has the highest F1 and accuracy, as well as high mAP and recall.
[0085] If the cows are not in estrus when the test is completed, it is difficult to verify whether the model is accurate and effective. Therefore, it is necessary to record videos during the estrus period for later verification.
[0086] After obtaining the optimal model for the cow estrus detection model, a standard data set is generated, specifically:
[0087] Check the data values of the optimal model:
[0088] Determine whether the description of the object being measured, the description of the measurement method, the correct measurement method, and the traceability of uncertainty are met. If not, reject; if so, proceed to the next step;
[0089] Determine whether the accuracy and reproducibility are met. If not, list it as reference data; if so, proceed to the next step;
[0090] Determine whether consistency is met. If so, proceed to the next step;
[0091] Conduct expert review and build a standard data set for the data values that pass the expert review.
[0092] Based on the same inventive concept, this application also provides a device corresponding to the method in Example 1, see Example 2 for details.
[0093] Example 2
[0094] like Figure 2 As shown, in this embodiment, a device for detecting estrus and basic movements of dairy cows is provided, comprising:
[0095] The image sampling and enhancement module collects videos of cow activities, extracts images by frame through the image processing system, and then performs image enhancement processing based on lighting and weather conditions and camera recording conditions;
[0096] A data set establishment module constructs positive samples and negative samples; the positive samples are manually selected images of different estrus behaviors, and the negative samples are manually selected images of different non-estrus behaviors, such as standing, lying, drinking, eating, and walking; samples are randomly extracted from the positive and negative samples to construct training sets, validation sets, and test sets;
[0097] A cow estrus detection model training module inputs the training set and the validation set into the neural network of the cow estrus detection model for training and parameter verification, and uses the test set to verify the model training effect;
[0098] The model testing and optimization module tests the trained dairy cow estrus detection model in a real environment to obtain the optimal model of the dairy cow estrus detection model and generate a standard data set.
[0099] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to the first embodiment, see the third embodiment for details.
[0100] Example 3
[0101] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any implementation method in the first embodiment can be implemented.
[0102] Since the electronic device described in this embodiment is the device used to implement the method in Example 1 of this application, based on the method described in Example 1 of this application, those skilled in the art will be able to understand the specific implementation of the electronic device of this embodiment and its various variations. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. As long as the device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection to be provided by this application.
[0103] Based on the same inventive concept, this application provides a storage medium corresponding to Example 1, see Example 4 for details.
[0104] Example 4
[0105] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any implementation method in the first embodiment can be implemented.
[0106] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, devices, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0107] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0108] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0109] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0110] Although the specific embodiments of the present invention are described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. A method for detecting estrus and basic movements of dairy cows, characterized in that: The following steps are involved: S1: Collect videos of cow activities, extract images by frame, and then perform image enhancement processing based on lighting and weather conditions and camera recording conditions; S2. Construct positive samples and negative samples; the positive samples are manually selected images of different estrus behaviors, and the negative samples are manually selected images of different non-estrus behaviors, such as standing, lying, drinking, eating, and walking; randomly extract samples from the positive samples and the negative samples to construct a training set, a validation set, and a test set; S3, training a dairy cow estrus detection model, inputting the training set and the validation set into the neural network of the dairy cow estrus detection model for training and parameter verification, and using the test set to verify the model training effect; S4. The trained dairy cow estrus detection model is put into a real environment for testing to obtain the optimal model of the dairy cow estrus detection model and generate a standard data set.
2. A method for detecting estrus and basic movements of dairy cows according to claim 1, characterized in that: The ratio of the positive samples to the negative samples is 2:1; 80% of the positive samples and the negative samples are randomly extracted to form a training set, 20% are used to form a validation set, and the remaining positive samples are used to form a test set.
3. A method for detecting estrus and basic movements of dairy cows according to claim 1, characterized in that: The cow estrus detection model training is specifically as follows: S01. Input the data values of the training set and the validation set into the neural network for forward propagation to obtain a score. Specifically, the data value is input into each neuron of the neural network, weighted and accumulated, and then input into the activation function to obtain an output value, which is the score. S02. Setting an expected value, inputting the score into an error function, comparing the score with the expected value to obtain at least one error, summing the at least one error to obtain an error sum, and using the error sum to determine the degree of recognition of the cow estrus behavior by the cow estrus detection model; S03, reversely deriving the error function and each activation function in the neural network to obtain a gradient vector for each neuron; S04. Update the data value of each neuron input using the gradient vector, wherein the updating method is: if the current gradient vector is negative and has a large absolute value, reduce the data value; if the gradient vector of the data value is positive, increase the data value; S05. Determine whether the number of cycles reaches the set number, or whether the average value of the error sum no longer decreases. If so, obtain the final cow estrus detection model. If not, input the updated data value into the neural network forward propagation to obtain a score, and repeat steps S02 to S04.
4. A method for detecting estrus and basic movements of dairy cows according to claim 1, characterized in that: The step S4 is specifically as follows: The evaluation indicators used are F1, mAP, P, and R in descending order of priority; F1, mAP, P, and R are F1 score, mean average precision, precision, and recall respectively; Record the curves of the evaluation indicators of the dairy cow estrus detection model changing with the iteration cycle during the test; Refer to the four evaluation indicators of F1, mAP, P, and R, and select the cow estrus detection model with the highest F1 value and save it as the optimal model of the cow estrus detection model; Check the data values of the optimal model: Determine whether the description of the object being measured, the description of the measurement method, the correct measurement method, and the traceability of uncertainty are met. If not, reject; if so, proceed to the next step; Determine whether the accuracy and reproducibility are met. If not, list it as reference data; if so, proceed to the next step; Determine whether consistency is met. If so, proceed to the next step; Conduct expert review and build a standard data set for the data values that pass the expert review.
5. A device for detecting estrus and basic movements of dairy cows, characterized in that: Includes the following modules: The image sampling and enhancement module collects videos of cow activities, extracts images by frame, and then performs image enhancement processing based on lighting and weather conditions and camera recording conditions; A data set establishment module constructs positive samples and negative samples; the positive samples are manually selected images of different estrus behaviors, and the negative samples are manually selected images of different non-estrus behaviors, such as standing, lying, drinking, eating, and walking; samples are randomly extracted from the positive and negative samples to construct training sets, validation sets, and test sets; A cow estrus detection model training module inputs the training set and the validation set into the neural network of the cow estrus detection model for training and parameter verification, and uses the test set to verify the model training effect; The model testing and optimization module tests the trained dairy cow estrus detection model in a real environment to obtain the optimal model of the dairy cow estrus detection model and generate a standard data set.
6. The device for detecting estrus and basic movements of dairy cows according to claim 5, characterized in that: The ratio of the positive samples to the negative samples is 2:1; 80% of the positive samples and the negative samples are randomly extracted to form a training set, 20% are used to form a validation set, and the remaining positive samples are used to form a test set.
7. The device for detecting estrus and basic movements of dairy cows according to claim 5, characterized in that: The cow estrus detection model training is specifically as follows: S01. Input the data values of the training set and the validation set into the neural network for forward propagation to obtain a score. Specifically, the data value is input into each neuron of the neural network, weighted and accumulated, and then input into the activation function to obtain an output value, which is the score. S02. Setting an expected value, inputting the score into an error function, comparing the score with the expected value to obtain at least one error, summing the at least one error to obtain an error sum, and using the error sum to determine the degree of recognition of the cow estrus behavior by the cow estrus detection model; S03, reversely deriving the error function and each activation function in the neural network to obtain a gradient vector for each neuron; S04. Update the data value of each neuron input using the gradient vector, wherein the updating method is: if the current gradient vector is negative and has a large absolute value, reduce the data value; if the gradient vector of the data value is positive, increase the data value; S05. Determine whether the number of cycles reaches the set number, or whether the average value of the error sum no longer decreases. If so, obtain the final cow estrus detection model. If not, input the updated data value into the neural network forward propagation to obtain a score, and repeat steps S02 to S04.
8. The device for detecting estrus and basic movements of dairy cows according to claim 5, characterized in that: The step S4 is specifically as follows: The evaluation indicators used are F1, mAP, P, and R in descending order of priority; F1, mAP, P, and R are F1 score, mean average precision, precision, and recall respectively; Record the curves of the evaluation indicators of the dairy cow estrus detection model changing with the iteration cycle during the test; Refer to the four evaluation indicators of F1, mAP, P, and R, and select the cow estrus detection model with the highest F1 value and save it as the optimal model of the cow estrus detection model; Check the data values of the optimal model: Determine whether the description of the object being measured, the description of the measurement method, the correct measurement method, and the traceability of uncertainty are met. If not, reject; if so, proceed to the next step; Determine whether the accuracy and reproducibility are met. If not, list it as reference data; if so, proceed to the next step; Determine whether consistency is met. If so, proceed to the next step; Conduct expert review and build a standard data set for the data values that pass the expert review.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.