Vision-based pig weight estimation method

By building a three-dimensional model through a multi-view camera system and image processing technology, combined with back fat texture and exercise energy index, the problems of accuracy and speed in pig weight measurement in complex environments are solved, and non-contact, fast and accurate estimation of pig weight is achieved.

CN120633944APending Publication Date: 2025-09-12INST OF ANIMAL HUSBANDRY & VETERINARY MEDICINE HENAN ACAD OF AGRI SCI
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510972646.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-15
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Existing pig weight measurement methods have difficulty achieving multi-angle and multi-dimensional data collection and fusion in complex breeding environments, resulting in low measurement accuracy and susceptibility to light and animal posture, making it impossible to estimate weight quickly and without interference.

Method used

A multi-view camera system is used to acquire images of breeding pigs. Mask coordinates are generated through image preprocessing. A skeleton-constrained ICP algorithm is used to construct a three-dimensional model. The back fat texture and motion energy index are combined and input into a dual-branch prediction model for weight estimation.

Benefits of technology

It realizes accurate and contactless measurement of pig weight in complex environments, improves the speed and accuracy of measurement, and supports production management and breeding selection in farms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120633944A_ABST
    Figure CN120633944A_ABST
Patent Text Reader

Abstract

The invention discloses a pig weight estimation method based on vision, and belongs to the field of intelligent breeding, and the method comprises the following steps: obtaining an initial image set of a breeding pig based on a multi-view camera system; performing image preprocessing on the initial image set to obtain mask coordinates; registering the multi-view point cloud of the boar depth image into a complete three-dimensional model by using a skeleton constraint ICP algorithm based on the mask coordinates, and determining the body structure representation of the boar based on the complete three-dimensional model; and inputting the body structure representation of the boar, the back fat texture features of the boar and the kinetic energy index into a double-branch prediction model to obtain a final weight estimation value of the boar. According to the invention, the influence of complex environment and light change of a farm is overcome, and accurate non-contact measurement of the boar weight is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of intelligent farming, and in particular relates to a pig weight estimation method based on vision. Background Art

[0002] In modern agriculture, accurate measurement of livestock weight is crucial for breeding management, growth monitoring, and improving economic benefits. Especially in large-scale breeding environments, real-time knowledge of weight can directly influence feeding strategies and resource allocation, and is a core link in promoting the development of intelligent breeding. However, current mainstream weight measurement methods mostly rely on manual operation or contact equipment, which is not only inefficient but also easily causes stress reactions in animals, affecting their health and growth. At the same time, these methods often have difficulty in ensuring measurement accuracy in complex environments, especially in low light conditions or when animals move frequently, which greatly challenges the reliability of the data.

[0003] Existing solutions are limited by their inability to adapt to the changing environmental conditions of farms, and the measurement process is time-consuming, making it difficult to achieve fast and non-intrusive operation. More importantly, traditional methods lack comprehensiveness in data collection and analysis, making it difficult to fully reflect the animal's true physical condition, resulting in significant deviations in the estimated results.

[0004] Against this backdrop, the field faces significant technical challenges. The primary issue is how to achieve multi-angle and multi-dimensional data acquisition in complex environments, ensuring stable image information under varying lighting conditions and animal postures. This acquisition challenge further necessitates an urgent need for data fusion: integrating data from different perspectives and types into a complete morphological model to accurately reflect the animal's physical characteristics. This fusion process, in turn, places higher demands on feature analysis and prediction accuracy, as a single data dimension cannot fully capture an animal's growth status. Comprehensive assessment of multiple features is necessary to improve the reliability of the estimate.

[0005] Therefore, how to build a fast, accurate and non-interference weight estimation system through efficient collection and integration of multi-dimensional data and comprehensive analysis of multiple features in a complex breeding environment has become a key issue that needs to be overcome in this study. Summary of the Invention

[0006] In order to solve the above technical problems, the present invention proposes a pig weight estimation method based on vision to solve the problems existing in the above-mentioned prior art.

[0007] To achieve the above object, the present invention provides a method for estimating pig weight based on vision, comprising the following steps:

[0008] Obtaining an initial image set of breeding pigs based on a multi-view camera system;

