A pig weight detection method and system based on back image recognition

By extracting the shoulder width, hip width and abdominal width features from the pig back images, combining the convolutional neural network and support vector regression model, the problem of low accuracy of pig weight estimation is solved, and efficient and accurate weight prediction is achieved.

CN120183003BActive Publication Date: 2025-08-08SICHUAN ACADEMY OF AGRICULTURAL MACHINERY SCIENCES +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510660726.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-22
Publication Date
2025-08-08
Estimated Expiration
2045-05-22

AI Technical Summary

Technical Problem

In the prior art, pig body weight estimation accuracy is low, traditional manual weighing methods are inefficient and labor-intensive, and existing computer vision methods ignore pig body shape and structural characteristics, resulting in large estimation errors.

Method used

By extracting shoulder width, hip width and abdominal width features from pig back images, using convolutional neural network model analysis, combining support vector regression model to construct a weight prediction model, and correcting the weight prediction results through the confidence of multiple images to reduce the impact of local bending and noise.

Benefits of technology

It improves the accuracy of pig weight prediction, enhances the fault tolerance of non-ideal images, adapts to different image acquisition conditions, reduces the impact of local bending on weight estimation, and expands the adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120183003B_ABST
    Figure CN120183003B_ABST
Patent Text Reader

Abstract

The present application discloses a pig weight detection method and system based on back image recognition, which relates to the field of pig breeding management, including: extracting a target back image from an initial back image; extracting target features of the target back image; obtaining a target weight according to the target features in the output of a weight prediction model; the target features include shoulder width, hip width and abdominal width, and the extraction method includes constructing a coordinate system and then calculating the centroid coordinates of the back area; constructing a minimum circumscribed rectangle of the back area, and constructing a reference line through the centroid; the reference line divides the back area into an upper area and a lower area; retrieving the maximum feature line in the upper area and the lower area; obtaining the shoulder width according to the distance between the maximum feature line of the upper area and the intersection point of the back contour; obtaining the hip width according to the distance between the maximum feature line of the lower area and the intersection point of the back contour; obtaining the abdominal area; retrieving the minimum feature line in the abdominal area, and obtaining the abdominal width according to the distance between the minimum feature line and the intersection point of the back contour, so as to improve the accuracy of the weight prediction model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of pig breeding management, and specifically to a pig weight detection method and system based on back image recognition. Background Art

[0002] Pig weight is a key indicator in pig farming, crucial for disease early warning and treatment, nutritional status assessment, precise feeding, and market decision-making. Traditional manual weighing methods, however, are characterized by high stress, low efficiency, and high labor intensity, making them unsuitable for large-scale pig farming.

[0003] Prior art already uses computer vision to estimate pig weight. For example, patent application number CN202310509165.0 discloses a non-contact pig weight measurement method, system, electronic device, and storage medium. This method estimates pig weight by identifying weight characteristics, such as body width, from overhead depth images of the pig. These weight characteristics are then input into a pre-trained AdaBoost regression model.

[0004] While this method enables contactless measurement of pig weight, it uses the short side length of the minimum circumscribed rectangle of the back region as a uniform indicator of body width, which loses structural characteristics of live pigs and increases weight estimation errors. For example, pigs with broad shoulders typically have well-developed muscles, while in fattening pigs, abdominal width is used to reflect fat content. If the short side lengths of the corresponding minimum circumscribed rectangles of these two regions are the same or similar, the weight estimation model will easily treat them as the same input, reducing the accuracy of weight estimation.

[0005] Therefore, there is an urgent need for a method and system for estimating pig weight to solve the technical problem of low accuracy in pig weight estimation in the existing technology. Summary of the Invention

[0006] The present invention provides a pig weight detection method and system based on back image recognition. By identifying and extracting the pig's body size information from the back image, the pig's body size information is analyzed and fitted using a convolutional neural network model to estimate the pig's weight. This achieves the purpose of increasing the proportion of valid images in a single captured image while realizing automated pig weight estimation.

[0007] According to a first aspect of the present invention, the present invention claims protection for a method for detecting pig weight based on back image recognition, comprising:

[0008] extracting a back region from an initial back image of a target pig to obtain a target back image;

[0009] Extract the feature values of the target back image to obtain the target features;

[0010] Obtain target weight based on the output of the weight prediction model based on the target features;

[0011] The eigenvalues include shoulder width, hip width, and abdominal width. The eigenvalue extraction methods include:

[0012] Construct a coordinate system on the target back image and calculate the coordinates of the center of mass of the back area;

[0013] Construct a minimum circumscribed rectangle of the back region, and construct a straight line through the centroid that is parallel to the short side of the minimum circumscribed rectangle to obtain a reference line; the reference line divides the back region into an upper region and a lower region;

[0014] In the upper and lower regions, the maximum characteristic line parallel to the reference line and with the largest distance between the two intersection points with the back contour is retrieved respectively; the shoulder width is obtained based on the maximum distance between the corresponding intersection points in the upper region; the hip width is obtained based on the maximum distance between the corresponding intersection points in the lower region;

[0015] The abdominal area is obtained based on the dorsal area between the maximum characteristic line of the lower area and the reference line;

[0016] The minimum characteristic line parallel to the reference line and with the smallest distance between the two intersection points with the back contour is retrieved in the abdominal region, and the abdominal width is obtained according to the distance between the intersection points of the minimum characteristic line and the back contour.

[0017] In one embodiment of the present application, the number of the initial back images is greater than 1, and the method further includes:

[0018] Obtaining corresponding image confidences according to the confidences of the upper region, the abdomen region, and the tail region of each initial back image; the tail region confidence is obtained according to the confidences of the regions other than the abdomen region in the lower region;

[0019] The target features of each initial back image are input into the weight prediction model to obtain the corresponding reference weight;

[0020] The target weight is calculated based on the image confidence of all initial back images and the reference weight.

[0021] In one embodiment of the present application, the confidence level includes a curvature component, and the method further includes:

[0022] Calculate the centroid coordinates of the upper, abdominal, and tail regions, respectively;

[0023] Construct a line connecting the centroid of the upper region and the centroid of the tail region to obtain the first characteristic line;

[0024] Construct a line connecting the centroid of the upper region and the centroid of the abdominal region to obtain the second characteristic line;

[0025] Construct a line connecting the center of mass of the tail region and the center of mass of the abdomen region to obtain the third characteristic line;

[0026] The curvature component of the upper region is obtained according to the angle between the first characteristic line and the second characteristic line;

