Livestock weight prediction method and system

Through image segmentation and body rule coupling learning network combination length and width characteristics, the problem of low prediction accuracy of livestock weight is solved, and efficient and contactless livestock weight estimation is achieved, which is suitable for intelligent management of large-scale farms.

CN120452028AActive Publication Date: 2025-08-08HUAZHONG AGRI UNIV +1
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510953677.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-11
Publication Date
2025-08-08
Estimated Expiration
2045-07-11

AI Technical Summary

Technical Problem

In the prior art, the prediction accuracy of domestic livestock weight is low, the traditional methods have high labor intensity and are susceptible to light, posture changes and individual differences, making it difficult to manage efficiently in large-scale farms.

Method used

The livestock area is segmented from the livestock image by using an image segmentation model, and the feature extraction module is used to convert it into a convolutional feature map. The network combines the length and width features through body rule coupling. The fusion module and full connection layer in the body rule coupling are used to predict the weight, and the body rule information is introduced to improve the weight estimation accuracy.

Benefits of technology

It realizes contactless high-precision livestock weight estimation without additional input of body length and width information in a single livestock image, which improves the robustness and generalization ability of the model and is suitable for intelligent management of large-scale farms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120452028A_ABST
    Figure CN120452028A_ABST
Patent Text Reader

Abstract

The invention provides a livestock weight prediction method and system, and the method comprises the steps: segmenting a livestock region from a livestock image of livestock to be subjected to weight estimation through an image segmentation model, and converting the livestock region into a convolution feature map through a feature extraction module; inputting the convolutional feature graph into a body size coupling learning network to obtain various body size features of the livestock to be subjected to weight estimation output by the body size coupling learning network; inputting the various body size characteristics into a fusion module in the body size coupling learning network to obtain the body weight characteristics of the livestock to be subjected to weight estimation output by the fusion module; and predicting the weight of the livestock to be subjected to weight estimation through a full connection layer according to the weight characteristics of the livestock to be subjected to weight estimation. The body size information is utilized to guide the deep network to obtain more accurate body weight feature expression, the weight estimation precision is improved, the method can be widely applied to large-scale farms, an efficient solution is provided for intelligent and non-contact livestock management, and the method has high practical value and popularization prospects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a livestock weight prediction method and system. Background Art

[0002] In modern farming systems, livestock weight is an important parameter for evaluating growth performance, feed conversion rate and timing of marketing.

[0003] Traditional livestock weighing methods rely primarily on manual measurement or electronic floor scales. These methods are not only labor-intensive and complex, but are also prone to measurement errors due to livestock stress reactions. Furthermore, in large-scale farms, frequent weighing increases the difficulty of livestock management and affects production efficiency. Therefore, the development of an efficient, non-contact, intelligent weight estimation technology is of great practical significance to the modern livestock industry.

[0004] In recent years, the rapid development of computer vision and deep learning technologies has opened up new possibilities for estimating livestock weight. Previous studies have attempted to estimate weight through image analysis, but relying solely on images is susceptible to changes in lighting, posture, and individual differences, resulting in reduced estimation accuracy. Summary of the Invention

[0005] The present invention provides a livestock weight prediction method and system, which are used to solve the defect of low accuracy of livestock weight prediction in the prior art and improve the accuracy of livestock weight prediction.

[0006] The present invention provides a method for predicting livestock weight, comprising:

[0007] Segmenting a livestock region from a livestock image of the livestock to be weighed using an image segmentation model, and converting the livestock region into a convolutional feature map using a feature extraction module;

[0008] Inputting the convolution feature map into a body size coupled learning network to obtain a plurality of body size features of the livestock to be weighed output by the body size coupled learning network;

[0009] Inputting the multiple body size features into a fusion module in the body size coupled learning network to obtain the weight feature of the livestock to be weighed output by the fusion module;

[0010] The weight features of the livestock to be estimated are used to predict the weight of the livestock to be estimated through a fully connected layer.

[0011] According to a livestock weight prediction method provided by the present invention, the livestock image is a top view of the livestock to be estimated, the livestock region is the back region of the livestock to be estimated, and the body size features include the body length features and body width features of the livestock to be estimated.

[0012] According to a livestock weight prediction method provided by the present invention, the body size coupling learning network includes a plurality of body size coupling submodules connected in sequence, and each body size coupling submodule, except the last body size coupling submodule, includes a convolution block, a horizontal layer state attention block, a vertical layer state attention block and a dual fusion cascade block;