[0009] Performing image preprocessing on the initial image set to obtain mask coordinates;

[0010] Based on the mask coordinates, a skeleton-constrained ICP algorithm is used to register the multi-view point cloud of the sow depth image into a complete three-dimensional model, and a body structure representation of the sow is determined based on the complete three-dimensional model;

[0011] The body structure representation of the sow, the back fat texture characteristics of the sow, and the exercise energy index are input into a two-branch prediction model to obtain a final weight estimation value of the sow.

[0012] Optionally, the multi-view camera system is a stereoscopic vision array, which includes: a top-view and a bilateral 45° tilted RGB-D camera, and a camera with a 940nm near-infrared fill light module.

[0013] Optionally, the process of performing image preprocessing on the initial image set to obtain mask coordinates includes:

[0014] Obtain original images from the initial image set, and use image reading tools to extract pixel information of each original image to obtain basic image data;

[0015] Using a median filter algorithm to perform denoising on the basic image data to obtain denoised intermediate image data;

[0016] Performing brightness correction on the denoised intermediate image data using a histogram equalization method to obtain brightness-adjusted image data;

[0017] Performing format unification processing on the brightness-adjusted image data to obtain a corrected image data set;

[0018] An improved YOLOv5s model is used to perform real-time target detection on the corrected image dataset to generate mask coordinates.

[0019] Optionally, the process of performing real-time target detection on the corrected image dataset using an improved YOLOv5s model to generate mask coordinates includes:

[0020] The improved YOLOv5s model is used to perform real-time detection on the corrected image dataset to obtain preliminary target recognition results;

[0021] Based on the preliminary target recognition results, combined with depth image processing technology, depth information of the target area is extracted to determine the three-dimensional feature data of the target;

[0022] Based on the three-dimensional feature data, construct an accurate mask for the target area and obtain corresponding mask boundary information;

[0023] A coordinate extraction operation is performed on the mask boundary information to generate mask coordinates corresponding to the target area.

[0024] Optionally, the process of registering the multi-view point cloud of the sow depth image into a complete three-dimensional model using the skeleton-constrained ICP algorithm includes:

[0025] Based on the mask coordinates, applying a mask to the sow depth image to obtain target area depth data;

[0026] The target area depth data is converted into a three-dimensional point cloud by using a camera intrinsic parameter matrix;

[0027] Performing initial alignment on the three-dimensional point clouds from multiple perspectives, and calculating an initial transformation matrix using a stereo microscope projection method, and fusing the initially aligned three-dimensional point clouds based on the initial transformation matrix to obtain an initial point cloud set;

[0028] A Laplacian shrinkage algorithm is used to extract a boar skeleton from the initial point cloud set to obtain a boar skeleton model;

[0029] The ICP algorithm is used to register the pig skeleton features and the initial point cloud set, and the distance between point clouds is iteratively calculated to obtain the registered point cloud data.

[0030] By registering point cloud data, a complete three-dimensional model is generated using voxel gridding method;

[0031] Extracting key points of body shape from the complete three-dimensional model, comparing the key points of body shape with a preset body shape template, and adjusting the model through surface fitting to obtain body shape structure data;

[0032] A body shape structure representation is generated based on the body shape structure data.

[0033] Optionally, when the ICP algorithm is used to register the pig skeleton features and the initial point cloud set, the skeleton constraint expression is:

[0034]

[0035] Where, E total is the total optimization objective function, which is used to minimize the point cloud registration error and skeleton deformation error at the same time, E ICP is the traditional ICP error term, λ is the weight coefficient, s j is the optimized skeleton feature point, s j ' is the theoretical position of the skeleton point after registration, R is the rotation matrix, and t is the translation vector.

[0036] Optionally, the dual-branch prediction model includes: a ResNet18 branch and a Bi-LSTM branch;

[0037] The process of inputting the sow's body structure representation, the sow's back fat texture characteristics, and the exercise energy index into a two-branch prediction model to obtain the sow's final weight estimate includes:

[0038] Obtaining a comprehensive feature set of the breeding pig based on the body structure representation of the breeding pig;

