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

By identifying and segmenting pig RGB images, and extracting feature data for weight estimation, the problem of large calculation volume and high complexity of traditional methods is solved, and efficient and accurate contactless pig weight estimation is achieved, which is suitable for intelligent breeding management.

CN120260076APending Publication Date: 2025-07-04BEIJING RES CENT FOR INFORMATION TECH & AGRI
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510289650.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The traditional pig weight estimation method has a large calculation volume and high calculation complexity, resulting in low efficiency.

Method used

Using a method based on RGB image recognition and target segmentation, the target mask image of the pig is obtained through image processing, and the volume scale data such as the relative projection area, contour circumference, body length, body width and eccentricity of the pig are extracted, and the regression model is used to estimate the pig body weight.

Benefits of technology

It improves the accuracy and efficiency of pig weight estimation, reduces the calculation volume and complexity, realizes contactless estimation, reduces labor costs, and is suitable for large-scale breeding management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120260076A_ABST
    Figure CN120260076A_ABST
Patent Text Reader

Abstract

The invention provides a live pig weight estimation method, device and system, electronic equipment and a storage medium, and the method comprises the steps: carrying out the image recognition and target segmentation of an RGB image of a target live pig, and obtaining an original mask image of the target live pig; performing image processing on the original mask image of the target live pig to obtain a target mask image of the target live pig; based on the target mask image of the target live pig, obtaining body size data of the target dimension of the target live pig; and inputting the body size data of the target live pig into a live pig weight estimation model to obtain a weight estimation value of the target live pig output by the live pig weight estimation model. According to the live pig weight estimation method, device and system, the electronic equipment and the storage medium provided by the invention, the calculation amount and calculation complexity of live pig weight estimation can be reduced while the accuracy of live pig weight estimation can be improved, the efficiency of live pig weight estimation can be remarkably improved, non-contact live pig weight estimation can be realized, and the user experience is improved. And efficient and reliable technical support is provided for intelligent breeding management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart agricultural technology, and in particular to a method, device, system, electronic device and storage medium for estimating the weight of a pig. Background Art

[0002] The weight of pigs is one of the important indicators for monitoring pig growth during pig breeding. The weight of pigs can directly reflect the health status and development progress of pigs. Quickly and accurately estimating the weight of pigs can help producers promptly identify pigs with abnormal growth or growth that deviates from the expected target, thereby reducing management labor costs and feed costs by adjusting feeding strategies.

[0003] Traditional pig weight estimation methods in related technologies can use computer vision technology, machine learning technology or three-dimensional sensor technology to estimate the weight of pigs.

[0004] However, the traditional pig weight estimation method in the related art has a large amount of calculation and high computational complexity when estimating pig weight, resulting in a technical defect of low efficiency of pig weight estimation. Therefore, how to reduce the amount of calculation and computational complexity of pig weight estimation, thereby improving the efficiency of pig weight estimation, is a technical problem to be solved in this field. Summary of the invention

[0005] The present invention provides a method, device, system, electronic device and storage medium for estimating pig weight, which are used to solve the defects of traditional pig weight estimation methods in the prior art, such as large amount of calculation and high calculation complexity when estimating pig weight, resulting in low efficiency of pig weight estimation, and reduce the amount of calculation and calculation complexity of pig weight estimation, thereby improving the efficiency of pig weight estimation.

[0006] The invention provides a method for estimating the weight of a live pig, comprising the following steps.

[0007] Performing image recognition and target segmentation on the RGB image of the target pig to obtain an original mask image of the target pig, wherein the RGB of the target pig is collected by an image sensor located above the target pig, with a shooting direction perpendicular to the ground where the target pig is located and downward and a distance from the ground where the target pig is located being a preset value, and the original mask image of the target pig includes a mask of the target pig; Performing image processing on the original mask image of the target pig to obtain a target mask image of the target pig; Based on the target mask image of the target pig, obtaining body size data of the target dimension of the target pig; Input the body measurement data of the target live pig into the live pig weight estimation model to obtain the weight estimation value of the target live pig output by the live pig weight estimation model. The live pig weight estimation model is constructed based on a regression model and obtained after training based on the body measurement data of the target dimension of the sample live pig and the actual weight value of the sample live pig.

[0008] According to a live pig weight estimation method provided by the present invention, the image processing of the original mask image of the target live pig to obtain the target mask image of the target live pig includes: Remove the masks of the target parts of the target live pig in the original mask image of the target live pig to obtain the target mask image of the target live pig. The target parts include ears, tail and legs.

[0009] According to a live pig weight estimation method provided by the present invention, the target dimension includes: relative projected area of the back, contour perimeter, body length, body width and eccentricity.

[0010] According to a live pig weight estimation method provided by the present invention, the obtaining of the body measurement data of the target dimension of the target live pig based on the target mask image of the target live pig includes: Generate the minimum circumscribed rectangle of the mask of the target live pig in the target mask image of the target live pig; Obtain the length of the short side of the minimum circumscribed rectangle as the body width of the target live pig, and obtain the length of the long side of the minimum circumscribed rectangle as the body length of the target live pig.

[0011] According to a live pig weight estimation method provided by the present invention, the obtaining of the body measurement data of the target dimension of the target live pig based on the target mask image of the target live pig includes: Obtain the contour of the target live pig in the target mask image of the target live pig; Based on the contour of the target live pig, use the least squares method to fit an ellipse for describing the contour of the target live pig; Calculate the square difference of the ratio of the major axis to the minor axis of the ellipse as the eccentricity of the target live pig.

[0012] According to a live pig weight estimation method provided by the present invention, the regression model is a backpropagation neural network.

[0013] The present invention also provides a live pig weight estimation device, including the following modules: An image segmentation module for performing image recognition and target segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig. The RGB of the target live pig is collected by an image sensor located above the target live pig, with the shooting direction perpendicular to the ground where the target live pig is located and the distance from the ground where the target live pig is located being a preset value. The original mask image of the target live pig includes the mask of the target live pig; An image processing module for performing image processing on the original mask image of the target live pig to obtain the target mask image of the target live pig; A data extraction module for obtaining the body size data of the target dimension of the target live pig based on the target mask image of the target live pig; A weight estimation module for inputting the body size data of the target live pig into a live pig weight estimation model to obtain the weight estimation value of the target live pig output by the live pig weight estimation model. The live pig weight estimation model is constructed based on a regression model and obtained after being trained based on the body size data of the target dimension of the sample live pig and the actual weight value of the sample live pig.

