Method for predicting milk yield of dairy cow

Through the step-by-step method of predicting milk production of cows, combining body, breast and time characteristics to integrate characteristics, the problem of low prediction accuracy in the prior art is solved and higher prediction accuracy is achieved.

CN120373567AActive Publication Date: 2025-07-25黑龙江省畜牧总站
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510555167.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2025-07-25
Estimated Expiration
2045-04-29

AI Technical Summary

Technical Problem

The existing methods for predicting milk production in dairy cows have the problem of low prediction accuracy, especially the genetic algorithm is prone to falling into local minimums, resulting in premature puberty, and the global optimal solution cannot be obtained.

Method used

The two-step prediction method is adopted. First, the crude predictive milk production is obtained through the trained cow milk production crude prediction model, and then the trained cow milk production precision prediction model is used for precise prediction, combining physical characteristics, breast characteristics and time characteristics to achieve accurate milk production in the cow.

Benefits of technology

The accuracy of milk production prediction of dairy cows is improved, and the accuracy of prediction is improved through step-by-step and feature fusion, ensuring the acquisition of global optimal solutions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120373567A_ABST
    Figure CN120373567A_ABST
Patent Text Reader

Abstract

The invention discloses a dairy cow milk yield prediction method, and relates to the technical field of milk yield prediction. The objective of the invention is to solve the problem of low prediction accuracy of an existing dairy cow yield prediction method. The method comprises the following steps: acquiring a to-be-predicted dairy cow milk production characteristic data set; preprocessing the to-be-predicted dairy cow milk production characteristic data to obtain a preprocessed to-be-predicted dairy cow milk production characteristic data set; inputting the preprocessed to-be-predicted dairy cow milk production characteristic data set into the trained dairy cow milk production rough prediction model to obtain the rough prediction milk production of the to-be-predicted dairy cow; and inputting the preprocessed to-be-predicted dairy cow milk production characteristic data set and the rough prediction milk production of the to-be-predicted dairy cow into the trained dairy cow milk production fine prediction model to obtain the milk production of the to-be-predicted dairy cow. The method is used for predicting the milk yield of the dairy cow.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of milk yield prediction, and particularly relates to a method for predicting the milk yield of dairy cows. Background Art

[0002] In recent years, the dairy cow breeding industry in China has developed vigorously and entered the stage of large-scale and intensive breeding. However, the single-cow yield level is still not high, and the increase in milk yield still mainly relies on the increase in the number of bred cows. Therefore, how to improve the milk yield of dairy cows during the breeding process has always been the focus of attention and the goal pursued by both industry players and researchers. The prediction of the daily milk yield of dairy cows can determine the demand for raw milk of each dairy company in advance and provide data support for the advance planning of the scheduling of transport vehicles. Therefore, the technology for predicting the milk yield of dairy cows is particularly important for the dairy products industry.

[0003] At present, the prediction of the daily milk yield of dairy cows in pastures is carried out by experienced breeders who find similar examples from past experience and estimate the daily milk yield of dairy cows based on experience and the growth, feeding, etc. of the cows. However, there is a shortage of experienced breeding talents in dairy cow enterprises, resulting in low prediction efficiency. At the same time, manual estimation may be negligent, leading to low accuracy in the prediction of the milk yield of dairy cows. With the progress of technology, the prediction of the daily milk yield of dairy cows uses a long short-term memory network algorithm based on a genetic algorithm for prediction to improve the accuracy of the model. This method does not require manual estimation based on experience and improves the accuracy and efficiency of prediction. However, when using the genetic algorithm for pre-optimization, it is easy to fall into a local minimum and stop searching when preprocessing the multi-peak problem with multiple optimal solutions, resulting in the premature problem and unable to obtain the global optimal solution, thus affecting the accuracy of prediction. Summary of the Invention

[0004] The purpose of the present invention is to solve the problem that the existing methods for predicting the milk yield of dairy cows still have low prediction accuracy, and a method for predicting the milk yield of dairy cows is proposed.

[0005] A method for predicting the milk yield of dairy cows specifically includes the following steps:

[0006] S1. Obtain a dataset of milk production characteristics of dairy cows to be predicted;

[0007] The milk production characteristics of the dairy cows include: body height, chest width of the cow, body depth, udder depth, length of the central suspensory ligament, position of the front teat, length of the front teat, height of the posterior udder attachment, position of the posterior teat, number of lactation days, parity, width of the posterior udder attachment;

[0008] S2. Perform normalization processing on the milk production characteristic data of the dairy cows to be predicted to obtain a preprocessed dataset of milk production characteristics of the dairy cows to be predicted;

[0009] S3. Input the preprocessed dataset of milk production characteristics of the cows to be predicted into the trained rough prediction model of cow milk production to obtain the rough predicted milk production of the cows to be predicted;

[0010] S4. Input the preprocessed dataset of milk production characteristics of the cows to be predicted and the rough predicted milk production of the cows to be predicted into the trained fine prediction model of cow milk production to obtain the milk production of the cows to be predicted.