[0039] The comprehensive feature set of the sow and the back fat texture feature of the sow are input into the ResNet18 branch. The ResNet18 branch extracts spatial morphological features through a 3D convolutional network, and processes geometric parameters through a fully connected network, and finally outputs a 512-dimensional static feature vector;

[0040] At the same time, the exercise energy index and weight growth curve are input into the Bi-LSTM branch, which uses a bidirectional LSTM network to capture temporal patterns and output 256-dimensional dynamic features;

[0041] The 512-dimensional static feature vector, 256-dimensional dynamic feature and breed label are input into the breed self-attention fusion layer to obtain the final weight estimation value of the breeding pig.

[0042] Compared with the prior art, the present invention has the following advantages and technical effects:

[0043] This paper discloses a method for estimating the weight of breeding pigs based on multi-view images. This method utilizes a stereoscopic vision array to acquire multi-angle image data, employs an improved YOLOv5s model for target detection and accurate mask generation, and constructs a complete three-dimensional model using a skeleton-constrained ICP algorithm. Key body structure parameters and deep feature vectors are extracted, and multimodal feature vectors are constructed by combining back fat texture and locomotor energy index. Finally, this method inputs into a dual-branch prediction model to obtain a weight estimate. This method overcomes the complex environment and light variations of breeding farms, enabling accurate, contactless measurement of breeding pig weight, providing important technical support for farm production management and breeding selection. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:

[0045] Figure 1 This is a flow chart of a vision-based pig weight estimation method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0046] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0047] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0048] Example 1

[0049] like Figure 1 As shown, this embodiment provides a method for estimating pig weight based on vision, comprising the following steps:

[0050] S1. Obtain an initial set of images of sows based on a multi-view camera system. By deploying a multi-view camera system, we capture image data of sows from different angles, taking into account the complex environmental conditions and lighting variations within the farm. This initial set of images covers the morphological characteristics of sows in various postures, resulting in the initial image set.

[0051] Furthermore, the multi-view camera system is a stereoscopic vision array, which includes: top-view and dual-side 45° tilted RGB-D cameras, combined with a 940nm near-infrared fill light module to ensure stable imaging in all weather conditions.

[0052] S2. Perform image preprocessing on the initial image set to obtain mask coordinates.

[0053] Furthermore, the process of performing image preprocessing on the initial image set to obtain mask coordinates includes: obtaining original images from the initial image set, using an image reading tool to extract pixel information of each original image to obtain basic image data; using a median filtering algorithm to denoise the basic image data to obtain denoised intermediate image data; using a histogram equalization method to perform brightness correction on the denoised intermediate image data to obtain brightness-adjusted image data; performing format unification processing on the brightness-adjusted image data to obtain a corrected image data set; and using an improved YOLOv5s model to perform real-time target detection on the corrected image data set to generate mask coordinates.

[0054] Furthermore, as a specific implementation of this embodiment, when processing sow image data, the initial image set contains noise and uneven lighting caused by different shooting environments. To address these issues, the pixel information of each image is first extracted using an image reading tool to form basic image data. Assume that the resolution of an image is 1920x1080, the pixel values ​​are stored in grayscale form, and the value of each pixel ranges from 0 to 255. When solving the sow interference problem, a median filtering algorithm is used for denoising. The principle of median filtering is to use a sliding window, such as a 3x3 window, to calculate the median of the pixel values ​​within the window to replace the center pixel value, thereby effectively removing isolated noise points. Assuming that there is a lot of noise around a certain pixel point, after median filtering, the noise points in the generated intermediate image data are smoothed, and the overall image is clearer. To address the problem of light changes in the intermediate image data, a histogram equalization method is used to correct brightness. Its principle is to adjust the grayscale value distribution of the original image to a uniform distribution, thereby enhancing image contrast. Suppose an image of a sow is dark in some areas due to backlighting during capture. Histogram equalization allows details in these dark areas to be revealed, generating temporary image data with adjusted brightness. If localized lighting unevenness still exists in the temporary image data, a secondary adjustment is performed using local contrast enhancement techniques. This involves contrast stretching local areas of the image, for example, enhancing detail lost at the edges of the sow's body due to shadows. Suppose the grayscale values ​​of a certain area are concentrated between 50 and 100. After adjustment, this value is expanded to between 30 and 120, resulting in more pronounced details and optimized adjusted image data. Finally, the processed image data is formatted uniformly to generate a corrected image dataset. Assume all images are standardized to JPEG format, with a resolution of 1280x720 to ensure compatibility with subsequent analysis systems.

