A pig growth curve prediction method based on multi-source data, an electronic device, a storage medium and a program product
By using non-contact multi-source data acquisition and deep learning network analysis, the problems of stress response and data sparsity in traditional pig growth data acquisition have been solved, enabling accurate prediction of pig growth status and personalized feeding control, thereby improving the intelligence level and economic benefits of farms.
Patent Information
- Application Number
- CN202610904807.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-23
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2046-06-23
AI Technical Summary
Traditional pig growth data acquisition relies on manual weighing and visual inspection, which leads to stress response, data sparsity, large subjective errors, weak generalization ability of single data source models, inability to accurately reflect the health status and environmental adaptability of pigs, and lag in capturing growth inflection points, affecting the accuracy of growth prediction and feeding decisions.
It employs non-contact acquisition of multi-source data, including RGB images, depth point clouds, and environmental data. It extracts body size parameters through a deep learning network, and combines multivariate nonlinear regression and multi-head self-attention mechanism to capture growth inflection points, dynamically adjust body fat correction factors, construct individual growth curves, and generate graded early warning information to achieve personalized feeding parameter matching.
It enables accurate prediction of pig growth status, reduces weight estimation errors, captures growth fluctuations, improves the level of intelligence and economic benefits of breeding, and reduces operation and maintenance costs and management difficulty.
Smart Images