[0013] The last body-scale coupling submodule includes a convolution block, a horizontal layer attention block, a vertical layer attention block and the fusion module;

[0014] The convolutional feature map is input into the convolution block in the first body-scale coupling submodule, and the features output by the convolution block in each body-scale coupling submodule are split into two sub-feature maps according to the channel dimension, and are input into the horizontal layer state attention block and the vertical layer state attention block in each body-scale coupling submodule one by one.

[0015] Input the features output by the horizontal layer attention block and the vertical layer attention block in each body-scale coupling submodule into the dual fusion cascade block or fusion module in each body-scale coupling submodule;

[0016] The features output by the dual fusion cascade block in each body-scale coupling submodule are used as the input of the convolution block in the next body-scale coupling submodule.

[0017] According to a livestock weight prediction method provided by the present invention, the horizontal layer attention block includes a first convolution layer, a second convolution layer, a third convolution layer and a Sigmoid function layer;

[0018] The sub-feature map is processed by the first convolution layer, the second convolution layer and the Sigmoid function layer in sequence, and then pixel-by-pixel multiplication is performed with the sub-feature map to obtain a body length feature map of the intermediate layer;

[0019] Passing the body length feature map of the intermediate layer through the third convolutional layer to obtain the attention weight matrix of each channel;

[0020] The attention weight matrix output by the third convolutional layer is processed by the Sigmoid function layer, and then averaged in each column and expanded to the column;

[0021] The expanded matrix is multiplied pixel by pixel with the body length feature map of the intermediate layer to obtain the body length feature map.

[0022] According to a livestock weight prediction method provided by the present invention, the longitudinal layer attention block includes the fourth to eighth convolutional layers and a Sigmoid function layer;

[0023] The sub-feature map is processed sequentially through the fourth convolution layer, the fifth convolution layer, the sixth convolution layer and the Sigmoid function layer, and then pixel-by-pixel multiplication is performed with the sub-feature map to obtain a body width feature map of the intermediate layer;

[0024] Passing the body length feature map of the middle layer through the seventh convolutional layer and the eighth convolutional layer in sequence to obtain the attention weight matrix of each channel;

[0025] The attention weight matrix output by the eighth convolutional layer is processed by the Sigmoid function layer, and then averaged per row and expanded to the row;

[0026] The expanded matrix is multiplied pixel by pixel with the body width feature map of the intermediate layer to obtain the body width feature map.

[0027] According to a livestock weight prediction method provided by the present invention, the dual fusion cascade block includes a splicing layer, a ninth convolution layer, a tenth convolution layer and a variability convolution layer connected in sequence;

[0028] Among them, after the body length features output by the horizontal layer attention block and the body width features output by the vertical layer attention block are spliced through the splicing layer, convolution is performed in sequence through the ninth convolution layer and the tenth convolution layer, and the convolution result is output after adjusting the local features through the variable convolution layer.

[0029] According to a livestock weight prediction method provided by the present invention, the fusion module includes an eleventh convolution layer, a hole convolution layer, a batch normalization and ReLU activation function layer, a splicing layer and a twelfth convolution layer;

[0030] The body length feature and body width feature are respectively input into the eleventh convolution layer, the void convolution layer, the batch normalization and the ReLU activation function layer, and then spliced through the splicing layer. The spliced features are passed through the twelfth convolution layer to obtain the weight feature.

[0031] According to a livestock weight prediction method provided by the present invention, before using an image segmentation model to segment a livestock region from a livestock image of the livestock to be estimated, and using a feature extraction module to convert the livestock region into a convolution feature map, the method further includes:

[0032] Segmenting livestock region samples from livestock image samples using an image segmentation model, and converting the livestock region samples into convolution feature maps using a feature extraction module;

[0033] Inputting the convolution feature map of the livestock image sample into a body size coupled learning network to obtain body length features and body width features corresponding to the livestock image sample output by the body size coupled learning network;

[0034] Inputting the body length feature and body width feature corresponding to the livestock image sample into a fusion module in the body size coupled learning network, and obtaining the weight feature corresponding to the livestock image sample output by the fusion module;

[0035] Passing the body length features, body width features, and weight features corresponding to the livestock image samples through a fully connected layer to predict the body length, body width, and weight corresponding to the livestock image samples;

[0036] Determining a loss function based on the predicted body length, body width, and weight of the livestock image sample and the actual body length, body width, and weight;

[0037] The body-scale coupled learning network is trained according to the loss function so that the value of the loss function is minimized.

