Method and system for predicting body weight of livestock

By combining image segmentation and body size coupled learning networks with body length and width features, the problem of low livestock weight prediction accuracy is solved, and efficient and accurate non-contact weight estimation is achieved in a single image, which is suitable for the intelligent management of large-scale farms.

CN120452028BActive Publication Date: 2025-10-10HUAZHONG AGRI UNIV +1
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing technology has low accuracy in predicting livestock weight. Traditional weighing methods are labor-intensive and easily affected by lighting, posture changes and individual differences, making them difficult to carry out efficiently in large-scale farms.

Method used

An image segmentation model is used to segment livestock areas from livestock images, which are converted into convolutional feature maps using a feature extraction module. The body length and width features are combined for prediction through a body size coupled learning network, and weight is predicted using multiple modules and fully connected layers in the body size coupled learning network.

Benefits of technology

It improves the accuracy and robustness of livestock weight prediction without the need for additional input of body length and width information in a single livestock image, and is suitable for non-contact intelligent weight estimation in large-scale farms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120452028B_ABST
    Figure CN120452028B_ABST
Patent Text Reader

Abstract

The present application provides a kind of livestock weight prediction method and system, the method comprises: livestock area is segmented from the livestock image of livestock to be estimated weight using image segmentation model, and the livestock area is converted into convolution feature map using feature extraction module;The convolution feature map is input into body size coupling learning network, and the multiple body size characteristics of the livestock to be estimated weight output by the body size coupling learning network are obtained;The multiple body size characteristics are input into the fusion module in the body size coupling learning network, and the body weight characteristics of the livestock to be estimated weight output by the fusion module are obtained;The body weight characteristics of the livestock to be estimated weight are predicted through fully connected layer to obtain the body weight of the livestock to be estimated weight.The present application uses body size information to guide deep network to obtain more accurate body weight characteristic expression, improves the estimation precision, can be widely applied in large-scale breeding farm, provides efficient solution for intelligent, non-contact livestock management, and has higher practical value and popularization prospect.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

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

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

[0003] Traditional livestock weighing methods mainly rely on manual measurement or electronic scales, which not only have high labor intensity and complex operation, but also are prone to measurement errors due to livestock stress response. In addition, in large-scale farms, frequent weighing will increase the difficulty of livestock management and affect production efficiency. Therefore, developing an efficient and non-contact intelligent weight estimation technology has important practical significance for modern farming.

[0004] In recent years, the rapid development of computer vision and deep learning technology has provided new possibilities for livestock weight estimation. Existing research attempts to estimate weight through image analysis, but relying solely on images is susceptible to lighting, posture changes and individual differences, resulting in decreased estimation accuracy. SUMMARY

[0005] The present application provides a livestock weight prediction method and system to solve the problem of low accuracy in livestock weight prediction in the prior art, and to improve the accuracy of livestock weight prediction.

[0006] The present application provides a livestock weight prediction method, comprising:

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

[0008] inputting the convolution feature map into a body size coupling learning network to obtain multiple body size features of the livestock to be weighed output by the body size coupling learning network;

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

[0010] predicting the body weight of the livestock to be weighed through a fully connected layer using the body weight feature of the livestock to be weighed.

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

