Visual phenotype driven pregnant sow weight estimation method
Through a visual phenotype-driven multimodal deep learning model, the correlation between the image sequence of pregnant sows and body weight is constructed, and the problem of low contact measurement and accuracy of weight estimation in the prior art is solved, and non-contact and accurate weight estimation is achieved, and reproductive efficiency and growth performance are optimized.
Patent Information
- Application Number
- CN202510029336.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art has problems with contact body phenotype measurement and low accuracy in the weight estimation of pregnant sows, and the linear calculation formula cannot fully reflect the nonlinear relationship between features.
Using a visual phenotype-driven method, by obtaining the historical weight data and video sequences of pregnant sows, the correlation between image sequence and weight is constructed, and a multimodal deep learning model is used for weight estimation to achieve contactless and accurate weight estimation.
The non-contact and accurate estimation of the weight of pregnant sows was realized, the non-linear correlation law between biological phenotype and weight changes was explored, scientific basis for precise nutrition management was provided, and sow reproductive efficiency and piglet growth performance were optimized.
Smart Images

Figure CN119888795A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of biological growth monitoring, and in particular relates to a method for estimating the weight of a pregnant sow driven by visual phenotype. Background Art
[0002] The weight change of sows during pregnancy is a key indicator to measure their nutritional needs and physiological health, which directly affects the development quality and growth performance of the fetus. It is of great significance to optimize reproductive efficiency and improve the birth quality and survival rate of piglets.
[0003] Accurate estimation of pig weight during pregnancy is crucial to achieve precise nutritional regulation and improve production performance. At present, deep learning-based methods mainly focus on weight estimation of fattening pigs, but have significant limitations in the field of accurate weight estimation of pregnant sows. The weight estimation method of sows is obtained by linear regression.
[0004] The common method used in the industry to estimate the weight of pregnant sows is the above calculation formula. There are two main problems with the above formula: 1. The measurement of morphological phenotypes, such as measuring the back fat thickness and chest circumference of pigs, requires manual operation, which can easily cause stress reactions and cause a series of problems, including miscarriage, death, etc.; 2. The linear calculation formula is too simple, and the error of the weight estimation result is large. The limitation of the linear model is that it cannot fully reflect the nonlinear relationship between the multi-level dynamics of these characteristics and the dynamic changes of weight, and ultimately only a "rough" estimation result can be obtained. Summary of the invention
[0005] In view of the above-mentioned deficiencies in the prior art, the present invention provides a method for estimating the weight of a pregnant sow driven by a visual phenotype, which solves the problem that the prior method requires contact-type body phenotype measurement and has low accuracy.
[0006] In order to achieve the above-mentioned purpose of the invention, the technical solution adopted by the present invention is: a method for estimating the weight of a pregnant sow driven by visual phenotype, comprising: Obtain historical weight data and historical video sequences of several pregnant sows; Preprocess the historical video sequences of each pregnant sow respectively to obtain a training set of pregnant sow image sequences; According to the training set of pregnant sow image sequences and the historical weight data of pregnant sows, the association between image sequences and weight is constructed, and a weight estimation model for estimating the weight of pregnant sows based on the pregnant sow image sequences is obtained; The video sequence of pregnant sows is acquired in real time, and the estimated weight of pregnant sows is obtained using the weight estimation model.
[0007] Furthermore, the historical video sequences of each pregnant sow are preprocessed to obtain a training set of pregnant sow image sequences, specifically: Each frame of the historical video sequence of each pregnant sow is normalized to obtain the normalized historical video sequence of each pregnant sow:
[0008] in, is the normalized historical video sequence Frame image; The first Frame image; is the mean sequence of each channel of the image; is the variance sequence of each channel of the image; According to the normalized historical video sequence of each pregnant sow, the pig detection model is used to determine the pig activity area in each frame image of each pregnant sow:
[0009] in, For images The pig activity area is a square area; For images The horizontal coordinate of the upper left corner of the activity area of the middle pig; For images The upper left vertical coordinate of the pig's activity area; For images The width of the activity area for medium pigs; For images The length of the activity area of medium pigs; is the total number of images; According to the pig activity area in each frame of each pregnant sow image, the image frames are filtered to obtain a pregnant sow image sequence training set.
[0010] Furthermore, the image frames are filtered according to the pig activity area in each frame of the image of each pregnant sow to obtain a pregnant sow image sequence training set, specifically: According to the pig activity area in each frame image of each pregnant sow, the variance of the coordinates of the upper left corner, lower left corner, upper right corner and lower right corner of the pig activity area of each pregnant sow is calculated respectively; Determine whether the variances of the coordinates of the upper left corner, lower left corner, upper right corner and lower right corner of the activity area of each pregnant sow are all less than the variance threshold. If so, take the maximum activity area as the final region of interest of the corresponding pregnant sow, and extract the final region of interest of each frame image in the normalized historical video sequence of the corresponding pregnant sow to obtain the image time series training sample of the corresponding pregnant sow. Otherwise, delete the normalized historical video sequence of the corresponding pregnant sow. All the image time series training samples of pregnant sows are integrated to obtain the pregnant sow image sequence training set.
[0011] Furthermore, the expression of the final region of interest is:
[0012] in, is the final region of interest; is the maximum value function.
[0013] Furthermore, the expression of the image time series training sample of the pregnant sow is:
[0014] in, It is a time series training sample of pregnant sow images; An operation for intercepting a normalized historical video sequence of a pregnant sow; is the final region of interest; For images The corresponding image only includes the final region of interest.
[0015] Further, the weight estimation model includes an encoder, a graph mapping layer, a bidirectional graph convolution, a graph remapping layer, a concatenation layer, an auxiliary signal encoder, a fusion layer, and a fully connected layer; The encoder is used to obtain training samples in a pregnant sow image sequence training set, and compress the images in the training samples to obtain pixel space features of the images; The graph mapping layer is used to map pixel space features to graph space to obtain aggregate features; The bidirectional graph convolution is used to obtain graph convolution features in time according to the aggregated features; The graph remapping layer is used to map the graph convolution features in time from the graph space back to the pixel space to obtain remapped features; The concatenation layer is used to concatenate the remapped features of all images in the training sample to obtain the encoded features; The auxiliary signal encoder is used to encode the gestational days and the number of pregnancies in the historical weight data as auxiliary signals to obtain auxiliary signal features; The fusion layer is used to fuse the auxiliary signal features and the coding features to obtain the final features; The fully connected layer is used to map the final features into weight.
[0016] Furthermore, the expression of the aggregation feature is:
[0017]
[0018] in, is the aggregation feature; is the graph mapping formula; is the pixel space feature; is the pixel space feature After mapping to the graph space, Features of vertices; is the total number of vertices; For encoder; For images The corresponding image only includes the final region of interest; The first Frame image.
[0019] Furthermore, the expression of the coding feature is:
[0020]
[0021]
[0022]
[0023]
[0024] in, is the coding feature; For splicing operation; is the remapping feature; is the total number of images; is the pixel space feature; is the graph remapping function; is the coefficient matrix; For images Temporal aggregation graph convolution features; is the time graph convolution function; For images Spatial graph convolution features; For images Spatial graph convolution features; is the convolution kernel function; for The adjacency matrix of For graph features Node characteristics; for The adjacency matrix of For graph features Graph node features of is a learnable parameter; is the spatial graph convolution function; is the aggregation feature.
[0025] Furthermore, the expression for mapping the final feature to weight is:
[0026] in, is body weight; is a fully connected layer; The final feature.
[0027] Furthermore, the loss function of the graph mapping layer is:
[0028]
[0029]
[0030] in, is the loss function of the graph mapping layer; is the pixel space feature spatial resolution; is the vertex index; is the total number of vertices; For and The associated weighted distribution coefficient; For the Pixel spatial features of pixels; is the aggregation feature; For the The pixel space feature of pixels is mapped to the first pixel in the image space Features of vertices; is the scaling factor; is the intermediate parameter; is the vertex feature; To make For the minimum The value of is the vertex feature set in the graph space.
[0031] The beneficial effects of the present invention are as follows: the weight estimation model constructed by the present invention uses the growth monitoring video of pregnant sows as input to achieve non-contact and accurate estimation of the weight of pregnant sows. The weight estimation model is a multimodal deep learning model that integrates the multidimensional biological phenotypic characteristics of pregnant sows, explores the nonlinear correlation between their biological phenotypes and weight changes, and achieves accurate estimation of the weight of sows during pregnancy. Based on the present invention, it can provide a scientific basis for precise nutritional management, ultimately optimize the reproductive efficiency of sows and the growth performance of piglets, and promote the development of animal husbandry towards intelligence and refinement. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 The figure is a flow chart of the method of the present invention.
[0033] Figure 2 It is a structural diagram of the weight estimation model in the present invention. DETAILED DESCRIPTION
[0034] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0035] like Figure 1 As shown, in one embodiment of the present invention, a method for estimating the weight of a pregnant sow driven by visual phenotype comprises: Obtain historical weight data and historical video sequences of several pregnant sows; Preprocess the historical video sequences of each pregnant sow respectively to obtain a training set of pregnant sow image sequences; According to the training set of pregnant sow image sequences and the historical weight data of pregnant sows, the association between image sequences and weight is constructed, and a weight estimation model for estimating the weight of pregnant sows based on the pregnant sow image sequences is obtained; The video sequence of pregnant sows is acquired in real time, and the estimated weight of pregnant sows is obtained using the weight estimation model.
[0036] In this embodiment, the hardware relied upon by this method includes: 1. High-definition RGB-D camera: A high-definition camera with at least 2 megapixels (1920×1080) installed 2 meters from the pigpen floor.
[0037] 2. Computing platform: A computer with a 3090 or higher GPU, no less than 16G memory, and a processor frequency of no less than 2.3GHz.
[0038] In this embodiment, the core content of the method is the acquisition process of the AI model. The process of training the AI model includes data collection and cleaning, model design and training, and model deployment and verification. During the data collection process, the data dimensions related to the sow weight are recorded, including: pig number, age, breed, gestation days, number of pregnancies, video, and weight. The storage specifications are shown in Table 1.
[0039] Table 1. Data dimensions
[0040] The historical video sequences of each pregnant sow are preprocessed to obtain a training set of pregnant sow image sequences, specifically: Each frame of the historical video sequence of each pregnant sow is normalized to obtain the normalized historical video sequence of each pregnant sow:
[0041] in, is the normalized historical video sequence Frame image; The first Frame image; is the mean sequence of each channel of the image; is the variance sequence of each channel of the image; According to the normalized historical video sequence of each pregnant sow, the pig detection model is used to determine the pig activity area in each frame image of each pregnant sow:
[0042] in, For images The pig activity area is a square area; For images The horizontal coordinate of the upper left corner of the activity area of the middle pig; For images The upper left vertical coordinate of the pig's activity area; For images The width of the activity area for medium pigs; For images The length of the activity area of medium pigs; is the total number of images; According to the pig activity area in each frame of each pregnant sow image, the image frames are filtered to obtain a pregnant sow image sequence training set.
[0043] The image frames are filtered according to the pig activity area in each frame of each pregnant sow image to obtain a pregnant sow image sequence training set, specifically: According to the pig activity area in each frame image of each pregnant sow, the variance of the coordinates of the upper left corner, lower left corner, upper right corner and lower right corner of the pig activity area of each pregnant sow is calculated respectively; Determine whether the variances of the coordinates of the upper left corner, lower left corner, upper right corner and lower right corner of the activity area of each pregnant sow are all less than the variance threshold. If so, take the maximum activity area as the final region of interest of the corresponding pregnant sow, and extract the final region of interest of each frame image in the normalized historical video sequence of the corresponding pregnant sow to obtain the image time series training sample of the corresponding pregnant sow. Otherwise, delete the normalized historical video sequence of the corresponding pregnant sow. All the image time series training samples of pregnant sows are integrated to obtain the pregnant sow image sequence training set.
[0044] The expression of the final region of interest is:
[0045] in, is the final region of interest; is the maximum value function.
[0046] The expression of the image time series training sample of the pregnant sow is:
[0047] in, It is a time series training sample of pregnant sow images; An operation for intercepting a normalized historical video sequence of a pregnant sow; is the final region of interest; For images The corresponding image only includes the final region of interest.
[0048] In this embodiment, data preprocessing: Input a video sequence ,in , is an image of a pregnant sow. First, normalize each image . The normalized image sequence Input each frame into the pig detection model to obtain the area containing only pigs , Representing images The pixel coordinates of the middle pig, ( ) represents the coordinates of the upper left corner, ( ) represents the coordinates of the lower right corner.
[0049] After the above calculation, there is a problem. Since the pig is moving, the coordinates obtained by the detection model for different video frames are different. In order to avoid this problem, the following strategy is adopted: (1) Calculate the variance of each coordinate. If the variance is greater than 20 pixels, it indicates that the pig is exercising vigorously and this data should be deleted. If the variance is not greater than 20 pixels, the largest area is taken as the pig's activity area, that is, .
[0050] (2) Extract the region of interest D from the video sequence to form an image sequence containing only the sow .
[0051] like Figure 2As shown, the weight estimation model includes an encoder, a graph mapping layer, a bidirectional graph convolution, a graph remapping layer, a concatenation layer, an auxiliary signal encoder, a fusion layer and a fully connected layer; The encoder is used to obtain training samples in a pregnant sow image sequence training set, and compress the images in the training samples to obtain pixel space features of the images; The graph mapping layer is used to map pixel space features to graph space to obtain aggregate features; The bidirectional graph convolution is used to obtain graph convolution features in time according to the aggregated features; The graph remapping layer is used to map the graph convolution features in time from the graph space back to the pixel space to obtain remapped features; The concatenation layer is used to concatenate the remapped features of all images in the training sample to obtain the encoded features; The auxiliary signal encoder is used to encode the gestational days and the number of pregnancies in the historical weight data as auxiliary signals to obtain auxiliary signal features; The fusion layer is used to fuse the auxiliary signal features and the coding features to obtain the final features; The fully connected layer is used to map the final features into weight.
[0052] In this embodiment, the encoder The structure is as follows: The first layer is a 3×3 convolution layer, which accepts an image of size 128×256×3 (the image after scaling) as input, and after calculation with 64 convolution kernels, the output dimension is 128×256×64; the relu activation layer removes the feature values less than 0. The second layer is a 1×1 convolution layer, which accepts a feature map of size 128×256×64 as input, and after calculation with 64 convolution kernels, the output dimension is 128×256×64, and links the relu activation layer and the dropout layer with a probability of 0.5.
[0053] Graph Mapping Formula The 128×256×64 features output from the previous layer are expanded to 3276×64 (32768=128×256), which can be marked as N ×64. The purpose of the map mapping is to N ×64 feature maps are aggregated features , the dimension is K ×64( K << N ).
[0054] The expression of the aggregation feature is:
[0055]
[0056] in, is the aggregation feature; is the graph mapping formula; is the pixel space feature; is the pixel space feature After mapping to the graph space, Features of vertices; is the total number of vertices; For encoder; For images The corresponding image only includes the final region of interest; The first Frame image.
[0057] The expression of the coding feature is:
[0058]
[0059]
[0060]
[0061]
[0062] in, is the coding feature; For splicing operation; is the remapping feature; is the total number of images; is the pixel space feature; is the graph remapping function; is the coefficient matrix; For images Temporal aggregation graph convolution features; is the time graph convolution function; For images Spatial graph convolution features; For images Spatial graph convolution features; is the convolution kernel function; for The adjacency matrix of For graph features Node characteristics; for The adjacency matrix of For graph features Graph node features of is a learnable parameter; is the spatial graph convolution function; is the aggregation feature.
[0063] The expression for mapping the final feature to weight is:
[0064] in, is body weight; is a fully connected layer; The final feature.
[0065] The loss function of the graph mapping layer is:
[0066]
[0067]
[0068] in, is the loss function of the graph mapping layer; is the pixel space feature spatial resolution; is the vertex index; is the total number of vertices; For and The associated weighted distribution coefficient; For the Pixel spatial features of pixels; is the aggregation feature; For the The pixel space feature of pixels is mapped to the first pixel in the image space Features of vertices; is the scaling factor; is the intermediate parameter; is the vertex feature; To make For the minimum The value of is the vertex feature set in the graph space.
[0069] In this embodiment, the purpose of designing the weight estimation model is to construct an image sequence and weight The association between them, that is, design a Mapping , so that .
Claims
1. A method for estimating the weight of pregnant sows driven by visual phenotype, characterized in that: include: Obtain historical weight data and historical video sequences of several pregnant sows; Preprocess the historical video sequences of each pregnant sow respectively to obtain a training set of pregnant sow image sequences; According to the training set of pregnant sow image sequences and the historical weight data of pregnant sows, the association between image sequences and weight is constructed, and a weight estimation model for estimating the weight of pregnant sows based on the pregnant sow image sequences is obtained; The video sequence of pregnant sows is acquired in real time, and the estimated weight of pregnant sows is obtained using the weight estimation model.
2. The method for estimating the weight of pregnant sows driven by visual phenotype according to claim 1, characterized in that: The historical video sequences of each pregnant sow are preprocessed to obtain a training set of pregnant sow image sequences, specifically: Each frame of the historical video sequence of each pregnant sow is normalized to obtain the normalized historical video sequence of each pregnant sow: in, is the normalized historical video sequence Frame image; The first Frame image; is the mean sequence of each channel of the image; is the variance sequence of each channel of the image; According to the normalized historical video sequence of each pregnant sow, the pig detection model is used to determine the pig activity area in each frame image of each pregnant sow: in, For images The pig activity area is a square area; For images The horizontal coordinate of the upper left corner of the activity area of the middle pig; For images The upper left vertical coordinate of the pig's activity area; For images The width of the activity area for medium pigs; For images The length of the activity area of medium pigs; is the total number of images; According to the pig activity area in each frame of each pregnant sow image, the image frames are filtered to obtain a pregnant sow image sequence training set.
3. The method for estimating the weight of pregnant sows driven by visual phenotype according to claim 2, characterized in that: The image frames are filtered according to the pig activity area in each frame of each pregnant sow image to obtain a pregnant sow image sequence training set, specifically: According to the pig activity area in each frame image of each pregnant sow, the variance of the coordinates of the upper left corner, lower left corner, upper right corner and lower right corner of the pig activity area of each pregnant sow is calculated respectively; Determine whether the variances of the coordinates of the upper left corner, lower left corner, upper right corner and lower right corner of the activity area of each pregnant sow are all less than the variance threshold. If so, take the maximum activity area as the final region of interest of the corresponding pregnant sow, and extract the final region of interest of each frame image in the normalized historical video sequence of the corresponding pregnant sow to obtain the image time series training sample of the corresponding pregnant sow. Otherwise, delete the normalized historical video sequence of the corresponding pregnant sow. All the image time series training samples of pregnant sows are integrated to obtain the pregnant sow image sequence training set.
4. The method for estimating the weight of pregnant sows driven by visual phenotype according to claim 3, characterized in that: The expression of the final region of interest is: in, is the final region of interest; is the maximum value function.
5. The method for estimating the weight of pregnant sows driven by visual phenotype according to claim 3, characterized in that: The expression of the image time series training sample of the pregnant sow is: in, It is a time series training sample of pregnant sow images; An operation for intercepting a normalized historical video sequence of a pregnant sow; is the final region of interest; For images The corresponding image only includes the final region of interest.
6. The method for estimating the weight of pregnant sows driven by visual phenotype according to claim 1, characterized in that: The weight estimation model includes an encoder, a graph mapping layer, a bidirectional graph convolution, a graph remapping layer, a concatenation layer, an auxiliary signal encoder, a fusion layer, and a fully connected layer; The encoder is used to obtain training samples in a pregnant sow image sequence training set, and compress the images in the training samples to obtain pixel space features of the images; The graph mapping layer is used to map pixel space features to graph space to obtain aggregate features; The bidirectional graph convolution is used to obtain graph convolution features in time according to the aggregated features; The graph remapping layer is used to map the graph convolution features in time from the graph space back to the pixel space to obtain remapped features; The concatenation layer is used to concatenate the remapped features of all images in the training sample to obtain the encoded features; The auxiliary signal encoder is used to encode the gestational days and the number of pregnancies in the historical weight data as auxiliary signals to obtain auxiliary signal features; The fusion layer is used to fuse the auxiliary signal features and the coding features to obtain the final features; The fully connected layer is used to map the final features into weight.
7. The method for estimating the weight of pregnant sows driven by visual phenotype according to claim 6, characterized in that: The expression of the aggregation feature is: in, is the aggregation feature; is the graph mapping formula; is the pixel space feature; is the pixel space feature After mapping to the graph space, Features of vertices; is the total number of vertices; For encoder; For images The corresponding image only includes the final region of interest; The first Frame image.
8. The method for estimating the weight of pregnant sows driven by visual phenotype according to claim 6, characterized in that: The expression of the coding feature is: in, is the coding feature; For splicing operation; is the remapping feature; is the total number of images; is the pixel space feature; is the graph remapping function; is the coefficient matrix; For images Temporal aggregation graph convolution features; is the time graph convolution function; For images Spatial graph convolution features; For images Spatial graph convolution features; is the convolution kernel function; for The adjacency matrix of For graph features Node characteristics of for The adjacency matrix of For graph features Graph node features of is a learnable parameter; is the spatial graph convolution function; is the aggregation feature.
9. The method for estimating the weight of pregnant sows driven by visual phenotype according to claim 6, characterized in that: The expression for mapping the final feature to weight is: in, is body weight; is a fully connected layer; The final feature.
10. The method for estimating the weight of a pregnant sow driven by visual phenotype according to claim 6, characterized in that: The loss function of the graph mapping layer is: in, is the loss function of the graph mapping layer; is the pixel space feature spatial resolution; is the vertex index; is the total number of vertices; For and The associated weighted distribution coefficient; For the Pixel spatial features of pixels; is the aggregation feature; For the The pixel space feature of pixels is mapped to the first pixel in the image space Features of vertices; is the scaling factor; is the intermediate parameter; is the vertex feature; To make For the minimum The value of is the vertex feature set in the graph space.