[0027] The curvature component of the tail region is obtained according to the angle between the first characteristic line and the third characteristic line;

[0028] The curvature component of the abdominal region is obtained according to the included angle between the second characteristic line and the third characteristic line.

[0029] In an embodiment of the present application, the confidence level further includes an occlusion component, and the confidence level is obtained by performing a linear weighted calculation on a curvature component and an occlusion component according to a preset weight.

[0030] In one embodiment of the present application, the method further includes: identifying the key points corresponding to the target pig in each of the initial back images; obtaining the target key point type and the corresponding number of key points based on the key point recognition results; if the target key point type includes all preset key point types, and each type corresponds to 2 key points identified, the occlusion components corresponding to the upper area, abdominal area and tail area of the initial back image are all set to preset maximum values; the preset key point types include shoulder key points, abdominal key points and buttocks key points.

[0031] In one embodiment of the present application, the method also includes: setting the occlusion component of the image area corresponding to the preset key point type in which the number of key points in the key point recognition result is 0 to a preset minimum value; setting the occlusion component of the image area corresponding to the preset key point type in which the number of key points in the key point recognition result is 2 to a preset maximum value; and setting the occlusion component of the image area corresponding to the preset key point type in which the number of key points in the key point recognition result is 1 to a preset intermediate value.

[0032] In one embodiment of the present application, the weight prediction model is constructed and trained based on a support vector regression model.

[0033] According to a second aspect of the present invention, the present invention claims protection for a pig weight detection system based on back image recognition, comprising:

[0034] Image acquisition module: extracts the back area from the initial back image of the target pig to obtain the target back image;

[0035] Feature extraction module: extracts the eigenvalues of the target back image to obtain the target features; the eigenvalues include shoulder width, hip width, and abdominal width. The feature extraction module includes:

[0036] Construct a coordinate system on the target back image and calculate the coordinates of the center of mass of the back area;

[0037] Construct a minimum circumscribed rectangle of the back region, and construct a straight line through the centroid that is parallel to the short side of the minimum circumscribed rectangle to obtain a reference line; the reference line divides the back region into an upper region and a lower region;

[0038] In the upper and lower regions, the maximum characteristic line parallel to the reference line and with the largest distance between the two intersection points with the back contour is retrieved respectively; the shoulder width is obtained based on the maximum distance between the corresponding intersection points in the upper region; the hip width is obtained based on the maximum distance between the corresponding intersection points in the lower region;

[0039] The abdominal area is obtained based on the dorsal area between the maximum characteristic line of the lower area and the reference line;

[0040] In the abdominal area, the minimum feature line that is parallel to the reference line and has the smallest distance between the two intersection points with the back contour is retrieved, and the abdominal width is obtained based on the distance between the intersection points of the minimum feature line and the back contour.

[0041] Weight prediction module: obtains the target weight based on the output of the weight prediction model according to the target features.

[0042] In one embodiment of the present application, the number of initial back images is greater than one, and the system further comprises a confidence acquisition module: obtaining corresponding image confidences according to the confidences of the upper region, the abdomen region, and the tail region corresponding to each initial back image; the tail region confidence is obtained according to the confidences of the regions other than the abdomen region in the lower region;

[0043] The weight prediction module also inputs the target features of each initial back image into the weight prediction model to obtain the corresponding reference weight; and calculates the target weight based on the image confidence of all initial back images and the reference weight.

[0044] In one embodiment of the present application, the confidence includes a curvature component, and the confidence acquisition module further includes a curvature acquisition submodule, and the curvature acquisition submodule includes:

[0045] Calculate the centroid coordinates of the upper, abdominal, and tail regions, respectively;

[0046] Construct a line connecting the centroid of the upper region and the centroid of the tail region to obtain the first characteristic line;

[0047] Construct a line connecting the centroid of the upper region and the centroid of the abdominal region to obtain the second characteristic line;

[0048] Construct a line connecting the center of mass of the tail region and the center of mass of the abdomen region to obtain the third characteristic line;

[0049] The curvature component of the upper region is obtained according to the angle between the first characteristic line and the second characteristic line;

[0050] The curvature component of the tail region is obtained according to the angle between the first characteristic line and the third characteristic line;

[0051] The curvature component of the abdominal region is obtained according to the included angle between the second characteristic line and the third characteristic line.

[0052] In an embodiment of the present application, the confidence acquisition module further includes an occlusion acquisition submodule, and the confidence acquisition module further includes performing a linear weighted calculation on the output of the bending acquisition submodule and the output of the occlusion acquisition submodule according to a preset weight.

[0053] In one embodiment of the present application, the occlusion acquisition submodule also includes: identifying the key points corresponding to the target pig in each of the initial back images; obtaining the target key point type and the corresponding key point number based on the key point recognition results; if the target key point type includes all preset key point types, and each type corresponds to 2 key points identified, the occlusion degree components corresponding to the upper area, abdominal area and tail area of the initial back image are all set to preset maximum values; the preset key point types include shoulder key points, abdominal key points and buttocks key points.

[0054] In one embodiment of the present application, the occlusion acquisition submodule also includes: setting the occlusion degree component of the image area corresponding to the preset key point type with a key point number of 0 in the key point recognition result to a preset minimum value; setting the occlusion degree component of the image area corresponding to the preset key point type with a key point number of 2 in the key point recognition result to a preset maximum value; and setting the occlusion degree component of the image area corresponding to the preset key point type with a key point number of 1 in the key point recognition result to a preset intermediate value.

[0055] In one embodiment of the present application, the weight prediction model is constructed and trained based on a support vector regression model.

[0056] This application has the following beneficial effects:

[0057] 1. By extracting the pig's shoulder width, abdominal width, and hip width features from the pig's back image, the individual differences of different pigs can be effectively captured. The target features accurately depict the development of the target pig's shoulders, abdomen, and hips, enabling the weight prediction model to deeply explore the correlation between the development of the pig's shoulders, abdomen, and hips and its weight, thereby improving the accuracy of the weight prediction model.

[0058] 2. When estimating weight, the eigenvalues of multiple initial back images of the same target pig are extracted. The output of the weight prediction model based on each eigenvalue is used as a reference for the estimated weight of the target pig. The output result of the corresponding weight prediction model is corrected according to the image confidence of different areas in different initial images, so that the final target weight can be predicted stably, and the recognition tolerance for non-ideal images is enhanced. In particular, when it is difficult to obtain an ideal back image of the target pig, the accuracy of the target pig's weight estimation result is improved to adapt to different image acquisition conditions in actual application scenarios.