[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 convolutional layer, a hole convolutional layer, a batch normalization and ReLU activation function layer, a splicing layer and a twelfth convolutional 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 application also provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the livestock weight prediction method according to any one of the above when executing the program.

[0047] The present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the livestock weight prediction method according to any one of the above.

[0048] The present application also provides a computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the livestock weight prediction method according to any one of the above.

[0049] The livestock weight prediction method and system provided by the present application can overcome the limitations of a single mode and improve the robustness and generalization ability of the model by introducing body size information in the process of modeling livestock weight in a deep network based on the strong correlation between body size data and livestock weight through computer vision and deep learning technology, and can achieve non-contact intelligent livestock weight estimation by using only a single livestock image without additional input of body length and body width information. BRIEF DESCRIPTION OF DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the present application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.

[0051] Figure 1 is a flowchart of the livestock weight prediction method provided by the present application;

[0052] Figure 2 is a model structure diagram of the livestock weight prediction method provided by the present application;

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

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

[0055] Figure 5 is a structure diagram of the livestock weight prediction system provided by the present application;

[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] The body length feature output by the transverse layer state attention block and the body width feature output by the longitudinal layer state attention block are spliced through the splicing layer, then are sequentially convolved through a ninth convolutional layer and a tenth convolutional layer, and then the convolutional results are output after adjusting local features through a variability convolutional layer.

[0095] As shown in the figure, the double fusion cascade block can be composed of a splicing layer, an F3N256, and an F3N64 connected in sequence. First, the two body length feature maps and the two body width feature maps of the same dimension are spliced in the channel dimension, information fusion of the two feature maps is promoted through the F3N256 and the F3N64, and then local features are adjusted through the DCN (variability convolutional network) and output. Figure 3

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

[0097] On the basis of the above-mentioned embodiment, the fusion module in the embodiment includes an eleventh convolutional layer, a dilated convolutional layer, a batch normalization and ReLU activation function layer, a splicing layer, and a twelfth convolutional layer.

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

[0099] As shown in the figure, the fusion module can be composed of two F1N128s, a DC, a splicing layer, and an F1N512 connected in sequence. For example, the obtained body length feature and the body width feature are halved through the F1N128 channel, then local features are extracted using a dilated convolution with a dilated rate of 2 and a size of 3x3, then the batch normalization and the ReLU activation function are used after the convolution, then the features obtained from the two branches are spliced in the channel dimension, then the number of input channels is restored using a 1x1 convolution, and finally the batch normalization and the ReLU are connected again. Figure 4 Among them, F1N128 represents a convolutional layer with a convolution kernel of 1x1 and an output channel of 128; and F1N512 represents a convolutional layer with a convolution kernel of 1x1 and an output channel of 512.

[0100] On the basis of the above-mentioned embodiment, before the image segmentation model is used to segment the livestock area from the livestock image of the livestock to be estimated, and the feature extraction module is used to convert the livestock area into a convolutional feature map, the embodiment further includes:

[0101]

[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 [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] In another aspect, the present application also provides a computer program product comprising a computer program, which can be stored on a non-transitory computer readable storage medium, and the computer program can be executed by a processor to enable a computer to perform the livestock weight prediction method provided by the above-mentioned methods, which comprises: segmenting a livestock area from a livestock image of a livestock to be weighed by using an image segmentation model, and converting the livestock area into a convolution feature map by using a feature extraction module; inputting the convolution feature map into a body size coupling learning network to obtain a plurality of body size features of the livestock to be weighed output by the body size coupling learning network; inputting the plurality of body size features into a fusion module in the body size coupling learning network to obtain a body weight feature of the livestock to be weighed output by the fusion module; and predicting the body weight of the livestock to be weighed by a fully connected layer through the body weight feature of the livestock to be weighed.

[0124] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having a computer program stored thereon, which can be executed by a processor to implement the livestock weight prediction method provided by the above-mentioned methods, which comprises: segmenting a livestock area from a livestock image of a livestock to be weighed by using an image segmentation model, and converting the livestock area into a convolution feature map by using a feature extraction module; inputting the convolution feature map into a body size coupling learning network to obtain a plurality of body size features of the livestock to be weighed output by the body size coupling learning network; inputting the plurality of body size features into a fusion module in the body size coupling learning network to obtain a body weight feature of the livestock to be weighed output by the fusion module; and predicting the body weight of the livestock to be weighed by a fully connected layer through the body weight feature of the livestock to be weighed.

[0125] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., they can be located in one place, or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment scheme according to actual needs. Those skilled in the art can understand and implement it without creative labor.

[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; Predicting the weight of the livestock to be estimated by using the weight features of the livestock to be estimated through a fully connected layer; 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-size coupling submodule. The features output by the convolution block in each body-size coupling submodule are split into two sub-feature maps according to the channel dimension. The sub-feature maps are input into the horizontal layer state attention block and the vertical layer state attention block in each body-size coupling submodule one by one, and the corresponding body length features and body width features are output respectively. 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.

2. The livestock weight prediction method according to claim 1, wherein: The livestock image is a top view of the livestock to be weighed, and the livestock region is a back region of the livestock to be weighed.

3. The livestock weight prediction method according to claim 1, wherein: 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.

4. The livestock weight prediction method according to claim 1, wherein: 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 width feature map of the intermediate 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.

5. The livestock weight prediction method according to claim 1, 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.

6. 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.

7. The livestock weight prediction method according to claim 1, 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.

8. The livestock weight prediction method according to claim 7, 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.

9. 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; A prediction module, 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; 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-size coupling submodule. The features output by the convolution block in each body-size coupling submodule are split into two sub-feature maps according to the channel dimension. The sub-feature maps are input into the horizontal layer state attention block and the vertical layer state attention block in each body-size coupling submodule one by one, and the corresponding body length features and body width features are output respectively. 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.

Citation Information

Patent Citations

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

    CN114926633A