[0055] The process of using the improved YOLOv5s model to perform real-time target detection on the corrected image dataset and generate mask coordinates includes: using the improved YOLOv5s model to perform real-time detection on the corrected image dataset to obtain a preliminary target recognition result; based on the preliminary target recognition result, combined with deep image processing technology, depth information of the target area is extracted to determine the three-dimensional feature data of the target; based on the three-dimensional feature data, an accurate mask is constructed for the target area to obtain corresponding mask boundary information; and a coordinate extraction operation is performed on the mask boundary information to generate mask coordinates corresponding to the target area.

[0056] Furthermore, as a specific implementation method of this embodiment, when processing the corrected image dataset, an improved YOLOv5s model is used for real-time detection, and the network structure of the model is adjusted to adapt to the recognition requirements of specific targets. In view of the characteristics of sow images, the model introduces more annotated data about the target area during the training phase, such as the body outline and key features of the sow, to ensure that the target area can be quickly locked even in complex backgrounds. Assuming that in an actual scenario, the image dataset contains 1,000 corrected sow images, in which the target area is partially blocked or insufficiently lit, the improved model prioritizes the local texture information of the target by adding a lightweight feature extraction layer, thereby improving the robustness of detection. Based on the preliminary target recognition results, when combining the depth information of the target area with the depth image processing technology, the binocular vision system is used to construct the three-dimensional data of the target. Specifically, the sow images are collected synchronously by two cameras, and the depth value of the target area is estimated based on the parallax principle, such as the stereo feature data within the range of 0.5 meters to 2 meters from the camera. When the mask generation technology is applied to the stereo feature data, an accurate mask is constructed for the target area through the segmentation algorithm. Assuming that in a sow image, the target area includes the body and head, the system automatically generates a mask based on the boundary differences in the depth data, closely fitting the target outline while excluding irrelevant background areas such as railings or the ground. When extracting the coordinates of the mask boundary information, a boundary tracking algorithm is used to obtain the specific coordinates of the target area. Assuming that in an image, the mask boundary of the sow's body is demarcated as a polygonal area, the system extracts the vertex coordinates of this area, such as the top left corner (x=100, y=200) and the bottom right corner (x=300, y=400), and other key point data.

[0057] S3. Based on the mask coordinates, the skeleton-constrained ICP algorithm is used to align the multi-view point cloud of the sow depth image into a complete three-dimensional model, and the body structure representation of the sow is determined based on the complete three-dimensional model.

[0058] Furthermore, the process of using the skeleton-constrained ICP algorithm to align the multi-view point clouds of the boar depth image into a complete three-dimensional model includes: based on the mask coordinates, applying a mask to the boar depth image to obtain target area depth data; the target area depth data is converted into a three-dimensional point cloud by using the camera intrinsic parameter matrix; the three-dimensional point clouds of multiple views are initially aligned, and the initial transformation matrix is ​​calculated using the stereo microscope projection method, and the initially aligned three-dimensional point clouds are fused based on the initial transformation matrix to obtain an initial point cloud set; the boar skeleton is extracted from the initial point cloud set using the Laplacian shrinkage algorithm to obtain a boar skeleton model; the boar skeleton features and the initial point cloud set are aligned using the ICP algorithm, and the distance between the point clouds is iteratively calculated to obtain aligned point cloud data; a complete three-dimensional model is generated by using the voxel gridding method through the aligned point cloud data; body key points are extracted from the complete three-dimensional model, the body key points are compared with the preset body template, and the model is adjusted by surface fitting to obtain body structure data; based on the body structure data, a body structure representation is generated.