[0059] 3. Using the center of mass of the upper, abdominal, and hip regions, we can quickly determine whether the target pig has localized curvature. For example, when a pig is walking in a straight line, the shoulder's swing range is smaller than the hip's due to head and neck constraints. Therefore, the confidence level for the upper region is higher than that for the abdominal region. This method not only reduces judgment complexity but is also less susceptible to image noise and offers strong interpretability, effectively reducing the impact of local curvature on overall weight estimation.

[0060] 4. The recognition results of the target pig's shoulder key points, abdomen key points, and buttocks key points are used as the basis for judging whether there is occlusion. Under the condition that the operation mechanism of the weight prediction model is consistent, the probability of the image being misjudged as an invalid image due to the existence of only non-critical parts such as the tail, legs, and ears is reduced, thereby improving the utilization rate of the collected images.

[0061] 5. A weight prediction model is constructed based on the SVR model. During the training process, positive and negative slack variables are introduced into the loss function. The preset error threshold ε is used to assist the model in maintaining the stability of the overall prediction when facing small sample errors or outliers. The regularization term in the loss function also reduces the probability of overfitting of the model, thereby expanding the adaptability of the model to pig farming scenarios of different scales. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0063] Figure 1 This is a flow chart of a pig weight detection method based on back image recognition according to an embodiment of the present application;

[0064] Figure 2 This is a schematic diagram of target feature extraction involved in an embodiment of the present application;

[0065] Figure 3 A schematic diagram of extracting the curvature of the back region involved in an embodiment of the present application;

[0066] Figure 4This is a structural diagram of a pig weight detection system based on back image recognition according to an embodiment of the present application;

[0067] Figure 5 A schematic diagram of the structure of an electronic device involved in an embodiment of the present application;

[0068] Symbols in the figure: C-center of mass, l0-reference line, l1-first maximum characteristic line, l2-second maximum characteristic line, l3-minimum characteristic line, E1-first intersection point, E2-second intersection point, A1-third intersection point, A2-fourth intersection point, B1-fifth intersection point, B2-sixth intersection point, C1-center of mass of the upper region, C2-center of mass of the abdominal region, C3-center of mass of the tail region, α1-angle between the line connecting the center of mass of the upper region and the center of mass of the tail region and the line connecting the center of mass of the upper region and the center of mass of the abdominal region, α2-angle between the line connecting the center of mass of the upper region and the center of mass of the tail region and the line connecting the center of mass of the tail region and the center of mass of the abdominal region, α3-angle between the line connecting the center of mass of the upper region and the center of mass of the abdominal region and the line connecting the center of mass of the tail region and the center of mass of the abdominal region. DETAILED DESCRIPTION

[0069] The present invention provides a method and system for detecting pig weight based on back image recognition. To make the above-mentioned objects, features, and advantages of this application more readily apparent, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of this application. It should be understood that the described embodiments are only some of the embodiments of this application, and not all of them. The components of the embodiments of this application generally described and illustrated in the drawings herein may be arranged and designed in various different configurations. Therefore, reference to the terms "one embodiment," "some embodiments," "implementation," "embodiment," "illustrative embodiment," "example," "specific example," or "some examples," etc., in the following detailed description of the embodiments of this application provided in the drawings, is not intended to limit the scope of the claimed application, but merely indicates that the specific features, structures, or characteristics described in conjunction with such embodiment or example are included in at least one embodiment or example of the present invention. Furthermore, the specific features, structures, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. All other embodiments derived by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0070] It should be noted that similar reference numerals and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined or explained in subsequent figures. At the same time, in the description of this application, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.

[0071] According to the first aspect of the present invention, the present invention claims a method for detecting the weight of a pig based on back image recognition, referring to the attached Figure 1 Shown, including:

[0072] S1: A camera is pre-set above the target piggery area, with the lens axis perpendicular to the horizontal plane, and the image plane covers the target recognition area. The camera focuses on the target piggery area and captures the back image of the target pig at the preset time.

[0073] It should be noted that the target pigsty area includes the active areas of the pigs, such as the pig pens and the aisles between pens. The target recognition area should not be smaller than the minimum area within which a complete back image can be captured. The initial back image may contain only the back image of a single pig or multiple pigs simultaneously.

[0074] S2: Preprocessing the collected back image of the target pig to obtain an initial back image.

[0075] In this embodiment, the preprocessing includes grayscale processing, noise removal, contrast enhancement and perspective transformation, but it is certainly not limited to these. The grayscale processing is used to convert the collected back image into a grayscale image to obtain a first back image. The noise removal is used to remove the image noise of the first back image to obtain a second back image. For example, a median filtering algorithm is used to remove salt and pepper noise, and the grayscale value of each pixel in the first back image is replaced by the median of the grayscale values of the pixels in the field, so as to achieve noise removal while retaining the edge and detail information of the pig's back image, and reduce the risk of blurring key features such as hair texture. The contrast enhancement is used to enhance the contrast of the second back image to obtain the initial back image. For example, an adaptive histogram equalization algorithm is used to process the second back image, and the mapping relationship is dynamically adjusted according to the grayscale distribution of different areas of the second back image to reduce the impact of uneven lighting on the image recognition results.

[0076] It should be noted that the perspective transformation is used to convert the back image of the target pig into a top view. The perspective transformation matrix can be calculated by the getPerspectiveTransform function in OpenCV, and the image can be converted into a top view according to the perspective transformation matrix using the warpPerspective function.

[0077] S3: Extracting the back region from the initial back image of the target pig to obtain a target back image.

[0078] In this embodiment, step S3 further includes the following sub-steps: S31, identifying the region of the target pig in the initial back image to obtain a third back image. Inputting the initial back image into an image segmentation model to obtain the region of the target pig in the initial back image. The image segmentation model can be constructed using a threshold segmentation method, a convolutional neural network model, or other feasible methods. S32, screening the region of the target pig's back from the third back image to obtain the target back image.

[0079] It should be noted that when the initial back image contains images of multiple pigs, step S31 further includes determining the position of the target pig in the initial back image to obtain the target pig's location. For example, the target pig's position in the initial back image can be located using a target tracking algorithm, ear tags can be used to assist in locating the target pig, manual positioning can be used, or other feasible methods can be used.

