Determination method, application method and related device of dairy cow heat stress identification model
Through video analysis and machine learning algorithms, identify the behavior and body temperature data of cows, and establish a model of dairy cow thermal stress, solve the accuracy and real -time problems of dairy cow thermal stress monitoring, realize high -efficiency heat Stress early warning and management.
Patent Information
- Application Number
- CN202411620473.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-11-14
AI Technical Summary
The prior art is difficult to accurately monitor and identify the heat stress status of dairy cows, and traditional methods lack real-time and accuracy, making it difficult to warning in advance.
By obtaining the video video of dairy cows, extract images in frame, use the YOLOV5 algorithm to identify dairy chest and abdomen behavior, extract contour characteristics and breathing depth features, combine with body temperature predictive models, train machine learning algorithms, and establish dairy cow thermal judgment models.
The accurate identification and early warning of the thermal stress state of dairy cows can be realized, which can monitor the degree of thermal stimulus of dairy cows in real time and in contact, and improve the efficiency of breeding and the welfare level of dairy cows.
Smart Images

Figure CN119152546B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of animal husbandry, and in particular to a method for determining a dairy cow heat stress identification model, an application method and related devices. Background Art
[0002] Heat stress in dairy cows is an important issue facing modern animal husbandry. It has serious harm to the physiology and production performance of dairy cows. Physiologically, it causes faster respiratory rate, higher body temperature, lower feed intake, lower immunity, etc. In production, it reduces milk production and quality, causing economic losses. The heat stress environment makes dairy cows uncomfortable, reduces their quality of life, and shows abnormal behaviors, such as frequent standing, reflecting their pain. A good breeding environment is crucial to alleviating heat stress. Improving ventilation and cooling conditions in cowsheds can reduce the probability of heat stress and improve the welfare level of dairy cows.
[0003] Traditional methods for monitoring heat stress in dairy cows have many limitations. There are many problems in determining heat stress in dairy cows. Traditional heat stress assessment is often carried out after the cow has entered a state of heat stress, and it is difficult to provide early warning. It is usually necessary to comprehensively consider multiple conditions such as external environmental factors, feeding time, respiratory rate, skin temperature, etc. to conduct an assessment. However, these conditions are difficult to accurately grasp in practical applications, and this assessment method has a low group observation coefficient, lacks real-time performance, and has low breeding efficiency. In addition, traditional environmental monitoring methods can only obtain basic information such as environmental temperature and humidity, and cannot directly reflect the heat stress of individual dairy cows.
[0004] Therefore, how to accurately monitor and identify heat stress in dairy cows has become a technical problem that urgently needs to be solved in this field. Summary of the invention
[0005] The purpose of the present invention is to provide a method for determining a dairy cow heat stress identification model, an application method and a related device, which can accurately identify whether a dairy cow is heat stressed and the degree of heat stress.
[0006] To achieve the above object, the present invention provides the following solution.
[0007] In a first aspect, the present invention provides a method for determining a dairy cow heat stress recognition model, and the method for determining a dairy cow heat stress recognition model comprises:
[0008] A cow thermal environment video is obtained; the cow thermal environment video includes: behavior data and environmental parameters of various parts of the cow's body.
[0009] The cow thermal environment video is frame-by-frame extracted to obtain a cow thermal environment image.
[0010] The cow thermal environment image is input into a recognizing model of a lying cow to obtain a cow chest and abdomen behavior image; the recognizing model of a lying cow is a model constructed based on a YOLOv5 algorithm; the cow chest and abdomen behavior image includes: an image of the contraction and relaxation state of the chest and abdomen when the cow breathes.
[0011] Based on the cow's chest and abdomen behavior images, characteristic parameters of the cow's chest and abdomen fluctuation behavior in a thermal environment are determined; the characteristic parameters of the cow's chest and abdomen fluctuation behavior in a thermal environment include: contour features and breathing depth features; the contour features are features obtained based on a Canny edge detection algorithm; the breathing depth features include: duration of the cow's breathing behavior in a thermal environment, duration of a breathing cycle, breathing depth, average amplitude of change per breath, breathing frequency, and variability and homogeneity of distribution of breathing behavior characteristic parameters.
[0012] Based on the characteristic parameters of chest and abdomen fluctuation behavior in the cow's thermal environment and the cow's body temperature prediction model, the cow's body temperature data is determined; the cow's body temperature prediction model associates the body temperature data with the respiratory rate.
[0013] The characteristic parameters of the chest and abdomen undulation behavior of the cow in the thermal environment and the body temperature data of the cow are used as input, and the heat stress degree of the cow is used as output, and a machine learning algorithm is trained to obtain a cow heat stress recognition model; the heat stress degree of the cow includes: no heat stress, mild heat stress, moderate heat stress, severe heat stress and dangerous heat stress.
[0014] In a second aspect, the present invention provides an application method of a dairy cow heat stress recognition model, and the application method of the dairy cow heat stress recognition model comprises:
[0015] A thermal environment video of a cow to be identified is obtained; the thermal environment video of the cow to be identified includes: behavioral data and environmental parameters of various parts of the cow's body.
[0016] The thermal environment video of the cow to be identified is subjected to frame extraction to obtain a thermal environment image of the cow to be identified.
[0017] The thermal environment image of the cow to be identified is input into the recognition model of the lying cow to obtain the chest and abdomen behavior image of the cow to be identified; the recognition model of the lying cow is a model built based on the YOLOv5 algorithm; the chest and abdomen behavior image of the cow to be identified includes: images of the contraction and relaxation states of the chest and abdomen of the cow to be identified when breathing.
[0018] Based on the chest and abdomen behavior images of the cow to be identified, characteristic parameters of the chest and abdomen fluctuation behavior of the cow to be identified in a thermal environment are determined; the characteristic parameters of the chest and abdomen fluctuation behavior of the cow to be identified in a thermal environment include: contour features and breathing depth features; the contour features are features obtained based on the Canny edge detection algorithm; the breathing depth features include: the duration of the breathing behavior of the cow to be identified in a thermal environment, the duration of the breathing cycle, the breathing depth, the average amplitude of each breath change, the breathing frequency, and the variability and homogeneity of the distribution of the breathing behavior characteristic parameters.
[0019] Based on the chest and abdomen fluctuation behavior characteristic parameters of the cow to be identified in the thermal environment and the cow body temperature prediction model, the body temperature data of the cow to be identified is determined; the cow body temperature prediction model associates the body temperature data with the respiratory rate.
[0020] The characteristic parameters of the chest and abdomen undulation behavior of the cow to be identified in the thermal environment and the body temperature data of the cow to be identified are input into the cow heat stress identification model to obtain the heat stress degree of the cow to be identified; the cow heat stress identification model is a model trained based on the determination method of the cow heat stress identification model described above.
[0021] In a third aspect, the present invention provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement any of the above-mentioned methods for determining a dairy cow heat stress identification model or the method for applying a dairy cow heat stress identification model.
[0022] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-mentioned methods for determining a dairy cow heat stress identification model or the application method of a dairy cow heat stress identification model.
[0023] In a fifth aspect, the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the above-mentioned methods for determining a dairy cow heat stress identification model or the application method of a dairy cow heat stress identification model.
[0024] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0025] The present invention provides a method for determining a cow heat stress identification model, an application method and a related device. The method for determining a cow heat stress identification model comprises: acquiring a cow thermal environment video; performing frame extraction on the cow thermal environment video to obtain a cow thermal environment image; inputting the cow thermal environment image into a recognition model of a lying cow to obtain a cow chest and abdomen behavior image; determining cow chest and abdomen fluctuation behavior characteristic parameters under a cow thermal environment based on the cow chest and abdomen behavior image; determining cow body temperature data based on the cow chest and abdomen fluctuation behavior characteristic parameters under a cow thermal environment and a cow body temperature prediction model; taking the cow chest and abdomen fluctuation behavior characteristic parameters under a cow thermal environment and the cow body temperature data as input and taking the cow heat stress degree as output, training a machine learning algorithm to obtain a cow heat stress identification model. The present invention can accurately identify the frequency and depth of chest and abdominal cavity fluctuations of cows in a lying state. Through non-contact and stress-free real-time automatic recognition technology, a large amount of data is collected to extract key parameters based on individual performance, and differences in performance under stress state are established, classified and summarized to form standards. In addition, the early warning device is coupled to achieve the purpose of judging whether there is heat stress and the degree of heat stress through the behavior of cows in a hot environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 A schematic flow chart of a method for determining a dairy cow heat stress identification model provided by one embodiment of the present invention.
[0028] Figure 2 A schematic diagram of the YOLOv5 model training results provided by an embodiment of the present invention.
[0029] Figure 3 A schematic diagram of extracting a binary image of a cow's abdomen provided by an embodiment of the present invention.
[0030] Figure 4 A flowchart of genetic algorithm, differential evolution, particle swarm optimization, and Bayesian optimization provided by one embodiment of the present invention.
[0031] Figure 5 A schematic flow chart of an application method of a dairy cow heat stress identification model provided in one embodiment of the present invention.
[0032] Figure 6 A schematic diagram of the structure of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0035] The sources of heat production in dairy cows include basal metabolism, rumen fermentation, growth, lactation, and pregnancy. The metabolic heat production is large, but the relative heat dissipation capacity is insufficient. When the ambient temperature exceeds a certain range, the deep body temperature of dairy cows is prone to rise, which in turn leads to a series of production performance impairments and animal welfare issues, such as decreased milk production, changes in milk composition, reduced reproduction rate, and mastitis. THI estimates potential heat stress by measuring ambient temperature and humidity. It is currently the most authoritative method for assessing heat stress in the world. When THI < 68, dairy cows have no heat stress; 68 ≤ THI < 74 is mild heat stress; 74 ≤ THI < 79 is moderate heat stress; 79 ≤ THI < 84 is severe heat stress; 84 ≤ THI < 90 is dangerous heat stress; when THI ≥ 100, cows may die. Timely determination and warning of whether dairy cows are in heat stress and intervention and regulation are the focus of current production research. Traditional heat stress identification methods are mainly divided into two types: external manifestations and blood manifestations. External manifestations are usually measured by measuring anal temperature and observing respiratory rate. Blood manifestations are determined by collecting blood from cows and measuring blood biochemical indicators and antioxidant-related indicators. Relative deep body temperature includes vaginal temperature and rectal temperature. Cows are large animals and need to be restrained before measurement. Blood measurement requires restraint and collection on the one hand, and it also takes a certain amount of time to detect the results. Respiratory rate is the easiest indicator to obtain and has obvious manifestations. Cows cause chest and abdominal undulations during breathing. In a high temperature environment, cows will speed up their breathing rate to speed up the body's heat dissipation. At the same time, in a hot environment, they usually lie in a cool place to reduce heat production. Noon is the hottest time of the day. This is the time for cows to rest after eating. The chest and abdomen of cows lying down change significantly, and most cows will lie in the bed to rest. In view of this, the present invention establishes a "determination method, application method and related device for the heat stress identification model of dairy cows" based on computer vision technology to accurately identify the frequency and depth of chest and abdominal fluctuations of dairy cows in a lying state. Through non-contact and stress-free real-time automatic identification technology, a large amount of data is collected to extract key parameters based on individual performance, and the difference in performance under stress state is established, classified and summarized, and a standard is formed, and an early warning device is coupled to achieve the purpose of judging whether there is heat stress and the degree of heat stress through the behavior of dairy cows in a hot environment.
[0036] In an exemplary embodiment, Figure 1 As shown, a method for determining a dairy cow heat stress identification model is provided, comprising the following steps.
[0037] A1: Obtain a cow thermal environment video; the cow thermal environment video includes: behavior data and environmental parameters of various parts of the cow's body.
[0038] A2: Extract frames from the cow thermal environment video to obtain a cow thermal environment image.
[0039] A3: Input the cow thermal environment image into the recognizing model of the lying cow to obtain the cow chest and abdomen behavior image; the recognizing model of the lying cow is a model constructed based on the YOLOv5 algorithm; the cow chest and abdomen behavior image includes: images of the contraction and relaxation states of the chest and abdomen when the cow breathes.
[0040] A4: Based on the cow's chest and abdomen behavior images, determine the cow's chest and abdomen fluctuation behavior characteristic parameters in a thermal environment; the cow's chest and abdomen fluctuation behavior characteristic parameters in a thermal environment include: contour features and breathing depth features; the contour features are features obtained based on the Canny edge detection algorithm; the breathing depth features include: the duration of the cow's breathing behavior in a thermal environment, the duration of the breathing cycle, the breathing depth, the average amplitude of each breath change, the breathing frequency, and the variability and homogeneity of the distribution of the breathing behavior characteristic parameters.
[0041] A5: Based on the characteristic parameters of the chest and abdomen fluctuation behavior of the cow in the thermal environment and the cow body temperature prediction model, the cow body temperature data is determined; the cow body temperature prediction model associates the body temperature data with the respiratory rate.
[0042] A6: Using the characteristic parameters of the chest and abdomen undulation behavior of the cow in the thermal environment and the body temperature data of the cow as input and the heat stress degree of the cow as output, the machine learning algorithm is trained to obtain a cow heat stress identification model; the heat stress degree of the cow includes: no heat stress, mild heat stress, moderate heat stress, severe heat stress and dangerous heat stress.
[0043] By implementing the above steps A1 to A6, by real-time monitoring of changes in the cow's abdomen and calculating and analyzing the cow's respiratory rate, it is possible to promptly warn of heat stress in the cow and intelligently remind managers to take corresponding measures, thereby reducing unnecessary losses in the farm and providing technical support for smart dairy cow farming.
[0044] In an exemplary embodiment, step A1 specifically includes:
[0045] Video shooting: In the cowshed with a hot environment, select multiple key locations and use a camera with a resolution of 1920×1080 and a frame rate of 25fps to shoot videos of cows. The video shooting angles cover all parts of the cow's body, focusing on the chest and abdomen. The shooting time should cover different time periods of the cow's daily activities to obtain comprehensive behavioral data.
[0046] Environmental parameter recording: A temperature sensor with an accuracy of ±0.5°C and a humidity sensor with an accuracy of ±3%RH are used to collect environmental temperature and humidity data. Professional blood testing equipment is used to obtain the cortisol level in the blood with a detection accuracy of ±0.01μg / dL. The temperature and humidity changes in the cowshed are recorded in real time, and the recording frequency is synchronized with the video acquisition time to ensure the temporal correspondence between environmental data and cow behavior data. These environmental parameters will serve as important reference factors for subsequent analysis.
[0047] In another exemplary embodiment of the present invention, in step A3, the method for determining the identification model of the lying cow specifically includes:
[0048] A31: Based on the cow thermal environment video, construct a data set; the data set includes: a cow thermal environment image and corresponding cow chest and abdominal behavior images.
[0049] A32: Using the cow thermal environment image as input and the cow chest and abdomen behavior image as output, the YOLOv5 algorithm is trained to obtain a lying cow recognition model.
[0050] Among them, in step A31, it specifically includes.
[0051] A311: Extract frames from the cow thermal environment video to obtain a cow thermal environment image.
[0052] A312: Preprocessing the cow thermal environment image to obtain a preprocessed image; the preprocessing includes: removing blurred, unclear images and images where changes in the abdomen cannot be accurately identified due to cows blocking each other.
[0053] A313: Using the labelimg tool, label the contraction and relaxation states of the chest and abdomen of the cow when breathing in the preprocessed image to obtain a labeled image.
[0054] A314: Construct a data set based on the cow thermal environment image and the annotated image.
[0055] Specifically, the dataset construction includes:
[0056] Image screening and labeling: Extract the collected videos by frames, remove blurry, unclear images, and images that cannot accurately identify the changes in the abdomen due to cows blocking each other, so as to improve the subsequent processing effect. Use the labelimg tool in the python environment to label the images, and label the contraction and relaxation of the abdomen of the cows when breathing in the remaining images, and save the images in txt format. The labeling should be accurate and detailed to ensure that each action state can be clearly identified.
[0057] Dataset division: The labeled image dataset is divided into training set, validation set and test set in a ratio of 7:2:1. This division ensures that the model can fully learn different features during the training process, and can accurately evaluate the performance of the model during the validation and testing stages.
[0058] In step A32, the training and optimization of the lying cow recognition model specifically includes:
[0059] Model selection: Use the YOLOv5 algorithm to build a lying cow recognition model, or use a Transformer architecture based on the attention mechanism. These models can effectively capture the spatiotemporal features in the image and have good performance in recognizing the breathing behavior of cows.
[0060] The training process is as follows.
[0061] Initialize model parameters: Use random initialization or pre-trained weights to initialize the model. Random initialization can prevent the model from falling into a local optimal solution at the beginning of training, while pre-trained weights can use existing knowledge and information to speed up model training.
[0062] Optimization algorithm selection: Use optimization algorithms with adaptive learning rates, such as Adagrad, Adadelta, or RMSprop. These algorithms can automatically adjust the learning rate according to the training situation of the model to improve training efficiency.
[0063] Training iteration: Multiple iterations of training are performed, each of which includes forward propagation, calculation of loss function, and back propagation to update model parameters. During the training process, the model parameters are adjusted by monitoring the performance indicators of the validation set, such as precision, recall, and F1 value, to prevent overfitting.
[0064] Model evaluation and tuning are as follows.
[0065] Model evaluation indicators: Use precision, recall, F1 value, accuracy and other indicators to evaluate the trained model and improve the generalization ability of the model. Precision indicates the proportion of samples predicted as positive by the model that are actually positive; recall indicates the proportion of actual positive examples predicted as positive by the model; F1 value is the harmonic mean of precision and recall, which comprehensively considers the performance of both; accuracy indicates the proportion of correct predictions made by the model as a whole.
[0066] In another exemplary embodiment of the present invention, step A4 specifically includes:
[0067] A41: Binarizing the cow chest and abdomen behavior image to obtain a binarized image.
[0068] A42: Perform contour extraction on the binarized image based on the Canny edge detection algorithm to obtain contour features.
[0069] A43: Based on the contour features, determine the chest and abdomen area of the cow and the change of the chest and abdomen area of the cow during the breathing cycle to obtain breathing depth information.
[0070] A44: Determine the optical flow information of the cow's respiratory behavior movement cycle according to the breathing depth information.
[0071] A45: Perform optical flow calculation on video frames within a breathing cycle of a cow to obtain the motion vector of each pixel.
[0072] A46: Organize the motion vector of each pixel into an optical flow data structure.
[0073] A47: Analyze and process the optical flow data structure to obtain an optical flow information image reflecting the characteristics of respiratory movement.
[0074] A48: Determine the breathing depth characteristics based on the optical flow information image.
[0075] Among them, image feature extraction includes.
[0076] Binarization: Binarize the labeled respiratory image to separate the chest and abdomen area from the background. By setting a suitable threshold, the pixel values in the image are divided into two categories, 0 and 1, where 0 represents the background and 1 represents the chest and abdomen area. This can simplify the image data and facilitate subsequent feature extraction.
[0077] Contour extraction: Use the Canny edge detection algorithm to extract the contours of the cow's chest and abdomen. Contour extraction can help us understand the shape and change trend of the chest and abdomen, provide an important basis for feature extraction, and finally perform feature calculation.
[0078] The binary image of the cow's respiratory behavior in a thermal environment is extracted. The images of the cow's abdomen in different states when breathing in a thermal environment are input. The filtering method based on domain similarity and the gradient calculation method are combined with the Canny contour extraction technology to identify the contour of the image. The contour area is screened by the contour function to accurately highlight the abdominal target area. Then the image is binarized to complete the binary image of the cow's respiratory behavior in a thermal environment.
[0079] Respiratory depth characterization includes:
[0080] Changes in chest and abdomen breathing area: Calculate the changes in the chest and abdomen area during breathing. The chest and abdomen area can be estimated by counting the number of pixels within the contour, and then the changes in the area during the breathing cycle can be analyzed to obtain breathing depth information.
[0081] The optical flow information of the cow's respiratory behavior movement cycle is extracted, and the optical flow calculation is performed on the video frames within a respiratory action cycle. The motion vector of each pixel is obtained and organized into a data structure. The optical flow data is analyzed and processed to obtain an optical flow information image reflecting the characteristics of the respiratory movement. Relevant characteristic parameters can be obtained from the optical flow information image, such as the duration of the cow's respiratory behavior in a thermal environment, the average amplitude of each breath change, the respiratory frequency, the variability and homogeneity of the distribution of the characteristic parameters of the respiratory behavior, the duration of the respiratory cycle (by analyzing the periodic motion of the pixels in the abdominal area in the vertical direction to determine the time interval between two adjacent similar motion states) and the depth of breathing (by analyzing the overall motion amplitude of the pixels in the abdominal area).
[0082] Image grayscale changes: Analyze the grayscale changes of the abdominal image during breathing. Since the abdomen rises and falls during breathing, the grayscale value of the image changes. By analyzing the changes in grayscale values, the characteristics of breathing depth can be extracted.
[0083] After processing based on the above method, a dataset of characteristic parameters of respiratory behavior of dairy cows in thermal environment was constructed, and indicators including duration of respiratory behavior of dairy cows in thermal environment, duration of respiratory cycle, respiratory depth, average amplitude of change per breath, respiratory frequency, variability and homogeneity of distribution of characteristic parameters of respiratory behavior were obtained.
[0084] According to the respiratory behavior characteristic parameter dataset of dairy cows in thermal environment, the threshold of dairy cow respiratory frequency was set based on the comprehensive respiratory frequency data, and a dairy cow body temperature prediction model was established. The heat stress index and respiratory behavior characteristic parameters were correlated and analyzed. The Pearson method was used to analyze the correlation between the respiratory behavior parameters and heat stress indexes in dairy cows in thermal environment. It was shown that the respiratory behavior characteristics can reflect the heat stress of dairy cows, and the key characteristic parameters of respiratory behavior closely related to heat stress were further optimized.
[0085] The variation rate of respiratory behavior parameters and body temperature rise rate of lying cows under different thermal environment conditions were extracted, the variation patterns of respiratory behavior parameters and body temperature values of lying cows under different thermal environment conditions were analyzed, the threshold of respiratory behavior parameters of cow heat stress was set, and a cow body temperature prediction model based on respiratory behavior parameters of lying cows was constructed. The accuracy of the cow body temperature prediction model was verified by blood stress index determination method, and the measured indicators included cortisol, SOD, MAD and CAT.
[0086] Finally, to verify whether the values calculated by the cow temperature prediction model are accurate, blood is collected from the tested cows or the rectal temperature of the cows is tested, and the test results are compared with the cow temperature prediction model.
[0087] Temperature detection: Detect the anal temperature of the cow three times, collect the temperature for 3 minutes each time and take the average value.
[0088] Blood index test sample collection: Based on different temperature conditions and the physiological performance of the dairy cow group to assist in judging the heat stress situation, the dairy cow group is randomly selected and blood samples are collected.
[0089] Parameter adjustment and optimization: Model training and evaluation: Use the optimized key feature parameters to retrain the cow heat stress recognition model and use the test set to evaluate the model. Determine the optimal parameter combination by comparing the performance indicators of the model under different parameter settings, such as accuracy, recall rate, F1 value, etc.
[0090] Cross-validation: K-fold cross-validation is used to evaluate and optimize the model. Cross-validation can effectively avoid overfitting of the model and improve the generalization ability of the model. During the cross-validation process, the values of key feature parameters are continuously adjusted to determine the optimal parameter combination.
[0091] Specifically, the determination of the dairy cow heat stress identification model specifically includes:
[0092] Establishing threshold values and correlation analysis of body temperature in heat-stressed cattle.
[0093] According to the cow body temperature prediction model, the body temperature data is associated with the respiratory rate, and the changing pattern of the cow's respiratory rate under different body temperature conditions is observed.
[0094] The cow's body temperature is normal and its breathing is stable. When the cow's body temperature fluctuates between 39.2 and 39.3℃, the cow exhibits rapid shallow breathing, and the respiratory rate increases from 57 times / min to 74 times / min. When the body temperature rises from 39.3℃ to 39.6℃, the cow exhibits open-mouth panting breathing, and the respiratory rate increases from 74 times / min to 81 times / min. When the temperature is 39.6℃ and above, the cow's respiratory rate increases from 81 times / min to 83 times / min. The range of the cow's body temperature is calculated by analyzing the respiratory rate using statistical methods, and the changes in the cow's body temperature are identified based on the model to establish the threshold of the heat stress cow's body temperature.
[0095] Based on the body temperature prediction model of the characteristic parameters of the cow's chest and abdominal fluctuation behavior, the changes in the cow's respiratory rate are analyzed in real time, and the respiratory rate threshold is set to achieve the cow's heat stress warning effect.
[0096] Establish threshold ranges for thoracic and abdominal behaviors.
[0097] Focus on observing the cow's chest and abdomen behaviors, with the main observation indicators including respiratory rate and abdominal fluctuations. Videos are collected from different positions and angles through cameras installed in the dairy farming environment, with a focus on the cow's resting area. The video shooting angle should ensure that the changes in the cow's abdomen when it lies on its side can be clearly captured.
[0098] Analyze and process the collected videos. Extract video images and remove bad images such as occlusion, dim light and poor angle. Perform operations such as format conversion, video segmentation and frame extraction on individual cows to improve subsequent processing effects.
[0099] A model for identifying heat stress levels based on the chest and abdomen was established.
[0100] Based on the above-established temperature thresholds and chest and abdomen behavior threshold ranges of heat-stressed cows, a comprehensive recognition model is constructed. The model uses the chest and abdomen fluctuation behavior characteristic parameters and body temperature data of dairy cows in a hot environment as input, and outputs the degree of heat stress of dairy cows (such as no heat stress, mild heat stress, moderate heat stress, severe heat stress and dangerous heat stress, etc.).
[0101] Consider using machine learning to build a model. For example, you can choose random forest algorithm, support vector machine algorithm, deep learning algorithm, neural network algorithm, etc. These algorithms can handle complex nonlinear relationships and conduct comprehensive analysis of various behavioral characteristics and body temperature data of dairy cows to accurately identify the degree of heat stress.
[0102] Model building and training.
[0103] Model initialization: According to the selected model type, the model is initialized, including setting the model parameters, number of layers, number of nodes, etc.
[0104] Training algorithm selection: Select a suitable training algorithm, such as stochastic gradient descent (SGD), Adagrad, Adadelta, etc., to train the model. The choice of training algorithm should be adjusted according to the characteristics of the model and the situation of the data to improve training efficiency and model performance.
[0105] Training process monitoring: During the training process, real-time monitoring of the model's performance indicators, such as loss function value, accuracy, recall rate, etc. If the model is found to be overfitting or underfitting, the training parameters should be adjusted in time or the amount of data should be increased.
[0106] Model evaluation and optimization.
[0107] The evaluation metrics are selected as follows.
[0108] Classification accuracy: Use accuracy as the main evaluation indicator to evaluate the classification accuracy of the model for cow heat stress. Accuracy indicates the proportion of samples correctly predicted by the model to the total samples, and is one of the important indicators for measuring model performance.
[0109] Recall rate and F1 value: At the same time, consider using indicators such as recall rate and F1 value to comprehensively evaluate the performance of the model. Recall rate indicates the model's ability to identify positive examples, and F1 value is the harmonic mean of precision and recall rate, which comprehensively considers the precision and recall rate of the model.
[0110] Model optimization strategy.
[0111] Hyperparameter adjustment: Based on the evaluation results, adjust the model’s hyperparameters, such as the depth of the decision tree, the number of trees in the random forest, the kernel function parameters of the support vector machine, etc., to optimize the model’s performance.
[0112] Feature engineering optimization: Further optimize feature engineering, such as adding feature combinations, to improve model performance.
[0113] Hyperparameter optimization: Genetic algorithm (GA), differential evolution (DE), particle swarm optimization (PSO) and Bayesian optimization (BO) algorithms are used to optimize the hyperparameters of the selected model. The appropriate hyperparameter range is determined, and the optimal hyperparameter combination is selected based on the model's performance indicators such as accuracy, recall, F1 value, determination coefficient R², mean absolute error MAE, mean absolute percentage error MAPE and root mean square error RMSE. During the optimization process, cross-validation (such as 5-fold cross-validation or 10-fold cross-validation) is used to ensure the generalization ability of the model.
[0114] Model regularization: Use regularization techniques, such as L1 regularization and L2 regularization, to prevent model overfitting and improve the generalization ability of the model.
[0115] The parameters used in the dairy cow heat stress identification model include key characteristic parameters of the cow's lying and breathing behavior in a hot environment and physiological heat stress indicators.
[0116] The following provides a specific test method for identifying heat stress in dairy cows.
[0117] Example 1: Study on the changing patterns of body temperature and respiratory rate of dairy cows under different temperatures and humidities.
[0118] 1. Experimental design: The experiment selected Holstein cows with two parities as the research subjects, and a dairy farm around Hohhot City as the research object. From July to August 2023, the changes in body temperature and respiratory rate of dairy cows under different temperature and humidity environments were collected for regularity study.
[0119] 2. Experimental data collection: The body temperature of the cows in a quiet state was collected at 14:30 every day and the respiratory rate was recorded. The rectal temperature and the vulva temperature were averaged. The respiratory rate was based on the chest and abdominal movement of the cows in a quiet state for 1 minute (one contraction was counted as one breath), and the average was recorded three times.
[0120] 3. Collection of test samples: Blood samples were collected based on body temperature and respiratory rate data. Cows with a respiratory rate higher than 60 times / minute and a body temperature ≥39.5℃ were selected as the test group, and cows with a respiratory rate of 35±5 times / minute and a body temperature of 39℃±0.2℃ were selected as the control group. 5ml of blood was collected from the jugular vein using a disposable vacuum blood collection tube, centrifuged at 3000r / min for 10min, and serum was taken for packaging, quickly frozen in liquid nitrogen, and then transferred to a -80℃ refrigerator for testing. The total antioxidant capacity (T-AOC), superoxide dismutase (SOD), and malondialdehyde (MDA) in the blood were determined using Nanjing Jiancheng kits, and the determination method was strictly carried out in accordance with the instructions.
[0121] 4. Statistical analysis: The data obtained from the experiment were preliminarily calculated and processed by Excel, and the GLM model in SAS 9.2 statistical software was used for one-way analysis of variance. The results were expressed as the mean and standard error of the least squares method, with P<0.05 indicating a significant difference and P<0.01 indicating an extremely significant difference.
[0122] 5. Results: The effects of heat stress on body temperature and respiratory rate of dairy cows are shown in Table 1. It can be seen that the body temperature of dairy cows in the experimental group is about 0.3℃ higher than that of dairy cows in the control group, but there is no significant difference (P>0.05). The respiratory rate in the experimental group is significantly higher than that in the control group (P<0.0001).
[0123] Table 1 Effects of heat stress on body temperature and respiratory rate in dairy cows
[0124]
[0125] The effects of heat stress on serum antioxidant indexes in dairy cows are shown in Table 2. It can be seen that the serum T-AOC and SOD indexes of the experimental group were significantly higher than those of the control group (P < 0.05), and there was no significant difference in MDA index between the experimental group and the control group (P > 0.05).
[0126] Table 2 Effects of heat stress on serum antioxidant indexes in dairy cows
[0127]
[0128] Example 2: Constructing a recognition model for lying cows.
[0129] Get the cow thermal environment video, select different angles, and collect videos at key locations in the dairy farming environment. Install high-definition cameras at key locations, equipped with wide-angle lenses and adjustable pan / tilts to ensure that the details of various parts of the cow and different behaviors can be clearly captured. Fix the camera position to cover the various ranges and angles of possible cow activities, and ensure that the camera angle can clearly capture the changes in the cow's abdomen when breathing. The video analyzes the breathing behavior according to actual needs.
[0130] A dataset of cows’ respiratory behavior images in thermal environments was established. Images were extracted from the collected videos to remove bad images caused by severe mutual occlusion between cows (the occlusion area exceeded 30% or more of the image), dim light (the average brightness of the image was lower than the preset threshold), and poor angles (the key parts of the cow, such as the abdomen and chest, accounted for too small a proportion of the image).
[0131] The video of each cow's image is converted into a different format, segmented (segmented according to fixed time intervals or behavioral events, such as one segment every 5 seconds or one segment each time the cow's behavior changes), and frame extracted (key frames are extracted from the segmented video segments, such as one frame every 1-2 seconds) to improve subsequent processing effects.
[0132] Label the image using the labelimg tool in Python. Different states of the cow's abdomen when breathing are marked in detail as contraction (the degree of contraction can be divided into mild, moderate, and severe), relaxation (the degree of relaxation can also be classified similarly), and other respiratory-related states. The image format is saved in txt format, and detailed labeling rules and classification systems are established to ensure that each label has a clear meaning and standard. An image dataset of cows' respiratory behavior in thermal environments is established, and a training set, validation set, and test set are constructed with a ratio of 7:2:1.
[0133] The YOLOv5 algorithm is used to build a recognition model for the respiratory behavior of dairy cows in thermal environments, including training model construction, verification model construction, and performance testing. The training model consists of an input terminal (Input), a backbone network (Backbone), a neck network (Neck), and an output terminal (Prediction).
[0134] At the input end, the input image is preprocessed, such as resizing the image, normalizing the pixel values, etc., to make it meet the input requirements of the model. The backbone network is initialized with pre-trained weights, and a network structure suitable for image feature extraction is selected, such as Darknet-53 or other advanced convolutional neural network structures. The neck network is used to fuse feature information at different levels to improve the expressiveness of features. At the output end, the corresponding output nodes are set according to the number of marked categories (such as abdominal contraction, relaxation, standing, feeding, etc.), and the probability of each category is calculated through the Softmax function.
[0135] The model performance is evaluated by precision, recall, and average precision, while taking into account factors such as model complexity, training time, and generalization ability. During the training process, appropriate optimization algorithms (such as stochastic gradient descent and its variants) and learning rate adjustment strategies are used to improve the training efficiency and performance of the model. Through multiple iterations of training, the model parameters are continuously adjusted to achieve the best performance on the validation set and improve the generalization ability of the model. The mark is "1" for exhalation and "2" for inhalation. The training model results are shown in Figure 2 .
[0136] Example 3: Constructing a body temperature prediction model based on characteristic parameters of chest and abdomen fluctuation behavior of dairy cows.
[0137] Extract the binary image of the cow's breathing behavior in a thermal environment. Input the image of the cow's abdomen in different states when breathing in a thermal environment. Use the filtering method based on domain similarity (such as bilateral filtering or adaptive median filtering, automatically adjust the filtering parameters according to the local features of the image), gradient calculation method (calculate the gradient amplitude and direction of the image, such as using the Sobel operator or Scharr operator), and combine the Canny contour extraction technology to perform contour recognition on the image. In the Canny contour extraction process, reasonably set the high and low thresholds (such as the low threshold is 20%-30% of the image gradient amplitude, and the high threshold is 60%-70% of the image gradient amplitude). Use the contour function to filter the contour area, accurately highlight the target area of the abdomen (filter out the contours with an area within a certain range and that meet the abdominal shape characteristics), and then perform image binarization processing (you can use the Otsu method or manually set the threshold, and choose the appropriate method according to the grayscale distribution characteristics of the image) to complete the binary image of the cow's breathing behavior in a thermal environment. For details, see Figure 3 .
[0138] Extract the optical flow information of the respiratory behavior motion cycle, calculate the optical flow of the video frames within a respiratory action cycle, obtain the motion vector of each pixel and organize it into a data structure, analyze and process these optical flow data, and obtain an optical flow information image that reflects the characteristics of respiratory motion. Visualize the optical flow field and the extracted chest and abdominal motion information of the cow. The larger the motion amplitude, the more obvious the optical flow, and the cow's breathing can be observed more intuitively. Relevant feature parameters can be obtained from the optical flow information image, such as the duration of the respiratory cycle (by analyzing the periodic motion of the pixels in the abdominal area in the vertical direction to determine the time interval between two adjacent similar motion states), breathing depth (by analyzing the overall motion amplitude of the pixels in the abdominal area), etc.
[0139] Construct a dataset of characteristic parameters of respiratory behavior of dairy cows in thermal environment. Based on the above processing, obtain indicators including duration of respiratory behavior of dairy cows in thermal environment (such as total duration of a single breath accurate to 0.1 seconds or more), average amplitude of each breath change (such as amplitude of breath depth change accurate to 0.1 mm or more, which can be calculated by analyzing the change of abdominal contour in the image), respiratory frequency (the number of breaths per unit time accurate to 0.1 times / minute or more), variability of distribution of characteristic parameters of respiratory behavior (by calculating the standard deviation or coefficient of variation of each characteristic parameter) and homogeneity (by analyzing the consistency of characteristic parameters in different time periods or between different dairy cows). At the same time, record the relevant information such as individual cow number, collection time, environmental temperature and humidity corresponding to each characteristic parameter for subsequent analysis and association.
[0140] Example 4: Optimizing key characteristic parameters of respiratory behavior of dairy cows in thermal environment.
[0141] Determine the heat stress indexes of different heat stress cows, collect blood samples from different heat stress cows, and select the collection time at different time periods of the day (such as 8 am, 12 noon, 4 pm) to reflect the changes in the physiological state of cows under different thermal environments. The collection site is the jugular vein of the cow, and professional blood collection equipment (such as vacuum blood collection tubes and blood collection needles) is used to ensure the standardization of the collection process and the quality of the samples. The amount of blood collected each time is 5-10ml, and it is processed immediately after collection.
[0142] Model optimization strategy.
[0143] Hyperparameter adjustment: Based on the evaluation results, adjust the model’s hyperparameters, such as the depth of the decision tree, the number of trees in the random forest, the kernel function parameters of the support vector machine, etc., to optimize the model’s performance.
[0144] Feature engineering optimization: Further optimize feature engineering, such as adding feature combinations, to improve model performance.
[0145] Hyperparameter optimization: Genetic algorithm (GA), differential evolution (DE), particle swarm optimization (PSO) and Bayesian optimization (BO) algorithms are used to optimize the hyperparameters of the selected model. Determine the appropriate hyperparameter range and select the optimal hyperparameter combination based on the model's performance indicators such as accuracy, recall, F1 value, determination coefficient R², mean absolute error MAE, mean absolute percentage error MAPE and root mean square error RMSE. During the optimization process, cross-validation (such as 5-fold cross-validation or 10-fold cross-validation) methods are used to ensure the generalization ability of the model. See details. Figure 4 .
[0146] Experimental group settings.
[0147] a. Experimental group 1.
[0148] From the video captured by the camera, the image processing algorithm is used to identify the changes in the chest and abdomen movements of all cows in the area, and the average respiratory rate and standard deviation of the respiratory rate of all cows in the area are calculated.
[0149] These extracted key feature parameters are input into the model for real-time analysis. When the respiratory rate of a cow increases from 57 times / min to 74 times / min, the cow is judged to be suffering from mild heat stress. When more than 30% of the cows in the group have the same respiratory rate, the administrator is notified in time and the spray ventilation system is started to cool the cowshed.
[0150] b. Experiment with 2 groups.
[0151] The same cameras, temperature sensors, humidity sensors, and physiological index collection equipment as those in experimental group 1 were used. From the video captured by the camera, the image processing algorithm was used to identify the changes in chest and abdominal movements of all cows in the area, and the average respiratory rate and standard deviation of respiratory rate of all cows in the area were calculated.
[0152] These extracted key characteristic parameters are input into the model for real-time analysis. When a cow shows open-mouth panting breathing and the respiratory rate increases from 74 times / min to 81 times / min, the cow is judged to be moderately heat stressed. Timely warning of heat stress is given, the coupled spray ventilation system (low power) is started, and the administrator is notified to handle the heat stress of the cow. When more than 30% of the cows in the group have the same situation, the coupled spray ventilation system (high power) is directly started to cool the cowshed and the administrator is notified to handle the heat stress of the herd.
[0153] c. Experiment with 3 groups.
[0154] The same cameras, temperature sensors, humidity sensors, and physiological index collection equipment as those in experimental group 1 were used. From the video captured by the camera, the image processing algorithm was used to identify the changes in chest and abdominal movements of all cows in the area, and the average respiratory rate and standard deviation of respiratory rate of all cows in the area were calculated.
[0155] These extracted key characteristic parameters were input into the model for real-time analysis, and the average respiratory rate was calculated to be 60 times / minute, and the standard deviation of the respiratory rate was 8 times / minute. The body temperature of the cow was 40.5℃, 79≤THI<84, and the cow was judged to be in severe heat stress. The coupled spray ventilation system (high power) was directly started to cool the cowshed and the administrator was notified to carry out emergency heat stress management work on the cattle farm to prevent large-scale severe heat stress.
[0156] The prior art is taken as a comparative example to illustrate that the solution of the present invention solves the problems of the prior art.
[0157] 1. Problems existing in the existing technology.
[0158] 1. Sensor-based contact method: 1) There is a stress response problem: some contact sensors such as smart collars worn on cows can easily cause stress responses in cows, affecting their normal behavior and physiological state, thereby interfering with the accurate judgment of heat stress. 2) Sensors are easily damaged: The activities of cows may cause damage to the sensors, affecting the continuity and accuracy of data collection.
[0159] 2. Traditional computer vision technology methods: 1) Requires a lot of manpower for labeling and analysis: Traditional methods require expert experience and a lot of manpower to label and analyze long-term behavioral monitoring data to achieve heat stress identification, which is time-consuming and laborious. 2) Poor real-time performance: It is difficult to achieve real-time monitoring and feedback, and it is impossible to detect changes in the heat stress of dairy cows in a timely manner.
[0160] 3. The method based on blood stress index is costly: it is necessary to collect blood samples from dairy cows for testing, which involves professional equipment and reagents, increasing the cost of testing.
[0161] Unable to monitor in real time: data cannot be obtained in real time, and the dynamic changes of heat stress in dairy cows cannot be reflected in time.
[0162] 2. Advantages of the solution of the present invention.
[0163] 1. Stress-free and contact-free monitoring: It mainly uses cameras to collect video data, avoiding stress reactions and sensor damage to cows. It can monitor the behavior of cows in their natural state and measure behavioral performance that is closer to the cows' real life scenes.
[0164] 2. Automated real-time monitoring: The constructed model automatically extracts features from video data and identifies heat stress. It does not require a large amount of manpower for labeling and analysis, and can provide real-time feedback on the heat stress of dairy cows.
[0165] 3. Comprehensive multi-indicator identification: Taking into account the environmental temperature and humidity data, combined with the cow's respiratory rate and other characteristics, the model comprehensively analyzes the correlation between these indicators and heat stress, and identifies heat stress more comprehensively and accurately, overcoming the problem of inaccurate judgment of a single indicator.
[0166] 4. Cost-effectiveness advantage: During the implementation of the present invention, a coupling analysis was conducted on the cow's respiration and antioxidant indicators in the blood, and the result of a strong correlation between respiration and antioxidant indicators was obtained, which confirmed that the cow's heat stress condition can be judged by detecting the cow's respiratory rate, and can assist in judging the cow's stress level. Therefore, the present invention can replace blood to detect heat stress levels under certain circumstances. The cost of the present invention is mainly reflected in the video detection equipment. The equipment can be used for a long time, and it is expected to be coupled with other detection equipment in the future to establish multiple judgment and evaluation methods. Compared with traditional blood tests, the present invention saves a lot of detection costs and labor costs. It is suitable for the current development plan of smart animal husbandry.
[0167] Taking the control test as a comparative example, if the reaction temperature is 20-50°C, a test plan corresponding to a reaction temperature outside the range of 20-50°C can be provided.
[0168] like Figure 5 As shown, in another exemplary embodiment of the present invention, a method for applying a cow heat stress identification model is provided, including:
[0169] B1: Obtain a thermal environment video of a cow to be identified; the thermal environment video of the cow to be identified includes: behavioral data and environmental parameters of various parts of the cow's body.
[0170] B2: Extract frames from the thermal environment video of the cow to be identified to obtain a thermal environment image of the cow to be identified.
[0171] B3: Input the thermal environment image of the cow to be identified into the recognition model of the lying cow to obtain the chest and abdomen behavior image of the cow to be identified; the recognition model of the lying cow is a model built based on the YOLOv5 algorithm; the chest and abdomen behavior image of the cow to be identified includes: images of the contraction and relaxation states of the chest and abdomen of the cow to be identified when breathing.
[0172] B4: Based on the chest and abdomen behavior images of the cow to be identified, determine the chest and abdomen fluctuation behavior characteristic parameters of the cow to be identified in a thermal environment; the chest and abdomen fluctuation behavior characteristic parameters of the cow to be identified in a thermal environment include: contour features and breathing depth features; the contour features are features obtained based on the Canny edge detection algorithm; the breathing depth features include: the duration of the breathing behavior of the cow to be identified in a thermal environment, the duration of the breathing cycle, the breathing depth, the average amplitude of each breath change, the breathing frequency, and the variability and homogeneity of the distribution of the breathing behavior characteristic parameters.
[0173] B5: Based on the chest and abdomen fluctuation behavior characteristic parameters of the cow to be identified in the thermal environment and the cow body temperature prediction model, determine the body temperature data of the cow to be identified; the cow body temperature prediction model associates the body temperature data with the respiratory rate.
[0174] B6: Input the chest and abdomen undulation behavior characteristic parameters of the cow to be identified in a thermal environment and the body temperature data of the cow to be identified into a cow heat stress identification model to obtain the heat stress degree of the cow to be identified; the cow heat stress identification model is a model trained based on the determination method of the cow heat stress identification model described above.
[0175] In an exemplary embodiment, step B4 specifically includes:
[0176] B41: Binarizing the chest and abdomen behavior image of the cow to be identified to obtain a binarized image.
[0177] B42: Extract contours of the binarized image based on the Canny edge detection algorithm to obtain contour features.
[0178] B43: Based on the contour features, determine the chest and abdomen area of the cow to be identified and the change of the chest and abdomen area of the cow to be identified during the breathing cycle to obtain breathing depth information.
[0179] B44: Determine the optical flow information of the respiratory behavior movement period of the cow to be identified based on the respiratory depth information.
[0180] B45: Perform optical flow calculation on the video frames within a breathing cycle of the cow to be identified to obtain the motion vector of each pixel.
[0181] B46: Organize the motion vector of each pixel into an optical flow data structure.
[0182] B47: Analyze and process the optical flow data structure to obtain an optical flow information image reflecting the characteristics of respiratory movement.
[0183] B48: Determine the breathing depth characteristics based on the optical flow information image.
[0184] Computer vision technology provides a new way to monitor heat stress in dairy cows. It can monitor the behavior of dairy cows in real time by installing cameras in the cowshed. Computer vision technology can automatically identify various behavioral postures of dairy cows, such as standing, lying, eating, etc., and can judge their heat stress by analyzing the changes in their behavior. For example, by observing the changes in the cows' eating frequency, activity level, breathing rate and other behavioral characteristics, computer vision technology can more accurately assess the heat stress state of dairy cows, with the advantages of high efficiency, accuracy and non-contact.
[0185] Among the many indicators of heat stress in dairy cows, respiratory rate is an important indicator that can directly reflect stress changes and is also the most obvious external manifestation indicator. Changes in respiratory rate are closely related to heat stress in dairy cows. When cows are under heat stress, their bodies will dissipate heat by speeding up their respiratory rate to maintain a balanced body temperature. Therefore, by monitoring the respiratory rate of dairy cows, we can keep abreast of the cows' heat stress. Moreover, the measurement of respiratory rate is relatively simple. It can be measured by observing the fluctuations of the cow's abdomen when breathing through a video. It does not require complex equipment and technology, and is easy to apply in actual breeding environments.
[0186] On this basis, further research can be conducted to establish an effective early warning system. Heat stress early warning can be achieved by monitoring the respiratory rate of dairy cows. The early warning system can control the switch of the circulation fan and start the spray system for cooling, thereby timely relieving the heat stress of dairy cows and ensuring the health and production performance of dairy cows. This coupling system can achieve automated control and improve the efficiency and accuracy of breeding management.
[0187] In an exemplary embodiment, the present invention also provides a cow heat stress degree identification system based on chest and abdomen fluctuation behavior, the system comprising: a camera for shooting cow video data in a dairy farm, focusing on the chest and abdomen behavior of the cow in the resting area; a host computer connected to the camera, for implementing the cow heat stress identification method constructed above, so as to obtain the heat stress degree identification result based on the cow video data; the host computer comprises: a memory for storing computer programs and cow video images and related environmental and physiological data; a processor connected to the memory and the camera, for retrieving and executing the computer program to implement the cow heat stress identification method constructed above. The processor comprises: 1. a video data acquisition module for acquiring cow video data to be identified. 2. a recognizing model construction module for lying cows in a thermal environment, for constructing a recognizing model for lying cows in a thermal environment. 3. a chest and abdomen behavior image extraction module, for inputting the cow video data into the recognizing model for lying cows in a thermal environment to obtain chest and abdomen behavior images. 4. A chest and abdomen behavior key feature parameter extraction module, used to extract chest and abdomen behavior key feature parameters based on the chest and abdomen behavior image. 5. A heat stress degree identification model construction module, used to construct a cow heat stress identification model based on chest and abdomen fluctuation behavior. 6. A heat stress degree identification module, used to input the chest and abdomen behavior key feature parameters into the cow heat stress identification model based on chest and abdomen fluctuation behavior to obtain a heat stress degree identification result.
[0188] The system can provide a personalized heat stress assessment for each cow based on individual chest and abdominal fluctuations, breathing rate, body temperature and other data. Farmers can take different management measures for different cows based on these personalized assessment results, making precise farming decisions and improving farming efficiency.
[0189] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store cow thermal environment videos. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for determining a cow heat stress identification model or an application method for a cow heat stress identification model is implemented.
[0190] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the above-mentioned method embodiments are implemented when the processor executes the computer program.
[0191] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the above-mentioned method embodiments are implemented.
[0192] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the above-mentioned method embodiments are implemented.
[0193] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0194] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for determining a dairy cow heat stress identification model, characterized in that: The method for determining the dairy cow heat stress identification model comprises: Acquire a cow thermal environment video; the cow thermal environment video includes: behavior data and environmental parameters of various parts of the cow's body; Extracting the cow thermal environment video by frames to obtain a cow thermal environment image; The cow thermal environment image is input into a recognizing model of a lying cow to obtain a cow chest and abdomen behavior image; the recognizing model of a lying cow is a model constructed based on a YOLOv5 algorithm; the cow chest and abdomen behavior image includes: an image of the contraction and relaxation state of the cow's chest and abdomen when the cow breathes; Based on the cow's chest and abdomen behavior image, determining the cow's chest and abdomen fluctuation behavior characteristic parameters in a thermal environment; the cow's chest and abdomen fluctuation behavior characteristic parameters in a thermal environment include: contour features and breathing depth features; the contour features are features obtained based on a Canny edge detection algorithm; the breathing depth features include: the duration of the cow's breathing behavior in a thermal environment, the duration of the breathing cycle, the breathing depth, the average amplitude of each breath change, the breathing frequency, and the variability and homogeneity of the distribution of the breathing behavior characteristic parameters; Determining the cow's body temperature data based on the cow's chest and abdomen fluctuation behavior characteristic parameters under the cow's thermal environment and the cow's body temperature prediction model; the cow's body temperature prediction model associates the body temperature data with the respiratory rate; The characteristic parameters of the chest and abdomen undulation behavior of the cow in the thermal environment and the body temperature data of the cow are used as input, and the heat stress degree of the cow is used as output, and a machine learning algorithm is trained to obtain a cow heat stress recognition model; the heat stress degree of the cow includes: no heat stress, mild heat stress, moderate heat stress, severe heat stress and dangerous heat stress.
2. The method for determining a dairy cow heat stress identification model according to claim 1, characterized in that: The method for determining the lying cow identification model specifically includes: Based on the cow thermal environment video, a data set is constructed; the data set includes: a cow thermal environment image and a corresponding cow chest and abdomen behavior image; With the cow thermal environment image as input and the cow chest and abdomen behavior image as output, the YOLOv5 algorithm or the Transformer architecture model based on the attention mechanism is trained to obtain a lying cow recognition model.
3. The method for determining the cow heat stress identification model according to claim 2, characterized in that: Based on the cow thermal environment video, a data set is constructed, specifically including: Extracting the cow thermal environment video by frames to obtain a cow thermal environment image; Preprocessing the cow thermal environment image to obtain a preprocessed image; the preprocessing includes: removing blurry, unclear images and images where changes in the abdomen cannot be accurately identified due to cows blocking each other; Using the labelimg tool to label the contraction and relaxation states of the chest and abdomen of the cow when breathing in the preprocessed image to obtain a labeled image; A data set is constructed based on the cow thermal environment image and the annotated image.
4. The method for determining a dairy cow heat stress identification model according to claim 1, characterized in that: Based on the cow chest and abdomen behavior image, determining the cow chest and abdomen fluctuation behavior characteristic parameters under the thermal environment, specifically including: Binarizing the cow chest and abdomen behavior image to obtain a binarized image; Performing contour extraction on the binarized image based on the Canny edge detection algorithm to obtain contour features; Based on the contour features, determining the chest and abdomen area of the cow and the change of the chest and abdomen area of the cow during the respiratory cycle to obtain respiratory depth information; Determining the optical flow information of the cow's respiratory behavior movement cycle according to the respiratory depth information; Perform optical flow calculation on video frames within a breathing cycle of a cow to obtain the motion vector of each pixel; Organize the motion vector of each pixel into an optical flow data structure; Analyzing and processing the optical flow data structure to obtain an optical flow information image reflecting the characteristics of respiratory movement; Based on the optical flow information image, a breathing depth feature is determined.
5. The method for determining a dairy cow heat stress identification model according to claim 1, characterized in that: The machine learning algorithms include: random forest algorithm, support vector machine algorithm, deep learning algorithm and neural network algorithm.
6. An application method of a dairy cow heat stress identification model, characterized in that: The application method of the dairy cow heat stress identification model includes: Obtain a thermal environment video of a cow to be identified; the thermal environment video of the cow to be identified includes: behavioral data and environmental parameters of various parts of the cow's body; Extracting frames from the thermal environment video of the cow to be identified to obtain a thermal environment image of the cow to be identified; Input the thermal environment image of the cow to be identified into the recognition model of the lying cow to obtain the chest and abdomen behavior image of the cow to be identified; the recognition model of the lying cow is a model built based on the YOLOv5 algorithm; the chest and abdomen behavior image of the cow to be identified includes: images of the contraction and relaxation states of the chest and abdomen of the cow to be identified when breathing; Based on the chest and abdomen behavior image of the cow to be identified, determining the chest and abdomen fluctuation behavior characteristic parameters of the cow to be identified in a thermal environment; the chest and abdomen fluctuation behavior characteristic parameters of the cow to be identified in a thermal environment include: contour features and breathing depth features; the contour features are features obtained based on the Canny edge detection algorithm; the breathing depth features include: the duration of the breathing behavior of the cow to be identified in a thermal environment, the duration of the breathing cycle, the breathing depth, the average amplitude of each breath change, the breathing frequency, and the variability and homogeneity of the distribution of the breathing behavior characteristic parameters; Based on the chest and abdomen fluctuation behavior characteristic parameters of the cow to be identified in the thermal environment and the cow body temperature prediction model, the body temperature data of the cow to be identified is determined; the cow body temperature prediction model associates the body temperature data with the respiratory rate; The characteristic parameters of the chest and abdomen undulation behavior of the cow to be identified in a thermal environment and the body temperature data of the cow to be identified are input into a cow heat stress identification model to obtain the heat stress degree of the cow to be identified; the cow heat stress identification model is a model trained based on the determination method of the cow heat stress identification model described in any one of claims 1 to 5.
7. The application method of the dairy cow heat stress identification model according to claim 6, characterized in that: Based on the chest and abdomen behavior image of the cow to be identified, determining the chest and abdomen fluctuation behavior characteristic parameters of the cow to be identified in a thermal environment, specifically including: Binarizing the chest and abdomen behavior image of the cow to be identified to obtain a binarized image; Performing contour extraction on the binarized image based on the Canny edge detection algorithm to obtain contour features; Based on the contour features, determine the chest and abdomen area of the cow to be identified and the change of the chest and abdomen area of the cow to be identified during the respiratory cycle to obtain the respiratory depth information; Determining the optical flow information of the respiratory behavior movement period of the cow to be identified according to the respiratory depth information; Perform optical flow calculation on the video frames within a breathing cycle of the cow to be identified to obtain the motion vector of each pixel; Organize the motion vector of each pixel into an optical flow data structure; Analyzing and processing the optical flow data structure to obtain an optical flow information image reflecting the characteristics of respiratory movement; Based on the optical flow information image, a breathing depth feature is determined.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for determining the cow heat stress identification model described in any one of claims 1 to 5 or the method for applying the cow heat stress identification model described in claim 6 or 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for determining the dairy cow heat stress identification model described in any one of claims 1 to 5 or the method for applying the dairy cow heat stress identification model described in claim 6 or 7 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for determining the dairy cow heat stress identification model described in any one of claims 1 to 5 or the method for applying the dairy cow heat stress identification model described in claim 6 or 7 is implemented.
Citation Information
Patent Citations
Milk cow heat stress behavior monitoring method and monitoring device
CN114532248A
Cow delivery stress degree identification method and system
CN117351404A