[0059] Furthermore, as a specific implementation method of this embodiment, when extracting target area point cloud data from a depth image using mask coordinates, the target area pixels can be filtered based on the depth value of the depth camera to generate a three-dimensional point cloud. Assuming that the sow is standing on a fixed platform, the depth image captured by the depth camera has a resolution of 640x480 and a pixel depth value range of 0.5-2.0 meters. For the pixels within the mask coordinates, points with depth values ​​greater than 0.8 meters are extracted to generate an initial point cloud containing approximately 100,000 points. When using the stereo microscope projection method to generate a multi-view point cloud, the sow can be rotated relative to the camera by rotating the platform, and depth images can be collected from angles such as 0°, 45°, and 90°. Approximately 80,000 point cloud points are generated for each view, which are merged to form an initial point cloud set of approximately 300,000 points. This method uses multiple viewpoints to cover the entire sow body, compensating for occlusion problems caused by a single viewpoint and improving the integrity of the point cloud. When using skeleton constraint technology to extract the sow's skeletal features, key joints such as the shoulder, hip, and midpoint of the spine can be identified based on the geometric distribution of the point cloud. Assuming that the initial skeleton feature points are 20, if they are lower than the preset threshold of 30, 10 points are added to the spinal region through cubic spline interpolation to form an optimized skeleton model. When generating a three-dimensional model through voxel gridding, the point cloud can be divided into voxel grids with a side length of 0.02 meters, and adjacent voxels are merged to form a three-dimensional geometric representation of the boar, which contains approximately 50,000 voxels. Specifically, when extracting key points of body shape, points at the boar's chest circumference, waist circumference, and hip circumference can be identified, which are approximately 15 key points. If the deviation of the key point from the preset template exceeds 0.05 meters, the model is adjusted through quadratic surface fitting to generate smooth body structure data.

[0060] Furthermore, when the ICP algorithm is used to register the pig skeleton features and the initial point cloud set, the skeleton constraint expression is:

[0061]

[0062] Where, E total is the total optimization objective function, which is used to minimize the point cloud registration error and skeleton deformation error at the same time, E ICP is the traditional ICP error term, λ is the weight coefficient, s j is the optimized skeleton feature point, s j ' is the theoretical position of the skeleton point after registration, R is the rotation matrix, and t is the translation vector.

[0063] S4. Based on the body structure representation of the breeding pigs, the key parameters in the body structure of the Alpha-Shape algorithm are used to extract deep feature vectors related to weight, obtain a comprehensive feature set that can reflect the growth status of livestock, and introduce a body shape correction coefficient to optimize the volume estimation.

[0064] Furthermore, through the body structure representation, the Alpha-Shape algorithm is used to extract key parameters and generate a set of body key points. Based on the set of body key points, the principal component analysis method is used to extract deep features and generate deep feature vectors associated with weight. Through the deep feature vectors, the K-means clustering algorithm is used to classify the growth status of the breeding pigs and generate a comprehensive feature set. Based on the comprehensive feature set, the breeding pig body correction coefficient is calculated. If the deviation of the correction coefficient exceeds the preset threshold, the coefficient is adjusted through polynomial regression to obtain an optimized correction coefficient. By optimizing the correction coefficient, the volume of the body structure representation is estimated to generate a three-dimensional geometric representation of the livestock body shape. Based on the three-dimensional geometric representation, the growth status parameters of the livestock body shape are extracted to generate a body feature description.

[0065] S5. Input the comprehensive feature set of the sow, the back fat texture features of the sow, and the exercise energy index into a dual-branch prediction model to obtain the final weight estimate of the sow. The dual-branch prediction model includes a ResNet18 branch and a Bi-LSTM branch.

[0066] Furthermore, the comprehensive feature set of the boar, the back fat texture features and the exercise energy index of the boar are input into the dual-branch prediction model to obtain the final weight estimation value of the boar, which includes: obtaining the comprehensive feature set of the boar based on the body structure representation of the boar; inputting the comprehensive feature set of the boar and the back fat texture features of the boar into the ResNet18 branch, the ResNet18 branch extracts spatial morphological features through a 3D convolutional network, and processes geometric parameters through a fully connected network, and finally outputs a 512-dimensional static feature vector; at the same time, the exercise energy index and the weight growth curve are input into the Bi-LSTM branch, the Bi-LSTM branch uses a bidirectional LSTM network to capture the timing pattern and outputs 256-dimensional dynamic features; the 512-dimensional static feature vector, the 256-dimensional dynamic features and the breed label are jointly input into the breed self-attention fusion layer to obtain the final weight estimation value of the boar.