[0038] According to a livestock weight prediction method provided by the present invention, the formula of the loss function is:

[0039] ;

[0040] Among them, Loss is the loss value, N is the total number of livestock image samples, is the actual weight corresponding to the livestock image sample, is the predicted weight corresponding to the livestock image sample; is the actual body length corresponding to the livestock image sample, is the predicted body length corresponding to the livestock image sample; is the actual body width corresponding to the livestock image sample, is the predicted body width corresponding to the livestock image sample; a, b and c represent the weight factors of weight, body length and body width respectively.

[0041] The present invention also provides a livestock weight prediction system, comprising:

[0042] a conversion module for segmenting a livestock region from a livestock image of the livestock to be weighed using an image segmentation model, and converting the livestock region into a convolution feature map using a feature extraction module;

[0043] an extraction module, configured to input the convolution feature map into a body size coupled learning network to obtain a plurality of body size features of the livestock to be weighed output by the body size coupled learning network;

[0044] a fusion module, configured to input the plurality of body size features into the fusion module in the body size coupled learning network, and obtain the weight feature of the livestock to be weighed output by the fusion module;

[0045] The prediction module is used to predict the weight of the livestock to be estimated by using the weight features of the livestock to be estimated through a fully connected layer.

[0046] The present invention also provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the livestock weight prediction methods described above is implemented.

[0047] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for predicting livestock weight as described above is implemented.

[0048] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the livestock weight prediction methods described above.

[0049] The livestock weight prediction method and system provided by the present invention utilize computer vision and deep learning technologies. Based on the strong correlation between body size data and livestock weight, body size information is introduced into the livestock weight modeling process using a deep network to achieve an interpretable and accurate livestock weight estimation method. This method can overcome the limitations of a single modality and improve the robustness and generalization ability of the model. In actual application, no additional body length and width information is required to be input; only a single livestock image is needed to achieve non-contact intelligent livestock weight estimation. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0051] Figure 1 1 is a schematic flow chart of a livestock weight prediction method provided by the present invention;

[0052] Figure 2 Schematic diagram of the model structure of the livestock weight prediction method provided by the present invention;

[0053] Figure 3 Schematic diagram of the structure of the body size coupling learning network in the livestock weight prediction method provided by the present invention;

[0054] Figure 4 Schematic diagram of the structure of the fusion module in the livestock weight prediction method provided by the present invention;

[0055] Figure 5 It is a structural schematic diagram of the livestock weight prediction system provided by the present invention;

[0056] Figure 6It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0057] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0058] The following combination Figure 1 A method for predicting livestock weight according to the present invention is described, comprising:

[0059] Step 101, using an image segmentation model to segment a livestock region from a livestock image of the livestock to be weighed, and using a feature extraction module to convert the livestock region into a convolution feature map;

[0060] Step 102: inputting the convolution feature map into a body size coupled learning network to obtain a plurality of body size features of the livestock to be weighed output by the body size coupled learning network;

[0061] Step 103: input the multiple body size features into a fusion module in the body size coupled learning network to obtain the weight feature of the livestock to be weighed output by the fusion module;

[0062] Step 104 : Using the weight features of the livestock to be estimated through a fully connected layer to predict the weight of the livestock to be estimated.

[0063] The livestock in this embodiment may be pigs, cattle, sheep, etc., and this embodiment does not limit the type of livestock.

[0064] The image segmentation model is used to segment the back region of the livestock in the top view to obtain livestock images without background. The body size features extracted from the livestock images include body length features and body width features.

[0065] Use an image segmentation model to obtain livestock masks in the image. The segmentation model can be a YOLOv8 network including a segmentation module.

[0066] The feature extraction module can be a network obtained by removing the average pooling and fully connected layers of ResNet18, which consists of four convolutional feature extraction modules. The structural diagram of the livestock weight prediction model is as follows: Figure 2 shown.

[0067] Livestock body size features, including length and width, are significantly correlated with weight. Combining body size information can effectively improve the accuracy of weight estimation. Therefore, this embodiment fuses body size data with image features for weight estimation.

[0068] This embodiment can be equipped with intelligent equipment to realize automatic data collection and real-time weight estimation. It is suitable for large-scale breeding environments, provides intelligent solutions for individual livestock management and precise breeding, and helps promote the digital upgrade of animal husbandry.