[0011] Further, the value of the front teat position in S1 is 1, 5 or 9; the value of the rear teat position is 1, 5 or 9.

[0012] Further, the normalization process of the milk production characteristic data of the cows to be predicted in S2 to obtain the preprocessed dataset of milk production characteristics of the cows to be predicted is specifically as follows:

[0013]

[0014] where is the normalized is the j-th feature in the i*-th sample of the cows to be tested, j ∈ [1, 12], j is the feature label of the cows to be predicted, and n* is the total number of cows to be predicted.

[0015] Further, the trained rough prediction model of cow milk production in S3 is obtained through the following method:

[0016] Step 1. Obtain the dataset of milk production characteristics of cows, and preprocess the dataset of milk production characteristics of cows to obtain the preprocessed dataset of milk production characteristics of cows;

[0017] Step 2. Combine the preprocessed cow milk production dataset and the milk production at the t-th lactation day to form a dataset, divide the dataset into a training set and a test set, and use the training set to train the rough prediction model of cow milk production to obtain the trained rough prediction model of cow milk production;

[0018] Step 3. Use the test set to test the trained rough prediction model of cow milk production. If the accuracy rate of the trained rough prediction model of cow milk production is lower than the preset threshold, return to Step 1; otherwise, output the trained rough prediction model of cow milk production.

[0019] Further, the obtaining of the dataset of milk production characteristics of cows and the preprocessing of the dataset of milk production characteristics of cows in Step 1 to obtain the preprocessed dataset of milk production characteristics of cows are specifically as follows:

[0020] Step 1-1. Obtain the dataset of milk production characteristics of cows;

[0021] X(t) = [X1(t), X2(t),...X i(t),..,X n (t)]

[0022] X i (t)=[X i,H ,X i,W ,X i,D ,X i,RD ,X i,L ,X i,Qp ,X i,Ql ,X i,BH ,X i,BW ,X i,Bp ,X i,S ,t]

[0023] Among them, X i (t) is the milk production characteristic vector of the i-th dairy cow on the t-th lactation day, X(t) is the dairy cow milk production characteristic data set, X i,H is the body height of the i-th dairy cow, X i,W is the chest width of the i-th dairy cow, X i,D is the body depth of the i-th dairy cow, X i,RD is the udder depth of the i-th dairy cow, X i,L is the length of the central suspensory ligament of the i-th dairy cow, X i,Qp is the position of the front teat of the i-th dairy cow, X i,Ql is the length of the front teat of the i-th dairy cow, X i,BH is the height of the posterior udder attachment of the i-th dairy cow, X i,Bp is the position of the rear teat of the i-th dairy cow, t is the lactation days, X i,S is the parity of the i-th dairy cow, X i,BW is the width of the posterior udder attachment of the i-th dairy cow after milking, n is the total number of dairy cows;

[0024] Steps one and two: Normalize the data in the dairy cow milk production characteristic data set to obtain the preprocessed dairy cow milk production characteristic data set:

[0025]

[0026] Among them, X′ ij is the normalized X ij , X ij is the j-th feature in the i-th dairy cow sample, j ∈ [1, 12], j is the feature label in the sample, n is the total number of dairy cows.

[0027] Furthermore, the preprocessed dairy cow milk production data set and the milk production on the t-th lactation day are combined to form a data set, the data set is divided into a training set and a test set, and the training set is used to train the rough prediction model of dairy cow milk production to obtain the trained rough prediction model of dairy cow milk production, specifically:

[0028] Step 2-1: Combine the preprocessed dairy cow milk production dataset and the milk production at the t-th lactation day to form a dataset, and divide the dataset into a training set and a test set;

[0029] Step 2-2: Use the training set to train the rough prediction model for dairy cow milk production;

[0030] The rough prediction model for dairy cow milk production includes: a feature division module, a feature scoring module, and a prediction module;

[0031] The feature division module is used to divide the preprocessed dairy cow milk production dataset into a body feature vector, a breast feature vector, and a time feature vector;