[0080] It should be noted that the third back image includes the head, body and tail of the target pig, and the area where the body is located is filtered out from the third back image to obtain the target back image. Step S32 also includes the following sub-steps: S321. The third back image is processed using a morphological opening operation to remove the raised parts of the head and tail. S322. The third back image with the head and tail removed is corroded using a morphological corrosion operation to remove interference information such as hair on the edge of the back contour. S323. The third back image after corrosion is filled using an expansion operation. The expansion operation is used to repair holes that appear in the corrosion operation. S324. Based on the initial back image, the pixel points in the corresponding area of the third back image obtained after the expansion operation are set to white, and the remaining part is set to black to obtain a binary image of the back of the target pig, that is, the target back image.

[0081] S4: Extracting feature values of the target back image to obtain target features.

[0082] In this embodiment, step S4 further includes the following sub-steps: S41, establishing a coordinate system in the fourth back image. S42, calculating and obtaining the target features according to the coordinate system.

[0083] It should be noted that when constructing the coordinate system, any pixel point in the target back image can be used as the origin of the coordinate system, and the coordinates of each pixel point can be determined after presetting the positive direction of the x-axis and the positive direction of the y-axis.

[0084] It should be noted that the characteristic values include shoulder width, hip width and abdominal width, but are certainly not limited thereto.

[0085] In this embodiment, the characteristic values are area, perimeter, body length, hip width, abdominal width, shoulder width and curvature of posture. Step S42 also includes: S421, counting the number of pixels in the white area as the area. S422, obtaining the back contour of the target pig based on the white area, calculating the distance between each adjacent point in the back contour respectively, and calculating the perimeter based on the sum of the distances between all adjacent points. S423, constructing the minimum circumscribed rectangle of the white area in the target back image. The minimum circumscribed rectangle is a rectangle that can completely contain the white area and has the smallest area. S424, taking the length of the major axis of the minimum circumscribed rectangle as the body length. S425, calculating the center of mass coordinates of the white area in the target back image. The center of mass is denoted as C, and the center of mass coordinates are denoted as (C x , C y ), that is, the horizontal coordinate of the center of mass is C x , the vertical axis is C y . The target back image can be input into the moments function of OpenCV to output the center of mass coordinates. S426. Construct a straight line parallel to the short side of the minimum circumscribed rectangle through the center of mass to obtain a reference line. The reference line divides the back area into an upper area and a lower area. The upper area is the area where the shoulder blades of the target pig are located. The lower area is the area where the abdomen and buttocks of the target pig are located. It can be classified and marked manually, or the two areas can be classified and marked based on a neural network model, or other feasible methods. S427. The shoulder width is obtained from the upper area, and the hip width and the abdominal width are obtained from the lower area. S428. Perform an ellipse fitting operation on the back contour to obtain a target ellipse; calculate the eccentricity of the target ellipse to obtain the curvature to measure the degree of curvature of the target pig's posture. For the same pig, the closer the eccentricity is to 0, the greater the degree of curvature of the corresponding target pig's posture.

[0086] It should be noted that the back contour can be fitted with an ellipse using the least squares method. Taking the fitEllipse function in OpenCV as an example, the construction of the target ellipse is described. The positions of all pixel points of the back contour are input into the fitEllipse function, and the eccentricity, i.e., the curvature component of the posture, is calculated based on the major and minor axis lengths output by the fitEllipse function. The calculation method of the eccentricity E includes:

[0087] ;

[0088] Wherein, a represents half of the length of the major axis of the target ellipse, that is, the length of the major semi-axis; b represents half of the length of the minor axis of the target ellipse, that is, the length of the minor semi-axis.

[0089] It should be noted that step S428 also includes the following sub-steps: S4281, searching the upper region for the maximum characteristic line that is parallel to the reference line and has the largest distance between the two intersection points with the back contour, and obtaining the first maximum characteristic line. The shoulder width is obtained based on the distance between the first maximum characteristic line and the corresponding intersection points with the back contour. S4282, searching the lower region for the maximum characteristic line that is parallel to the reference line and has the largest distance between the two intersection points with the back contour, and obtaining the second maximum characteristic line. The hip width is obtained based on the distance between the second maximum characteristic line and the corresponding intersection points with the back contour. S4283, obtaining the abdominal region based on the back region between the second maximum characteristic line and the reference line. S4284, searching the abdominal region for the minimum characteristic line that is parallel to the reference line and has the smallest distance between the two intersection points with the back contour, and obtaining the abdominal width based on the distance between the minimum characteristic line and the intersection points with the back contour.

[0090] In this embodiment, refer to the attached Figure 2 As shown, the target back image is placed in the first quadrant of the coordinate system, with the lower left corner pixel of the target back image as the origin of the coordinate system. The horizontal right direction is the positive direction of the x-axis, and the vertical upward direction is the positive direction of the y-axis. The position of each pixel is expressed in integer coordinates. The expression of the reference line l0 is y=C y , the first maximum characteristic line is l1, the second maximum characteristic line is l2, and the minimum characteristic line is l3. The first maximum characteristic line l1 intersects with the back contour at the first intersection E1 and the second intersection E2, the second maximum characteristic line l2 intersects with the back contour at the third intersection A1 and the fourth intersection A2, and the minimum characteristic line l3 intersects with the back contour at the fifth intersection B1 and the sixth intersection B2. The coordinates of the first intersection E1 are marked as (x e1 ,y e ), the coordinates of the second intersection point E2 are marked as (x e2 ,y e ), the coordinates of the third intersection point A1 are marked as (x a1 ,ya ), the coordinates of the fourth intersection point A2 are marked as (x a2 ,y a ), the coordinates of the fifth intersection B1 are marked as (x b1 ,y b ), the coordinates of the sixth intersection point B2 are marked as (x b2 ,y b ). It can be seen that the shoulder width is equal to |x e1 -x e2 |, the hip width is equal to |x a1 -x a2 |, the abdominal width is equal to |x b1 -x b2 |.

[0091] S5: Inputting the target features into a weight prediction model to obtain a target weight of the target pig.

[0092] It should be noted that sample back images and their corresponding actual weights of sample pigs from the farm are collected in advance. The collected sample back images are expanded by varying lighting intensities, rotating them, and other methods to obtain a training image set for the weight prediction model. Each training image in the training image set is subjected to steps S2-S4 to obtain corresponding training features. The training features of all images and their corresponding actual weights constitute the training dataset for the weight prediction model.

[0093] It should be noted that the weight prediction model is constructed based on the Support Vector Regression (SVR) model. The weight prediction model f can be expressed as:

[0094] ;

[0095] Wherein, x represents the target feature; ω represents the weight vector of the target feature; b represents the bias term; φ represents the kernel function that maps the target feature to a high-dimensional feature space, such as a linear kernel function, a polynomial kernel function, and a sigmoid kernel function.

[0096] In this embodiment, the loss function O of the weight prediction model can be expressed as:

[0097] ;

[0098] ;

[0099] ;

[0100] Among them, RT represents the regularization term, which controls the complexity of the model by minimizing the L2 norm of the weight vector ω; C represents the preset penalty parameter. The larger the value of the preset penalty parameter, the more severe the penalty for prediction error. represents the positive slack variable of sample i, that is, the error of the predicted value being lower than the actual value; represents the negative slack variable for sample i, i.e., the error by which the predicted value is higher than the actual value. Both the positive and negative slack variables are greater than 0 only when the prediction error exceeds the preset error threshold ε; otherwise, they are 0. n represents the number of samples.

[0101] It should be noted that in the actual breeding process, although the image acquisition process is standardized, due to factors such as individual posture differences, occlusion, and illumination, the collected images may have a certain degree of deviation or outliers. During the training process, the SVR model introduces positive and negative relaxation variables into the loss function, and uses the preset error threshold ε to assist the model in maintaining the stability of the overall prediction when facing small sample errors or outliers. The regularization term in the loss function reduces the probability of overfitting of the model, thereby expanding the adaptability of pig breeding scenarios of different scales.

[0102] It should be noted that the coefficient of determination, mean absolute error and mean square error are used as performance evaluation indicators of the weight prediction model. Grid search and cross-validation are used to optimize the selection of model hyperparameters. The model performance of different hyperparameter value combinations is compared, and the model with the best performance is selected as the final weight prediction model.

[0103] In this embodiment, by extracting the pig's shoulder width features, abdominal body width features and hip width features from the pig's back image, the individual differences of different pigs can be effectively captured. The target features accurately depict the development of the target pig's shoulders, abdomen and hips, allowing the weight prediction model to deeply explore the correlation between the development of the pig's shoulders, abdomen and hips and its weight, thereby improving the accuracy of the weight prediction model.

[0104] In addition, fine-grained regional corrections are performed on the shoulder width, abdominal body width, and hip width through eccentricity to improve the weight prediction model's ability to identify inconsistent changes in different parts and compensate for errors when the pig has posture bending, thereby improving the prediction accuracy of the weight prediction model.

[0105] In a feasible embodiment, the number of initial back images is greater than 1, and the method further includes obtaining an image confidence of each of the initial back images, and calculating the target weight based on the weight prediction result corresponding to each of the initial back images and the image confidence.

[0106] In this embodiment, the confidence scores for the upper region, the corresponding abdominal region, and the corresponding tail region are obtained for each initial back image. The image confidence score is then derived based on the confidence scores for the upper region, the abdominal region, and the tail region of the same initial back image. The target features of each initial back image are input into a weight prediction model to obtain the corresponding reference weight. The target weight is then calculated based on the image confidence scores and the reference weights for all initial back images.

[0107] It should be noted that the tail area is the area outside the abdomen area in the lower area.

[0108] It should be noted that the confidence level can be derived from features extracted from the image region, such as the clarity, degree of occlusion, and degree of regional image deformation of the corresponding image region, which can be used to estimate the reliability of the pig's weight. When calculating the image confidence level of each initial back image, weights can be assigned based on the importance of the upper region, abdominal region, and tail region. The image confidence level is calculated by linearly weighting the confidence levels of the upper region, abdominal region, and tail region according to the weights.

[0109] It should be noted that the confidence value range is [0, 1], that is, when the confidence value is 0, it means that the features of the image area cannot be used to estimate the weight of the pig. When the confidence value is about 1, it means that the features of the image area are more reliable for estimating the weight of the pig.

[0110] In this embodiment, the weight values corresponding to the confidence of the upper region, the confidence of the abdomen region, and the confidence of the tail region are all 1, that is, the image confidence is the sum of the confidence of the upper region, the confidence of the abdomen region, and the confidence of the tail region. The method for calculating the target weight W includes:

[0111] ;

[0112] Where m represents the number of initial back images, c j represents the image confidence corresponding to the jth initial back image, w j represents the reference weight corresponding to the j-th initial back image.

[0113] It should be noted that when estimating weight, eigenvalues are extracted from multiple initial back images of the same target pig, and the output of each eigenvalue in the weight prediction model is used as a reference for the estimated weight of the target pig. The output result of the corresponding weight prediction model is corrected according to the image confidence of different areas in different initial images, so that the final target weight is stably predicted, and the recognition tolerance for non-ideal images is enhanced. Especially when it is difficult to obtain an ideal back image of the target pig, the accuracy of the target pig's weight estimation result is improved to adapt to different image acquisition conditions in actual application scenarios. For example, the image clarity of the upper area in the first initial back image is poor, and there is occlusion in the tail area in the second initial back image.

[0114] In this embodiment, the confidence level includes a curvature component and an occlusion component, but is not limited thereto. The confidence level for the upper region can be calculated by linearly weighting the curvature and occlusion components according to preset weights. The confidence levels for the abdomen and tail regions are similar and will not be further described here.

[0115] In this embodiment, the greater the curvature of the target pig in the upper region, the greater the probability that the shoulder width extracted in the upper region is different from the actual value, and the lower the reliability of estimating the pig's weight based on the shoulder width extracted in the upper region. Correspondingly, a smaller curvature component is used when calculating the confidence level. The smaller the curvature of the target pig in the upper region, the smaller the probability that the shoulder width extracted in the upper region is different from the actual value, and the higher the reliability of estimating the pig's weight based on the shoulder width extracted in the upper region. Correspondingly, a higher curvature component is used when calculating the confidence level.

[0116] In this embodiment, refer to the attached Figure 3 As shown, the method further includes: calculating the coordinates of the center of mass of the upper region, which is recorded as the coordinates of the center of mass C1 (C 1x , C 1y ). Calculate the coordinates of the center of mass of the abdominal area, and record the coordinates of the center of mass C2 as (C 2x , C 2y ). Calculate the coordinates of the center of mass of the tail area, and record it as the coordinates of the center of mass C3 (C 3x , C 3y). Construct a line connecting the center of mass of the upper region and the center of mass of the tail region to obtain the first characteristic line l4. Construct a line connecting the center of mass of the upper region and the center of mass of the abdominal region to obtain the second characteristic line l5. Construct a line connecting the center of mass of the tail region and the center of mass of the abdominal region to obtain the third characteristic line l6. The curvature component of the upper region is obtained based on the angle α1 between the first characteristic line l4 and the second characteristic line l5. The curvature component of the tail region is obtained based on the angle α2 between the first characteristic line l4 and the third characteristic line l6. The curvature component of the abdominal region is obtained based on the angle α3 between the second characteristic line l5 and the third characteristic line l6.