Figure CN122451819B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of smart farming and agricultural information technology, and discloses a method for predicting pig growth curves based on multi-source data, electronic equipment, storage medium and program products. Background Technology
[0002] In traditional farming models, obtaining pig growth data mainly relies on manual weighing and visual assessment, which presents the following challenges: Stress response: Manually driving pigs to be weighed or measured can easily cause stress response in the pig herd, leading to decreased feed intake, slowed growth rate, and even disease, directly affecting the accuracy of growth data.
[0003] Data sparsity: Due to limitations in manpower and time costs, traditional weighing is usually performed once a month or quarter, resulting in sparse data points. This makes it impossible to capture the continuous dynamic changes in pig growth and to construct high-precision growth curves.
[0004] Subjective error: Visual assessment is greatly influenced by the experience of breeders and lacks objective standards, resulting in poor data consistency and making it difficult to use for precise genetic breeding or nutritional regulation analysis.
[0005] Early automated monitoring technologies (such as those using only weight sensors) reduced human intervention, but the models themselves had flaws: Limited information dimensions: Relying solely on weight data fails to reflect the pig's health status, feed intake efficiency, and environmental adaptability. For example, weight gain may mask potential disease risks or malnutrition.
[0006] Weak model generalization ability: Single data source models are poorly adapted to external factors such as variety differences, seasonal changes, and feed ratio adjustments, and are prone to prediction bias. Summary of the Invention
[0007] This invention provides a method, electronic device, storage medium, and program product for predicting pig growth curves based on multi-source data, in order to solve the problems of high stress from contact-based data collection, low accuracy of weight estimation, inability to quantify environmental impact, delayed capture of growth inflection points, and crude feeding decisions in existing pig growth prediction technologies.
[0008] A method for predicting pig growth curves based on multi-source data includes the following steps: S1. Acquire multi-source data collected by the inspection robot along the track above the pigsty in a non-contact manner. The multi-source data includes RGB images of pigs, depth point cloud data, and pigsty environmental data. Preprocess the multi-source data and extract the three-dimensional spatial coordinates of the pig's body surface from the depth point cloud data to generate a structured time-series dataset. S2. A deep learning network is used to extract features and locate key points in the preprocessed RGB images and depth point cloud data, calculate body size parameters including body length, abdominal circumference and backfat thickness, and calculate body volume based on three-dimensional spatial coordinates through spatial integration; input the body volume and body size parameters into a multivariate nonlinear regression model, and output the real-time weight of the pig from the regression model. The regression model introduces a body fat correction factor that is dynamically adjusted based on backfat thickness. S3. The obtained weight data, behavioral feature data obtained from video stream analysis, and the environmental data are uniformly encoded into multi-source temporal features; the environmental stress index calculated based on the environmental data is introduced as a correction factor to weight the multi-source temporal feature matrix to obtain the stress de-stress bias feature matrix; the stress de-stress bias feature matrix is processed using a multi-head self-attention mechanism to capture growth inflection points, fit individual growth curves, and calculate growth deviation. S4. Determine abnormal growth status based on individual growth deviation and preset growth rate threshold, generate graded early warning information, and dynamically match personalized feeding parameters according to the real-time weight of the pig, backfat thickness and environmental stress index.
[0009] Furthermore, all the multi-source data is transmitted in real time to an edge computing server for unified preprocessing; Preprocessing includes Gaussian denoising and white balance enhancement of RGB images, abnormal noise removal of depth point clouds, and normalization of environmental data; the three-dimensional spatial coordinates in the structured time-series dataset are extracted frame by frame from the depth point cloud after aligning the timestamps.
[0010] Furthermore, in S2, the deep learning network is an improved HRNet deep learning network, with a torso rigidity constraint loss added to the HRNet deep learning network. loss of elastic restraint of limbs Construct the total loss function: ; In the formula, For keypoint regression loss, For the rigid constraint loss of the torso, Loss of elastic restraint in the limbs , These are the weighting coefficients; The keypoint regression loss : ; In the formula, The total number of key points. For the first The true 3D coordinates of each key point For the first Predicted 3D coordinates of key points The square of the Euclidean distance between the predicted coordinates and the true coordinates; The rigid constraint loss of the torso : ; In the formula, For the total number of key points on the torso, For the first Predicted distances to key points on the torso. For the first Standard distance to key points of the torso The square of the deviation between the predicted distance and the standard distance; The elastic constraint loss of the limbs : ; In the formula, This represents the total number of joints in the limbs. For the first Predicted angles of each joint For the first The minimum normal angle of each joint For the first The maximum normal angle of each joint To obtain the maximum value among the three values, when Within the normal range, the result is 0, resulting in no loss. The result is , At that time, the result was ; The multivariate nonlinear regression model is as follows: ; In the formula, For bias terms, Weighted by body volume. For body volume, Weighted by body length For body length, Weighted by waist circumference, Waist circumference, Weighted by back fat thickness. For back fat thickness, For body fat correction factor weights, As a body fat correcting factor, , The coefficients for the first-order term are the fitting coefficients. The fitting coefficients are quadratic terms. Standard backfat thickness for the variety. and Obtained through multinomial regression analysis.
[0011] Furthermore, in S3, the environmental stress index and stress de-stress feature matrix They are respectively: ; ; In the formula, , , These are normalized temperature, humidity, and harmful gas stress factors, respectively. , , The weights of the normalized temperature, humidity, and harmful gas stress factors are respectively... , This is the original time-series feature matrix. This is the stress attenuation coefficient.
[0012] Furthermore, the stress de-stress bias feature matrix based on the multi-head self-attention mechanism... Perform time-series weight calculation: ; In the formula, This is the attention weight matrix. , For learnable weight matrix, The scaling factor is the feature dimension. The timing length; Based on the attention weight matrix, the degree of attention at each moment is identified. When the degree of attention at a certain moment increases abnormally and the instantaneous growth rate before and after that moment decreases by more than a preset threshold, that moment is determined to be a growth inflection point. After identifying the growth inflection point, the time-series data was segmented using the Chrono-Growth Transformer model, with the inflection point as the boundary. The Chrono-Growth Transformer model is a commonly used time-series Transformer model in the field of time-series forecasting. Within each segment, the weight value was predicted hourly based on the de-stress characteristics of that time period, and the segments were then stitched together to obtain the individual growth curve. ; The growth deviation The calculation formula is: ; In the formula, For the standard growth curve of the corresponding variety, It is an L2 norm.
[0013] Furthermore, in step S4, a preset growth deviation threshold is defined. and minimum normal growth rate threshold A dual threshold joint determination is adopted: when When the instantaneous growth rate is determined to be abnormal, it is considered an abnormal deviation from the growth trajectory; Furthermore, if the duration exceeds 72 hours, it is determined to be physiological growth arrest. By combining the pig's feeding frequency and activity level behavioral characteristics obtained from video stream analysis, pathological growth abnormalities can be distinguished from normal fluctuations caused by environmental stress, making the abnormality determination more complete.
[0014] Furthermore, S4 also includes: Constructing a multidimensional feature vector for aquaculture decision-making : ; In the formula, Real-time weight of pigs. For back fat thickness, For growth deviation, For instantaneous growth rate, It is an environmental stress index; The real-time feature vector is input into a pre-set feeding strategy mapping model, which is a gradient boosting tree regression model trained based on historical breeding data. The input is a multi-dimensional breeding feature vector. The model is trained by the gradient boosting tree algorithm to obtain: the growth data, environmental data and corresponding optimal feeding records of pigs are collected, the dataset is divided into training set and validation set in an 8:2 ratio, and the gradient boosting tree regression model is trained with feed conversion rate and daily weight gain as optimization objectives. The output is three core feeding parameters: feed crude protein ratio, crude fiber ratio and single feeding amount, so as to realize personalized and precise feeding control of individual pigs.
[0015] Secondly, the present invention also provides an electronic device, the electronic device including a processor and a memory communicatively connected to the processor; the memory stores instructions executed by the processor, the instructions being executed by the processor to cause the processor to perform a method for predicting pig growth curves based on multi-source data.
[0016] Thirdly, the present invention also provides a storage medium storing a computer program, which is executed by a processor as a method for predicting pig growth curves based on multi-source data.
[0017] Fourthly, the present invention also provides a program product for enabling a processor to execute a method for predicting pig growth curves based on multi-source data.
[0018] Compared with the prior art, the present invention has the following beneficial effects: This invention constructs a non-contact intelligent monitoring and prediction system for the entire growth process of pigs by integrating RGB images, depth point clouds, and multi-source environmental data. This effectively solves the industry pain points of traditional pig farming, such as high stress from manual weighing, delayed observation of growth status, and difficulty in accurately controlling individual differences. By introducing rigid constraints on the torso and elastic constraints on the limbs that conform to the physiological structure of pigs, the accuracy of key point detection on flexible bodies is significantly improved, reducing the relative error in weight estimation. Through a multi-head self-attention mechanism combined with dual determination of growth rate to identify growth inflection points, it can capture growth fluctuations caused by different factors. By correcting temporal characteristics through an environmental stress index and using a piecewise fitting method for growth curves, it achieves accurate prediction of the growth status of individual pigs, improving the intelligence level and economic benefits of large-scale pig farming.
[0019] The electronic device of this invention adopts an industrial-grade edge computing architecture and is specifically optimized for the complex environment of large-scale pig farms. It can operate stably and reliably in different pig house environments, avoiding network latency and bandwidth dependence caused by cloud computing, and ensuring real-time feeding control and abnormal early warning. The device integrates multiple industrial communication interfaces, which can seamlessly connect with existing breeding equipment such as track inspection robots, environmental sensors, and automatic feeders. It can be quickly deployed without large-scale modification of existing breeding facilities, providing a unified intelligent breeding solution for farms.
[0020] The computer-readable storage medium of this invention standardizes and solidifies all functional modules of the pig growth curve prediction method, including a complete executable program, pre-trained model parameters, and configuration files, exhibiting strong versatility and portability. This storage medium can be directly plugged into any livestock edge computing device equipped with a processor, requiring no additional software development or debugging. The storage medium uses industrial-grade non-volatile memory chips. Through this storage medium, the technical solution of this invention can be quickly and cost-effectively replicated and promoted to pig farms of different sizes and hardware configurations, significantly reducing the barriers to technology implementation and shortening the time required.
[0021] The program product provided by this invention, when executed by a processor to implement the prediction method, can display the individual growth curve of pigs, body size and weight data, pig house environmental parameters and abnormal warning information in real time, and supports manual adjustment of growth threshold and feeding strategy, which significantly reduces the system's operation and maintenance costs and management difficulty. Attached Figure Description
[0022] Figure 1 This is a flowchart of the technology of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention are described clearly and completely below. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0024] A method for predicting pig growth curves based on multi-source data, such as Figure 1 As shown, it includes the following steps: S1. Acquire multi-source data collected by the inspection robot along the track above the pigsty in a non-contact manner. The multi-source data includes RGB images of pigs, depth point cloud data, and pigsty environmental data. Preprocess the multi-source data and extract the three-dimensional spatial coordinates of the pig's body surface from the depth point cloud data to generate a structured time-series dataset. S2. A deep learning network is used to extract features and locate key points in the preprocessed RGB images and depth point cloud data, calculate body size parameters including body length, abdominal circumference and backfat thickness, and calculate body volume based on three-dimensional spatial coordinates through spatial integration; input the body volume and body size parameters into a multivariate nonlinear regression model, and output the real-time weight of the pig from the regression model. The regression model introduces a body fat correction factor that is dynamically adjusted based on backfat thickness. S3. The obtained weight data, behavioral feature data obtained from video stream analysis, and the environmental data are uniformly encoded into multi-source temporal features; the environmental stress index calculated based on the environmental data is introduced as a correction factor to weight the multi-source temporal feature matrix to obtain the stress de-stress bias feature matrix; the stress de-stress bias feature matrix is processed using a multi-head self-attention mechanism to capture growth inflection points, fit individual growth curves, and calculate growth deviation. S4. Determine abnormal growth status based on individual growth deviation and preset growth rate threshold, generate graded early warning information, and dynamically match personalized feeding parameters according to the real-time weight of the pig, backfat thickness and environmental stress index.
[0025] S1 includes all the multi-source data being transmitted to the edge computing server in real time for unified preprocessing; Preprocessing includes Gaussian denoising and white balance enhancement of RGB images, abnormal noise removal of depth point clouds, and normalization of environmental data; the three-dimensional spatial coordinates in the structured time-series dataset are extracted frame by frame from the depth point cloud after aligning the timestamps.
[0026] S2 includes an improved HRNet deep learning network, which adds a torso rigidity constraint loss to the HRNet deep learning network. loss of elastic restraint of limbs Construct the total loss function: ; In the formula, For keypoint regression loss, For the rigid constraint loss of the torso, Loss of elastic restraint in the limbs , These are weighting coefficients, obtained through a controlled variable comparison experiment; Keypoint regression loss Used to measure the deviation between the network-predicted keypoint coordinates and the manually labeled true coordinates: ; In the formula, The total number of key points. For the first The true 3D coordinates of each key point were obtained through manual annotation. For the first Predicted 3D coordinates of key points The square of the Euclidean distance between the predicted coordinates and the true coordinates; The trunk rigidity constraint loss constrains trunk deformation by calculating the distance changes between adjacent trunk key points. Leveraging the relatively rigid physiological characteristics of the pig's trunk skeletal structure, it reduces false detections of key points caused by posture distortion. First, the baseline distance between each adjacent trunk key point is calculated from normal posture samples in the training set. These trunk key points include the scapula, hip tuberosity, and ischial tuberosity. The trunk rigidity constraint calculation formula is as follows: ; In the formula, For the total number of key points on the torso, For the first Predicted distances to key points on the torso. For the first The standard distances to key points on the torso were obtained through statistical analysis. The square of the deviation between the predicted distance and the standard distance; The limb elastic constraint loss is calculated by altering the angles of key points in the limbs to constrain limb posture. Utilizing the physiological range of joint movement in pigs, predictions based on key points that do not conform to biomechanics are excluded. First, the normal angle ranges for each limb joint are defined, including the shoulder-elbow joint, elbow-wrist joint, hip-knee joint, and patellar joint. The formula for the limb elastic constraint loss is: ; In the formula, This represents the total number of joints in the limbs. For the first Predicted angles of each joint For the first The minimum normal angle of each joint was obtained through statistical analysis. For the first The maximum normal angle of each joint was obtained through statistical analysis. To obtain the maximum value among the three values, when Within the normal range, the result is 0, resulting in no loss. The result is (degrees exceeding the upper limit) At that time, the result was (Degrees exceeding the lower limit); The multivariate nonlinear regression model is as follows: ; In the formula, For bias terms, Weighted by body volume. For body volume, Weighted by body length For body length, Weighted by waist circumference, Waist circumference, Weighted by back fat thickness. For back fat thickness, For body fat correction factor weights, , , , , , Obtained through least squares regression analysis As a body fat correcting factor, , The coefficients for the first-order term are the fitting coefficients. The fitting coefficients are quadratic terms. Standard backfat thickness for the variety. and Obtained through multinomial regression analysis.
[0027] S3 includes the environmental stress index. and stress de-stress feature matrix They are respectively: ; ; In the formula, , , These are normalized temperature, humidity, and harmful gas stress factors, respectively. , , The weights of normalized temperature, humidity, and harmful gas stress factors are obtained through orthogonal experiments. , This is the original time-series feature matrix. The stress attenuation coefficient was obtained through comparative experiments.
[0028] S3 includes a stress de-attention bias feature matrix based on a multi-head self-attention mechanism. Perform time-series weight calculation: ; In the formula, This is the attention weight matrix. , For learnable weight matrix, The scaling factor is the feature dimension. The timing length; Based on the attention weight matrix, the degree of attention at each moment is identified. When the degree of attention at a certain moment increases abnormally and the instantaneous growth rate before and after that moment decreases by more than a preset threshold, that moment is determined to be a growth inflection point. After identifying the growth inflection point, the time-series data was segmented using the Chrono-Growth Transformer model, with the inflection point as the boundary. The Chrono-Growth Transformer model is a commonly used time-series Transformer model in the field of time-series forecasting. Within each segment, the weight value was predicted hourly based on the de-stress characteristics of that time period, and the segments were then stitched together to obtain the individual growth curve. ; The growth deviation The calculation formula is: ; In the formula, For the standard growth curve of the corresponding variety, It is an L2 norm.
[0029] S4 includes a preset growth deviation threshold. and minimum normal growth rate threshold A dual threshold joint determination is adopted: when When the instantaneous growth rate is determined to be abnormal, it is considered an abnormal deviation from the growth trajectory; Furthermore, if the duration exceeds 72 hours, it is determined to be physiological growth arrest. By combining the pig's feeding frequency and activity level behavioral characteristics obtained from video stream analysis, pathological growth abnormalities can be distinguished from normal fluctuations caused by environmental stress, making the abnormality determination more complete.
[0030] S4 also includes constructing a multidimensional feature vector for aquaculture decision-making. : ; In the formula, Real-time weight of pigs. For back fat thickness, For growth deviation, For instantaneous growth rate, It is an environmental stress index; The real-time feature vector is input into a pre-set feeding strategy mapping model, which is a gradient boosting tree regression model trained based on historical breeding data. The input is a 5-dimensional feature vector. The model is trained using the gradient boosting tree algorithm. The model collects growth data, environmental data, and corresponding optimal feeding records of 2,000 pigs. The dataset is divided into training and validation sets in an 8:2 ratio. The gradient boosting tree regression model is trained with feed conversion rate and daily weight gain as optimization objectives. The output consists of three core feeding parameters: feed crude protein ratio, crude fiber ratio, and single feeding amount, enabling personalized and precise feeding control for individual pigs.
[0031] The device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a GPU BOX, mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0032] This application also provides a computer-readable storage medium storing a computer program / instructions thereon, which, when executed by a processor, implements the steps in a method for predicting pig growth curves based on multi-source data as disclosed in this application.
[0033] This application also provides a computer program product that, when run on an electronic device, enables the processor to execute the steps in a method for predicting pig growth curves based on multi-source data as disclosed in this application.
[0034] The following description, in conjunction with the accompanying drawings and embodiments, provides further details.
[0035] This embodiment was conducted in a pigsty of a large-scale pig farm. All equipment used in the experiment were existing commercially available mature industrial products, requiring no custom development. A flexible track was installed above the pigsty, and a track-guided robot ran along the track, covering the entire pigsty area. The robot was equipped with multiple sensors to achieve "stress-free, zero-contact" data collection. The data collection mainly included: The robot is equipped with a visible light camera (to collect high-definition images for morphological recognition) and a depth camera (to acquire three-dimensional point cloud data for body size measurement). Using the depth camera and wide-angle camera, it collects the body size (such as body length, body width, and backfat thickness) and morphological characteristics of pigs as the physical basis for weight estimation. The robot is equipped with environmental sensors (monitoring temperature, humidity, and harmful gas concentrations). The temperature and humidity measurement range is -40℃ to 85℃, relative humidity is 0% to 100%, and ammonia concentration measurement range is 0 to 100ppm, enabling real-time monitoring of the pigsty environment. By analyzing the activity level and feeding behavior of pigs through video streams, the robot can determine their health status and serve as an auxiliary basis for judging their growth potential. The robot automatically conducts multiple inspections daily according to a preset route, collecting images, videos, sounds, and environmental data of the pigs without disturbing them, achieving "stress-free and zero-contact" data acquisition. The robot analyzes the pigs' respiratory rate (calculated by abdominal movement), activity level (movement trajectory analysis), and feeding behavior (feed trough residue monitoring) through video streams.
[0036] All raw data is transmitted in real time to edge computing servers for unified processing.
[0037] For the acquired RGB images, pig targets are first detected, and the bounding box coordinates of each pig in a single frame are output. Background and non-pig areas are filtered out to avoid invalid data interfering with subsequent calculations. Then, the images undergo preprocessing: Gaussian denoising with a 5×5 Gaussian kernel is used to remove random noise points from the images; white balance enhancement is performed using an existing grayscale world algorithm to correct color deviations caused by uneven lighting in the pigsty; and bilinear interpolation is used to uniformly scale all images to 640×640 pixels to ensure consistent input data size.
[0038] For the depth point cloud data, existing statistical filtering algorithms are first used to remove abnormal noise and invalid point clouds that are too far or too close to the camera. Then, existing ICP point cloud registration algorithms are used to register and align the point clouds of consecutive frames to eliminate point cloud offsets and jitter caused by robot movement. Based on the preprocessed depth point cloud data, the three-dimensional spatial coordinates of each pig's body surface are extracted. A structured time-series dataset is generated by aligning timestamps. Each data entry contains complete information such as a timestamp, a unique pig ID, a set of three-dimensional coordinates, and corresponding environmental data, providing standardized input for subsequent feature extraction and model calculation.
[0039] The preprocessed RGB image, depth point cloud data, and corresponding 3D spatial coordinates are input into the improved HRNet deep learning network for feature extraction and key point localization.
[0040] The network is initialized using publicly available HRNet pre-trained weights and fine-tuned on a dataset containing 5000 manually annotated pig keypoints. The Adam optimizer is used, with an initial learning rate of 0.001, which decays to 0.1 every 10 epochs. Training is performed for 50 epochs. Training is stopped early when the validation set loss stops decreasing for three consecutive epochs to avoid overfitting. During network training, a rigid constraint loss is added to the traditional keypoint regression loss to improve the accuracy of detecting pig flexible body keypoints. loss of elastic restraint of limbs Construct the total loss function: ; In the formula, For keypoint regression loss, For the rigid constraint loss of the torso, Loss of elastic restraint in the limbs , These are weighting coefficients, obtained through a controlled variable comparison experiment; Among them, keypoint regression loss The mean square error loss function and the torso rigid constraint loss are used. Torso deformation is constrained by calculating the distance changes between adjacent key points on the torso, and the elastic constraint loss of the limbs is also considered. Limb posture is constrained by calculating the angular changes of key points in the limbs; Keypoint regression loss Used to measure the deviation between the network-predicted keypoint coordinates and the manually labeled true coordinates: ; In the formula, The total number of key points. For the first The true 3D coordinates of each key point were obtained through manual annotation. For the first Predicted 3D coordinates of key points The square of the Euclidean distance between the predicted coordinates and the true coordinates; The trunk rigidity constraint loss constrains trunk deformation by calculating the distance changes between adjacent trunk key points. Leveraging the relatively rigid physiological characteristics of the pig's trunk skeletal structure, it reduces false detections of key points caused by posture distortion. First, the baseline distance between each adjacent trunk key point is calculated from normal posture samples in the training set. These trunk key points include the scapula, hip tuberosity, and ischial tuberosity. The formula for calculating the trunk rigidity constraint loss is as follows: ; In the formula, For the total number of key points on the torso, For the first Predicted distances to key points on the torso. For the first The standard distances to key points on the torso were obtained through statistical analysis. The square of the deviation between the predicted distance and the standard distance; The limb elastic constraint loss is calculated by altering the angles of key points in the limbs to constrain limb posture. Utilizing the physiological range of joint movement in pigs, predictions based on key points that do not conform to biomechanics are excluded. First, the normal angle range of the limb joints is defined, including the shoulder-elbow joint, elbow-wrist joint, hip-knee joint, and patellar joint. The formula for the limb elastic constraint loss is: ; In the formula, This represents the total number of joints in the limbs. For the first Predicted angles of each joint For the first The minimum normal angle of each joint was obtained through statistical analysis. For the first The maximum normal angle of each joint was obtained through statistical analysis. To obtain the maximum value among the three values, when Within the normal range, the result is 0, resulting in no loss. The result is (degrees exceeding the upper limit) At that time, the result was (Degrees exceeding the lower limit); The network ultimately outputs the three-dimensional coordinates of seven core anatomical key points in pigs, including the scapula, hip tuberosity, ischial tuberosity, shoulder tip, and tail root. Based on the spatial location of these key points, key body size parameters are calculated, such as body length. The Euclidean distance from the shoulder to the tail root, and the abdominal circumference. The circumference and backfat thickness of pig abdomens were calculated by fitting the abdominal contour curve. The vertical distance from the skin on the back of a pig to its spine was calculated based on deep point cloud data.
[0041] Based on the three-dimensional coordinates of the pig's body surface, an existing Poisson surface reconstruction algorithm is used to fit the complete surface of the pig's body, and the volume of the pig's body is obtained through triple integration. to increase body volume Body length Waist circumference Back fat thickness Calculate real-time weight using a multivariate nonlinear regression model. The specific calculation formula is as follows: ; In the formula, For bias terms, Weighted by body volume. For body volume, Weighted by body length For body length, Weighted by waist circumference, Waist circumference, Weighted by back fat thickness. For back fat thickness, For body fat correction factor weights, , , , , , Obtained through least squares regression analysis As a body fat correcting factor, , The coefficients for the first-order term are the fitting coefficients. The fitting coefficients are quadratic terms. Standard backfat thickness for the variety. and Obtained through multinomial regression analysis; The body fat correction factor can effectively compensate for the differences in body density between pigs with different fat and lean body types, thereby improving the accuracy of weight estimation.
[0042] Pig weight data for seven consecutive days, behavioral feature data obtained from video stream analysis, and environmental data were extracted and uniformly encoded into a multi-source temporal feature matrix. The behavioral feature data included the daily feeding frequency, exercise duration, and lying time of the pigs, which were obtained through target tracking and behavioral analysis of continuous video frames.
[0043] To eliminate the impact of environmental stress on growth prediction, an environmental stress index was constructed. As a dynamic correction factor, the calculation formula is: ; In the formula, The normalized temperature stress factor is used, and the suitable growth temperature range for pigs is 18℃ to 26℃. The normalized humidity stress factor is given, and the suitable humidity range for pigs is 50% to 80%. To normalize the harmful gas stress factors, the safe ammonia concentration in the pigsty is no more than 20 ppm. , , The weights of normalized temperature, humidity, and harmful gas stress factors are obtained through orthogonal experiments. ; Using stress attenuation coefficient The original time-series feature matrix is weighted and corrected to obtain the stress-relief bias feature matrix. : ; In the formula, This is the original time-series feature matrix. The stress attenuation coefficient was obtained through comparative experiments. .
[0044] De-stress bias characteristic matrix The multi-head self-attention module is used to calculate temporal weights. The number of attention heads is set to 8, and the formula for calculating the temporal weight coefficients is as follows: ; In the formula, This is the attention weight matrix. , For learnable weight matrix, The scaling factor is the feature dimension. The timing length; The attention weight matrix identifies the degree of attention received at each moment. When the attention weight value at a certain moment exceeds three times the average weight value, and the instantaneous growth rate decreases by more than 30% within 24 hours before and after that moment, that moment is determined to be a growth inflection point. This can accurately capture growth fluctuations caused by factors such as population transition, vaccination, and environmental mutations. After identifying the growth inflection point, the Chrono-Growth Transformer model is used to segment the time-series data using the inflection point as the boundary. The Chrono-Growth Transformer model is a commonly used time-series Transformer model in the field of time-series prediction, containing two encoder layers and two decoder layers, with a hidden layer dimension of 128. It is initialized using pre-trained weights for time-series prediction. The model segments the time-series data using the identified growth inflection point as the boundary, predicts the weight value time-by-time within each segment based on the de-stressing characteristics of that time period, and then concatenates the segments to obtain the individual growth curve. ; To quantify the difference between the growth status of pigs and the standard level, the growth deviation is calculated. The calculation formula is: ; In the formula, For the standard growth curve of the corresponding variety, It is an L2 norm; Growth deviation The higher the value, the more serious the deviation of the individual pig's growth status from the standard level.
[0045] and The preset growth deviation threshold was obtained through ROC curve analysis. and minimum normal growth rate threshold A dual threshold joint determination is adopted: when When the instantaneous growth rate is determined to be abnormal, it is considered an abnormal deviation from the growth trajectory; Furthermore, if the duration exceeds 72 hours, it is determined to be physiological growth arrest. By combining the pig's feeding frequency and activity level behavioral characteristics obtained from video stream analysis, pathological growth abnormalities can be distinguished from normal fluctuations caused by environmental stress, making the abnormality determination more complete. By combining the behavioral characteristics of pigs' feeding frequency and activity level obtained from video stream analysis, we can further distinguish between pathological growth abnormalities and normal fluctuations caused by environmental stress: if the feeding frequency of pigs decreases by more than 50% and their activity level decreases significantly, it is determined to be a pathological abnormality, and a health check should be conducted in a timely manner; if the pigs' feeding and activity are basically normal, it is determined to be a fluctuation caused by environmental stress, and normal growth can be restored by adjusting the pig house environmental parameters.
[0046] Constructing a multidimensional feature vector for aquaculture decision-making : ; In the formula, Real-time weight of pigs. For back fat thickness, For growth deviation, For instantaneous growth rate, It is an environmental stress index; The real-time feature vector is input into a pre-set feeding strategy mapping model, which is a gradient boosting tree regression model trained based on historical breeding data. The input is a 5-dimensional feature vector. The model is trained using the gradient boosting tree algorithm. The model collects growth data, environmental data, and corresponding optimal feeding records of 2,000 pigs. The dataset is divided into training and validation sets in an 8:2 ratio. The gradient boosting tree regression model is trained with feed conversion rate and daily weight gain as optimization objectives. The output consists of three core feeding parameters: feed crude protein ratio, crude fiber ratio, and single feeding amount, enabling personalized and precise feeding control for individual pigs.
[0047] The optimal feeding parameters output by the model are transmitted to the automatic feeder in the pigsty via the Internet of Things (IoT), enabling personalized and precise feeding control for individual pigs. When the system detects abnormal conditions such as deviation from the growth trajectory or physiological growth retardation, it automatically generates warning information including the type of abnormality, the degree of growth deviation, the ear tag ID of the target pig, real-time environmental parameters, and the duration of the abnormality. This information is simultaneously pushed to the farmer's mobile app and cloud management platform, enabling proactive identification and precise intervention of growth abnormalities. Based on real-time weight and backfat data, the system can automatically calculate the optimal feed ratio and feeding amount, optimizing the feed conversion ratio from the traditional 2.8 to 2.6, significantly reducing farming costs.
[0048] Experimental results show that this method achieves non-contact, precise prediction and intelligent control of pig growth: the average absolute and relative errors of pig weight estimation are significantly reduced compared to traditional single-dimensional body size estimation methods; the growth curve fitting has a high coefficient of determination, accurately reflecting the actual growth pattern of pigs; the average accuracy of weight estimation can reach over 95%, far exceeding the accuracy of traditional manual visual estimation or single data source models; the accuracy of growth abnormality detection is high; and after adopting personalized precision feeding, the feed conversion rate is high, and the economic benefits of pig farming are significantly improved.
[0049] By extracting the body size features of pigs (such as body length, body width, and backfat thickness) using visual algorithms, and combining deep learning and multi-source data fusion, the average accuracy of weight estimation can reach over 95%, far exceeding the accuracy of traditional manual visual estimation or single data source models.
[0050] The robot can work 24 hours a day, collecting data multiple times a day. Compared to the traditional manual weighing once or twice a month, the system can construct a continuous and smooth individual growth curve, accurately capturing subtle fluctuations in the growth process.
[0051] Through individual identification technology, the system can create a unique growth record for each pig, track its growth trajectory throughout its entire life cycle, and achieve precise management based on individual pig needs.
[0052] The system not only focuses on body weight but also analyzes multi-source data such as the pigs' respiratory rate, activity level, and feeding behavior to determine their health status. When abnormal fluctuations occur in the growth curve, the system can provide early warnings of disease or abnormal growth, assisting managers in timely intervention and reducing mortality.
[0053] Based on real-time weight and backfat data, the system can automatically calculate the optimal feed ratio and feeding amount, optimizing the feed conversion ratio from the traditional 2.8 to 2.6, significantly reducing breeding costs.
[0054] The robot conducts non-contact inspections above the pigsty via a track, completely avoiding the stress response of the pigs caused by manual herding and restraint, and ensuring the authenticity of the data and the health of the pigs.
[0055] One robot can replace multiple human workers, significantly reducing labor intensity and management costs. At the same time, it enables automated and high-frequency data collection, solving the pain points of data sparsity and high labor intensity in traditional methods.
[0056] The electronic device of this invention is an industrial-grade edge computing terminal deployed in the control room of a pigsty. It uses 16GB of RAM and a 512GB solid-state drive, and is equipped with a gigabit Ethernet interface, a wireless communication interface, and an industrial control interface. The terminal's built-in memory stores a complete computer program that implements the pig growth curve prediction method of this invention. When the processor executes the program, it can control the track inspection robot to collect multi-source data at a preset cycle, and sequentially complete image and point cloud preprocessing, three-dimensional coordinate extraction, improved HRNet key point detection, body size and weight calculation, multi-source temporal feature fusion, growth curve fitting, growth anomaly judgment, and feeding parameter solution. It also sends personalized feeding instructions to the automatic feeder through the RS485 interface, and simultaneously uploads early warning information and growth data to the cloud management platform, realizing automated monitoring and intelligent control of the entire pig growth process.
[0057] The device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a GPU BOX, mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0058] The storage medium of this invention is a computer-readable non-volatile storage medium, specifically an industrial-grade solid-state drive. The storage medium contains an executable computer program that implements the pig growth curve prediction method based on multi-source data of this invention. The program includes six functional units: a data acquisition module, a preprocessing module, a body size calculation module, a growth curve fitting module, an anomaly detection module, and a feeding decision module. It also stores improved HRNet pre-trained weights, Chrono-GrowthTransformer model parameters, and a feeding strategy mapping model trained based on historical breeding data. This storage medium can be plugged into any breeding edge device equipped with a processor. When the processor reads and executes the program in the storage medium, all technical steps of this invention can be fully implemented without additional development, making it suitable for rapid deployment in pig farms of different sizes and hardware configurations.
[0059] The program product of this invention can automatically detect the operating environment, install the required dependency libraries, and complete the communication parameter configuration of the inspection robot, environmental sensors, and automatic feeder during installation. After running, it provides a visual operation interface that can display the individual growth curves of pigs, body size and weight data, pig house environmental parameters, and abnormal warning information in real time. It also supports manual adjustment of growth thresholds and feeding strategies. This program product can be distributed in batches to the edge computing terminals of farms via USB flash drive or network, supporting remote online updates and version management. No professional technicians are required for on-site debugging; ordinary farm workers can complete the deployment and daily operation.
[0060] Of course, the above description is not intended to limit the present invention, and the present invention is not limited to the examples given above. Any changes, modifications, additions or substitutions made by those skilled in the art within the scope of the present invention should also fall within the protection scope of the present invention.
Claims
1. A method for predicting pig growth curves based on multi-source data, characterized in that, Includes the following steps: S1. Acquire multi-source data collected by the inspection robot along the track above the pigsty in a non-contact manner. The multi-source data includes RGB images of pigs, depth point cloud data, and pigsty environmental data. The multi-source data is preprocessed, and the three-dimensional spatial coordinates of the pig body surface are extracted from the deep point cloud data to generate a structured time-series dataset. S2. A deep learning network is used to extract features and locate key points in the preprocessed RGB images and depth point cloud data, calculate body size parameters including body length, abdominal circumference and backfat thickness, and calculate body volume based on three-dimensional spatial coordinates through spatial integration; input the body volume and body size parameters into a multivariate nonlinear regression model, and output the real-time weight of the pig from the regression model. The regression model introduces a body fat correction factor that is dynamically adjusted based on backfat thickness. The deep learning network described is an improved HRNet deep learning network, which adds a torso rigidity constraint loss to the HRNet deep learning network. loss of elastic restraint of limbs Construct the total loss function: ; In the formula, For keypoint regression loss, For the rigid constraint loss of the torso, Loss of elastic restraint in the limbs , These are the weighting coefficients; The keypoint regression loss : ; In the formula, The total number of key points. For the first The true 3D coordinates of each key point For the first Predicted 3D coordinates of key points The square of the Euclidean distance between the predicted coordinates and the true coordinates; The rigid constraint loss of the torso : ; In the formula, For the total number of key points on the torso, For the first Predicted distances to key points on the torso. For the first Standard distance to key points of the torso The square of the deviation between the predicted distance and the standard distance; The elastic constraint loss of the limbs : ; In the formula, This represents the total number of joints in the limbs. For the first Predicted angles of each joint For the first The minimum normal angle of each joint For the first The maximum normal angle of each joint To obtain the maximum value among the three values, when Within the normal range, the result is 0, resulting in no loss. The result is , At that time, the result was ; The multivariate nonlinear regression model is as follows: ; In the formula, For bias terms, Weighted by body volume. For body volume, Weighted by body length For body length, Weighted by waist circumference, Waist circumference, Weighted by back fat thickness. For back fat thickness, For body fat correction factor weights, As a body fat correcting factor, , The coefficients for the first-order term are the fitting coefficients. The fitting coefficients are quadratic terms. Standard backfat thickness for the variety; S3. The obtained weight data, the behavioral feature data obtained from video stream analysis, and the environmental data are uniformly encoded into multi-source temporal features; An environmental stress index calculated from environmental data is introduced as a correction factor to weight the multi-source time-series feature matrix, resulting in a stress de-stress bias feature matrix. The multi-head self-attention mechanism is used to process the stress de-stress bias feature matrix to capture growth inflection points, fit individual growth curves, and calculate growth deviation. S4. Determine abnormal growth status based on individual growth deviation and preset growth rate threshold, generate graded early warning information, and dynamically match personalized feeding parameters according to the real-time weight of the pig, backfat thickness and environmental stress index.
2. The method for predicting pig growth curves based on multi-source data according to claim 1, characterized in that, All the multi-source data are transmitted to the edge computing server in real time for unified preprocessing. Preprocessing includes Gaussian denoising and white balance enhancement of RGB images, abnormal noise removal of depth point clouds, and normalization of environmental data; The three-dimensional spatial coordinates in the structured time-series dataset are extracted frame by frame from the depth point cloud after aligning the timestamps.
3. The method for predicting pig growth curves based on multi-source data according to claim 1, characterized in that, In S3, the environmental stress index and stress de-stress feature matrix They are respectively: ; ; In the formula, , , These are normalized temperature, humidity, and harmful gas stress factors, respectively. , , The weights of the normalized temperature, humidity, and harmful gas stress factors are respectively... , This is the original time-series feature matrix. This is the stress attenuation coefficient.
4. The method for predicting pig growth curves based on multi-source data according to claim 1, characterized in that, Based on the multi-head self-attention mechanism, the stress de-stress bias feature matrix Perform time-series weight calculation: ; In the formula, This is the attention weight matrix. , For learnable weight matrix, The scaling factor is the feature dimension. The timing length; Based on the attention weight matrix, the degree of attention at each moment is identified. When the degree of attention at a certain moment increases abnormally and the instantaneous growth rate before and after that moment decreases by more than a preset threshold, that moment is determined to be a growth inflection point. After identifying the growth inflection point, the time-series data was segmented using the Chrono-Growth Transformer model, with the inflection point as the boundary. The Chrono-Growth Transformer model is a commonly used time-series Transformer model in the field of time-series forecasting. Within each time period, the weight value is predicted hourly based on the de-stress characteristics of that time period, and the segments are then stitched together to obtain the individual growth curve. ; The growth deviation The calculation formula is: ; In the formula, For the standard growth curve of the corresponding variety, It is an L2 norm.
5. The method for predicting pig growth curves based on multi-source data according to claim 1, characterized in that, In S4, a preset growth deviation threshold is defined. and minimum normal growth rate threshold A dual threshold joint determination is adopted: when When the instantaneous growth rate is determined to be abnormal, it is considered an abnormal deviation from the growth trajectory; Furthermore, if the duration exceeds 72 hours, it is determined to be physiological growth arrest. By combining the pig's feeding frequency and activity level behavioral characteristics obtained from video stream analysis, pathological growth abnormalities can be distinguished from normal fluctuations caused by environmental stress, making the abnormality determination more complete.
6. The method for predicting pig growth curves based on multi-source data according to claim 1, characterized in that, S4 further includes: Constructing a multidimensional feature vector for aquaculture decision-making : ; In the formula, Real-time weight of pigs. For back fat thickness, For growth deviation, For instantaneous growth rate, It is an environmental stress index; The real-time feature vector is input into a pre-set feeding strategy mapping model, which is a gradient boosting tree regression model trained based on historical breeding data. The input is a multi-dimensional breeding feature vector. The model is trained by the gradient boosting tree algorithm to obtain: the growth data, environmental data and corresponding optimal feeding records of pigs are collected, the dataset is divided into training set and validation set in an 8:2 ratio, and the gradient boosting tree regression model is trained with feed conversion rate and daily weight gain as optimization objectives. The output is three core feeding parameters: feed crude protein ratio, crude fiber ratio and single feeding amount, so as to realize personalized and precise feeding control of individual pigs.
7. An electronic device, characterized in that, The electronic device includes a processor and a memory communicatively connected to the processor; the memory stores instructions that are executed by the processor to cause the processor to perform a method for predicting pig growth curves based on multi-source data as described in any one of claims 1 to 6.
8. A storage medium, characterized in that, The storage medium stores a computer program, which is executed by a processor as described in any one of claims 1 to 6, a method for predicting pig growth curves based on multi-source data.
9. A program product, characterized in that, The program product is used to enable the processor to execute a method for predicting pig growth curves based on multi-source data as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Pig breeding intelligent management and control system based on multi-modal data monitoring
CN120338722A
Live pig weight estimation method based on semantic key point guidance and three-dimensional morphological feature fusion
CN122049548A