[0014] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the live pig weight estimation method as described in any one of the above is implemented.

[0015] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the live pig weight estimation method as described in any one of the above is implemented.

[0016] The present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, the live pig weight estimation method as described in any one of the above is implemented.

[0017] The live pig weight estimation method, device, system, electronic device and storage medium provided by the present invention, after performing image recognition and target segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig, removes the mask of the target part of the target live pig in the original mask image of the target live pig to obtain the target mask image of the target live pig. Based on the target mask image of the target live pig, the body measurement data of the target dimension of the target live pig is obtained. Furthermore, the body measurement data of the target live pig is input into the live pig weight estimation model, and the weight estimation value of the target live pig output by the live pig weight estimation model is obtained, which can improve the accuracy of live pig weight estimation while reducing the calculation amount and calculation complexity of live pig weight estimation, can significantly improve the efficiency of live pig weight estimation, can realize non-contact live pig weight estimation, avoid stress response of live pigs, reduce the input of labor costs, is applicable to large-scale breeding scenarios, and provides efficient and reliable technical support for intelligent breeding management. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0019] Figure 1 It is a schematic flowchart of the live pig weight estimation method provided by the present invention.

[0020] Figure 2 It is a schematic flowchart of performing image recognition and target segmentation on the RGB image of the target live pig in the live pig weight estimation method provided by the present invention.

[0021] Figure 3 It is a comparison diagram of the original mask image and the target mask image of the target live pig in the live pig weight estimation method provided by the present invention.

[0022] Figure 4 It is a dimension schematic diagram of the body measurement data measured manually in the live pig weight estimation method provided by the present invention.

[0023] Figure 5 It is a schematic diagram of data division in five-fold cross-validation.

[0024] Figure 6 It is a schematic structural diagram of the live pig weight estimation device provided by the present invention.

[0025] Figure 7 It is a schematic structural diagram of the electronic device provided by the present invention.

[0026] Figure 8It is one of the schematic structural diagrams of the image acquisition device in the live pig weight estimation system provided by the present invention.

[0027] Figure 9 It is the second of the schematic structural diagrams of the image acquisition device in the live pig weight estimation system provided by the present invention. Detailed implementation manners

[0028] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without making creative efforts shall fall within the protection scope of the present invention.

[0029] In the description of the invention, it should be noted that unless otherwise clearly defined and limited, the terms "installed", "connected" and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.

[0030] In the description of this application, the terms "first", "second", etc. are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of this application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are usually of the same type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, in the description of this application, " / and / " means at least one of the connected objects, and the character " / " generally means that the associated objects before and after are in an "or" relationship.

[0031] It should be noted that the live pig breeding and pork industry are important components of the global food supply chain and have a profound impact on the economy, society and environment. Live pig weight measurement is crucial in live pig breeding management. It can not only reflect the growth situation, help optimize feeding strategies, but also be closely related to feeding costs and feed conversion rates, helping to reduce costs. The weight data of live pigs can be used to support a scientific slaughter plan to ensure the best market weight, thereby maximizing economic benefits. In addition, live pig weight measurement helps to detect potential disease hazards of live pigs in a timely manner and take effective prevention and control measures. The application of an intelligent live pig weight measurement system can enable live pig farms to record the weight data of live pigs in real time, improving the accuracy of decision-making and breeding efficiency.

[0032] Traditional methods of monitoring pig weight usually use mechanical floor scales or weighing cages to obtain the pig's weight. This direct contact method can easily induce stress responses in pigs. The main types of stress in pigs include group stress, behavioral stress and physiological stress. These stresses not only affect the accuracy of pig weight measurement, but may also damage pig health, pig production performance and economic benefits.

[0033] With the development of computer vision technology, image-based contactless pig weight estimation has attracted great attention in the agricultural field. Computer vision technology can be used in related technologies to achieve automatic contactless estimation of pig weight, which not only reduces manual intervention in pig weight estimation, avoids stress reactions in pigs, but also reduces the investment in labor costs.

[0034] However, the traditional pig weight estimation method based on computer vision technology and machine learning technology in the related art has a large number of parameters and a large computational complexity when estimating the weight of pigs, resulting in a large amount of calculation when estimating the weight of pigs based on the above traditional pig weight estimation method, and the efficiency of pig weight estimation is not high. Therefore, how to reduce the amount of calculation and computational complexity of pig weight estimation, thereby improving the efficiency of pig weight estimation, is a technical problem that needs to be solved in this field.

[0035] In this regard, the present invention provides a method for estimating the weight of live pigs. The method for estimating the weight of live pigs provided by the present invention predicts the weight of live pigs by using the features (back relative projection area, circumference, body length, body width, eccentricity, etc.) extracted from the mask image after the RGB image of the live pig is segmented. Compared with the prior art, the method for estimating the weight of live pigs provided by the present invention can improve the weight estimation accuracy while avoiding the limitations caused by high computing resources in the deep learning method, and finds a better machine learning model suitable for estimating the weight of live pigs in a free state.

[0036] Combine the following Figures 1 - 5 The present invention describes a method for estimating pig weight.

[0037] Figure 1 : is a flow chart of the pig weight estimation method provided by the present invention, such as Figure 1 As shown, the method includes the following: Step 101, performing image recognition and target segmentation on the RGB image of the target pig to obtain an original mask image of the target pig, the RGB of the target pig is collected by using an image sensor located above the target pig, with a shooting direction perpendicular to the surface where the target pig is located and downward and a distance from the surface where the target pig is located being a preset value, and the original mask image of the target pig includes a mask of the target pig.

[0038] It should be noted that the execution subject of the embodiments of the present invention is a live pig weight estimation device. The above-mentioned live pig weight estimation device can be configured in electronic devices such as computers or servers.