[0069] This embodiment uses computer vision and deep learning technologies, based on the strong correlation between body size data and livestock weight. By introducing body size information into the livestock weight modeling process using a deep network, an interpretable and accurate livestock weight estimation method is implemented. This method can overcome the limitations of a single modality and improve the robustness and generalization ability of the model. In actual application, no additional body length and width information is required; only a single livestock image is needed to achieve non-contact intelligent livestock weight estimation.

[0070] Based on the above embodiment, in this embodiment, the livestock image is a top view of the livestock to be weighed, the livestock region is the back region of the livestock to be weighed, and the body size features include the body length and width features of the livestock to be weighed.

[0071] Based on the above embodiment, the body-scale coupling learning network described in this embodiment includes multiple body-scale coupling sub-modules connected in sequence. Except for the last body-scale coupling sub-module, each body-scale coupling sub-module includes a convolution block, a horizontal layer state attention block, a vertical layer state attention block, and a dual fusion cascade block.

[0072] The last body-scale coupling submodule includes a convolution block, a horizontal layer attention block, a vertical layer attention block and the fusion module;

[0073] The convolutional feature map is input into the convolution block in the first body-scale coupling submodule, and the features output by the convolution block in each body-scale coupling submodule are split into two sub-feature maps according to the channel dimension, and are input into the horizontal layer state attention block and the vertical layer state attention block in each body-scale coupling submodule one by one.

[0074] Input the features output by the horizontal layer attention block and the vertical layer attention block in each body-scale coupling submodule into the dual fusion cascade block or fusion module in each body-scale coupling submodule;

[0075] The features output by the dual fusion cascade block in each body-scale coupling submodule are used as the input of the convolution block in the next body-scale coupling submodule.

[0076] like Figure 2 As shown in FIG, the body-scale coupled learning network may include four convolution blocks, four horizontal layer attention blocks, four vertical layer attention blocks, three dual fusion cascade blocks and one fusion module.

[0077] Based on the above embodiment, the horizontal layer attention block in this embodiment includes a first convolutional layer, a second convolutional layer, a third convolutional layer and a Sigmoid function layer;

[0078] The sub-feature map is processed by the first convolution layer, the second convolution layer and the Sigmoid function layer in sequence, and then pixel-by-pixel multiplication is performed with the sub-feature map to obtain a body length feature map of the intermediate layer;

[0079] Passing the body length feature map of the intermediate layer through the third convolutional layer to obtain the attention weight matrix of each channel;

[0080] The attention weight matrix output by the third convolutional layer is processed by the Sigmoid function layer, and then averaged in each column and expanded to the column;

[0081] The expanded matrix is multiplied pixel by pixel with the body length feature map of the intermediate layer to obtain the body length feature map.

[0082] like Figure 3 As shown in the figure, the convolutional block in the body-scale coupled learning network can be composed of a sequentially connected F3N128 and F3N64. The convolutional feature map obtained by F3N128 and F3N64 is split into two sub-feature maps according to the channel dimension. Among them, F3N128 represents a convolutional layer with a convolution kernel of 3×3 and 128 output channels; F3N64 represents a convolutional layer with a convolution kernel of 3×3 and 64 output channels.

[0083] The horizontal attention block can be composed of three convolutional layers, a sigmoid function layer, a pixel-by-pixel summation layer, and two pixel-by-pixel multiplication operations. The three convolutional layers can be F1N4, F1N1, and F7N1 respectively.

[0084] The feature map extracted by the convolution module is divided into a portion of sub-feature maps along the channel dimension. These sub-feature maps are summed and averaged pixel-by-pixel in the spatial dimension and then added together. After processing through the F1N4, F1N1, and Sigmoid function layers, they are multiplied pixel-by-pixel with the sub-feature maps to obtain the body length feature map in the intermediate layer. The body length feature map in the intermediate layer is concatenated with the pixel-by-pixel summation and averaging operations along the channel dimension. The attention weight matrix for a single channel is obtained through F7N1. The obtained weights are averaged and expanded to that row through the Sigmoid function layer. They are then multiplied pixel-by-pixel with the body length feature map in the intermediate layer and output as the body length feature map.

[0085] Among them, F1N4 represents a convolution layer with a convolution kernel of 1×1 and an output channel of 4; F1N1 represents a convolution layer with a convolution kernel of 1×1 and an output channel of 1; F7N1 represents a convolution layer with a convolution kernel of 7×7 and an output channel of 1.

[0086] Based on the above embodiment, the vertical layer attention block in this embodiment includes the fourth to eighth convolutional layers and a Sigmoid function layer;