[0032] Body feature vector B i =[X i,H , X i,W , X i,D ;

[0033] Breast feature vector R i =[X i,RD , X i,L , X i,Qp , X i,Ql , X i,BH , X i,BW , X i,Bp ;

[0034] Time feature vector S i =[X i,S , t];

[0035] The feature scoring module is used to obtain the importance scores of the body features, breast features, and time features of the dairy cow; the feature scoring module includes: a body feature score acquisition unit, a breast feature score acquisition unit, and a time feature score acquisition unit;

[0036] The body feature score acquisition unit includes: an input layer, an attention layer, an activation function layer, a feature weighting layer, a fully connected layer, and an output layer;

[0037] The input layer is used to input the dairy cow body feature vector and input the dairy cow body feature vector into the attention layer; the dimension of the input layer is 4;

[0038] The attention layer is used to assign weights to each feature in the dairy cow body feature vector to obtain a dairy cow body feature weight vector;

[0039] The activation function layer is used to normalize the dairy cow body feature weights to obtain the normalized dairy cow body feature weights; the activation function layer is a softmax function;

[0040] The feature weighting layer is used to multiply each cow body feature by the corresponding weight to obtain a body weighted feature vector;

[0041] The fully connected layer is used to map the body weighted feature vector into the feature space;

[0042] The output layer is used to output the importance score of the cow body feature vector.

[0043] The output layer adopts a sigmoid activation function.

[0044] The structure of the breast feature score acquisition unit is the same as that of the body feature score acquisition unit; however, the dimension of the input and output layer is 7; the importance score of the breast feature is output;

[0045] The structure of the time feature score acquisition unit is the same as that of the body feature score acquisition unit; however, the dimension of the input and output layer is 2; the importance score of the time feature is output;

[0046] The prediction module uses the importance scores of the cow's body features, breast feature importance scores, time feature importance scores, body feature vectors, breast feature vectors, and time feature vectors to obtain the milk yield on the t-th lactation day

[0047] Furthermore, the feature prediction module includes: a feature combination unit and a prediction unit;

[0048] The feature combination unit is used to splice the body feature vector and the importance score of the body feature vector, the breast feature vector and the importance score of the breast feature vector, the time feature vector and the importance score of the time feature vector respectively, and input the three vectors obtained after splicing into the prediction unit;

[0049] The prediction unit is used to obtain the milk yield on the t-th lactation day by using the spliced vectors

[0050] The prediction unit includes: a data filling layer, a hidden layer, and an output layer;

[0051] The data filling layer is used to zero-fill the three spliced vectors to the same length and input the filled vectors into the hidden layer;

[0052] The input of the hidden layer is the output of the data filling layer;

[0053] The output layer is used to obtain the milk yield on the t-th lactation day according to the output of the hidden layer

[0054] Furthermore, the trained precise prediction model of cow milk yield is obtained by the following method:

[0055] A1. Obtain the dairy cow milk production characteristic dataset, perform normalization preprocessing on the dairy cow milk production characteristic dataset to obtain the preprocessed dairy cow milk production characteristic dataset, and use the preprocessed dairy cow milk production dataset, the rough predicted value of the dairy cow milk production output by the dairy cow milk production rough prediction model, and the milk production at the t-th lactation day to form a second dataset, and divide the second dataset into a second training set and a second test set;

[0056] A2. Use the second training set to train the dairy cow milk production fine prediction model to obtain the trained dairy cow milk production fine prediction model;

[0057] A3. Use the second test set to test the dairy cow milk production fine prediction model. If the accuracy of the trained dairy cow milk production fine prediction model is greater than the preset threshold, output the currently trained dairy cow milk production fine prediction model; otherwise, return to step A1.

[0058] Furthermore, the dairy cow milk production fine prediction model includes: a feature vector acquisition module, a feature fusion module, and a milk production fine prediction module;

[0059] The feature vector acquisition module is used to obtain the dairy cow body feature vector, breast feature vector, and time feature vector according to the dairy cow milk production characteristic dataset;

[0060] The body feature vector B i = [X i,H , X i,W , X i,D ;

[0061] The breast feature vector R i = [X i,RD , X i,L , X i,Qp , X i,Ql , X i,BH , X i,BW , X i,Bp ;

[0062] The time feature vector S i = [X i,S , t];

[0063] The feature fusion module is used to fuse the body feature vector, breast feature vector, time feature vector, and the rough predicted value of the dairy cow milk production to obtain the feature fusion result C i :

[0064] C i = MCCA(B i , R i , S i , M i )

[0065] Among them, M i is the rough prediction result of the milk production of dairy cows;

[0066] The refined milk production prediction module obtains the refined milk production prediction result of dairy cows according to the feature fusion result C i .

[0067] Furthermore, a mapping vector acquisition layer, a mapping vector concatenation layer, a concatenated result transformation layer, and an output layer;

[0068] The mapping vector acquisition layer uses the feature fusion result C i to obtain mapping vectors, specifically:

[0069] Z i,l = φ(C i W i,l + b i,l ), l = 1,..., L

[0070] where Z i,l is the l-th mapping vector of the i-th dairy cow sample, L is the number of mapping vectors, φ() is a linear transformation function, W i,l is the feature mapping weight matrix, and b i,l is the feature mapping bias;

[0071] The mapping vector concatenation layer is used to concatenate the mapping vectors to obtain a concatenated result;

[0072] The concatenated result transformation layer is used to perform a non-linear transformation on the concatenated result to obtain an enhanced result, specifically:

[0073] H i,p = ξ([Z i,1 , Z i,2 ,..., Z i,L W p + b p ), p = 1,..., P

[0074] ξ() = tanh()

[0075] where p is the enhanced node label, P is the total number of enhanced nodes, ξ() is a non-linear activation function, W p is the concatenated result transformation layer weight matrix, b p is the concatenated result transformation layer bias, H i,p is the p-th enhanced result of the i-th dairy cow sample, and Z i,L is the L-th mapping vector of the i-th dairy cow sample;

[0076] The output layer obtains the refined milk production prediction result of dairy cows by using the enhanced result and the mapping vector, specifically;

[0077]

[0078] Among them, Z i,L =[Z i,1 , Z i,2 ,... Z i,L , where Z i,L is the set of L feature mapping vectors of the i-th dairy cow, and H i,P =[H i,1 , H i,2 ,... H i,P , where H i,P is the set of P enhancement results of the i-th dairy cow, and W is the output layer weight matrix.

[0079] The beneficial effects of the present invention are as follows:

[0080] The present invention comprehensively considers the factors affecting milk production of dairy cows, and uses a rough measurement model and a refined prediction model for milk production of dairy cows to predict the milk production of dairy cows. The present invention conducts rough and refined two-step predictions, which improves the accuracy of predicting the milk production of dairy cows. The present invention determines the importance of different features for the milk production of dairy cows, and conducts a rough prediction of the milk production of dairy cows based on the importance features of different milk production features; the present invention divides the milk production features of dairy cows into body features, breast features, and time features, fuses them with the rough prediction results of the milk production of dairy cows, and conducts a refined prediction of the milk production of dairy cows based on the fused features, further improving the accuracy of predicting the milk production of dairy cows. Description of the Drawings

[0081] Figure 1 This is the flow chart of the present invention. Detailed Embodiments

[0082] Detailed Embodiment 1: The specific process of a method for predicting the milk production of dairy cows in this embodiment is as follows:

[0083] S1. Obtain the data set of milk production characteristics of the dairy cow to be predicted;

[0084] The milk production characteristics of the dairy cow include: body height, chest width of the cow, body depth, breast depth, length of the central suspensory ligament, position of the front teat, length of the front teat, height of the posterior breast attachment, position of the posterior teat, number of lactation days, parity, width of the posterior breast attachment;

[0085] S2. Normalize the data of the milk production characteristics of the dairy cow to be predicted to obtain the preprocessed data set of the milk production characteristics of the dairy cow to be predicted. Specifically:

[0086]

[0087] Among them, is the normalized is the j-th feature in the i-th dairy cow sample to be measured, where j ∈ [1, 12], j is the feature label of the dairy cow to be predicted, and n* is the total number of dairy cows to be predicted;

[0088] S3. Input the preprocessed dataset of milk production characteristics of dairy cows to be predicted into the trained rough prediction model of dairy cow milk production to obtain the rough predicted milk production of the dairy cows to be predicted;

[0089] S4. Input the preprocessed dataset of milk production characteristics of dairy cows to be predicted and the rough predicted milk production of the dairy cows to be predicted into the trained fine prediction model of dairy cow milk production to obtain the milk production of the dairy cows to be predicted.

[0090] The trained rough prediction model of dairy cow milk production is obtained through the following method:

[0091] Step 1. Obtain the dataset of milk production characteristics of dairy cows and preprocess the dataset of milk production characteristics of dairy cows to obtain the preprocessed dataset of milk production characteristics of dairy cows. Specifically:

[0092] Step 1-1. Obtain the dataset of milk production characteristics of dairy cows;

[0093] X(t) = [X1(t), X2(t),...X i (t),..,X n (t)]

[0094] X i (t) = [X i,H ,X i,W ,X i,D ,X i,RD ,X i,L ,X i,Qp ,X i,Ql ,X i,BH ,X i,BW ,X i,Bp ,X i,S ,t]

[0095] where X i (t) is the milk production feature vector of the i-th dairy cow on the t-th lactation day, X(t) is the dataset of milk production characteristics of dairy cows, X i,H is the body height of the i-th dairy cow, X i,W is the chest width of the i-th dairy cow, X i,D is the body depth of the i-th dairy cow, X i,RD is the udder depth of the i-th dairy cow, X i,L is the length of the central suspensory ligament of the i-th dairy cow, X i,Qp is the position of the front teat of the i-th dairy cow, X i,Ql is the length of the front teat of the i-th dairy cow, X i,BH is the height of the posterior udder attachment of the i-th dairy cow, X i,Bpis the position of the rear teat of the i-th cow, t is the number of days in lactation, X i,S is the parity of the i-th cow, X i,BW is the width of the rear udder attachment of the i-th cow, and n is the total number of cows;

[0096] The milk production characteristics of the cows include: body height X H , chest width X W , body depth X D , udder depth X RD , length of the central suspensory ligament X L , position of the front teat X Qp , length of the front teat X Ql , height of the rear udder attachment X BH , width of the rear udder attachment X BW , position of the rear teat X Bp , parity X S , number of days in lactation t;

[0097] The chest width is the width of the chest floor between the inner sides of the two front limbs;

[0098] The body depth is the ratio of the vertical distance from the lumbar vertebra at the last rib to the abdominal bottom to the vertical distance from the lumbar vertebra at the last rib to the ground;

[0099] The udder depth is the vertical distance from the bottom of the udder to the hock;

[0100] The length of the central suspensory ligament is the vertical distance between the base of the central suspensory ligament and the bottom of the udder;

[0101] The position of the front teat is the relative position of the base of the front teat in the milk area; if it is greater than the first preset distance, it means far, and the position of the front teat is assigned 1. If it is less than or equal to the first preset distance and greater than the second preset distance, it means moderate, and the position of the front teat is assigned 5. If it is less than or equal to the second preset distance, it means near, and the position of the front teat is assigned 9;

[0102] The height of the rear udder attachment is the vertical distance between the uppermost edge of the udder glandular tissue and the base of the vulva;

[0103] The width of the udder attachment is the width of the upper edge of the rear udder glandular tissue;

[0104] The position of the rear teat is the relative position of the base of the rear teat in the milk area where it is located; if the distance between the two teats is greater than the third preset distance, it means far, and the position of the rear teat is assigned 1. If it is less than or equal to the third preset distance and greater than the fourth preset distance, it means moderate, and the position of the rear teat is assigned 5. If it is less than or equal to the fourth preset distance, it means near, and the position of the rear teat is assigned 9;

[0105] Steps one and two: Normalize the data in the cow milk production characteristics dataset to obtain the preprocessed cow milk production characteristics dataset:

[0106]

[0107] Among them, X' ij is the normalized X ij , X ij is the j-th feature in the i-th dairy cow sample, j ∈ [1, 12], j is the feature label in the sample, and n is the total number of dairy cows;

[0108] Step 2: Combine the preprocessed dairy cow milk production dataset and the milk production at the t-th lactation day to form a dataset, divide the dataset into a training set and a test set, and use the training set to train a rough dairy cow milk production prediction model to obtain a trained rough dairy cow milk production prediction model, specifically:

[0109] Step 2-1: Combine the preprocessed dairy cow milk production dataset and the milk production at the t-th lactation day to form a dataset, and divide the dataset into a training set and a test set;

[0110] Step 2-2: Use the training set to train a rough dairy cow milk production prediction model;

[0111] The rough dairy cow milk production prediction model includes: a feature division module, a feature scoring module, and a prediction module;

[0112] The feature division module is used to divide the preprocessed dairy cow milk production dataset into a body feature vector, a breast feature vector, and a time feature vector;

[0113] The body feature vector B i = [X i,H , X i,W , X i,D ;

[0114] The breast feature vector R i = [X i,RD , X i,L , X i,Qp , X i,Ql , X i,BH , X i,BW , X i,Bp ;

[0115] The time feature vector S i = [X i,S , t];

[0116] The feature scoring module is used to obtain the body feature importance score, the breast feature importance score, and the time feature importance score of the dairy cow, including: a body feature score acquisition unit, a breast feature score acquisition unit, and a time feature score acquisition unit;

[0117] The body feature score acquisition unit includes: an input layer, an attention layer, an activation function layer, a feature weighting layer, a fully connected layer, and an output layer;

[0118] The input layer is used to input the cow body feature vector and input the cow body feature vector into the attention layer; the dimension of the input layer is 4;

[0119] The attention layer is used to assign weights to each feature in the cow body feature vector to obtain the cow body feature weight vector;

[0120] The activation function layer is used to normalize the cow body feature weights to obtain the normalized cow body feature weights; the activation function layer is a softmax function;

[0121] The feature weighting layer is used to multiply each cow body feature by the corresponding weight to obtain the body weighted feature vector;

[0122] The fully connected layer is used to map the body weighted feature vector into the feature space;

[0123] The output layer is used to output the importance score of the cow body feature vector.

[0124] The output layer uses a sigmoid activation function.

[0125] The structure of the breast feature score acquisition unit is the same as that of the body feature score acquisition unit; however, the dimension of the input and output layer is 7; the importance score of the breast feature is output;

[0126] The structure of the time feature score acquisition unit is the same as that of the body feature score acquisition unit; however, the dimension of the input and output layer is 2; the importance score of the time feature is output;

[0127] The prediction module includes: a feature combination unit and a prediction unit;

[0128] The feature combination unit is used to splice the body feature vector and the importance score of the body feature vector, the breast feature vector and the importance score of the breast feature vector, and the time feature vector and the importance score of the time feature vector respectively, and input the three vectors obtained after splicing into the prediction unit;

[0129] The prediction unit is used to obtain the milk yield of the t-th lactation day by using the spliced vectors

[0130] The prediction unit includes: a data filling layer, a hidden layer, and an output layer;

[0131] The data filling layer is used to zero-pad the three spliced vectors to the same length and input the padded vectors into the hidden layer;

[0132] The hidden layer is used to process the output of the data filling layer;

[0133] The output layer is used to obtain the milk production of the t-th lactation day according to the output of the hidden layer The present invention adopts a linear activation function;

[0134] Step 3: Use the test set to test the trained rough prediction model of cow milk production. If the accuracy rate of the trained rough prediction model of cow milk production is lower than the preset threshold, return to Step 1; otherwise, output the trained rough prediction model of cow milk production.

[0135] Specific Embodiment 2: The trained refined prediction model of cow milk production is obtained through the following method:

[0136] A1. Obtain a cow milk production characteristic data set, perform normalization preprocessing on the cow milk production characteristic data set to obtain a preprocessed cow milk production characteristic data set, and combine the preprocessed cow milk data set, the rough prediction value of cow milk production output by the rough prediction model of cow milk production, and the milk production of the t-th lactation day to form a second data set, and divide the second data set into a second training set and a second test set;

[0137] A2. Use the second training set to train the refined prediction model of cow milk production to obtain a trained refined prediction model of cow milk production;

[0138] The refined prediction model of cow milk production includes: a feature vector acquisition module, a feature fusion module, and a milk production refined prediction module;

[0139] The feature vector acquisition module is used to obtain a cow body feature vector, a breast feature vector, and a time feature vector according to the cow milk production characteristic data set;

[0140] The feature fusion module is used to fuse the body feature vector, the breast feature vector, the time feature vector, and the rough prediction value of cow milk production to obtain a feature fusion result C i :

[0141] C i = MCCA(B i , R i , S i , M i )

[0142] where M i is the rough prediction result of cow milk production;

[0143] The milk production refined prediction module is based on the feature fusion result C iObtain the precise prediction result of the milk production of dairy cows; the precise milk production prediction module includes: a mapping vector acquisition layer, a mapping vector splicing layer, a spliced result transformation layer, and an output layer;

[0144] The mapping vector acquisition layer uses the feature fusion result C i to obtain the mapping vector, specifically:

[0145] Z i,l = φ(C i W i,l + b i,l ), l = 1,..., L

[0146] where Z i,l is the l-th mapping vector of the i-th dairy cow sample, L is the number of mapping vectors, φ() is a linear transformation function, W i,l is the feature mapping weight matrix, and b i,l is the feature mapping bias;

[0147] The mapping vector splicing layer is used to splice the mapping vectors to obtain the spliced result;

[0148] The spliced result transformation layer is used to perform a non-linear transformation on the spliced result to obtain the enhanced result, specifically:

[0149] H i,p = ξ([Z i,1 , Z i,2 ,..., Z i,L W p + b p ), p = 1,..., P

[0150] ξ() = tanh()

[0151] where p is the enhanced node label, P is the total number of enhanced nodes, ξ() is a non-linear activation function, W p is the spliced result transformation layer weight matrix, b p is the spliced result transformation layer bias, H i,p is the p-th enhanced result of the i-th dairy cow sample, and Z i,L is the L-th mapping vector of the i-th dairy cow sample;

[0152] The output layer uses the enhanced result and the mapping vector to obtain the precise prediction result of the milk production of dairy cows, specifically;

[0153]

[0154] where Z i,L = [Z i,1 , Z i,2 ,... Z i,L , Z i,Lis the set of L feature mapping vectors of the i-th cow, H i,P = [H i,1 , H i,2 , … H i,P , H i,P is the set of P enhancement results of the i-th cow, and W is the output layer weight matrix.

[0155] A3. Use the second test set to test the accurate milk production prediction model of cows. If the accuracy of the trained accurate milk production prediction model of cows is greater than the preset threshold, output the currently trained accurate milk production prediction model of cows; otherwise, return to step A1.

Claims

1. A method for predicting the milk yield of dairy cows, characterized in that The method includes the following steps: S1. Obtain the dataset of milk production characteristics of cows to be predicted; The milk production characteristics of cows include: body height, chest width of cows, body depth, udder depth, length of the central suspensory ligament, position of the front teat, length of the front teat, height of the posterior udder attachment, position of the rear teat, number of lactation days, parity, width of the posterior udder attachment; S2. Normalize the data of milk production characteristics of cows to be predicted to obtain the preprocessed dataset of milk production characteristics of cows to be predicted; S3. Input the preprocessed dataset of milk production characteristics of cows to be predicted into the trained rough prediction model of cow milk production to obtain the rough predicted milk production of cows to be predicted; S4. Input the preprocessed dataset of milk production characteristics of cows to be predicted and the rough predicted milk production of cows to be predicted into the trained refined prediction model of cow milk production to obtain the milk production of cows to be predicted.

2. The milk yield prediction method for dairy cows according to claim 1, wherein: The value of the position of the front teat in S1 is 1, 5 or 9; the value of the position of the rear teat is 1, 5 or 9.

3. The method for predicting the milk yield of dairy cows according to claim 2, wherein: The normalization process of the data of milk production characteristics of cows to be predicted in S2 to obtain the preprocessed dataset of milk production characteristics of cows to be predicted is specifically as follows: Among them, is the normalized is the j-th feature in the i-th dairy cow sample to be measured, where j ∈ [1, 12], j is the feature label of the dairy cow to be predicted, and n* is the total number of dairy cows to be predicted.

4. A method for predicting the milk yield of dairy cows according to claim 3, characterized in that: The trained rough prediction model of cow milk production in S3 is obtained through the following method: Step 1. Obtain the dataset of milk production characteristics of cows and preprocess the dataset of milk production characteristics of cows to obtain the preprocessed dataset of milk production characteristics of cows; Step 2: Combine the preprocessed dairy cow milk production dataset and the milk production at the t-th lactation day to form a dataset, divide the dataset into a training set and a test set, and use the training set to train a rough prediction model for dairy cow milk production to obtain a trained rough prediction model for dairy cow milk production; Step 3. Use the test set to test the trained rough prediction model of cow milk production. If the accuracy rate of the trained rough prediction model of cow milk production is lower than the preset threshold, return to Step 1; Otherwise, output the trained rough prediction model of cow milk production.

5. A method for predicting the milk yield of dairy cows according to claim 4, characterized in that: The obtaining of the dataset of milk production characteristics of cows and the preprocessing of the dataset of milk production characteristics of cows in Step 1 to obtain the preprocessed dataset of milk production characteristics of cows is specifically as follows: Step 11. Obtain the dataset of milk production characteristics of cows; X(t) = [X1(t), X2(t),... X i (t),.., X n (t)] X i (t) = [X i,H , X i,W , X i,D , X i,RD , X i,L , X i,Qp , X i,Ql , X i,BH , X i,BW , X i,Bp , X i,S , t] Among them, X i (t) is the milk production characteristic vector of the i-th dairy cow on the t-th lactation day, X(t) is the dairy cow milk production characteristic data set, X i,H is the body height of the i-th dairy cow, X i,W is the chest width of the i-th dairy cow, X i,D is the body depth of the i-th dairy cow, X i,RD is the udder depth of the i-th dairy cow, X i,L is the length of the central suspensory ligament of the i-th dairy cow, X i,Qp is the position of the front teat of the i-th dairy cow, X i,Ql is the length of the front teat of the i-th dairy cow, X i,BH is the height of the rear udder attachment of the i-th dairy cow, X i,Bp is the position of the rear teat of the i-th dairy cow, t is the lactation days, X i,S is the parity of the i-th dairy cow, X i,BW is the width of the rear udder attachment of the i-th dairy cow after milking, n is the total number of dairy cows; Step 12. Normalize the data in the dataset of milk production characteristics of cows to obtain the preprocessed dataset of milk production characteristics of cows: Among them, X' ij is the normalized X ij , X ij is the j-th feature in the i-th dairy cow sample, j ∈ [1, 12], j is the feature label in the sample, and n is the total number of dairy cows.

6. The method for predicting the milk yield of dairy cows according to claim 5, characterized in that: The milk production data set of dairy cows after preprocessing and the milk production at the t-th lactation day in the second step are combined to form a data set. The data set is divided into a training set and a test set. The rough prediction model of dairy cow milk production is trained using the training set to obtain a trained rough prediction model of dairy cow milk production, specifically as follows: Step 2-1: Combine the preprocessed dairy cow milk production dataset and the milk production at the t-th lactation day to form a dataset, and divide the dataset into a training set and a test set; Step 22. Use the training set to train the rough prediction model of cow milk production; The rough prediction model of cow milk production includes: a feature division module, a feature scoring module, and a prediction module; The feature division module is used to divide the preprocessed dataset of cow milk production into a body feature vector, a udder feature vector, and a time feature vector; Body feature vector B i = [X i,H , X i,W , X i,D ; Breast feature vector R i = [X i,RD , X i,L , X i,Qp , X i,Ql , X i,BH , X i,BW , X i,Bp ; Time feature vector S i = [X i,S , t]; The feature scoring module is used to obtain the importance scores of the body features, udder features, and time features of cows; the feature scoring module includes: a body feature score obtaining unit, a udder feature score obtaining unit, and a time feature score obtaining unit; The body feature score obtaining unit includes: an input layer, an attention layer, an activation function layer, a feature weighting layer, a fully connected layer, and an output layer; The input layer is used to input the body feature vector of cows and input the body feature vector of cows into the attention layer; the dimension of the input layer is 4; The attention layer is used to assign weights to each feature in the body feature vector of cows to obtain the body feature weight vector of cows; The activation function layer is used to normalize the weights of the cow body features to obtain the normalized weights of the cow body features; the activation function layer is a softmax function; The feature weighting layer is used to multiply each cow body feature by the corresponding weight to obtain a body weighted feature vector; The fully connected layer is used to map the body weighted feature vector into the feature space; The output layer is used to output the importance score of the cow body feature vector. The output layer uses a sigmoid activation function. The structure of the breast feature score acquisition unit is the same as that of the body feature score acquisition unit; however, the dimension of the input and output layer is 7; the importance score of the breast feature is output; The structure of the time feature score acquisition unit is the same as that of the body feature score acquisition unit; however, the dimension of the input and output layer is 2; the importance score of the time feature is output; The prediction module obtains the milk yield on the t-th lactation day by using the importance scores of the body characteristics, breast characteristics, and time characteristics of the dairy cow, as well as the body characteristic vector, breast characteristic vector, and time characteristic vector.

7. A method for predicting the milk production of dairy cows according to claim 6, characterized in that: The feature prediction module includes: a feature combination unit and a prediction unit; The feature combination unit is used to splice the body feature vector and the importance score of the body feature vector, the breast feature vector and the importance score of the breast feature vector, and the time feature vector and the importance score of the time feature vector respectively, and input the three vectors obtained after splicing into the prediction unit; The prediction unit is used to obtain the milk yield on the t-th lactation day by using the spliced vectors The prediction unit includes: a data filling layer, a hidden layer, and an output layer; The data filling layer is used to zero-pad the three spliced vectors to the same length and input the padded vectors into the hidden layer; The input of the hidden layer is the output of the data filling layer; The output layer is used to obtain the milk yield on the t-th lactation day according to the output of the hidden layer 8. A method for predicting the milk yield of dairy cows according to claim 7, characterized in that: The trained fine prediction model for cow milk production is obtained by the following method: A1. Obtain a dairy cow milk production characteristic dataset, perform normalization preprocessing on the dairy cow milk production characteristic dataset to obtain the preprocessed dairy cow milk production characteristic dataset, and use the preprocessed dairy cow milk production dataset, the rough predicted value of the dairy cow milk production output by the dairy cow milk production rough prediction model, and the milk production at the t-th lactation day to form a second dataset, and divide the second dataset into a second training set and a second test set; A2. Use the second training set to train the fine prediction model for cow milk production to obtain the trained fine prediction model for cow milk production; A3. Use the second test set to test the fine prediction model for cow milk production. If the accuracy of the trained fine prediction model for cow milk production is greater than the preset threshold, output the currently trained fine prediction model for cow milk production; Otherwise, return to step A1.

9. A method for predicting milk yield of dairy cows according to claim 8, characterized in that: The fine prediction model for cow milk production includes: a feature vector acquisition module, a feature fusion module, and a fine prediction module for milk production; The feature vector acquisition module is used to obtain the cow body feature vector, the breast feature vector, and the time feature vector according to the cow milk production feature data set; Body feature vector B i = [X i,H , X i,W , X i,D ; Breast feature vector R i = [X i,RD , X i,L , X i,Qp , X i,Ql , X i,BH , X i,BW , X i,Bp ; Time feature vector S i = [X i,S , t]; The feature fusion module is used to fuse the body feature vector, breast feature vector, time feature vector, and the rough predicted value of the milk production of the cow to obtain the feature fusion result C i : C i = MCCA(B i , R i , S i , M i ) Among them, M i is the rough prediction result of the milk yield of dairy cows; The milk yield precise prediction module obtains the precise prediction result of the milk yield of dairy cows according to the feature fusion result C i ​ 10. A method for predicting the milk yield of dairy cows according to claim 9, characterized in that: The fine prediction module for milk production includes: a mapping vector acquisition layer, a mapping vector splicing layer, a splicing result transformation layer, and an output layer; The mapping vector acquisition layer uses the feature fusion result C i to obtain a mapping vector, specifically as follows: Z i,l = φ(C i W i,l + b i,l ), l = 1, ..., L where, Z i,l is the l-th mapping vector of the i-th cow sample, L is the number of mapping vectors, φ() is a linear transformation function, W i,l is the feature mapping weight matrix, and b i,l is the feature mapping bias; The mapping vector splicing layer is used to splice the mapping vectors to obtain a splicing result; The splicing result transformation layer is used to perform a non-linear transformation on the splicing result to obtain an enhanced result, specifically: H i,p = ξ([Z i,1 , Z i,2 ,..., Z i,L W p + b p ), p = 1, ..., P ξ() = tanh() where p is the enhanced node label, P is the total number of enhanced nodes, ξ() is a non-linear activation function, W p is the weight matrix of the concatenation result transformation layer, b p is the bias of the concatenation result transformation layer, H i,p is the p-th enhanced result of the i-th cow sample, Z i,L is the L-th mapping vector of the i-th cow sample; The output layer uses the enhanced result and the mapping vector to obtain the fine prediction result of cow milk production, specifically; Among them, Z i,L = [Z i,1 , Z i,2 ,... Z i,L , Z i,L is the set of L feature mapping vectors of the i-th cow, H i,P = [H i,1 , H i,2 ,... H i,P , H i,P is the set of P enhancement results of the i-th cow, and W is the output layer weight matrix.

Citation Information

Patent Citations

  • Dairy cow milk yield data processing and predicting method

    CN116090651A

  • Dairy cow milk yield prediction method based on deep learning

    CN117094446A

  • Method and device for predicting milk yield of dairy cow

    CN118886608A

  • Prediction model creation method, prediction method, prediction model creation device, prediction device, prediction model creation program, and prediction program

    WO2023053918A1