[0039] Specifically, the target live pig is the estimation object of the live pig weight estimation method provided by the present invention. Based on the live pig weight estimation method provided by the present invention, the weight of the target live pig can be estimated to obtain the weight estimation value of the target live pig.

[0040] It should be noted that the target live pig in the embodiments of the present invention can be determined based on actual needs. For example, in the embodiments of the present invention, each live pig in the pigsty can be sequentially determined as the target live pig; or, in the embodiments of the present invention, any live pig in the pigsty can also be determined as the target live pig according to actual needs.

[0041] In the embodiments of the present invention, an image sensor located above the target live pig, with the shooting direction perpendicular to the ground where the target live pig is located and the distance from the ground where the target live pig is located being a preset value, can be used to collect the RGB image of the target live pig.

[0042] It should be noted that the preset value in the embodiments of the present invention can be determined according to prior knowledge and / or actual situations. The specific value of the preset value in the embodiments of the present invention is not limited.

[0043] It can be understood that since the above-mentioned image sensor is located above the target live pig and the shooting direction is perpendicular to the ground where the target live pig is located, the RGB image of the target live pig includes an image of the back of the target live pig.

[0044] In the embodiments of the present invention, based on the deep learning method, image recognition and target segmentation can be performed on the RGB image of the target live pig to obtain the original mask image of the target live pig including the mask of the target live pig.

[0045] Optionally, in the embodiments of the present invention, a pre-trained SAM2 (Segment Anything Model 2) segmentation model can be used to perform image recognition and target segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig including the mask of the target live pig.

[0046] Figure 2 is a schematic flowchart of image recognition and target segmentation of the RGB image of the target live pig in the live pig weight estimation method provided by the present invention. As Figure 2 shown, in order to achieve the accurate segmentation of the target live pig from the RGB image, in the embodiments of the present invention, the EISeg tool can be used to annotate the sample live pig in the RGB image of the sample live pig to obtain the image of the annotated sample live pig.

[0047] Among them, the SAM2 segmentation model is a model for comprehensive object segmentation in images and videos. The SAM2 segmentation model adopts a unified and promptable model architecture, supports real-time processing and zero-shot learning, and performs excellently in image segmentation tasks in complex environments, and can effectively handle object segmentation under various postures and backgrounds.

[0048] After obtaining the images of the labeled sample live pigs, the pre-trained SM2 segmentation model can be adjusted based on the above-mentioned images of the labeled sample live pigs to obtain the adjusted live pig segmentation model SAM2-Pig, so as to make full use of the general features learned in the large-scale dataset.

[0049] Before the RGB image of the target live pig is input into the above-mentioned live pig segmentation model SAM2-Pig, data normalization processing is performed on the RGB image of the target live pig to ensure the consistency of the image and the stability of the model input.

[0050] After the RGB image of the target live pig after data normalization processing is input into the above-mentioned live pig segmentation model SAM2-Pig, the above-mentioned live pig segmentation model SAM2-Pig can accurately identify and segment the pig area from the RGB image of the target live pig after the above-mentioned data normalization processing in a short time. Especially in the case of complex backgrounds or large changes in the postures of pigs, a high segmentation accuracy can still be maintained. Furthermore, the original mask image of the target live pig including the mask of the target live pig output by the above-mentioned live pig segmentation model SAM2-Pig can be obtained.

[0051] It should be noted that in the original mask image of the target live pig, the pixel values of the pixel points in the area where the target live pig is located are 255, forming the mask of the target live pig. The pixel values of the pixel points in the area other than the area where the mask of the target live pig is located in the original mask image of the target live pig are 0.

[0052] Step 102: Perform image processing on the original mask image of the target live pig to obtain the target mask image of the target live pig.

[0053] Specifically, in order to further improve the accuracy of target live pig weight estimation, after obtaining the original mask image of the target live pig, image processing can be further performed on the original mask image of the target live pig to remove the parts of the mask of the target live pig that are not related to weight estimation, and obtain the target mask image of the target live pig.

[0054] As an optional embodiment, performing image processing on the original mask image of the target live pig to obtain the target mask image of the target live pig includes: removing the masks of the target parts of the target live pig from the original mask image of the target live pig to obtain the target mask image of the target live pig, and the target parts include ears, tails and legs.

[0055] It should be noted that since the ears, tails, and legs of live pigs occupy a relatively large area in the images of live pigs, but the above-mentioned parts of live pigs have no direct correlation with the weight of live pigs, when estimating the weight of live pigs, the above-mentioned parts of live pigs are not the objects that need to be concerned about, and will also affect the accuracy of the body size data of live pigs obtained, and interfere with the estimation of live pig weight.

[0056] Therefore, in the embodiments of the present invention, the ears, tails, and legs are determined as the target parts. After obtaining the original mask image of the target live pig, the method of continuous morphological opening operation based on the adaptive kernel size can be used to modify the pixel values of the pixel points in the area where the target parts of the target live pig are located in the original mask image of the target live pig to 0, so as to remove the mask of the target parts of the target live pig in the original mask image of the target live pig, and determine the original mask image of the target live pig after removing the mask of the target parts of the target live pig as the target mask image of the target live pig.

[0057] Figure 3 It is a comparison diagram of the original mask image and the target mask image of the target live pig in the live pig weight estimation method provided by the present invention. The comparison between the original mask image and the target mask image of the target live pig is as Figure 3 shown.

[0058] Step 103: Based on the target mask image of the target live pig, obtain the body size data of the target dimension of the target live pig.

[0059] Specifically, after obtaining the target mask image of the target live pig, the body size data of the target dimension of the target live pig can be obtained through numerical calculation, mathematical statistics, deep learning, or other means.

[0060] It should be noted that the target dimension in the embodiments of the present invention can be determined based on prior knowledge and / or actual situations. The target dimension in the embodiments of the present invention is not specifically limited.

[0061] As an optional embodiment, the target dimension includes: relative projection area of the back, contour perimeter, body length, body width, and eccentricity.