[0087] The sub-feature map is processed sequentially through the fourth convolution layer, the fifth convolution layer, the sixth convolution layer and the Sigmoid function layer, and then pixel-by-pixel multiplication is performed with the sub-feature map to obtain a body width feature map of the intermediate layer;

[0088] Passing the body length feature map of the middle layer through the seventh convolutional layer and the eighth convolutional layer in sequence to obtain the attention weight matrix of each channel;

[0089] The attention weight matrix output by the eighth convolutional layer is processed by the Sigmoid function layer, and then averaged per row and expanded to the row;

[0090] The expanded matrix is multiplied pixel by pixel with the body width feature map of the intermediate layer to obtain the body width feature map.

[0091] like Figure 3 As shown, the vertical layer attention block can be composed of five convolutional layers, a Sigmoid function layer, a pixel-by-pixel summation layer, and two pixel-by-pixel multiplication operations. The five convolutional layers can be F1N8, F1N4, F1N1, F5N16, and F3N1. The feature map extracted by the convolution module is divided equally according to the channel dimension to obtain a portion of sub-feature maps. Pixel-by-pixel summation and averaging operations are performed on the spatial dimension and then added. After processing through the F1N8, F1N4, F1N1, and Sigmoid function layers, pixel-by-pixel multiplication is performed with the sub-feature maps to obtain the volume-width feature map of the intermediate layer. Pixel-by-pixel summation and averaging operations are performed on the channel dimension and then concatenated. After passing through F5N16 and F3N1, the intermediate attention weight matrix is obtained. The obtained weights are averaged and expanded to each row through the Sigmoid function layer. They are then pixel-by-pixel multiplied with the volume-width feature map of the intermediate layer and output as the volume-width feature map.

[0092] Among them, F1N8 represents a convolution layer with a convolution kernel of 1×1 and 8 output channels; F5N16 represents a convolution layer with a convolution kernel of 5×5 and 16 output channels; F3N1 represents a convolution layer with a convolution kernel of 3×3 and 1 output channel.

[0093] Based on the above embodiment, the dual fusion cascade block in this embodiment includes a splicing layer, a ninth convolution layer, a tenth convolution layer, and a variable convolution layer connected in sequence;

[0094] Among them, after the body length features output by the horizontal layer attention block and the body width features output by the vertical layer attention block are spliced through the splicing layer, convolution is performed in sequence through the ninth convolution layer and the tenth convolution layer, and the convolution result is output after adjusting the local features through the variable convolution layer.

[0095] like Figure 3 As shown in the figure, the dual fusion cascade block can be composed of a sequential concatenation layer, F3N256, and F3N64. First, the body length feature map and body width feature map of the same dimension are concatenated in the channel dimension. F3N256 and F3N64 are used to promote information fusion between the two feature maps. Finally, the DCN (Deformable Convolutional Network) is used to adjust the local features before output.

[0096] Among them, F3N256 represents a convolution layer with a convolution kernel of 3×3 and 256 output channels; F3N64 represents a convolution layer with a convolution kernel of 3×3 and 64 output channels; DCN represents a deformable convolution layer with a convolution kernel of 3×3 and 64 output channels.

[0097] Based on the above embodiment, the fusion module in this embodiment includes an eleventh convolutional layer, a hole convolutional layer, a batch normalization and ReLU activation function layer, a splicing layer and a twelfth convolutional layer;

[0098] The body length feature and body width feature are respectively input into the eleventh convolution layer, the void convolution layer, the batch normalization and the ReLU activation function layer, and then spliced through the splicing layer. The spliced features are passed through the twelfth convolution layer to obtain the weight feature.

[0099] like Figure 4 As shown in the figure, the fusion module can be composed of two F1N128, DC, concatenation layers, and an F1N512 connected in sequence. For example, the acquired body length and width features are halved through the F1N128 channel, followed by a 3×3 dilated convolution with a dilation ratio of 2 to extract local features. After the convolution, batch normalization and ReLU activation functions are used to concatenate the features obtained from the two branches according to the channel dimension, and a 1×1 convolution is used to restore the number of channels to the input. Finally, batch normalization and ReLU are applied again.

[0100] Among them, F1N128 represents a convolution layer with a convolution kernel of 1×1 and 128 output channels; F1N512 represents a convolution layer with a convolution kernel of 1×1 and 512 output channels.

[0101] Based on the above embodiment, this embodiment further includes the following steps before segmenting a livestock region from a livestock image of the livestock to be weighed using an image segmentation model and converting the livestock region into a convolution feature map using a feature extraction module:

[0102] Segmenting livestock region samples from livestock image samples using an image segmentation model, and converting the livestock region samples into convolution feature maps using a feature extraction module;

[0103] Inputting the convolution feature map of the livestock image sample into a body size coupled learning network to obtain body length features and body width features corresponding to the livestock image sample output by the body size coupled learning network;

[0104] Inputting the body length feature and body width feature corresponding to the livestock image sample into a fusion module in the body size coupled learning network, and obtaining the weight feature corresponding to the livestock image sample output by the fusion module;

[0105] Passing the body length features, body width features, and weight features corresponding to the livestock image samples through a fully connected layer to predict the body length, body width, and weight corresponding to the livestock image samples;

[0106] Determining a loss function based on the predicted body length, body width, and weight of the livestock image sample and the actual body length, body width, and weight;

[0107] The body-scale coupled learning network is trained according to the loss function so that the value of the loss function is minimized.

[0108] Based on the above embodiment, the formula of the loss function in this embodiment is:

[0109] ;

[0110] Among them, Loss is the loss value, N is the total number of livestock image samples, is the actual weight corresponding to the livestock image sample, is the predicted weight corresponding to the livestock image sample; is the actual body length corresponding to the livestock image sample, is the predicted body length corresponding to the livestock image sample; is the actual body width corresponding to the livestock image sample, is the predicted body width corresponding to the livestock image sample; a, b and c represent the weight factors of weight, body length and body width respectively.

[0111] Table 1 provides some examples of the effectiveness of the algorithm implemented in this invention for livestock weight estimation. Compared to classic regression methods and mainstream CNN models, the proposed method demonstrates significant advantages for deep modality data: its parameter count (11.60M) and computational overhead (1.88G FLOPs) are similar to those of ResNet-18. However, it achieves the best prediction performance, achieving a MAE of 3.811, a MRE of 7.460%, and an R² of 0.965, surpassing Xception, the ResNet series, and MobileNet.

[0112] Table 1

[0113] method Data Type #Param. FLOPs MAE MAPE <![CDATA[R 2 ]]> Linear Regression - - - 8.11 16.54% 0.935 ResNet18 RGB 11.18M 1.82G 15.99 25.33% 0.664 ResNet18 Depth 11.18M 1.82G 4.090 7.672% 0.959 ResNet50 RGB 25.56M 4.1G 12.27 19.53% 0.734 ResNet50 Depth 25.56M 4.1G 4.100 7.658% 0.959 MobileNet RGB 5.58M 0.22G 11.01 16.47% 0.725 MobileNet Depth 5.58M 0.22G 4.202 8.000% 0.956 Xception RGB 20.83M 4.60G 10.998 20.84% 0.835 Xception Depth 20.83M 4.60G 3.924 7.59% 0.963 The present invention Depth 11.60M 1.88G 3.811 7.46% 0.965

[0114] The livestock weight prediction system provided by the present invention is described below. The livestock weight prediction system described below and the livestock weight prediction method described above can be referenced to each other.

[0115] like Figure 5 As shown, the system includes a conversion module 501, an extraction module 502, a fusion module 503 and a prediction module 504, wherein:

[0116] The conversion module 501 is used to segment the livestock region from the livestock image of the livestock to be weighed using the image segmentation model, and convert the livestock region into a convolution feature map using the feature extraction module;

[0117] The extraction module 502 is used to input the convolution feature map into the body size coupled learning network to obtain multiple body size features of the livestock to be weighed output by the body size coupled learning network;

[0118] The fusion module 503 is used to input the multiple body size features into the fusion module in the body size coupled learning network to obtain the weight feature of the livestock to be weighed output by the fusion module;

[0119] The prediction module 504 is configured to predict the weight of the livestock to be estimated by using the weight features of the livestock to be estimated through a fully connected layer.

[0120] This embodiment uses computer vision and deep learning technologies, based on the strong correlation between body size data and livestock weight. By introducing body size information into the livestock weight modeling process using a deep network, an interpretable and accurate livestock weight estimation method is implemented. This method can overcome the limitations of a single modality and improve the robustness and generalization ability of the model. In actual application, no additional body length and width information is required; only a single livestock image is needed to achieve non-contact intelligent livestock weight estimation.