[0117] It should be noted that the first characteristic line l4 describes the target pig's overall back posture, while the second characteristic line l5 describes the target pig's shoulder posture. A larger angle α1 between the two indicates a greater shoulder curvature, corresponding to a smaller curvature component. A smaller angle α1 indicates a smaller shoulder curvature, corresponding to a larger curvature component. The third characteristic line l6 describes the target pig's overall back posture. A larger angle α2 indicates a greater hip curvature, corresponding to a smaller curvature component. A smaller angle α2 indicates a smaller hip curvature, corresponding to a larger curvature component. A larger angle α3 indicates a smaller abdominal curvature, corresponding to a larger curvature component. A smaller angle α3 indicates a greater abdominal curvature, corresponding to a smaller curvature component. If and only if the first characteristic line l4 , the second characteristic line l5 and the third characteristic line l6 coincide with each other, the posture of the target pig does not have any bend.

[0118] It should be noted that the centroids of the upper, abdominal, and hip regions can be used to quickly determine whether the target pig has localized curvature. For example, when a pig is walking in a straight line, the range of its shoulders' swing is smaller than its hips' due to head and neck constraints. Therefore, the confidence level for the upper region is higher than that for the abdominal region. This method not only reduces judgment complexity but is also less susceptible to image noise.

[0119] It should be noted that image areas with greater occlusion levels use smaller occlusion components, and image areas with greater occlusion levels use smaller occlusion components. The occlusion component can be used to determine whether occlusion exists based on image recognition methods such as whether the contour area is connected, whether there are sudden changes in edges based on contour analysis, and whether there are sudden changes in color at the contour boundary based on optical flow. If occlusion exists, the probability of error in pig weight estimation based on the image increases, and the occlusion component of the corresponding image can be set to 0. If there is no occlusion, the occlusion component of the corresponding image can be set to 1.

[0120] In this embodiment, the method further includes identifying skeletal keypoints corresponding to the target pig in each of the initial back images using a neural network model. The occlusion component is obtained based on the type of skeletal keypoints and the number of corresponding types. The preset types of skeletal keypoints include shoulder keypoints, abdomen keypoints, and hip keypoints, but are not limited thereto.

[0121] It should be noted that the value range of the occlusion degree component can be preset. For example, the preset minimum value is preset to 0, the preset maximum value is preset to 1, and the preset intermediate value is preset to 0.5.

[0122] In a feasible embodiment, if the image recognition result includes all preset types and the number of bone key points corresponding to each type is 2, the corresponding image is regarded as not occluded, and the occlusion components of the corresponding image in the upper area, abdominal area and tail area are set to the preset maximum value, that is, the value is 1; if the number of bone key points of the preset type in the image recognition result is less than 2, the corresponding image is regarded as occluded, and the occlusion components of the corresponding image in the upper area, abdominal area and tail area are set to the preset minimum value, that is, the value is 0.

[0123] In another feasible embodiment, if the image recognition result includes all preset types, and the number of skeletal key points corresponding to each type is 2, the corresponding image is deemed to have no occlusion, and the occlusion degree components of the corresponding image in the upper area, abdomen area and tail area are all set to the preset maximum value, that is, the value is 1. If the number of skeletal key points of the preset type in the image recognition result is less than 2, the corresponding image is deemed to have occlusion, and the occlusion degree component of the area corresponding to the preset type where the number of skeletal key points in the recognition result is less than 2 is set to the preset minimum value, that is, the value is 0, and the occlusion degree component of the area corresponding to the preset type where the number of skeletal key points in the recognition result is equal to 2 is set to the preset maximum value, that is, the value is 1.

[0124] It should be noted that when the weight prediction model estimates the weight of a target pig, the source of feature extraction is the back image of the target pig. Since the pig's back is flat and wide, and the image is mainly taken from a top-down angle from above the pig house, any occlusion in the back image of the target pig is mainly caused by other pigs blocking it from the side. The occlusion is concentrated at the edge of the back image, and there is very little occlusion that changes the connectivity of the back image. The recognition results of the target pig's shoulder key points, abdomen key points, and hip key points are used as the basis for determining whether there is occlusion. In accordance with the calculation mechanism of the weight prediction model, the probability of the image being misjudged as invalid due to the presence of occlusion in non-critical parts such as the tail, legs, and ears is reduced, thereby improving the utilization rate of the collected images.

[0125] In another feasible embodiment, if the image recognition result includes all preset types, and the number of skeletal key points corresponding to each type is 2, the corresponding image is deemed to have no occlusion, and the occlusion degree components of the corresponding image in the upper area, abdomen area and tail area are all set to the preset maximum value, that is, the value is 1. If the number of skeletal key points of the preset type in the image recognition result is less than 2, the corresponding image is deemed to have occlusion, and the occlusion degree component of the area corresponding to the preset type where the number of skeletal key points in the recognition result is equal to 0 is set to the preset minimum value, that is, the value is 0; the occlusion degree component of the area corresponding to the preset type where the number of skeletal key points in the recognition result is equal to 1 is set to the preset intermediate value, that is, the value is 0.5; the occlusion degree component of the area corresponding to the preset type where the number of skeletal key points in the recognition result is equal to 2 is set to the preset maximum value, that is, the value is 0.

[0126] It should be noted that, for example, if the neural network model recognizes two shoulder key points in the initial back image, the occlusion component of the upper area corresponding to the initial back image is set to 1; if the neural network model recognizes one abdominal key point in the initial back image, the occlusion component of the abdominal area corresponding to the initial back image is set to 0.5; if the neural network model does not recognize the hip key point in the initial back image, the occlusion component of the tail area corresponding to the initial back image is set to 0.

[0127] According to the second aspect of the present invention, the present invention claims a pig weight detection system based on back image recognition, referring to the attached Figure 4 Shown, including:

[0128] Image acquisition module: extracts the back area from the initial back image of the target pig to obtain the target back image;