[0062] It should be noted that the target dimension in the embodiments of the present invention is determined after performing multiple regression model analysis and correlation analysis on the body size data of the sample live pigs measured manually and the actual weight values of the sample live pigs. The dimensions of the body size data measured manually include body length, shoulder width, shoulder height, chest circumference, abdominal circumference, hip circumference, and metacarpal circumference.

[0063] Figure 4 It is a schematic diagram of the dimensions of the body size data measured manually in the live pig weight estimation method provided by the present invention. As Figure 4As shown in the figure, the body length measured manually refers to the straight-line distance from the front end of the head (usually the position between the two ears) to the root of the tail; the shoulder width measured manually refers to the horizontal distance between the widest points on both sides of the shoulders in the standing state; the shoulder height measured manually refers to the vertical distance from the ground to the shoulders of the live pig; the chest circumference measured manually refers to the circumference of the widest part of the pig's chest, usually measured at the sternum behind the front limbs; the abdominal circumference measured manually refers to the circumference of the widest part of the live pig's abdomen; the hip circumference measured manually refers to the distance from the front edge of the left knee joint, passing through the anus, and around to the front edge of the right knee joint; the circumference of the metacarpal bone measured manually refers to the measurement at the thinnest part of the front limb tube bone of the live pig, and the circumference data is recorded by going around the tube bone once.

[0064] Based on the target mask image of the target live pig, obtain the body measurement data of the target dimension of the target live pig, including: generating the minimum circumscribed rectangle of the mask of the target live pig in the target mask image of the target live pig.

[0065] Obtain the length of the short side of the minimum circumscribed rectangle as the body width of the target live pig, and obtain the length of the long side of the minimum circumscribed rectangle as the body length of the target live pig.

[0066] Specifically, as Figure 3 shown, after obtaining the target mask image of the target live pig, the minimum circumscribed matrix of the mask of the target live pig can be generated in the target mask image of the target live pig based on the cv2.minAreaRect(contours) function. Furthermore, the length of the short side of the above minimum circumscribed matrix can be determined as the body width of the target live pig, and the length of the long side of the above minimum circumscribed matrix can be determined as the body length of the target live pig. The specific formula is expressed as follows: Among them, the cv2.minAreaRect(contours) function is a function in the OpenCV library used to calculate the minimum area circumscribed rectangle of a given contour. represents the body length of the target live pig; represents the body width of the target live pig; represents the four corner coordinates of the minimum circumscribed matrix of the mask of the target live pig; and represents the long side of the minimum circumscribed matrix of the mask of the target live pig; and represents the short side of the minimum circumscribed matrix of the mask of the target live pig.

[0067] As an optional embodiment, based on the target mask image of the target live pig, obtain the body measurement data of the target dimension of the target live pig, including: obtaining the contour of the target live pig in the target mask image of the target live pig.

[0068] Based on the contour of the target live pig, the least squares method is used to fit an ellipse for describing the contour of the target live pig.

[0069] Calculate the square difference of the ratio of the major axis to the minor axis of the ellipse as the eccentricity of the target live pig.

[0070] Specifically, the eccentricity of the target live pig can be expressed by the following formula: where, represents the eccentricity of the target live pig; represents the major axis of the ellipse for describing the contour of the target live pig; represents the minor axis of the ellipse for describing the contour of the target live pig. The ellipse for describing the contour of the target live pig is as Figure 3 shown.

[0071] It should be noted that in the embodiments of the present invention, the ratio of the area of the region where the mask of the target live pig is located in the target mask image of the target live pig to the area of the target mask image of the target live pig can be obtained as the relative projection area of the back of the target live pig. The specific formula is as follows: where, represents the relative projection area of the back of the target live pig; represents the number of pixel points with a pixel value of 255 (pixel points within the region where the mask of the target live pig is located) in the target mask image of the target live pig; represents the number of all pixel points in the target mask image of the target live pig.

[0072] It should be noted that in the embodiments of the present invention, the contour length of the mask of the target live pig in the target mask image of the target live pig, that is, the total number of pixels on the contour of the mask of the target live pig, can be obtained as the contour perimeter of the target live pig. The specific formula is as follows: where, represents the contour perimeter of the target live pig; represents obtained through cv 2 .arclength the contour of the mask of the target live pig in the target mask image of the target live pig; represents that the mask of the target live pig in the target mask image of the target live pig is closed. cv 2 .arclength represents a function in the OpenCV library for calculating the arc length of a curve in a two-dimensional plane.

[0073] Step 104: input the body size data of the target pig into the pig weight estimation model to obtain the target pig weight estimation value output by the pig weight estimation model. The pig weight estimation model is constructed based on a regression model and is obtained after training based on the body size data of the target dimension of the sample pigs and the actual weight value of the sample pigs.

[0074] It should be noted that the specific steps for obtaining the body size data of the target dimension of the sample pigs and the actual weight value of the sample pigs in the embodiment of the present invention are as follows: first, the sample pigs are driven out of the group pen, and the sample pigs are guided into the cage scale to measure and record the actual weight value, and then the body size data of the sample pigs are collected and recorded using a tape measure. Then, the sample pigs are driven into the empty pen, and the RGB image of the sample pigs is collected using an image sensor located above the sample pigs, with the shooting direction perpendicular to the surface where the sample pigs are located downward and the distance from the surface where the target pigs are located being a preset value. After the RGB image of each sample pig is collected, the sample pigs are driven back to the group pen.

[0075] It should be noted that when collecting RGB images of sample live pigs, the image sensor can follow the sample live pigs moving slowly above the group pen containing multiple sample live pigs and collect images while moving. During the image collection process, the sample live pigs can move freely.

[0076] Optionally, the image sensor can be an Orbbec Femto Bolt camera, which operates in WFOV2X2BINNED mode, which effectively improves the signal strength of the camera, improves the imaging quality under low light conditions, and reduces image noise. The camera has a wide field of view of 120°×120° and can effectively measure between 0.25 meters and 2.88 meters. The camera can capture images at a speed of 30 frames per second, and the resolution of the camera is set to 1920×1080 pixels.