[0121] Figure 6 An example of a physical structure diagram of an electronic device is shown below. Figure 6 As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630, and a communications bus 640. The processor 610, the communications interface 620, and the memory 630 communicate with each other via the communications bus 640. The processor 610 may invoke logic instructions in the memory 630 to execute a livestock weight prediction method, which includes: using an image segmentation model to segment a livestock region from an image of the livestock to be estimated, and using a feature extraction module to convert the livestock region into a convolutional feature map; inputting the convolutional feature map into a body size coupled learning network to obtain multiple body size features of the livestock to be estimated, output by the body size coupled learning network; inputting the multiple body size features into a fusion module within the body size coupled learning network to obtain weight features of the livestock to be estimated, output by the fusion module; and using the weight features of the livestock to be estimated to predict the weight of the livestock to be estimated through a fully connected layer.

[0122] Furthermore, the logic instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0123] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the livestock weight prediction method provided by the above methods, which includes: using an image segmentation model to segment a livestock area from a livestock image of the livestock to be estimated, and using a feature extraction module to convert the livestock area into a convolution feature map; inputting the convolution feature map into a body size coupling learning network to obtain multiple body size features of the livestock to be estimated output by the body size coupling learning network; inputting the multiple body size features into a fusion module in the body size coupling learning network to obtain the weight features of the livestock to be estimated output by the fusion module; and predicting the weight of the livestock to be estimated through a fully connected layer using the weight features of the livestock to be estimated.

[0124] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the livestock weight prediction method provided by the above-mentioned methods, the method comprising: using an image segmentation model to segment a livestock area from a livestock image of the livestock to be estimated, and using a feature extraction module to convert the livestock area into a convolution feature map; inputting the convolution feature map into a body size coupled learning network to obtain a plurality of body size features of the livestock to be estimated output by the body size coupled learning network; inputting the plurality of body size features into a fusion module in the body size coupled learning network to obtain the weight features of the livestock to be estimated output by the fusion module; and predicting the weight of the livestock to be estimated using the weight features of the livestock to be estimated through a fully connected layer.

[0125] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0126] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.