[0067] Furthermore, as a specific implementation of this embodiment, a static visual feature branch (improved based on ResNet18) is used.

[0068] Input layer:

[0069] Body structure data: 12-dimensional geometric feature vector (body length, height, chest circumference, etc.), 64×64×64 voxel representation of the three-dimensional grid.

[0070] Fat texture features: 128×128 local binary pattern (LBP) texture map.

[0071] Geometric feature subnetwork: fully connected layer (12D→64D), ReLU activation, batch normalization (BatchNorm) layer.

[0072] 3D voxel processing subnetwork: 3D convolution layer (1→32 channels, 3×3×3 kernel) → BatchNorm → ReLU → 3D max pooling (2×2×2); repeat the convolution-pooling operation 4 times, and finally output a 32-channel 8×8×8 feature tensor; after flattening, it is compressed to 256 dimensions through a fully connected layer.

[0073] Texture feature subnetwork: 2D convolution layer (1→32 channels, 3×3 kernel) → BatchNorm → ReLU → 2D max pooling; 4 layers of convolution-pooling output 32-channel 8×8 feature map; flattened and then fully connected layer to reduce the dimension to 8192 dimensions

[0074] Feature fusion: Concatenate geometric features (64 dimensions), voxel features (256 dimensions), and texture features (8192 dimensions) into an 8512-dimensional vector; then uniformly map them to a 512-dimensional static feature representation through a fully connected layer.

[0075] Furthermore, as a specific implementation of this embodiment, dynamic time series feature branching (based on Bi-LSTM).

[0076] Input layer:

[0077] Motion energy sequence: daily motion characteristics within 30 days (10 dimensions / day, including optical flow amplitude, direction distribution, etc.).

[0078] Growth curve: 30-day series of daily weight growth rates (1 dimension / day).

[0079] Motion feature encoder: bidirectional LSTM (10-dimensional input, 64-dimensional hidden layer, 2 stacked layers); the bidirectional output of the final time step is concatenated into a 128-dimensional feature.

[0080] Growth curve encoder: bidirectional LSTM (1-dimensional input, 32-dimensional hidden layer); the final time step output is concatenated into 64-dimensional features.

[0081] Feature fusion: Merge motion features (128 dimensions) and growth curve features (64 dimensions) into a 192-dimensional vector; the fully connected layer compresses it to a 256-dimensional dynamic feature representation.

[0082] Furthermore, as a specific implementation of this embodiment, a self-attention fusion layer is provided.

[0083] Input processing:

[0084] Static features (512 dimensions) + dynamic features (256 dimensions) → concatenated into a 768-dimensional vector.

[0085] The variety labels (8-dimensional one-hot encoding) are expanded to 768 dimensions through a fully connected layer.

[0086] Attention Mechanism:

[0087] Weight generation: 768-dimensional fused features → 384-dimensional hidden layer (ReLU activation) → 2-dimensional Softmax output; the output weights correspond to the importance of static and dynamic branches respectively.

[0088] Feature modulation: static feature × static weight + dynamic feature × dynamic weight.

[0089] Output layer: The fully connected layer (768 dimensions → 1 dimension) directly outputs the weight estimate.

[0090] The above are merely preferred embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A method for estimating pig weight based on vision, characterized in that: The following steps are involved: Obtaining an initial image set of breeding pigs based on a multi-view camera system; Performing image preprocessing on the initial image set to obtain mask coordinates; Based on the mask coordinates, a skeleton-constrained ICP algorithm is used to register the multi-view point cloud of the sow depth image into a complete three-dimensional model, and a body structure representation of the sow is determined based on the complete three-dimensional model; The body structure representation of the sow, the back fat texture characteristics of the sow, and the exercise energy index are input into a two-branch prediction model to obtain a final weight estimation value of the sow.

2. The method for estimating pig weight based on vision according to claim 1, characterized in that: The multi-view camera system is a stereoscopic vision array, which includes: a top-view and a bilateral 45° tilted RGB-D camera, and a camera equipped with a 940nm near-infrared fill light module.