[0077] After the RGB images of the sample pigs are collected, the RGB images of the sample pigs may include various forms of the sample pigs, such as lying down, sitting down, and standing. In the above RGB images, there may also be situations where the body elements of the sample pigs are missing, the images are too bright or too dark, etc., and the RGB images of the sample pigs need to be cleaned to remove the RGB images of the sample pigs in the lying down and sitting states, and to remove the RGB images of the sample pigs with missing body elements and too bright or too dark images.

[0078] It can be understood that after data cleaning is completed, the remaining RGB images are of sample live pigs in a standing state, with complete body elements and suitable lighting. The RGB images of the above sample live pigs meet the training requirements of the subsequent live pig weight estimation model and provide a high-quality data basis for the construction of the training sample dataset. Since no artificial intervention was made on the behavior of the sample live pigs during the acquisition of the above RGB images of the sample live pigs, the forms of the sample live pigs in the above RGB images of the sample live pigs are rich. Also, due to the relatively large collection pen, it is closer to the daily living environment of the sample live pigs, and the sample live pigs can freely eat, drink, and carry out other activities. Therefore, the above RGB images of the sample live pigs can truly reflect the natural forms and behaviors of the sample live pigs and conform to the daily living habits of the sample live pigs.

[0079] After obtaining the RGB images of the sample live pigs, the corresponding relationship between the RGB images of the sample live pigs and the actual weight values can be further determined.

[0080] It should be noted that after obtaining the RGB images of the sample live pigs, the body measurement data of the target dimension of the sample live pigs can be obtained based on the RGB images of the sample live pigs. In the embodiments of the present invention, the method for obtaining the body measurement data of the target dimension of the sample live pigs based on the RGB images of the sample live pigs is the same as the method for obtaining the body measurement data of the target dimension of the target live pigs based on the RGB images of the target live pigs.

[0081] Specifically, by using the pre-trained SAM2 segmentation model to perform image recognition and target segmentation on the RGB images of the sample live pigs, the original mask image of the sample live pigs including the mask of the sample live pigs can be obtained. The pre-trained SAM2 segmentation model has good adaptability and stability in different scenarios and pig postures. The original mask image of the sample live pigs provides accurate image data for the training of the subsequent live pig weight estimation model and ensures the reliability of the analysis. Generally speaking, the SAM2 segmentation model can still effectively complete the segmentation task of the sample pigs on a small dataset and provide high-quality input data for the subsequent weight estimation, verifying its feasibility and effectiveness in practical applications.

[0082] After removing the mask of the target part of the sample live pigs from the original mask image of the sample live pigs, the target mask image of the sample live pigs is obtained. Based on the target mask image of the sample live pigs, the body measurement data of the target dimension of the sample live pigs can be obtained. Table 1 is the body measurement data table of the target dimension of the sample live pigs.

[0083] Table 1 Body measurement data table of the target dimension of the sample live pigs

[0084] After obtaining the body measurement data of the target dimension of the sample live pigs, the body measurement data of the target dimension of the sample live pigs can be normalized, and the body measurement data of the target dimension of the sample live pigs is scaled to a specific range, usually [0, 1], which can eliminate the influence of the inconsistent dimension between different features on the model training.

[0085] Among them, represents the normalized data; represents the input data; represents the average value; represents the standard deviation.

[0086] After obtaining the body measurement data of the target dimension of the sample live pigs, the corresponding relationship between the body measurement data of the target dimension of the sample live pigs and the actual weight value can be determined. Furthermore, the body measurement data of the target dimension of the sample live pigs can be used as the training sample, and the actual weight value of the above sample live pigs can be used as the sample label to train the initial model to obtain a trained live pig weight estimation model.

[0087] It should be noted that the initial model in the embodiments of the present invention can be constructed based on a regression model. The above regression models include ordinary least squares (OLS), support vector regression (SVR), backpropagation neural network (BPNN, including trainbr, trainlm, trainscg, and traincgb), adaptive boosting algorithm (Adaptive Boosting, AdaBoost), CatBoost, extreme gradient boosting algorithm (eXtreme Gradient Boosting, XGBoost), and random forest (Random Forest, RF).

[0088] Ordinary least squares (OLS) is a classic linear regression method, which aims to fit the data by minimizing the sum of squared errors. It is suitable for scenarios with strong linear relationships and has good interpretability.

[0089] Support vector regression (SVR) performs regression through the support vector machine algorithm. It can effectively handle non-linear relationships and use the kernel trick to find the optimal regression hyperplane in the high-dimensional space, thereby enhancing the robustness of the model.

[0090] The Backpropagation Neural Network (BPNN) is a multi-layer feedforward neural network that uses the backpropagation algorithm to update the network weights and can handle complex non-linear data. In BPNN, trainlm (Levenberg-Marquardt algorithm) and trainbr (Bayesian regularization) are two commonly used optimization variants that can accelerate convergence and prevent overfitting. In addition, the trainscg (Scaled Conjugate Gradient) optimization algorithm is used for training large-scale datasets, which can provide a more stable training process through the extended conjugate gradient method and effectively avoid the convergence problems in the traditional gradient descent method. On the other hand, traincgb (Conjugate Gradient with Box Constraints) is another variant of the conjugate gradient method, which is suitable for optimization problems with constraints and can perform efficient optimization under specific constraints of model parameters, and is suitable for training scenarios that require imposing constraints

[28] . AdaBoost is an ensemble learning method that repeatedly trains multiple weak regressors, and in each round of iteration, it increases the weights of the previous-round model on misclassified samples, thus effectively improving the accuracy of the model.

[0091] CatBoost is based on gradient boosting trees and has strong categorical feature processing capabilities. It improves the performance of the model by optimizing the loss function and feature ranking.

[0092] The Extreme Gradient Boosting algorithm (XGBoost) improves the traditional gradient boosting tree by introducing regularization terms and second-order Taylor expansions, significantly improving the fitting accuracy and computational efficiency, and has strong generalization ability.

[0093] Random Forest (RF) improves the prediction performance by integrating multiple decision trees and combining a voting mechanism, effectively reducing the bias and variance of a single decision tree, and enhancing the robustness and stability of the model.

[0094] Model training can be carried out in the Python 3.12.3 and PyTorch 2.5.1 environments, and the system used supports NVIDIA GPUs. The specific configuration is NVIDIA driver version 475.14 and CUDA version 11.4.