[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A method for predicting livestock weight, characterized in that: include: Segmenting a livestock region from a livestock image of the livestock to be weighed using an image segmentation model, and converting the livestock region into a convolutional feature map using a feature extraction module; Inputting the convolution feature map into a body size coupled learning network to obtain a plurality of body size features of the livestock to be weighed output by the body size coupled learning network; Inputting the multiple body size features into a fusion module in the body size coupled learning network to obtain the weight feature of the livestock to be weighed output by the fusion module; The weight features of the livestock to be estimated are used to predict the weight of the livestock to be estimated through a fully connected layer.

2. The livestock weight prediction method according to claim 1, wherein: The livestock image is a top view of the livestock to be weighed, the livestock region is a back region of the livestock to be weighed, and the body size features include a body length feature and a body width feature of the livestock to be weighed.

3. The livestock weight prediction method according to claim 1, wherein: The body-scale coupling learning network includes a plurality of body-scale coupling submodules connected in sequence, and each body-scale coupling submodule, except the last body-scale coupling submodule, includes a convolution block, a horizontal layer state attention block, a vertical layer state attention block and a dual fusion cascade block; The last body-scale coupling submodule includes a convolution block, a horizontal layer attention block, a vertical layer attention block and the fusion module; The convolutional feature map is input into the convolution block in the first body-scale coupling submodule, and the features output by the convolution block in each body-scale coupling submodule are split into two sub-feature maps according to the channel dimension, and are input into the horizontal layer state attention block and the vertical layer state attention block in each body-scale coupling submodule one by one. Input the features output by the horizontal layer attention block and the vertical layer attention block in each body-scale coupling submodule into the dual fusion cascade block or fusion module in each body-scale coupling submodule; The features output by the dual fusion cascade block in each body-scale coupling submodule are used as the input of the convolution block in the next body-scale coupling submodule.

4. The livestock weight prediction method according to claim 3, characterized in that: The horizontal layer attention block includes a first convolutional layer, a second convolutional layer, a third convolutional layer and a Sigmoid function layer; The sub-feature map is processed by the first convolution layer, the second convolution layer and the Sigmoid function layer in sequence, and then pixel-by-pixel multiplication is performed with the sub-feature map to obtain a body length feature map of the intermediate layer; Passing the body length feature map of the intermediate layer through the third convolutional layer to obtain the attention weight matrix of each channel; The attention weight matrix output by the third convolutional layer is processed by the Sigmoid function layer, and then averaged in each column and expanded to the column; The expanded matrix is multiplied pixel by pixel with the body length feature map of the intermediate layer to obtain the body length feature map.

5. The livestock weight prediction method according to claim 3, characterized in that: The vertical layer attention block includes the fourth to eighth convolutional layers and the Sigmoid function layer; The sub-feature map is processed sequentially through the fourth convolution layer, the fifth convolution layer, the sixth convolution layer and the Sigmoid function layer, and then pixel-by-pixel multiplication is performed with the sub-feature map to obtain a body width feature map of the intermediate layer; Passing the body length feature map of the middle layer through the seventh convolutional layer and the eighth convolutional layer in sequence to obtain the attention weight matrix of each channel; The attention weight matrix output by the eighth convolutional layer is processed by the Sigmoid function layer, and then averaged per row and expanded to the row; The expanded matrix is multiplied pixel by pixel with the body width feature map of the intermediate layer to obtain the body width feature map.

6. The livestock weight prediction method according to claim 3, characterized in that: The dual fusion cascade block includes a splicing layer, a ninth convolutional layer, a tenth convolutional layer, and a deformable convolutional layer connected in sequence; Among them, after the body length features output by the horizontal layer attention block and the body width features output by the vertical layer attention block are spliced through the splicing layer, convolution is performed in sequence through the ninth convolution layer and the tenth convolution layer, and the convolution result is output after adjusting the local features through the variable convolution layer.

7. The livestock weight prediction method according to claim 1, characterized in that: The fusion module includes an eleventh convolutional layer, a hole convolutional layer, a batch normalization and ReLU activation function layer, a splicing layer and a twelfth convolutional layer; The body length feature and body width feature are respectively input into the eleventh convolution layer, the void convolution layer, the batch normalization and the ReLU activation function layer, and then spliced through the splicing layer. The spliced features are passed through the twelfth convolution layer to obtain the weight feature.

8. The livestock weight prediction method according to claim 3, characterized in that: Before segmenting a livestock region from a livestock image of the livestock to be weighed using an image segmentation model and converting the livestock region into a convolution feature map using a feature extraction module, the method further includes: Segmenting livestock region samples from livestock image samples using an image segmentation model, and converting the livestock region samples into convolution feature maps using a feature extraction module; Inputting the convolution feature map of the livestock image sample into a body size coupled learning network to obtain body length features and body width features corresponding to the livestock image sample output by the body size coupled learning network; Inputting the body length feature and body width feature corresponding to the livestock image sample into a fusion module in the body size coupled learning network, and obtaining the weight feature corresponding to the livestock image sample output by the fusion module; Passing the body length features, body width features, and weight features corresponding to the livestock image samples through a fully connected layer to predict the body length, body width, and weight corresponding to the livestock image samples; Determining a loss function based on the predicted body length, body width, and weight of the livestock image sample and the actual body length, body width, and weight; The body-scale coupled learning network is trained according to the loss function so that the value of the loss function is minimized.

9. The livestock weight prediction method according to claim 8, characterized in that: The formula of the loss function is: ; Among them, Loss is the loss value, N is the total number of livestock image samples, is the actual weight corresponding to the livestock image sample, is the predicted weight corresponding to the livestock image sample; is the actual body length corresponding to the livestock image sample, is the predicted body length corresponding to the livestock image sample; is the actual body width corresponding to the livestock image sample, is the predicted body width corresponding to the livestock image sample; a, b and c represent the weight factors of weight, body length and body width respectively.

10. A livestock weight prediction system, characterized in that: include: a conversion module for segmenting a livestock region from a livestock image of the livestock to be weighed using an image segmentation model, and converting the livestock region into a convolution feature map using a feature extraction module; an extraction module, configured to input the convolution feature map into a body size coupled learning network to obtain a plurality of body size features of the livestock to be weighed output by the body size coupled learning network; a fusion module, configured to input the plurality of body size features into the fusion module in the body size coupled learning network, and obtain the weight feature of the livestock to be weighed output by the fusion module; The prediction module is used to predict the weight of the livestock to be estimated by using the weight features of the livestock to be estimated through a fully connected layer.

Citation Information

Patent Citations

  • High-precision pig weight estimation method based on deep learning

    CN114926633A

  • Cow weight estimation method and system based on cow back image and height and body length data

    CN118898854A

  • Live pig weight estimation method, device and system, electronic equipment and storage medium

    CN120260076A

  • Object detection method based on attention-enhanced bidirectional feature pyramid network (a-bifpn)

    GB202217717D0

  • Method and apparatus for estimating size and weight of crops and livestocks

    KR102467234B1