[0129] Feature extraction module: extracts the eigenvalues of the target back image to obtain the target features; the eigenvalues include shoulder width, hip width, and abdominal width. The feature extraction module includes:

[0130] Construct a coordinate system on the target back image and calculate the coordinates of the center of mass of the back area;

[0131] Construct a minimum circumscribed rectangle of the back region, and construct a straight line through the centroid that is parallel to the short side of the minimum circumscribed rectangle to obtain a reference line; the reference line divides the back region into an upper region and a lower region;

[0132] In the upper and lower regions, the maximum characteristic line parallel to the reference line and with the largest distance between the two intersection points with the back contour is retrieved respectively; the shoulder width is obtained based on the maximum distance between the corresponding intersection points in the upper region; the hip width is obtained based on the maximum distance between the corresponding intersection points in the lower region;

[0133] The abdominal area is obtained based on the dorsal area between the maximum characteristic line of the lower area and the reference line;

[0134] In the abdominal area, the minimum feature line that is parallel to the reference line and has the smallest distance between the two intersection points with the back contour is retrieved, and the abdominal width is obtained based on the distance between the intersection points of the minimum feature line and the back contour.

[0135] Weight prediction module: obtains the target weight based on the output of the weight prediction model according to the target features.

[0136] In one feasible embodiment, the number of initial back images is greater than one, and the system further comprises a confidence acquisition module: obtaining corresponding image confidences according to the confidences of the upper region, the abdomen region, and the tail region corresponding to each initial back image; the tail region confidence is obtained according to the confidences of the regions other than the abdomen region in the lower region;

[0137] The weight prediction module also inputs the target features of each initial back image into the weight prediction model to obtain the corresponding reference weight; and calculates the target weight based on the image confidence of all initial back images and the reference weight.

[0138] In a feasible implementation, the confidence includes a curvature component, and the confidence acquisition module further includes a curvature acquisition submodule, and the curvature acquisition submodule includes:

[0139] Calculate the centroid coordinates of the upper, abdominal, and tail regions, respectively;

[0140] Construct a line connecting the centroid of the upper region and the centroid of the tail region to obtain the first characteristic line;

[0141] Construct a line connecting the centroid of the upper region and the centroid of the abdominal region to obtain the second characteristic line;

[0142] Construct a line connecting the center of mass of the tail region and the center of mass of the abdomen region to obtain the third characteristic line;

[0143] The curvature component of the upper region is obtained according to the angle between the first characteristic line and the second characteristic line;

[0144] The curvature component of the tail region is obtained according to the angle between the first characteristic line and the third characteristic line;

[0145] The curvature component of the abdominal region is obtained according to the included angle between the second characteristic line and the third characteristic line.

[0146] In a feasible implementation, the confidence acquisition module further includes an occlusion acquisition submodule, and the confidence acquisition module further includes performing a linear weighted calculation on the output of the bending acquisition submodule and the output of the occlusion acquisition submodule according to a preset weight.

[0147] In a feasible embodiment, the occlusion acquisition submodule also includes: identifying the key points corresponding to the target pig in each of the initial back images; obtaining the target key point type and the corresponding key point number based on the key point recognition results; if the target key point type includes all preset key point types, and each type corresponds to 2 key points identified, the occlusion degree components corresponding to the upper area, abdominal area and tail area of the initial back image are all set to preset maximum values; the preset key point types include shoulder key points, abdominal key points and buttocks key points.

[0148] In a feasible embodiment, the occlusion acquisition submodule also includes: setting the occlusion degree component of the image area corresponding to the preset key point type with a key point number of 0 in the key point recognition result to a preset minimum value; setting the occlusion degree component of the image area corresponding to the preset key point type with a key point number of 2 in the key point recognition result to a preset maximum value; and setting the occlusion degree component of the image area corresponding to the preset key point type with a key point number of 1 in the key point recognition result to a preset intermediate value.

[0149] In a feasible embodiment, the weight prediction model is constructed and trained based on a support vector regression model.

[0150] Refer to the attached Figure 5 As shown, an embodiment of the present application provides an electronic device, including: a processor and a memory, the processor and the memory are interconnected and communicate with each other through a communication bus and / or other forms of connection mechanisms (not shown), the memory stores a computer program executable by the processor, and when the computing device is running, the processor executes the computer program to execute the system in any optional implementation mode of the above embodiment.

[0151] An embodiment of the present application provides a storage medium, wherein when the computer program is executed by a processor, the system of any optional implementation of the above embodiment is executed. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0152] In the embodiments provided in this application, it should be understood that the disclosed system can be implemented in other ways. The system embodiments described above are merely schematic. For example, the division of the modules is only a logical function division, and can be implemented in another way. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interface, indirect coupling or communication connection of the system or unit, which can be electrical, mechanical or other forms.

[0153] In addition, the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0154] Furthermore, the functional modules in the various embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0155] Flowcharts are used herein to illustrate the steps of the methods of the embodiments of the present disclosure. It should be understood that the preceding or following steps do not necessarily need to be performed in exact order. Instead, the various steps may be evaluated in reverse order or simultaneously. Furthermore, other operations may be added to these processes.

[0156] Unless otherwise defined, all terms used herein have the same meaning as commonly understood by those skilled in the art to which the present disclosure belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and should not be interpreted in an idealized or highly formal sense unless expressly defined as such herein.

[0157] The above is a detailed introduction to the provided method and system for detecting the weight of pigs based on back image recognition. This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only an embodiment of this application, which is only used to help understand the method and system for detecting the weight of pigs based on back image recognition of this application, and is not used to limit the scope of protection of this application. At the same time, for those skilled in the art, this application can have various changes and variations. Any modifications and equivalent substitutions made within the spirit and principles of this application should be included in the scope of protection of this application.

Claims