[0095] Under the above circumstances, in the embodiments of the present invention, regression models such as ordinary least squares (OLS), support vector regression (SVR), AdaBoost, CatBoost, XGBoost, and random forest (RF) are respectively determined as the initial models. On the MATLAB platform, BPNN (including trainbr, trainlm, trainscg, traincgb) is determined as the initial model, and model training and model verification are respectively carried out. By comparing the performance of different regression models on different training sets, the effectiveness and robustness of the live pig weight estimation model constructed based on different regression models in practical applications can be evaluated. Furthermore, the live pig weight estimation method provided by the present invention can select the most suitable regression algorithm for weight estimation and maximize the prediction performance of the model under different types of data and task scenarios.

[0096] As an optional embodiment, the regression model is a backpropagation neural network.

[0097] Figure 5 It is a schematic diagram of data division in five-fold cross-validation. It should be noted that, as Figure 5 shown, in the embodiments of the present invention, the 5-fold K-fold cross-validation method is adopted to evaluate the performance of the trained live pig weight estimation model, in which the training set and the test set are divided at a ratio of 4:1. To ensure that the weight distribution of the training set and the test set is representative, the weight of all sample live pigs and the body size data of the target dimension are sorted in ascending order of weight. The purpose of doing this is to ensure that the weight in each fold of the dataset shows a uniform increasing trend, so that each fold can cover pigs of different weight segments and ensure that the model can effectively predict data in various weight ranges.

[0098] In the embodiments of the present invention, the coefficient of determination (R²), mean absolute error (MAE), mean square error (MSE), and root mean square error (RMSE) can be used as indicators to evaluate the live pig weight evaluation model trained based on different regression models.

[0099] Among them, represents the number of samples; represents the actual value, represents the predicted value, represents the average of the actual values.

[0100] In order to find the most suitable BPNN configuration, in the embodiments of the present invention, parameters such as the network structure, training algorithm, and the number of neurons in the hidden layer are deeply adjusted. The embodiments of the present invention adopt a variety of hidden layer configurations, including combinations of single hidden layers and double hidden layers. Specifically, in the embodiments of the present invention, single hidden layer configurations such as

[10] ,

[20] ,

[50] , etc. are tried, as well as double hidden layer configurations such as [10,10], [20, 10], [50,30], [100,50], etc. The embodiments of the present invention find that smaller single-layer networks (such as

[10] ,

[20] ) are suitable for faster training and less computational effort, while double-layer networks (such as [20, 10], [50, 30]) perform more excellently in improving accuracy and generalization ability. Finally, by combining optimization algorithms (trainbr, trainlm, trainscg, traincgb) and adjusting hyperparameters such as the learning rate and the number of training epochs, the optimal configuration in the BPNN network model is found. Table 2 is a performance comparison table of the live pig weight estimation models trained based on different regression models and different configurations of the BPNN network.

[0101] Table 2 Performance Comparison Table of Live Pig Weight Estimation Models Trained Based on Different Configurations of the BPNN Network

[0102] As can be seen from Table 2, the live pig weight estimation model trained based on the Trainlm[20,10] configuration of the BPNN network performs the best, with the lowest MSE, RMSE, and MAE, and the highest R², indicating that its prediction accuracy and fitting effect on the sample data set are the most excellent. Secondly, the live pig weight estimation models trained based on CatBoost and XGBoost perform well, especially in terms of R² and error metrics, and have strong prediction capabilities. The live pig weight estimation model trained based on OLS also performs relatively stably, is suitable for situations with a strong linear relationship, and has good interpretability. The live pig weight estimation models trained based on AdaBoost and SVR are relatively weak, with large errors, probably because they fail to fully capture the non-linear characteristics of the data.

[0103] In an embodiment of the present invention, after performing image recognition and target segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig, the mask of the target part of the target live pig in the original mask image of the target live pig is removed to obtain the target mask image of the target live pig. Based on the target mask image of the target live pig, the body size data of the target dimension of the target live pig is obtained. Furthermore, the body size data of the target live pig is input into the live pig weight estimation model, and the weight estimation value of the target live pig output by the live pig weight estimation model is obtained. It can improve the accuracy of live pig weight estimation while reducing the calculation amount and calculation complexity of live pig weight estimation, significantly improve the efficiency of live pig weight estimation, realize non-contact live pig weight estimation, avoid stress reactions of live pigs, reduce the input of labor costs, be applicable to large-scale breeding scenarios, and provide efficient and reliable technical support for intelligent breeding management.

[0104] Figure 6 It is a schematic structural diagram of the live pig weight estimation device provided by the present invention. The following combines Figure 6 to describe the live pig weight estimation device provided by the present invention. The live pig weight estimation device described below can be mutually corresponding and referred to the live pig weight estimation method provided by the present invention described above. As Figure 6 shown, the device includes: an image segmentation module 601, an image processing module 602, a data extraction module 603, and a weight estimation module 604.

[0105] The image segmentation module 601 is configured to perform image recognition and target segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig. The RGB of the target live pig is collected by an image sensor located above the target live pig, with the shooting direction perpendicular to the ground where the target live pig is located and the distance from the ground where the target live pig is located being a preset value. The original mask image of the target live pig includes the mask of the target live pig; The image processing module 602 is configured to perform image processing on the original mask image of the target live pig to obtain the target mask image of the target live pig; The data extraction module 603 is configured to obtain the body size data of the target dimension of the target live pig based on the target mask image of the target live pig; The weight estimation module 604 is configured to input the body size data of the target live pig into the live pig weight estimation model to obtain the weight estimation value of the target live pig output by the live pig weight estimation model. The live pig weight estimation model is constructed based on a regression model and obtained after training based on the body size data of the target dimension of the sample live pig and the actual weight value of the sample live pig.

[0106] Specifically, the image segmentation module 601, the image processing module 602, the data extraction module 603, and the weight estimation module 604 are electrically connected.