3. The method for estimating pig weight based on vision according to claim 1, characterized in that: The process of performing image preprocessing on the initial image set to obtain mask coordinates includes: Obtain original images from the initial image set, and use image reading tools to extract pixel information of each original image to obtain basic image data; Using a median filter algorithm to perform denoising on the basic image data to obtain denoised intermediate image data; Performing brightness correction on the denoised intermediate image data using a histogram equalization method to obtain brightness-adjusted image data; Performing format unification processing on the brightness-adjusted image data to obtain a corrected image data set; An improved YOLOv5s model is used to perform real-time target detection on the corrected image dataset to generate mask coordinates.

4. The method for estimating pig weight based on vision according to claim 3, characterized in that: The process of using the improved YOLOv5s model to perform real-time target detection on the corrected image dataset to generate mask coordinates includes: The improved YOLOv5s model is used to perform real-time detection on the corrected image dataset to obtain preliminary target recognition results; Based on the preliminary target recognition results, combined with depth image processing technology, depth information of the target area is extracted to determine the three-dimensional feature data of the target; Based on the three-dimensional feature data, construct an accurate mask for the target area and obtain corresponding mask boundary information; A coordinate extraction operation is performed on the mask boundary information to generate mask coordinates corresponding to the target area.

5. The method for estimating pig weight based on vision according to claim 1, characterized in that: The process of registering the multi-view point cloud of the pig depth image into a complete 3D model using the skeleton-constrained ICP algorithm includes: Based on the mask coordinates, applying a mask to the sow depth image to obtain target area depth data; The target area depth data is converted into a three-dimensional point cloud by using a camera intrinsic parameter matrix; Performing initial alignment on the three-dimensional point clouds from multiple perspectives, and calculating an initial transformation matrix using a stereo microscope projection method, and fusing the initially aligned three-dimensional point clouds based on the initial transformation matrix to obtain an initial point cloud set; A Laplacian shrinkage algorithm is used to extract a boar skeleton from the initial point cloud set to obtain a boar skeleton model; The ICP algorithm is used to register the pig skeleton features and the initial point cloud set, and the distance between point clouds is iteratively calculated to obtain the registered point cloud data. By registering point cloud data, a complete three-dimensional model is generated using voxel gridding method; Extracting key points of body shape from the complete three-dimensional model, comparing the key points of body shape with a preset body shape template, and adjusting the model through surface fitting to obtain body shape structure data; A body shape structure representation is generated based on the body shape structure data.

6. The method for estimating pig weight based on vision according to claim 5, characterized in that: When using the ICP algorithm to register the pig skeleton features and the initial point cloud set, the skeleton constraint expression is: Where, E total is the total optimization objective function, which is used to minimize the point cloud registration error and skeleton deformation error at the same time, E ICP is the traditional ICP error term, λ is the weight coefficient, s j is the optimized skeleton feature point, s j ' is the theoretical position of the skeleton point after registration, R is the rotation matrix, and t is the translation vector.

7. The method for estimating pig weight based on vision according to claim 1, characterized in that: The dual-branch prediction model includes: a ResNet18 branch and a Bi-LSTM branch; The process of inputting the sow's body structure representation, the sow's back fat texture characteristics, and the exercise energy index into a two-branch prediction model to obtain the sow's final weight estimate includes: Obtaining a comprehensive feature set of the breeding pig based on the body structure representation of the breeding pig; The comprehensive feature set of the sow and the back fat texture feature of the sow are input into the ResNet18 branch. The ResNet18 branch extracts spatial morphological features through a 3D convolutional network, and processes geometric parameters through a fully connected network, and finally outputs a 512-dimensional static feature vector; At the same time, the exercise energy index and weight growth curve are input into the Bi-LSTM branch, which uses a bidirectional LSTM network to capture temporal patterns and output 256-dimensional dynamic features; The 512-dimensional static feature vector, 256-dimensional dynamic feature and breed label are input into the breed self-attention fusion layer to obtain the final weight estimation value of the breeding pig.

Citation Information

Cited By

  • A visual measurement method for pig body size

    CN122492765A