1. A method for detecting pig weight based on back image recognition, characterized in that: include: extracting a back region from an initial back image of a target pig to obtain a target back image; Extract the feature values of the target back image to obtain the target features; Obtain target weight based on the output of the weight prediction model based on the target features; The eigenvalues include shoulder width, hip width, and abdominal width. The eigenvalue extraction methods include: Construct a coordinate system on the target back image and calculate the coordinates of the center of mass of the back area; Construct a minimum circumscribed rectangle of the back region, and construct a straight line through the centroid that is parallel to the short side of the minimum circumscribed rectangle to obtain a reference line; the reference line divides the back region into an upper region and a lower region; In the upper and lower regions, the maximum characteristic line parallel to the reference line and with the largest distance between the two intersection points with the back contour is retrieved respectively; the shoulder width is obtained based on the maximum distance between the corresponding intersection points in the upper region; the hip width is obtained based on the maximum distance between the corresponding intersection points in the lower region; The abdominal area is obtained based on the dorsal area between the maximum characteristic line of the lower area and the reference line; Retrieve the minimum characteristic line in the abdominal region that is parallel to the reference line and has the smallest distance between the two intersection points with the back contour, and obtain the abdominal width according to the distance between the intersection points of the minimum characteristic line and the back contour; The number of the initial back images is greater than 1, and the method further includes: Obtaining corresponding image confidences according to the confidences of the upper region, the abdomen region, and the tail region of each initial back image; the tail region confidence is obtained according to the confidences of the regions other than the abdomen region in the lower region; The target features of each initial back image are input into the weight prediction model to obtain the corresponding reference weight; The target weight is calculated based on the image confidence of all initial back images and the reference weight. The target weight is calculated by: ; Where W represents the target weight, m represents the number of initial back images, and c j represents the image confidence corresponding to the jth initial back image, w j represents the reference weight corresponding to the jth initial back image; The confidence metric includes a tortuosity component, the method further comprising: Calculate the centroid coordinates of the upper, abdominal, and tail regions, respectively; Construct a line connecting the centroid of the upper region and the centroid of the tail region to obtain the first characteristic line; Construct a line connecting the centroid of the upper region and the centroid of the abdominal region to obtain the second characteristic line; Construct a line connecting the center of mass of the tail region and the center of mass of the abdomen region to obtain the third characteristic line; The curvature component of the upper region is obtained according to the angle between the first characteristic line and the second characteristic line; The curvature component of the tail region is obtained according to the angle between the first characteristic line and the third characteristic line; The curvature component of the abdominal region is obtained according to the angle between the second characteristic line and the third characteristic line; The confidence level also includes an occlusion degree component, and the confidence level is obtained by performing a linear weighted calculation on a curvature degree component and an occlusion degree component according to a preset weight.

2. A pig weight detection method based on back image recognition according to claim 1, characterized in that: The method also includes: identifying key points corresponding to the target pig in each of the initial back images; obtaining the target key point type and the corresponding key point quantity based on the key point identification results; if the target key point type includes all preset key point types, and each type corresponds to two key points identified, the occlusion components corresponding to the upper area, abdominal area and tail area of the corresponding initial back image are all set to preset maximum values; the preset key point types include shoulder key points, abdominal key points and buttocks key points.

3. The method for detecting pig weight based on back image recognition according to claim 2, characterized in that: The method also includes: setting the occlusion degree component of the image area corresponding to the preset key point type with a key point number of 0 in the key point recognition result to a preset minimum value; setting the occlusion degree component of the image area corresponding to the preset key point type with a key point number of 2 in the key point recognition result to a preset maximum value; and setting the occlusion degree component of the image area corresponding to the preset key point type with a key point number of 1 in the key point recognition result to a preset intermediate value.

4. A method for detecting pig weight based on back image recognition according to any one of claims 1 to 3, characterized in that: The weight prediction model is constructed and trained based on a support vector regression model.

5. A pig weight detection system based on back image recognition, characterized in that: include: Image acquisition module: extracts the back area from the initial back image of the target pig to obtain the target back image; Feature extraction module: extracts the feature values of the target back image to obtain the target features; The feature values include shoulder width, hip width and abdominal width, and the feature extraction module includes: Construct a coordinate system on the target back image and calculate the coordinates of the center of mass of the back area; Construct a minimum circumscribed rectangle of the back region, and construct a straight line through the centroid that is parallel to the short side of the minimum circumscribed rectangle to obtain a reference line; the reference line divides the back region into an upper region and a lower region; In the upper and lower regions, the maximum characteristic line parallel to the reference line and with the largest distance between the two intersection points with the back contour is retrieved respectively; the shoulder width is obtained based on the maximum distance between the corresponding intersection points in the upper region; the hip width is obtained based on the maximum distance between the corresponding intersection points in the lower region; The abdominal area is obtained based on the dorsal area between the maximum characteristic line of the lower area and the reference line; Retrieve the minimum characteristic line in the abdominal region that is parallel to the reference line and has the smallest distance between the two intersection points with the back contour, and obtain the abdominal width according to the distance between the intersection points of the minimum characteristic line and the back contour; Weight prediction module: obtains the target weight based on the output of the weight prediction model based on the target features; The number of initial back images is greater than one, and the system further comprises a confidence acquisition module: obtaining corresponding image confidences according to the confidences of the upper region, the abdomen region, and the tail region corresponding to each initial back image; the tail region confidence is obtained according to the confidences of the regions other than the abdomen region in the lower region; The weight prediction module also inputs the target features of each initial back image into the weight prediction model to obtain the corresponding reference weight; and calculates the target weight based on the image confidence of all initial back images and the reference weight. The target weight calculation method includes: ; Where W represents the target weight, m represents the number of initial back images, and c j represents the image confidence corresponding to the jth initial back image, w j represents the reference weight corresponding to the jth initial back image; The confidence includes a curvature component, and the confidence acquisition module further includes a curvature acquisition submodule, and the curvature acquisition submodule includes: Calculate the centroid coordinates of the upper, abdominal, and tail regions, respectively; Construct a line connecting the centroid of the upper region and the centroid of the tail region to obtain the first characteristic line; Construct a line connecting the centroid of the upper region and the centroid of the abdominal region to obtain the second characteristic line; Construct a line connecting the center of mass of the tail region and the center of mass of the abdomen region to obtain the third characteristic line; The curvature component of the upper region is obtained according to the angle between the first characteristic line and the second characteristic line; The curvature component of the tail region is obtained according to the angle between the first characteristic line and the third characteristic line; The curvature component of the abdominal region is obtained according to the angle between the second characteristic line and the third characteristic line; The confidence acquisition module further includes an occlusion acquisition submodule, and the confidence acquisition module further includes performing a linear weighted calculation on the output of the bending acquisition submodule and the output of the occlusion acquisition submodule according to a preset weight.

Citation Information

Patent Citations

  • Non-contact body weight measurement method and system for live pigs, electronic equipment and storage medium

    CN116485823A

  • Livestock weight estimation method, device and equipment and computer readable storage medium

    CN111243005A

  • Construction method of live pig body composition prediction model based on machine vision and machine learning

    CN118097364A