[0107] In the live pig weight estimation device according to the embodiments of the present invention, after performing image recognition and target segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig, the mask of the target part of the target live pig in the original mask image of the target live pig is removed to obtain the target mask image of the target live pig. Based on the target mask image of the target live pig, the body measurement data of the target dimension of the target live pig is obtained. Then, the body measurement data of the target live pig is input into the live pig weight estimation model, and the weight estimation value of the target live pig output by the live pig weight estimation model is obtained. It can improve the accuracy of live pig weight estimation while reducing the calculation amount and calculation complexity of live pig weight estimation, significantly improve the efficiency of live pig weight estimation, realize non-contact live pig weight estimation, avoid stress reactions of live pigs, reduce the input of labor costs, be applicable to large-scale breeding scenarios, and provide efficient and reliable technical support for intelligent breeding management.

[0108] Figure 7 An example of the physical structure diagram of an electronic device is shown as Figure 7 shown. The electronic device 701 may include: a processor 710, a communication interface 720, a memory 730, and a communication bus 740. Among them, the processor 710, the communication interface 720, and the memory 730 complete communication with each other through the communication bus 740. The processor 710 can call the logical instructions in the memory 730 to execute the live pig weight estimation method, which includes: performing image recognition and target segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig. The RGB of the target live pig is collected by an image sensor located above the target live pig, with the shooting direction perpendicular to the ground where the target live pig is located and the distance from the ground where the target live pig is located being a preset value. The original mask image of the target live pig includes the mask of the target live pig; performing image processing on the original mask image of the target live pig to obtain the target mask image of the target live pig; obtaining the body measurement data of the target dimension of the target live pig based on the target mask image of the target live pig; inputting the body measurement data of the target live pig into the live pig weight estimation model to obtain the weight estimation value of the target live pig output by the live pig weight estimation model. The live pig weight estimation model is constructed based on a regression model and obtained after training based on the body measurement data of the target dimension of the sample live pig and the actual weight value of the sample live pig.

[0109] In addition, when the logical instructions in the above-mentioned memory 730 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a 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 such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0110] Based on the content of the above embodiments, a live pig weight estimation system includes: the electronic device and the image acquisition device as described above; the image acquisition device is electrically connected to the electronic device; The image acquisition device includes a moving mechanism, a support mechanism, and an image sensor; the moving mechanism is connected to the support mechanism, and the moving mechanism is used to drive the support mechanism to move; The image sensor is installed on the support mechanism, the shooting direction of the image sensor is vertically downward perpendicular to the horizontal plane, and the image sensor is used to acquire the RGB image of the target live pig located below the image sensor and send the acquired RGB image of the target live pig to the electronic device.

[0111] Figure 8 is one of the structural schematic diagrams of the image acquisition device in the live pig weight estimation system provided by the present invention. Figure 9 is the second structural schematic diagram of the image acquisition device in the live pig weight estimation system provided by the present invention. As Figure 8 and Figure 9 shown, in the embodiment of the present invention, the moving mechanism 804 in the image acquisition device can be used to move the image sensor above the target live pig. The support mechanism in the embodiment of the present invention can have degrees of freedom in both the horizontal and vertical directions. Therefore, the moving mechanism and the support mechanism can be used to move the image sensor above the target live pig.

[0112] It should be noted that in the embodiment of the present invention, the shooting direction of the image sensor is the direction that passes through the lens center of the image sensor and is perpendicular to the plane where the lens of the image sensor is located and extends in the direction away from the image sensor.

[0113] The support mechanism includes a support base 801 and a multi-axis robotic arm 802. One end of the multi-axis robotic arm 802 is fixed to the support base 801, and the other end of the multi-axis robotic arm 802 is connected to the image sensor 803. The multi-axis robotic arm 802 includes a plurality of connecting rods, and the connecting rods are sequentially rotatably connected.

[0114] Specifically, the support mechanism in the embodiment of the present invention includes a support base 801 and a multi-axis robotic arm 802. The multi-axis robotic arm 802 consists of a plurality of connecting rods, and the connecting rods are sequentially connected through rotating joints. The above-mentioned rotating joints can allow relative rotation between adjacent connecting rods, so that the multi-axis robotic arm 802 can be bent and extended in three-dimensional space.

[0115] By adjusting the angle between the connecting rods in the multi-axis robotic arm 802, the image sensor 803 can be driven to move above the target live pig.

[0116] Optionally, the material of the support mechanism in the embodiment of the present invention can be aluminum profiles, which have the characteristics of being lightweight, having relatively high strength, and relatively low price.

[0117] Optionally, the moving mechanism 804 can include four pulleys and a brake to ensure the stability of the moving mechanism 804 during the moving process.

[0118] As an optional embodiment, the support base 801 has a telescopic function and can drive the multi-axis robotic arm 802 to move in a direction perpendicular to the horizontal plane.

[0119] As an optional embodiment, the electronic device 701 is electrically connected to at least one of the support base 801, the multi-axis robotic arm 802, and the moving mechanism 804. When the electronic device 701 is electrically connected to the moving mechanism 804, it is used to control the moving direction and / or moving distance of the moving mechanism 804. When the electronic device 701 is electrically connected to the multi-axis robotic arm 802, it is used to control the angle between at least two adjacent connecting rods in the multi-axis robotic arm 802. When the electronic device 701 is electrically connected to the support base 801, it is used to control the height of the support base 801.

[0120] The power supply 901 can be arranged on the support base 801.

[0121] In the image acquisition device according to the embodiments of the present invention, the moving mechanism is connected to the supporting mechanism and can drive the supporting mechanism to move, so that the image acquisition device can adjust its position within a large spatial range, providing users with a greater degree of shooting freedom. It can collect RGB images and depth images of any live pig as needed. The supporting mechanism includes a supporting base and a multi-axis robotic arm. The multi-axis robotic arm is formed by sequentially rotating and connecting a plurality of connecting rods, enabling the image sensor to achieve precise positioning and shooting in three-dimensional space. By adjusting the rotation angles of the respective connecting rods, the image sensor can be flexibly moved above the target live pig. By integrating the moving mechanism, the supporting mechanism, and the image sensor, the image acquisition device realizes the automation and high efficiency of the shooting process. Users can quickly adjust the shooting position of the image sensor through simple operations, significantly improving the shooting efficiency. It can better adapt to the dynamic and complex actual environment of the farm, reduce manual intervention when collecting live pig images, better avoid stress reactions in live pigs, improve the practicality of live pig weight estimation, provide a more accurate and efficient data basis for live pig weight estimation, and improve the practicality and popularization of live pig weight estimation.

