Intelligent prediction method for feed loading quantity of modern pig farm
By constructing a neural network and using gradient descent to optimize feed quantity, the problem of inaccurate feed delivery in pig farms was solved, realizing intelligent and precise feeding for each pig and improving the slaughter rate and quality of pigs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JINKAI TECH (DALIAN) CO LTD
- Filing Date
- 2024-10-30
- Publication Date
- 2026-07-24
Smart Images

Figure CN119047533B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart farming technology, specifically to a method for intelligently predicting feed intake in modern pig farms. Background Technology
[0002] As people's living standards continue to improve, the demand for livestock is constantly increasing. Modern scientific pig farming methods can effectively increase the rate of pig slaughter.
[0003] Currently, pig farms typically feed pigs in groups, with a large proportion relying on feed. This often leads to fighting and competition during feeding, resulting in feed waste. Furthermore, the growth of pigs in each group is not necessarily the same, making it difficult to control the balance of feed intake in each group. Consequently, it is difficult to achieve precise feeding for each pig to improve pig yield and quality.
[0004] To achieve the above objectives, those skilled in the art employ semi-automatic or even fully manual methods for feed supply and feeding. During feeding, the amount of feed is typically adjusted based on the pig's growth weight and body size, without considering the breed, sex, age, or physical condition of the pig. This is particularly prominent among individual farmers, and this method is labor-intensive, time-consuming, and inefficient. Furthermore, in current farms, the amount of feed given to each pig is usually manually controlled, which cannot achieve precise feeding and incurs significant labor costs. Summary of the Invention
[0005] This invention provides an intelligent prediction method for feed feeding in modern pig farms. This method collects information about pigs and combines this information to determine the optimal feed feeding amount for each pig, thereby achieving precise and intelligent farming.
[0006] The purpose of this invention is to provide an intelligent prediction method for feed intake in modern pig farms, comprising the following steps:
[0007] Obtain information about pigs in a pig farm, including their age-group weight gain rate and number of days until slaughter; wherein, the pig information includes age group, initial weight for age group, and feed amount;
[0008] The network is constructed by using information about pigs as input and the weight gain rate and number of days until slaughter as output.
[0009] The first loss function is obtained based on the weight gain rate of each age group, the number of days until slaughter, and the preset weight gain rate weights for each age group.
[0010] The neural network is trained based on the first loss function, and the weights of weight gain rate for each age group are continuously updated until convergence; and the weights of weight gain rate for each age group are obtained during the training process of the neural network.
[0011] The age group weight is obtained by determining the weight of weight gain rate for each age group.
[0012] The information of any pig is input into the trained neural network to obtain the predicted weight gain rate and predicted number of days to market for that pig in each age group; then, a second loss function is obtained based on the predicted weight gain rate, age group weight, predicted number of days to market for that pig in each age group, and initial weight in each age group.
[0013] Based on the second loss function, while keeping the trained neural network parameters unchanged, the gradient descent method is used to continuously update the amount of feed to be learned and retrain the neural network until convergence. The final converged feed amount is the optimal feed amount for the pig in the corresponding age group.
[0014] The optimal feed intake for each pig at any given age is determined sequentially.
[0015] In one embodiment, the second loss function is obtained according to the following steps:
[0016] The weight gain loss for each age group is obtained by predicting the weight gain rate by age group and by weighting the age group.
[0017] The weight of the predicted number of days for slaughter is obtained based on the predicted number of days for slaughter.
[0018] The estimated number of days lost before slaughter is obtained based on the initial weight and predicted weight gain rate of each age group.
[0019] Then, a second loss function is obtained based on the weight loss of age group, the weight of predicted days of slaughter, and the estimated loss of days of slaughter.
[0020] In one embodiment, the formula for calculating weight gain loss for the age group is as follows:
[0021]
[0022] In the formula, Indicates weight loss for a specific age group;
[0023] Indicates the first The first pig in Predicted weight gain rate for each age group;
[0024] Indicates the first Weighting of each age group;
[0025] Indicates the first Cycles for each age group;
[0026] Indicates the first The weighted sum of the weight gain of a pig at each age group, where, Indicates the first The age range of the first pig; Indicates the first The age range of maturity for a pig.
[0027] In one embodiment, the first The formula for calculating the weight of each age group is as follows:
[0028]
[0029] In the formula, Indicates the first Age group weights for each age group; Indicates the first Weighting of weight gain rate for each age group; This indicates the age range at which a pig reaches maturity.
[0030] In one embodiment, the formula for calculating the weighted number of days for predicted slaughter is as follows:
[0031]
[0032] In the formula, This indicates the weight of the predicted number of days until the pigs can be sold.
[0033] Indicates the first The first pig in The predicted number of days until slaughter for each age group.
[0034] In one embodiment, the information about the pig also includes breed and sex.
[0035] In one embodiment, the formula for calculating the estimated number of days of slaughter lost is as follows:
[0036]
[0037] In the formula, Indicates the first The first pig Initial weight for each age group; Indicates the first The slaughter weight of a pig. Indicates the first The breed of pig; Indicates the first The first pig in Predicted weight gain rate for each age group; Indicates the first The age range of the first pig; Indicates the first The age range of maturity for a pig; Indicates the first Cycles for each age group; This indicates the estimated number of days of loss before the animals can be sold.
[0038] In one embodiment, the initial weight of the next age group is obtained based on the initial weight of the previous age group and the predicted weight gain rate.
[0039] In one embodiment, during the process of training the neural network according to the first loss function, the initial weight of the weight gain rate of each age group is obtained according to the weight gain rate of pigs in the pig farm; the initial weight of the weight gain rate of each age group is used to accelerate the convergence speed of the weights during the network training process.
[0040] In one embodiment, the first loss function is calculated using the following formula:
[0041]
[0042] In the formula, Represents the first loss function; Indicates the predicted weight gain rate for a given age group; This indicates the actual rate of weight gain for a given age group; Indicates the predicted number of days until the animals are ready for market; Indicates the actual number of days the animals can be sold. Indicates age group; Indicates age group Weighting rate weighting This indicates the weight of the number of days the pig can be sold.
[0043] The beneficial effects of this invention application are:
[0044] This application provides an intelligent prediction method for feed input in modern pig farms. This method utilizes historical information about pigs to construct a neural network, obtaining the optimal feed input for each pig. Compared to existing feed input prediction technologies, the neural network used in this application has a simpler structure. Furthermore, this invention, through thorough analysis and calculation of individual pig information, achieves more accurate predictions of feed input for pigs at different growth stages, thereby realizing precise and intelligent farming and improving pig slaughter efficiency. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is a flowchart illustrating the overall steps of an embodiment of the intelligent prediction method for feed quantity in modern pig farms according to the present invention. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] This invention provides an intelligent prediction method for feed intake in modern pig farms, see [link to relevant documentation]. Figure 1 As shown, it includes the following steps:
[0049] S001. Obtain information about pigs in the pig farm, including the weight gain rate and number of days until slaughter for each age group; wherein, the pig information includes age group, initial weight for each age group, and feed amount; the pig information also includes breed and sex.
[0050] It should be noted that the growth rate of pigs is related to their breed, sex, age, physical condition, and the amount of feed they are given; in order to construct a neural network to obtain the optimal amount of feed, it is necessary to collect basic information about the pigs.
[0051] The initial weight of different pigs at each age can be understood as a reflection of their different physical conditions. We need to obtain the pig's breed, sex, age group, and initial weight for that age group. To build the neural network, we also need to calculate the daily feed intake for each age group, the weight gain rate for each age group, and the final number of days until slaughter.
[0052] First, the pigs are divided into age groups. Based on experience, the growth cycle of pigs is divided into 's' age groups. The growth rate of pigs in each age group is basically the same, but the cycle of each age group is different, denoted as 's'. Pigs typically reach maturity and slaughter weight at age s.
[0053] In this embodiment, based on the existing pigs in the pig farm, the breed, sex, age group, and initial weight of the pigs in the age group are obtained, so that the optimal feed amount for each pig can be obtained later based on the trained neural network; that is, the dataset for training the neural network is the historical data of the pigs in the pig farm: the breed, sex, age group, initial weight of the age group, feed amount, weight gain rate of the age group, and number of days before slaughter.
[0054] S002. Construct a neural network by using the pig information as the input to the network and the weight gain rate and number of days until slaughter as the output of the network.
[0055] The first loss function is obtained based on the weight gain rate of each age group, the number of days until slaughter, and the preset weight gain rate weights for each age group.
[0056] The neural network is trained based on the first loss function, and the weights of weight gain rate for each age group are continuously updated until convergence; and the weights of weight gain rate for each age group are obtained during the training process of the neural network.
[0057] The age group weight is obtained by determining the weight of weight gain rate for each age group.
[0058] The amount of feed should vary depending on the breed, sex, age group, and initial weight of the pigs at different ages. Therefore, it is necessary to establish a mapping relationship between pig information and the pig's age-specific weight gain rate and number of days until slaughter to obtain the optimal feed dosage for different pigs.
[0059] In this embodiment, by combining a neural network, different initial weights for weight gain are set for different age groups, and a mapping relationship is established between pig information and the pig's age-group weight gain rate and the number of days until slaughter.
[0060] Specifically, constructing a neural network:
[0061] The specific process of constructing an FC neural network is as follows:
[0062] (1) The input to the network is information about pigs, including breed. ,gender Age group Initial weight for each age group Feed quantity The network output is the weight gain rate for each age group. Number of days available for slaughter .
[0063] (2) The data used for network training is a collection of historical pig datasets, including pig breeds. ,gender Age group Initial weight for each age group Feed quantity .
[0064] (3) The network tags are the weight gain rates of pigs by age group collected. Number of days available for slaughter information.
[0065] It should be noted that, since the rate of weight gain varies at different ages and the importance of weight gain at different ages varies in the entire growth cycle of pigs, a weight is constructed for the rate of weight gain at different ages, so that the loss function pays different attention to the rate of weight gain at different ages.
[0066] In this embodiment, a first loss function is obtained based on the weight gain rate of each age group, the number of days until slaughter, and a preset weight for the weight gain rate of each age group; wherein, the calculation formula for the first loss function is as follows:
[0067]
[0068] In the formula, Represents the first loss function; Indicates the predicted weight gain rate for a given age group; This indicates the actual rate of weight gain for a given age group; Indicates the predicted number of days until the animals are ready for market; Indicates the actual number of days the animals can be sold. Indicates age group; Indicates age group Weighting rate weight; This indicates the weight of the number of days until the pig is ready for market. The importance of weight gain varies across different age groups in the entire pig growth cycle. For important age groups, it is necessary to predict the weight gain rate more accurately, and the loss function should focus more on the weight gain rate of each age group.
[0069] In this embodiment, the neural network is trained according to the first loss function and the stochastic gradient descent algorithm is used to train the neural network. At the same time, the weights of weight gain rate of learning age groups are continuously updated until convergence. The weights of weight gain rate of age groups are obtained during the training process of the neural network.
[0070] Furthermore, during the training of the neural network based on the first loss function, initial weights for each age group's weight gain rate are obtained according to the age-specific weight gain rates of pigs in the pig farm. These initial weights accelerate the convergence speed of the weights during network training. Specifically:
[0071] First, initialize a weighting weight for weight gain rate for each age group: combining information from all pigs in historical data, group the pigs by age group, with pigs of the same age group grouped together, and calculate the average weight gain rate for each group (i.e., each age group). The initial weights for weight gain rates in each age group are obtained by combining the average values. Initial weighting of weight gain rate for each age group The calculation formula is as follows:
[0072]
[0073] In the formula, For the first Average weight gain rate for each age group; This represents the maximum value of the average weight gain rate across all age groups. As a weighting factor, avoid the first The initial weighting of the weight gain rate for the first age group was too high, leading to the... The number of days available for slaughter for each age group is lost in the loss function, in this embodiment. .
[0074] Similarly, calculate the initial weights for weight gain rates for all age groups to obtain an initial weight sequence. The initial weighted sequence for the number of days available for slaughter is then: .
[0075] Using historical data to obtain initial weights can accelerate the convergence speed of weights during the network learning process, making network training more accurate.
[0076] At this point, a trained neural network was obtained, and a mapping relationship was established between pig information and the pig's age-related weight gain rate and the number of days until it can be marketed.
[0077] To ensure better growth of pigs during key age periods when feeding them with appropriate feed amounts, thereby reducing their time to market and increasing overall pig production, the neural network was trained to learn the weights of weight gain at different age stages. These weights were then used to determine age-group weights, representing the importance of different age groups throughout the pig's growth cycle. This allows the neural network to focus more on key age groups when converging feed amounts.
[0078] In this embodiment, the age group weight is obtained based on the weight gain rate weight of each age group; this weight reflects the degree of attention paid to the weight gain rate of different age groups. The age group weight, obtained based on the weight gain rate weight, is used to characterize the importance of different age groups in the entire pig's growth cycle. Specifically, the... Age group weights for each age group The calculation formula is as follows:
[0079]
[0080] In the formula, Indicates the first Age group weights for each age group; Indicates the first Weighting of weight gain rate for each age group; This indicates the pig's age range of maturity. The higher the weight of an age range, the more important that age range is in the pig's growth cycle.
[0081] S003. Input the information of any pig into the trained neural network to obtain the predicted weight gain rate and predicted number of days to market for the pig in each age group; then obtain the second loss function based on the predicted weight gain rate, age group weight, predicted number of days to market for the pig, and initial weight in each age group.
[0082] The second loss function is obtained by following these steps: obtaining the age group weight gain loss based on the predicted weight gain rate and age group weight; obtaining the predicted number of days to market based on the predicted number of days to market; obtaining the estimated number of days to market based on the initial weight and predicted weight gain rate of the age group; and then obtaining the second loss function based on the age group weight gain loss, the predicted number of days to market weight, and the estimated number of days to market weight loss.
[0083] It should be noted that the feed amounts in historical data may not be optimal. For pigs in pig farms, this embodiment aims to find a feed amount for different age groups based on the pig's breed, sex, age group, and initial weight information for each age group, so that the pigs can reach market weight in the shortest possible time under different feed amounts at different age groups. This feed amount is referred to as the optimal feed amount for different age groups.
[0084] In this embodiment, the pig farm is used as an example. Taking a pig as an example, the breed of this pig is... Gender is Age group Initial weight for each age group The optimal feed amount for pigs at different ages is determined as follows:
[0085] Pig farm The age range of the first pig is Then, the pig will need to undergo further growth stages during its growth cycle. Age group. To minimize the final slaughter time of the pig, it is necessary to obtain data on the pig's age range. Optimal feed amounts for different age groups. The pigs were then... The amount of feed for each age group is recorded as follows: First, initialize randomly. The value of is kept unchanged, and the neural network structure and network parameters obtained in S2 are used to change the value of . breed of pig ,gender Age group Initial weight for each age group Feed quantity The input is fed into the trained neural network, and the network output is the [number]th [unit]. The first pig Age-group predicted weight gain rate Predicted number of days until slaughter .
[0086] In this embodiment, the initial weight of the next age group is obtained based on the initial weight of the previous age group and the predicted weight gain rate. Then the... The first pig The next age group of adjacent age groups Predicted initial weight for age group The calculation formula is as follows:
[0087]
[0088] In the formula, Indicates the first The first pig Initial weight for each age group;
[0089] Indicates the first The first pig Initial weight for each age group; Indicates the first The first pig in Predicted weight gain rate for each age group; Indicates the first The cycle of each age group. Then the... The first pig Age group information is used to predict varieties ,gender Age group Initial weight for each age group Compare it with the initial feed amount The input is fed into the trained neural network, and the network output is the [number]th [unit]. The first pig Age-group predicted weight gain rate Predicted number of days until slaughter .
[0090] Similarly, obtain the first The first pig Age groups are used to predict weight gain rate and the number of days until slaughter. Based on this information, a second loss function is constructed. :
[0091]
[0092] In the formula, This represents the second loss function; Indicates weight loss for a specific age group; This indicates the weight of the predicted number of days until the pigs can be sold. This indicates the estimated number of days of loss before the animals can be sold.
[0093] Specifically, the formula for calculating weight loss in the aforementioned age group is as follows:
[0094]
[0095] In the formula, Indicates weight loss for a specific age group;
[0096] Indicates the first The first pig in Predicted weight gain rate for each age group;
[0097] Indicates the first Age group weights for each age group;
[0098] Indicates the first Cycles for each age group;
[0099] Indicates the first The weighted sum of the weight gain of a pig at each age group, where, Indicates the first The age range of the first pig; Indicates the first The maturity age range of the first pig. (Based on weighted analysis.) This allows the network to pay closer attention to weight gain during key age stages. To ensure a shorter final slaughter time, the first... The weighted sum of the weight gain of a pig at each age group should be relatively large.
[0100] The formula for calculating the weighted number of days of predicted slaughter availability is as follows:
[0101]
[0102] In the formula, This indicates the weight of the predicted number of days until the pigs can be sold. Indicates the first The first pig in The predicted number of days until market weight for each age group. The shorter the predicted number of days until market weight, the more suitable the feed amount.
[0103] The formula for calculating the estimated loss of days available for slaughter is as follows:
[0104]
[0105] In the formula, Indicates the first The first pig Initial weight for each age group; Indicates the first The slaughter weight of a pig. Indicates the first The breed of pig; Indicates the first The first pig in Predicted weight gain rate for each age group; Indicates the first The age range of the first pig; Indicates the first The age range of maturity for a pig; Indicates the first Cycles for each age group; This indicates the estimated number of days of loss before the animals can be sold.
[0106] For the first The first pig in The weight at the end of each age group, that weight minus the slaughter weight divided by [the weight at which the animal can be slaughtered]. The result indicates the first The first pig is estimated to be able to [achieve something] in the [number]th [year]. Before the end of each age group The larger the fruit, the shorter the time it takes to reach market weight. It should be noted that the growth cycle for each age group is based on the experience of the breeders.
[0107] Weight loss in combination with age group Weighting of predicted number of days available for slaughter Estimated loss of days available for slaughter The loss function is obtained. .
[0108] S004. Based on the second loss function, while keeping the trained neural network parameters unchanged, the gradient descent method is used to continuously update the amount of feed to be learned and retrain the neural network until convergence. The final converged feed amount is the optimal feed amount for the pig in the corresponding age group.
[0109] The optimal feed intake for each pig at any given age is determined sequentially.
[0110] In this embodiment, a loss function is used. While keeping the neural network parameters constant, the parameters to be learned are continuously updated using gradient descent based on backpropagation. The size of the neural network is then used to retrain it until convergence. The final convergent network will then... The value is the first The optimal feed amount for pigs at different ages. That is, the current number The optimal amount of feed to feed a pig.
[0111] Similarly, the optimal feed amount per pig in a pig farm can be obtained.
[0112] In summary, this invention provides an intelligent prediction method for feed quantity in modern pig farms. This method utilizes historical information about pigs to construct a neural network, thereby obtaining the optimal feed quantity for each pig, achieving intelligent and precise breeding, improving pig quality, and increasing the slaughter rate of pigs.
[0113] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for intelligently predicting feed intake in modern pig farms, characterized in that, Includes the following steps: Obtain information about pigs in a pig farm, including their age-group weight gain rate and number of days until slaughter; wherein, the pig information includes age group, initial weight for age group, and feed amount; The network uses pig information as input and age-group weight gain rate and number of days to market as output to construct a neural network. This neural network is an open-cell (FC) neural network, and the input to the network includes pig information such as breed. ,gender Age group Initial weight for each age group Feed quantity The network output is the weight gain rate for each age group. Number of days available for slaughter The data used for network training is a historical dataset of pigs, including pig breeds. ,gender Age group Initial weight for each age group Feed quantity The network's tags are the weight gain rates of pigs collected by age group. Number of days available for slaughter information; The first loss function is obtained based on the weight gain rate of each age group, the number of days until slaughter, and the preset weight gain rate weights for each age group. The neural network is trained based on the first loss function, and the weights of weight gain rate for each age group are continuously updated until convergence; and the weights of weight gain rate for each age group are obtained during the training process of the neural network. The age group weight is obtained by determining the weight gain rate weight for each age group. The information of any pig is input into the trained neural network to obtain the predicted weight gain rate and predicted number of days to market for that pig in each age group; then, a second loss function is obtained based on the predicted weight gain rate, age group weight, predicted number of days to market for that pig in each age group, and initial weight in each age group. Based on the second loss function, while keeping the trained neural network parameters unchanged, the gradient descent method is used to continuously update the amount of feed to be learned and retrain the neural network until convergence. The final converged feed amount is the optimal feed amount for the pig in the corresponding age group. The optimal feed intake for each pig at any given age is determined sequentially. The second loss function is obtained according to the following steps: The weight gain loss for each age group is obtained by predicting the weight gain rate by age group and by weighting the age group. The weight of the predicted number of days available for slaughter is obtained based on the predicted number of days available for slaughter. The estimated number of days lost before slaughter is obtained based on the initial weight and predicted weight gain rate of each age group. Then, a second loss function is obtained based on the weight loss of age group, the weight of predicted days for slaughter, and the estimated loss of days for slaughter. The formula for calculating weight gain loss in the specified age group is as follows: In the formula, Indicates weight loss for a specific age group; Indicates the first The first pig in Predicted weight gain rate for each age group; Indicates the first Weighting of each age group; Indicates the first Cycles for each age group; Indicates the first The weighted sum of the weight gain of a pig at each age group, where, Indicates the first The age range of the first pig; Indicates the first The age range of maturity for a pig; The first The formula for calculating the weight of each age group is as follows: In the formula, Indicates the first Age group weights for each age group; Indicates the first Weighting of weight gain rate for each age group; Indicates the age range of pig maturity; The formula for calculating the weighted number of days of predicted slaughter availability is as follows: In the formula, This indicates the weight of the predicted number of days until the pigs can be sold. Indicates the first The first pig in Predicted number of days until slaughter for each age group; The information about the pigs also includes breed and sex; The formula for calculating the estimated loss of days available for slaughter is as follows: In the formula, Indicates the first The first pig Initial weight for each age group; Indicates the first The slaughter weight of a pig. Indicates the first The breed of pig; Indicates the first The first pig in Predicted weight gain rate for each age group; Indicates the first The age range of the first pig; Indicates the first The age range of maturity for a pig; Indicates the first Cycles for each age group; This indicates the estimated loss in the number of days the pigs can be sold. Constructing a second loss function : In the formula, This represents the second loss function; Indicates weight loss for a specific age group; This indicates the weight of the predicted number of days until the pigs can be sold. This indicates the estimated loss in the number of days the pigs can be sold. In the process of training the neural network according to the first loss function, the initial weight of the weight gain rate of each age group is obtained according to the weight gain rate of pigs in the pig farm; the initial weight of the weight gain rate of each age group is used to accelerate the convergence speed of the weights during the network training process. The formula for calculating the first loss function is as follows: In the formula, Represents the first loss function; Indicates the predicted weight gain rate for a given age group; This indicates the actual rate of weight gain for a given age group; Indicates the predicted number of days until the animals are ready for market; Indicates the actual number of days the animals can be sold. Indicates age group; Indicates age group Weighting rate weight; This indicates the weight of the number of days the pig can be sold.
2. The intelligent prediction method for feed intake in a modern pig farm according to claim 1, characterized in that, The initial weight of the next age group is obtained based on the initial weight of the previous age group and the predicted weight gain rate.