[0122] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program that 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 live pig weight estimation method provided by each of the above methods. The method includes: performing image recognition and target segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig. The RGB of the target live pig is collected by an image sensor located above the target live pig, with the shooting direction perpendicular to the ground where the target live pig is located and the distance from the ground where the target live pig is located being a preset value. The original mask image of the target live pig includes the mask of the target live pig; performing image processing on the original mask image of the target live pig to obtain the target mask image of the target live pig; obtaining the body size data of the target dimension of the target live pig based on the target mask image of the target live pig; inputting the body size data of the target live pig into the live pig weight estimation model to obtain the weight estimation value of the target live pig output by the live pig weight estimation model. The live pig weight estimation model is constructed based on a regression model and obtained after being trained based on the body size data of the sample live pig in the target dimension and the actual weight value of the sample live pig.

[0123] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the live pig weight estimation method provided by the above-mentioned various methods. The method includes: performing image recognition and target segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig. The RGB of the target live pig is collected by an image sensor located above the target live pig, with the shooting direction perpendicular to the ground where the target live pig is located and the distance from the ground where the target live pig is located being a preset value. The original mask image of the target live pig includes the mask of the target live pig; performing image processing on the original mask image of the target live pig to obtain the target mask image of the target live pig; obtaining the body dimension data of the target dimension of the target live pig based on the target mask image of the target live pig; inputting the body dimension data of the target live pig into the live pig weight estimation model to obtain the weight estimation value of the target live pig output by the live pig weight estimation model. The live pig weight estimation model is constructed based on a regression model and obtained after being trained based on the body dimension data of the target dimension of the sample live pig and the actual weight value of the sample live pig.

[0124] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.

[0125] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disc, etc., and includes several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0126] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of the present invention.

Claims

1. A method for estimating the weight of live pigs, characterized in that, including: Performing image recognition and object segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig. The RGB of the target live pig is collected by an image sensor located above the target live pig, with the shooting direction perpendicular to the ground where the target live pig is located and the distance from the ground where the target live pig is located being a preset value. The original mask image of the target live pig includes the mask of the target live pig; Performing image processing on the original mask image of the target live pig to obtain the target mask image of the target live pig; Based on the target mask image of the target live pig, obtaining the body measurement data of the target dimension of the target live pig; Inputting the body measurement data of the target live pig into the live pig weight estimation model to obtain the weight estimation value of the target live pig output by the live pig weight estimation model. The live pig weight estimation model is constructed based on a regression model and obtained after training based on the body measurement data of the target dimension of the sample live pig and the actual weight value of the sample live pig.

2. The live pig weight estimation method according to claim 1, wherein The performing image processing on the original mask image of the target live pig to obtain the target mask image of the target live pig includes: Removing the mask of the target part of the target live pig in the original mask image of the target live pig to obtain the target mask image of the target live pig. The target part includes ears, tail and legs.

3. The live pig weight estimation method according to claim 2, wherein The target dimension includes: relative dorsal projection area, contour perimeter, body length, body width and eccentricity.

4. The live pig weight estimation method according to claim 3, wherein, The obtaining the body measurement data of the target dimension of the target live pig based on the target mask image of the target live pig includes: Generating the minimum bounding rectangle of the mask of the target live pig in the target mask image of the target live pig; Obtaining the length of the short side of the minimum bounding rectangle as the body width of the target live pig, and obtaining the length of the long side of the minimum bounding rectangle as the body length of the target live pig.

5. The live hog weight estimation method according to claim 3, wherein, The obtaining the body measurement data of the target dimension of the target live pig based on the target mask image of the target live pig includes: Obtaining the contour of the target live pig in the target mask image of the target live pig; Based on the contour of the target live pig, using the least squares method to fit an ellipse for describing the contour of the target live pig; Calculating the square difference of the ratio of the major axis to the minor axis of the ellipse as the eccentricity of the target live pig.

6. The live pig weight estimation method according to any one of claims 1 to 5, characterized in that The regression model is a backpropagation neural network.

7. A live pig weight estimation device, characterized in that, including: An image segmentation module for performing image recognition and object segmentation on the RGB image of the target live pig to obtain the original mask image of the target live pig. The RGB of the target live pig is collected by an image sensor located above the target live pig, with the shooting direction perpendicular to the ground where the target live pig is located and the distance from the ground where the target live pig is located being a preset value. The original mask image of the target live pig includes the mask of the target live pig; An image processing module for performing image processing on the original mask image of the target live pig to obtain the target mask image of the target live pig; A data extraction module for obtaining the body measurement data of the target dimension of the target live pig based on the target mask image of the target live pig; A weight estimation module, configured to input the body size data of the target live pig into a live pig weight estimation model, and obtain a weight estimation value of the target live pig output by the live pig weight estimation model. The live pig weight estimation model is constructed based on a regression model and is obtained after being trained based on the body size data of the sample live pig in the target dimension and the actual weight value of the sample live pig.

8. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the live pig weight estimation method according to any one of claims 1 to 6.

9. A live pig weight estimation system, characterized in that, Comprising: The electronic device and the image acquisition device according to claim 8; the image acquisition device is electrically connected to the electronic device; The image acquisition device includes a moving mechanism, a supporting mechanism and an image sensor; the moving mechanism is connected to the supporting mechanism, and the moving mechanism is used to drive the supporting mechanism to move; The image sensor is installed on the supporting mechanism, the shooting direction of the image sensor is vertically downward perpendicular to the horizontal plane, and the image sensor is used to acquire an RGB image of a target live pig located below the image sensor and send the acquired RGB image of the target live pig to the electronic device.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the live pig weight estimation method according to any one of claims 1 to 6.

Citation Information

Cited By

  • Livestock weight prediction method and system

    CN120452028A

  • Target object weight estimation method and device based on structured light image

    CN120853156A