Method and device for automatic scoring of boar hams based on three-dimensional point cloud

By using a 3D point cloud-based method, the stability problem of 2D image evaluation methods in capturing the spatial geometric features of pigs and in complex environments was solved, and automated, accurate and consistent scoring of pig leg structures was achieved.

CN122313518APending Publication Date: 2026-06-30BEIJING RES CENT FOR INFORMATION TECH & AGRI
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING RES CENT FOR INFORMATION TECH & AGRI
Filing Date
2026-01-08
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing methods for assessing pig legs based on two-dimensional images cannot fully capture the spatial geometric features of the pig's body, and are easily affected by posture and lighting in complex breeding environments, resulting in insufficient stability of measurement results.

Method used

A three-dimensional point cloud-based method was adopted. By acquiring the target three-dimensional point cloud model of the pig, the background point cloud was removed and filtered. Downsampling and orientation standardization were performed to segment the point cloud of the four legs. Multi-scale curvature analysis was used to accurately locate key points of joints, leg roots and hooves. Combined with trunk key point data, posture determination and leg structure scoring were performed.

Benefits of technology

It achieves full automation from raw point cloud to quantitative scoring, ensuring the accuracy, robustness and interpretability of the scoring, and outputting objective and consistent leg structure assessment results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122313518A_ABST
    Figure CN122313518A_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of intelligent breeding, and provides a sow leg automatic scoring method and device based on three-dimensional point cloud. The method comprises the following steps: acquiring a target three-dimensional point cloud model of a pig; extracting a leg point cloud set corresponding to each leg of the pig from the target three-dimensional point cloud model; determining leg key point data of each leg from the leg point cloud set corresponding to each leg; determining trunk key point data from the target three-dimensional point cloud model according to the leg key point data; determining a posture determination result of the pig according to the target three-dimensional point cloud model, the leg key point data of each leg and the trunk key point data; and in the case that the posture determination result indicates that the pig is in a standard standing posture, determining a leg structure type and a leg structure score of the pig according to the leg key point data. The application can stably identify the leg structure characteristics of the pig and realize consistent automatic scoring, and has good application potential in terms of accuracy, robustness and interpretability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart breeding technology, and in particular to an automatic scoring method and device for the legs of breeding pigs based on three-dimensional point clouds. Background Technology

[0002] The limb structure of pigs' legs has a significant impact on pig production and breeding, with over 20% of sows being culled due to hoof and leg problems. Good leg structure not only determines the health and lifespan of a pig's limbs and hooves but also directly affects its production performance and reproductive results, making it a crucial indicator for evaluating the quality of breeding pigs. However, for a long time, pig farms have generally relied on manual visual inspection and experience-based assessments of pig leg structure. This method is highly subjective, and different assessors may produce significant differences. Furthermore, it is inefficient, time-consuming, and labor-intensive when implemented on a large scale, failing to meet the needs of modern large-scale farms for efficient and objective phenotypic evaluation. To overcome these limitations, computer vision technology has been introduced. Among these, automatic measurement and scoring methods based on two-dimensional images (such as quantifying joint angles and extracting body shape features using deep learning) have made some progress in research and commercial breeding, demonstrating the feasibility of technical assessment.

[0003] However, two-dimensional image-based technologies are difficult to fully capture the spatial geometric features of pigs and are easily affected by posture and lighting in complex breeding environments, resulting in insufficient stability of measurement results. Summary of the Invention

[0004] This application provides an automatic scoring method and device for the legs of breeding pigs based on three-dimensional point clouds, in order to solve the technical problem that the existing two-dimensional image technology is difficult to fully capture the spatial geometric features of the pig body, and is easily affected by posture and lighting in complex breeding environments, resulting in insufficient stability of measurement results.

[0005] This application provides an automatic scoring method for the legs of breeding pigs based on three-dimensional point clouds, including the following steps: Obtain a target 3D point cloud model of the pig; Extract the point cloud set corresponding to each leg of the pig from the target 3D point cloud model; Determine the key point data of each leg from the point cloud set corresponding to each leg; Based on the leg key point data, determine the torso key point data from the target 3D point cloud model; Based on the target 3D point cloud model, the key point data of each leg and the key point data of the torso, the pig's posture determination result is determined; When the posture assessment result indicates that the pig is in a standard standing posture, the leg structure type and leg structure score of the pig are determined based on the key point data of the legs.

[0006] In one embodiment, obtaining a target 3D point cloud model of a pig includes: Obtain the initial point cloud set for the pigs; Background point clouds are removed from the initial point cloud set, and the initial point cloud set after removing the background point cloud set is filtered to obtain the first point cloud set. The first point cloud set is downsampled to obtain the second point cloud set; The second point cloud set is standardized in body pose direction based on principal component analysis to obtain the target 3D point cloud model.

[0007] In one embodiment, extracting the leg point cloud set corresponding to each leg of the pig from the target 3D point cloud model includes: Delete the head point cloud data corresponding to the pig in the target 3D point cloud model to obtain a third point cloud set; Based on the principal component analysis results of the third point cloud set, the central axis of the pig's body was determined; Based on the body's central axis and its center point, the third point cloud set is divided into multiple fourth point cloud sets; Based on the fourth point cloud set, determine the leg point cloud set.

[0008] In one embodiment, determining the leg point cloud set based on the fourth point cloud set includes: Select the fifth point cloud set belonging to the first preset range sequentially upwards from the ground along the Z-axis direction, where the Z-axis direction is from the ground to the back of the pig's body; Cluster the point clouds in the fifth point cloud set to obtain at least one point cloud cluster; If all point cloud clusters meet the leg determination criteria, each point cloud cluster is determined as the leg point cloud set corresponding to each leg.

[0009] In one embodiment, determining the key point data of each leg from the leg point cloud set corresponding to each leg includes: Divide the leg point cloud set into the first number of sixth point cloud sets along the Z-axis direction; Determine the first cloud centroid of each sixth-point cloud set; Multiple first-point cloud centroids are smoothed and spline interpolated to determine the three-dimensional feature curve corresponding to each leg; Multi-scale curvature analysis is performed on the three-dimensional feature curve to determine the first curvature value of each point in the three-dimensional feature curve under each first scale window; The first curvature value of each point in the three-dimensional feature curve is fused to determine the total curvature index of each point in the three-dimensional feature curve. Candidate joints are determined from multiple points in the three-dimensional feature curve based on the total curvature index.

[0010] Based on the candidate key points and the leg point cloud set, determine the key point data for each leg.

[0011] In one embodiment, based on candidate keypoints and a leg point cloud set, leg keypoint data for each leg is determined, including: Using the Z-coordinate of the candidate joint as the center point, select the seventh point cloud set belonging to the second preset range; Divide the seventh point cloud set into a second number of eighth point cloud sets along the Z-axis direction; Determine the second cloud centroid of each eighth-point cloud set; For each eighth point cloud set, multiple second point cloud centroids are smoothed and spline interpolated to determine local characteristic curves; Multi-scale curvature analysis is performed on the local characteristic curve to determine the second curvature value of each point in the local characteristic curve under each second scale window; The second curvature value of each point in the local feature curve is fused to determine the local curvature value of each point in the local feature curve; The first point cloud centroid corresponding to the local curvature value with the smallest value is determined as the joint point, the vertex of the three-dimensional feature curve to which the joint point belongs is determined as the leg root point, and the bottom point of the three-dimensional feature curve to which the joint point belongs is determined as the hoof point. The joint point, leg root point, and hoof point are collectively identified as the key leg point data.

[0012] In one embodiment, the pig's posture determination result is made based on the target 3D point cloud model, leg keypoint data for each leg, and torso keypoint data, including: Four hoof points from the key point data of the pig's leg are projected onto the first plane to obtain the first projection rectangle. The first plane is the plane to which the X-axis and Y-axis belong. The X-axis coincides with the central axis of the pig's body, and the Y-axis is perpendicular to the X-axis. The Y-axis points from the left side of the pig's torso to the right side of the torso. Determine the first average value of the difference between each interior angle of the first projected rectangle and a preset angle value, and the length ratio between the two diagonals of the first projected rectangle; Project the forebody upper point, head centroid, torso midpoint and hindbody upper point from the torso key point data onto the first plane, connect the forebody upper point and the torso midpoint to obtain the first line, connect the forebody upper point and the hindbody upper point to obtain the second line, and connect the forebody upper point and the head centroid to obtain the third line. Determine the first included angle between the first and second lines, and the second included angle between the first and third lines; Determine the first height value of the head's center of mass, the second height value of the left forelimb's leg root point, and the third height value of the right forelimb's leg root point; Determine the second average value between the second and third altitude values; If the first average value is greater than or equal to the first angle threshold, the length ratio is less than or equal to the ratio threshold, the first included angle is greater than or equal to the second angle threshold, the second included angle is greater than or equal to the third angle threshold, and the first height value is greater than or equal to the second average value, the posture determination result is determined to be a standard standing posture.

[0013] In one embodiment, determining torso key point data from a target 3D point cloud model based on leg key point data includes: Based on the leg root point in the leg key point data, the third average value between the first X coordinate value of the leg root point of the left foreleg and the second X coordinate value of the leg root point of the right foreleg, the fourth average value between the X coordinate values ​​of the leg root point of the left hindleg and the right hindleg, and the fifth average value between the third X coordinate values ​​of the leg root points of the limbs are determined. From the target 3D point cloud, a first candidate point cloud with an X-coordinate value of the third average is selected; from the target 3D point cloud, a second candidate point cloud with an X-coordinate value of the fourth average is selected; and from the target 3D point cloud, a third candidate point cloud with an X-coordinate value of the fifth average is selected. Determine the first median among the Y coordinates of multiple first candidate point clouds, the second median among the Y coordinates of multiple second candidate point clouds, and the third median among the Y coordinates of multiple third candidate point clouds; The fourth candidate point cloud with the first median Y coordinate value is obtained from the target 3D point cloud; the fifth candidate point cloud with the second median Y coordinate value is obtained from the target 3D point cloud; and the sixth candidate point cloud with the third median Y coordinate value is obtained from the target 3D point cloud. Determine the first preset quantile between the Z coordinates of multiple fourth candidate point clouds, the second preset quantile between the Z coordinates of multiple fifth candidate point clouds, and the third preset quantile between the Z coordinates of multiple sixth candidate point clouds; The upper point of the forequarters is determined based on the third average, the first median, and the first preset quantile. The posterior superior point is determined based on the fourth mean, the second median, and the second preset quantile. The midpoint of the torso is determined based on the fifth mean, the third median, and the third preset quantile. Determine the centroid of the head from the head point cloud data of the target 3D point cloud model; The forequarters, hindquarters, mid-thigh, and head centroid are collectively defined as key trunk points.

[0014] In one embodiment, the key point data of the leg includes: the leg root point, the joint point, and the hoof point; In cases where the posture assessment result indicates that the pig is in a standard standing posture, the leg structure type and score are determined based on key leg point data, including: Based on key leg data, determine the forelimb lateral view structure type and forelimb lateral view score of the pig; Based on key leg data, determine the lateral view structure type and lateral view score of the pig's hind limb; Based on key leg data, determine the type of anterior visual structure and anterior visual score of the pig; Based on the key point data of the legs, the posterior structure type and posterior score of the pig were determined; The forelimb lateral view structure type, hindlimb lateral view structure type, anterior view structure type, and posterior view structure type are identified as leg structure types; The leg structure score is determined based on the forelimb lateral view score, hindlimb lateral view score, anterior view score, and posterior view score.

[0015] In one embodiment, determining the forelimb lateral view structure type and forelimb lateral view score of a pig based on leg key point data includes: Project the leg root point, joint point and hoof point in the leg key point data onto the second plane, and determine the first included angle with the joint point as the vertex. The second plane is the plane to which the X-axis and Z-axis belong. The forelimb lateral view structure type is determined based on the first angle range corresponding to the first included angle. Based on the first included angle, and the first reference angle and first scoring interval corresponding to the forelimb lateral view structure type, the forelimb lateral view score is determined.

[0016] In one embodiment, determining the hindlimb lateral view structure type and hindlimb lateral view score of a pig based on leg key point data includes: Project the leg root point, joint point and hoof point from the key point data of the leg onto the second plane, and determine the second included angle with the leg root point as the vertex; The lateral view structure type of the hind limb is determined based on the second angle interval corresponding to the second included angle. The hindlimb lateral view score is determined based on the second included angle, the second reference angle corresponding to the hindlimb lateral view structure type, and the second scoring interval.

[0017] In one embodiment, determining the pig's anterior visual structure type and anterior visual score based on leg key point data includes: Determine the first horizontal distance difference between the left and right forelegs of the pig at the leg joint point, the second horizontal distance difference at the joint point, and the third horizontal distance difference at the hoof point; The first difference ratio is determined based on the first horizontal distance difference, the second horizontal distance difference, and the third horizontal distance difference; Determine the third angle between the first connecting line between the heel point and the hoof point of the left foreleg and the third plane, and the fourth angle between the second connecting line between the heel point and the hoof point of the right foreleg and the third plane, where the third plane is the plane to which the Y-axis and Z-axis belong; Based on the changing trends of the first difference ratio, the third included angle, the fourth included angle, and the first horizontal distance difference, the second horizontal distance difference, and the third horizontal distance difference, determine the forward-looking structure type; The forward gaze score is determined based on the first difference ratio, the third included angle, the fourth included angle, and the third reference angle and the third scoring interval corresponding to the forward gaze structure type.

[0018] In one embodiment, determining the pig's posterior structural type and posterior score based on leg key point data includes: Determine the fourth horizontal distance difference between the left and right hind legs of the pig at the leg joint point, the fifth horizontal distance difference at the joint point, and the sixth horizontal distance difference at the hoof point; The second difference ratio is determined based on the fourth, fifth, and sixth level distance differences; Based on the changing trends of the second difference ratio, the fifth included angle, the sixth included angle, and the fourth, fifth, and sixth horizontal distance differences, determine the rear view structure type; Determine the fifth angle between the third connecting line between the heel point and the hoof point of the left hind leg and the third plane, and the sixth angle between the fourth connecting line between the heel point and the hoof point of the right hind leg and the third plane. The rearview score is determined based on the second difference ratio, the fifth included angle, the sixth included angle, and the fourth reference angle and the fourth scoring interval corresponding to the rearview structure type.

[0019] This application also provides an automatic scoring device for the legs of breeding pigs based on three-dimensional point clouds, including the following modules: The first acquisition module is used to acquire the target 3D point cloud model of the pig. The extraction module is used to extract the leg point cloud set corresponding to each leg of the pig from the target 3D point cloud model; The first determining module is used to determine the key point data of each leg from the leg point cloud set corresponding to each leg; The second determination module is used to determine the torso key point data from the target 3D point cloud model based on the leg key point data; The third determination module is used to determine the pig's posture based on the target 3D point cloud model, the key point data of each leg, and the key point data of the torso. The fourth determination module is used to determine the pig's leg structure type and leg structure score based on the key point data of the legs, when the posture judgment result indicates that the pig is in a standard standing posture.

[0020] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any of the above-described automatic scoring methods for the legs of breeding pigs based on three-dimensional point clouds.

[0021] This application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described automatic scoring methods for the legs of breeding pigs based on three-dimensional point clouds.

[0022] This application also provides a computer program product, including a computer program that, when executed by a processor, implements any of the above-described automatic scoring methods for the legs of breeding pigs based on three-dimensional point clouds.

[0023] This application provides an automatic scoring method and device for pig legs based on 3D point clouds. Through background removal, downsampling, and orientation standardization, a high-quality, posture-uniform 3D model is generated, providing reliable input for subsequent analysis. Hierarchical clustering and decision rules are then used to robustly segment four leg point clouds from the complex point cloud. Multi-scale curvature analysis accurately locates three key points for each leg: joints, leg root, and hoof. The spatial relationships of these leg key points are used to deduce key trunk points, collectively forming a complete skeleton describing the posture. Based on multiple geometric rules such as hoof projection, trunk connection angles, and head height, non-standard standing posture data is effectively filtered out, ensuring a reliable scoring basis. Finally, by integrating side, front, and back views, quantitative indicators such as joint angles and symmetry ratios are used to classify and linearly score the leg structure, ultimately outputting objective and consistent evaluation results. The entire process achieves full automation from raw point clouds to quantitative scoring, with each step interconnected to ensure the accuracy, robustness, and interpretability of the detection. Attached Figure Description

[0024] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 This is one of the flowcharts of the automatic scoring method for the legs of breeding pigs based on three-dimensional point clouds provided in this application.

[0026] Figure 2A This is a schematic diagram showing the distribution of the point cloud acquisition devices provided in this application.

[0027] Figure 2BThis is a schematic diagram of the multi-machine synchronous setup process provided in this application.

[0028] Figure 3 This is a schematic diagram illustrating the generation process of the target 3D point cloud model provided in this application.

[0029] Figure 4 This is a schematic diagram of the process for generating a leg point cloud set provided in an embodiment of this application.

[0030] Figure 5 This is a schematic diagram of the process for generating three-dimensional feature curves provided in the embodiments of this application.

[0031] Figure 6 This is a schematic diagram of the process for determining key points of the leg using multi-scale curvature, as provided in an embodiment of this application.

[0032] Figure 7 This is a schematic diagram of the distribution of key points on a pig's body provided in an embodiment of this application.

[0033] Figure 8 This is a schematic diagram of the posture judgment effect provided in the embodiment of this application.

[0034] Figure 9 This is a schematic diagram of the leg structure scoring perspective provided in an embodiment of this application.

[0035] Figure 10 This is the second flowchart of the automatic scoring method for the legs of breeding pigs based on three-dimensional point clouds provided in this application.

[0036] Figure 11 This is a schematic diagram of the leg structure scoring based on three-dimensional point clouds provided in this application.

[0037] Figure 12 This is a schematic diagram of the automatic scoring device for the legs of breeding pigs based on three-dimensional point clouds provided in this application.

[0038] Figure 13 A schematic diagram of the physical structure of an electronic device is provided. Detailed Implementation

[0039] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0040] The following is combined Figures 1-11 This application describes an automatic scoring method for the legs of breeding pigs based on 3D point clouds.

[0041] Figure 1 This is one of the flowcharts illustrating the automatic scoring method for pig legs based on 3D point clouds provided in this application, such as... Figure 1 As shown, the method includes the following: Step 101: Obtain the target 3D point cloud model of the pig.

[0042] The target 3D point cloud model can be a 3D point cloud model composed of multiple point clouds used to describe the 3D structure of a pig.

[0043] Optionally, in some embodiments, a target three-dimensional point cloud model of a pig is obtained, and an initial point cloud set of the pig is obtained; background point clouds in the initial point cloud set are removed, and the initial point cloud set after removing the background point cloud set is filtered to obtain a first point cloud set; the first point cloud set is downsampled to obtain a second point cloud set; and the second point cloud set is normalized in body pose direction based on the principal component analysis method to obtain the target three-dimensional point cloud model.

[0044] The initial point cloud set is unprocessed point cloud data acquired by the point cloud acquisition device. Since the initial point cloud set includes noise data and background data, it needs to be optimized to obtain the target point cloud data.

[0045] In this embodiment, obtaining the initial point cloud set of pigs can be achieved by constructing a data acquisition channel for pigs to walk through the farm, taking into account the morphological characteristics of the pigs and the complex environment of the farm. An arch-shaped data acquisition device is installed in the channel, with one camera at the top of the arch, two cameras on each side, and one camera at the front and back of the channel, for a total of seven cameras. (See [link to previous document]). Figure 2A , Figure 2A This is a schematic diagram illustrating the distribution of the point cloud acquisition equipment provided in this application. All cameras used are TOF depth cameras, and all seven depth cameras are connected to an industrial control computer via USB-C interfaces. Multi-camera synchronization is achieved through a professional-grade star-shaped synchronization hub (Multi-Camera Sync Hub Pro). When a pig passes through the passage, the seven cameras simultaneously acquire its external morphological information, obtaining 3D point cloud data from various perspectives. These cameras are distributed at different angles, arranged around the pig under test, possessing a 512×512 depth resolution and a large 120°×120° field of view, ensuring complete coverage of the pig's leg structure from multiple angles.

[0046] In this embodiment, since pigs are typically difficult to keep still, the system needs to complete multi-view synchronous acquisition in a very short time to ensure the accuracy of 3D reconstruction. This study achieves multi-camera synchronization by calling the Orbbec official SDK and modifying the acquisition control program. A data buffer container is created in the program; when an acquisition command is received, data from the current frame of all seven cameras is simultaneously extracted and their hardware timestamps are recorded. The synchronization mechanism uses a hardware triggering method, connecting an eight-channel adapter cable and a USB-C data cable through a professional-grade star-shaped synchronization hub to provide a unified trigger signal for each camera, such as... Figure 2B As shown, Figure 2B This is a schematic diagram of the multi-camera synchronous setup process provided in this application. The system further introduces a timestamp comparison mechanism to filter out asynchronous frames that may be caused by bandwidth conflicts, ensuring that the time error of each frame of data is controlled within 3ms, thereby ensuring the consistency of multi-camera data in time and space, that is, capturing the spatial pose of the pig leg at the same time point.

[0047] For example, consider 14 three-way crossbred commercial pigs at a pig farm, approximately 170 days old and weighing between 80 and 110 kg. The data collection equipment includes an arch-shaped acquisition device with five cameras, a front-view acquisition camera, and a rear-view acquisition camera. Each pig has a unique ear tag for identification. During data collection, the pigs are guided to the acquisition area and briefly remain standing. The data collector issues acquisition commands via a keyboard, and upon receiving the commands, the system simultaneously saves point cloud data from synchronized frames of the seven cameras.

[0048] In this embodiment, point cloud data from seven perspectives are acquired. To achieve spatial consistency of the data in a unified coordinate system, registration and fusion processing are required. Based on the preset and fixed relative spatial positions between cameras, a transformation matrix is ​​pre-calculated and applied to the point cloud data from each perspective, completing a unified transformation of their coordinates. By transforming all point clouds to a unified global coordinate system and fusing them into a complete initial 3D point cloud model, a complete spatial reconstruction of an individual pig is achieved.

[0049] In this embodiment of the disclosure, after acquiring the 3D point cloud model of the pig, background removal and noise filtering can be performed on the point cloud data to extract the effective point cloud information of the target pig. First, based on the known range of the acquisition area in the channel, a 3D bounding box is constructed to define the region of interest. By calculating the convex hull of the bounding box, the polyhedral boundary surrounding the pig body is obtained. The point cloud within the convex hull is further cropped and retained to filter out stray points from non-target areas such as fences and the ground.

[0050] In this embodiment of the disclosure, such as Figure 3 As shown, Figure 3This is a schematic diagram of the generation process of the target 3D point cloud model provided in this application. After removing the background point cloud from the initial point cloud set, a Statistical Outlier Removal (SOR) algorithm is used to remove outliers and flying points with abnormally low local density. Subsequently, a Radius Outlier Removal (ROR) algorithm is applied to remove isolated clusters of noise, improving the consistency and coherence of the global point cloud. The point cloud processed by ROR is then downsampled using a voxel grid filter to reduce the number of points, improve computational efficiency, and simultaneously smooth local density, resulting in a second point cloud set.

[0051] In this embodiment of the disclosure, in order to solve the problem of inconsistent orientation and posture of the pig body at different collection times and further improve the analysis accuracy, the second point cloud set can be standardized by body posture orientation based on principal component analysis to obtain the target three-dimensional point cloud model.

[0052] Specifically, this can be achieved by calculating the covariance matrix and eigenvectors of the point cloud along the three principal axes to extract the major axis (head-to-tail direction), width axis (left-right direction), and height axis (back-to-ventral direction) of the pig's body. The point cloud is then rotated along the principal axes to align the major axis with the global X-axis, the width axis with the Y-axis, and the height axis with the Z-axis, as described above. Figure 3 As shown in section b, the red point cloud represents the effect before correction, while the black point cloud represents the effect after correction. This achieves standard pose normalization of the pig model in space, providing a unified reference system for subsequent leg structure analysis from a fixed perspective.

[0053] Step 102: Extract the leg point cloud set corresponding to each leg of the pig from the target 3D point cloud model.

[0054] The point cloud data corresponding to each leg of the pig is the leg point cloud set.

[0055] In this embodiment of the disclosure, after obtaining the target three-dimensional point cloud model, the leg point cloud set corresponding to each leg can be segmented from the target three-dimensional point cloud model.

[0056] Optionally, in some embodiments, extracting the leg point cloud set corresponding to each leg of the pig from the target 3D point cloud model can be achieved by deleting the head point cloud data corresponding to the pig in the target 3D point cloud model to obtain a third point cloud set. Based on the principal component analysis results of the third point cloud set, the pig's body midline is determined. Based on the body midline and its center point, the third point cloud set is divided into multiple fourth point cloud sets. Based on the fourth point cloud sets, the leg point cloud set is determined.

[0057] In other words, to achieve precise and automatic extraction of pig legs, the approximate locations of the four legs can first be determined through coarse segmentation, and then the left foreleg, right foreleg, left hind leg, and right hind leg can be accurately segmented through fine segmentation. Figure 4 As shown, Figure 4 This is a schematic diagram illustrating the generation process of the leg point cloud set provided in this application embodiment. First, the front end of the point cloud model is trimmed along the long axis of the pig's body, removing the head point cloud data to obtain a third point cloud set. This is to avoid its use in subsequent left-right segmentation and leg localization. Specifically, after pose normalization (ensuring consistency along the longitudinal axis), we remove the frontmost segment of the point cloud by a fixed proportion of the total longitudinal length of the point cloud. The point cloud obtained after trimming mainly includes the torso and limbs, serving as input for leg segmentation, such as... Figure 4 As shown in stage a.

[0058] In this embodiment, after projecting the point cloud onto the XY plane, uniform sampling is performed along the X-axis. For each sampling interval, the midpoint of the X-axis and the median of the point cloud along the Y-axis are calculated. All sampling points are then fitted using the least squares method to obtain a quadratic curve model representing the pig's central axis. Based on this central axis, the point cloud is divided left and right, and then the front and rear regions are divided along the center position of the X-axis. This roughly determines the fourth point cloud sets corresponding to the four legs: left front, left rear, right front, and right rear, as shown below. Figure 4 As shown in stage b.

[0059] Optionally, in some embodiments, determining the leg point cloud set based on the fourth point cloud set can be achieved by selecting a fifth point cloud set belonging to a first preset range sequentially upwards from the ground along the Z-axis direction, performing clustering processing on the point clouds in the fifth point cloud set to obtain at least one point cloud cluster, and determining each point cloud cluster as the leg point cloud set corresponding to each leg when all point cloud clusters meet the leg determination criteria.

[0060] The Z-axis direction is from the ground towards the back of the pig's body.

[0061] Among them, selecting the first preset range sequentially upwards from the ground can be along the Z-axis direction, starting from the ground and progressing upwards, from a height range of... - Select from the interval up to the height The spatial range of the cross section.

[0062] Among them, height The point cloud within the spatial range of the cross section is the fifth point cloud set.

[0063] In other words, in this embodiment of the present disclosure, any set of candidate leg points can be used. Its height range is , In each iteration, the distance from the bottom of the point cloud to its height is preserved. Fifth point cloud set of the cross section : ; In this embodiment of the disclosure, after determining the fifth point cloud set, the point clouds in each fifth point cloud set can be clustered to obtain at least one point cloud cluster. Then, it can be determined whether each point cloud cluster meets the leg determination criteria. If all point cloud clusters meet the leg determination criteria, each point cloud cluster is determined as the leg point cloud set corresponding to each leg.

[0064] In this embodiment of the disclosure, the criteria for determining point cloud clusters are shown in Table 1 below. These criteria include: a point count threshold, height and width range, aspect ratio, vertical similarity, and cylindricity. If the clustered point cloud is considered as a cylinder formed around a principal axis, its cross-sectional consistency can be determined by the standard deviation of the distance from each point to the principal axis. Evaluation. Calculate the shortest distance from each point to the principal axis line. Define cylindricity for: .

[0065] Table 1

[0066] In this embodiment, if the point cloud clusters meet the criteria in Table 1 above, each point cloud cluster can be identified as a leg point cloud set corresponding to each leg. If none of the point cloud clusters meet the criteria in Table 1 above, it indicates that the height includes the abdomen or other non-leg areas. The algorithm will further reduce the cross-sectional height and repeat the verification process until four leg point cloud clusters that meet the structural conditions are extracted. This method requires no manual intervention, has good individual adaptability and robustness, and can stably achieve high-precision leg extraction under different body shapes and postures. Figure 4 As shown in stage c.

[0067] Step 103: Determine the key point data of each leg from the leg point cloud set corresponding to each leg.

[0068] Among them, key leg point data can be, for example, the bottom point (hoof / toe), the middle point (joint point, such as the knee joint or hock), and the top point (the highest point where the leg connects to the torso).

[0069] Optionally, in some embodiments, determining the key point data of each leg from the leg point cloud set corresponding to each leg may involve dividing the leg point cloud set into a first number of sixth point cloud sets along the Z-axis, determining the first point cloud centroid of each sixth point cloud set, performing smoothing and spline interpolation on the multiple first point cloud centroids to determine the three-dimensional feature curve corresponding to each leg, performing multi-scale curvature analysis on the three-dimensional feature curve to determine the first curvature value of each point in the three-dimensional feature curve under each first scale window, performing fusion processing on the first curvature value of each point in the three-dimensional feature curve to determine the total curvature index of each point in the three-dimensional feature curve, determining candidate joints from multiple points in the three-dimensional feature curve based on the total curvature index, and determining the key point data of each leg based on the candidate joints and the leg point cloud set.

[0070] In other words, determining the key point data for each leg from the point cloud set corresponding to each leg can be achieved by performing multi-scale curve analysis on each leg's point cloud to find the key point data. Given the point cloud data corresponding to one leg: First, obtain its Z-axis range. and .like Figure 5 As shown, Figure 5 This is a schematic diagram of the process for generating three-dimensional feature curves provided in an embodiment of this application, such as... Figure 5 As shown in stage a, several cross-sectional centroids can be sampled in layers within this height range: first, the leg is divided into equal intervals along the height direction. The first horizontal slice, the... Center height of the layer Represented as: ; At each center height Nearby, extract using symmetrical intervals Points within the height range are denoted as: ; in =8mm, meaning each extracted slice is a point cloud fragment with a local thickness of 16mm. For each Collective three-dimensional geometric centroid ,in: ; In this embodiment of the disclosure, all centroids are pressed. Arrange in ascending order to obtain a rough set of centerline points for the leg shape: ; like Figure 5 As shown in stage b, to suppress the influence of point cloud noise on the centerline, the centroid sequence is... Application of three-dimensional Gaussian smoothing filter Generate a smooth point sequence: ; Then, based on cubic spline interpolation, the following was performed: Perform curve reconstruction and interpolate along the curve trajectory to obtain a three-dimensional feature curve. ,as follows: ; In this embodiment of the disclosure, the three-dimensional feature curve It depicts a continuous, smooth central axis path from top to bottom, approximately reflecting the longitudinal geometry of the leg shape, such as... Figure 5 As shown in stage c.

[0071] In this embodiment of the disclosure, after generating the three-dimensional feature curve of the leg, a multi-scale curvature analysis method can be further introduced. Significant curvature peaks or abrupt changes typically occur at joints. The method identifies significant bending locations in the leg curve and uses this to determine the spatial location of the joint region. When performing side-view structural analysis of the leg, the fitted curve needs to be projected onto the side-view plane (i.e., the XZ plane), and then multi-scale curvature analysis is performed on this plane. Similarly, for structural identification at forward or backward view angles, the curve should be projected onto the frontal view plane (i.e., the YZ plane).

[0072] For example, see Figure 6 , Figure 6 This is a flowchart illustrating the process of determining key points of the leg using multi-scale curvature, as provided in an embodiment of this application. It can be achieved by defining multiple first-scale windows. , respectively corresponding to weights Larger-scale windows reflect the overall bending trend of the legs, while smaller-scale windows highlight local details. For each midpoint in the sequence... (satisfy Using it as the vertex, select the preceding and following points within the symmetrical neighborhood. Construct a vector based on this point: ; Then, the angle between the two vectors can be calculated. : ; Therefore, the first curvature value can be defined under each first scale window as: ; In this embodiment, a larger first curvature value indicates a more significant spatial fold at that point. By using multi-window fusion to combine curvature results at different scales, the sensitivity to joint regions is improved and the impact of noise is reduced. Finally, the total curvature index of the multi-scale fusion is expressed as: .

[0073] In this embodiment of the disclosure, the total curvature index of each point in the three-dimensional feature curve is determined, and candidate joint points are determined from multiple points in the three-dimensional feature curve based on the total curvature index; and the key point data of each leg are determined based on the candidate joint points and the leg point cloud set.

[0074] Optionally, in some embodiments, the leg key point data for each leg is determined based on the candidate joint points and the leg point cloud set. This can be achieved by selecting a seventh point cloud set belonging to a second preset range, using the Z-coordinate of the candidate joint point as the center point, dividing the seventh point cloud set into a second number of eighth point cloud sets along the Z-axis, determining the second point cloud centroid of each eighth point cloud set, performing smoothing and spline interpolation on the multiple second point cloud centroids of each eighth point cloud set to determine the local feature curve, performing multi-scale curvature analysis on the local feature curve to determine the second curvature value of each point in the local feature curve under each second scale window, fusing the second curvature values ​​of each point in the local feature curve to determine the local curvature value of each point in the local feature curve, determining the first point cloud centroid corresponding to the local curvature value with the smallest value as the joint point, determining the vertex of the three-dimensional feature curve to which the joint point belongs as the leg root point, determining the bottom point of the three-dimensional feature curve to which the joint point belongs as the hoof point, and jointly determining the joint point, leg root point, and hoof point as the leg key point data.

[0075] In other words, in this embodiment of the present disclosure, after initially locating the peak curvature points on the three-dimensional feature curve of the leg, a further local fine-tuning search strategy is introduced to improve the accuracy and stability of joint position recognition. For the peak curvature points... Centered on the neighborhood of the point along the Z-axis, leg point clouds are extracted within a certain second preset range to form a seventh point cloud set. Subsequently, a local coordinate system is established within this seven-point cloud set, and the local feature curve is refitted with a higher vertical resolution (i.e., denser horizontal slices). On this local feature curve, the curvature index is recalculated with a smaller second-scale window length. The index of the point with the largest curvature is found, and the curve point corresponding to this index is mapped back to the global curve. This serves as an index for the bend points obtained from detailed analysis. The final calibrated joint positions are... Finally, three representative key points were selected from the central axis curve to form a skeleton node set: the bottom point (hoof point), the lowest point of the curve, and the lowest point of the curve. Midpoint (joint point), precisely identified joint point Vertex (root point), the uppermost endpoint of the curve. .

[0076] In this embodiment of the disclosure, the key point data of the pig's legs can be as shown in Table 2 below: Table 2

[0077] In this embodiment of the disclosure, after determining the key point data of the leg, the retreating angle of the leg can be calculated based on these three key points to quantify the degree of bending. Vectors are constructed for the base point, joint point, and vertex respectively: ; In this embodiment of the disclosure, the backbend angle is defined. Let be the angle between two vectors, where, for a forelimb side view, It represents the degree of elbow flexion; for hind limb lateral view, it corresponds to hock flexion; for forelimb anterior view and hind limb posterior view, it corresponds to the degree of leg flexion in the anterior and posterior view.

[0078] Step 104: Determine the torso key point data from the target 3D point cloud model based on the leg key point data.

[0079] In this embodiment of the disclosure, after determining the key point data of each leg from the leg point cloud set corresponding to each leg, the key point data of the torso can be determined from the target three-dimensional point cloud model based on the key point data of the legs.

[0080] Optionally, in some embodiments, determining torso key point data from the target 3D point cloud model based on leg key point data can be based on the leg root points in the leg key point data, determining a third average value between the first X-coordinate value of the left foreleg root point and the second X-coordinate value of the right foreleg root point, a fourth average value between the X-coordinate values ​​of the left hind leg root point and the right hind leg root points, and a fifth average value between the third X-coordinate values ​​of the limb root points; filtering from the target 3D point cloud to obtain a first candidate point cloud with the third average X-coordinate value, a second candidate point cloud with the fourth average X-coordinate value, and a third candidate point cloud with the fifth average X-coordinate value; and determining a first median among the Y-coordinates of the multiple first candidate point clouds, a second median among the Y-coordinates of the multiple second candidate point clouds, and a third median among the Y-coordinates of the multiple third candidate point clouds. From the target 3D point cloud, a fourth candidate point cloud with a Y-coordinate value of the first median is selected; from the target 3D point cloud, a fifth candidate point cloud with a Y-coordinate value of the second median is selected; and from the target 3D point cloud, a sixth candidate point cloud with a Y-coordinate value of the third median is selected. A first preset quantile is determined among the Z-coordinates of the multiple fourth candidate point clouds, a second preset quantile among the Z-coordinates of the multiple fifth candidate point clouds, and a third preset quantile among the Z-coordinates of the multiple sixth candidate point clouds. Based on the third average, the first median, and the first preset quantile, the forequarter upper point is determined. Based on the fourth average, the second median, and the second preset quantile, the hindquarter upper point is determined. Based on the fifth average, the third median, and the third preset quantile, the torso midpoint is determined. The head centroid is determined from the head point cloud data of the target 3D point cloud model. The forequarter upper point, hindquarter upper point, torso midpoint, and head centroid are collectively determined as the torso key point data.

[0081] In this embodiment of the disclosure, in order to achieve automated judgment of the overall standing posture of pigs, four trunk key point data for global posture analysis can be further defined and derived based on the pig's leg key point data: forequarter upper point e, hindquarter upper point g, trunk midpoint f, and head centroid point. These trunk key point data, together with the 12 leg key point data, constitute a skeletal system for posture modeling, which can be used to identify whether pigs have posture distortion, asymmetrical limb support, or head abnormalities.

[0082] In this embodiment of the disclosure, the location and spatial position information of the key points of the torso can be shown in Table 3 below: Table 3

[0083] In this embodiment of the disclosure, by combining spatial reasoning and feature statistics of limb structural points and body skeletal points, a basic skeletal structure required for pig posture analysis is established, such as... Figure 7As shown, Figure 7 This is a schematic diagram of the distribution of key points on a pig's body provided in an embodiment of this application. This structure not only illustrates the distribution of key parts of a pig in a standing position, but also provides a reliable basis for subsequent posture analysis.

[0084] Step 105: Determine the pig's posture based on the target 3D point cloud model, the key point data of each leg, and the key point data of the torso.

[0085] The posture assessment results can be used to indicate whether a pig is in a standard standing posture. A standard standing posture refers to a pig being in a naturally upright position, and its posture should meet the following conditions: limbs are symmetrically distributed and evenly bear weight, with stable limb positions; the spine is basically horizontal, without excessive bending or lateral deviation; the head maintains a natural orientation, without lowering, turning, or leaning forward. This posture represents the most representative and valuable form for assessing leg structure characteristics. See [link to relevant documentation]. Figure 8 , Figure 8 This is a schematic diagram of the posture judgment effect provided in the embodiment of this application.

[0086] Optionally, in some embodiments, determining the pig's posture based on the target 3D point cloud model, leg key point data for each leg, and torso key point data can involve projecting four hoof points from the pig's leg key point data onto a first plane to obtain a first projection rectangle. The first plane is the plane containing the X-axis and Y-axis, with the X-axis coinciding with the pig's body midline and the Y-axis perpendicular to the X-axis, pointing from the left side of the pig's torso to the right side. The first average value of the difference between each interior angle of the first projection rectangle and a preset angle value, and the length ratio between the two diagonals of the first projection rectangle are determined. The forequarter upper point, head centroid, torso midpoint, and hindquarter upper point from the torso key point data are projected onto the first plane, and the forequarter upper point is connected to the torso. A first line is drawn from the midpoint; a second line is drawn connecting the upper points of the forequarters and hindquarters; a third line is drawn connecting the upper points of the forequarters and the center of mass of the head. A first angle is determined between the first and second lines, and a second angle is determined between the first and third lines. A first height value of the center of mass of the head, a second height value of the root point of the left forelimb, and a third height value of the root point of the right forelimb are determined. A second average value is determined between the second and third height values. If the first average value is greater than or equal to a first angle threshold, and the length ratio is less than or equal to a ratio threshold, and the first angle is greater than or equal to a second angle threshold, and the second angle is greater than or equal to a third angle threshold, and the first height value is greater than or equal to the second average value, the posture is determined to be a standard standing posture.

[0087] In other words, in this embodiment of the present disclosure, the four hoof points can be projected onto a first plane to obtain a first projected rectangle. Then, the first average value of the difference between the four corners of the quadrilateral and a preset angle value (90°) and the ratio of the lengths of the two diagonals can be calculated. If the first average value is greater than a first angle threshold, or the ratio of the lengths of the two diagonals is greater than a ratio threshold, then the four-legged support is asymmetrical.

[0088] In this embodiment of the disclosure, the forequarter top point, head centroid, torso midpoint, and hindquarter top point in the torso key point data can be projected onto a first plane. A first line is obtained by connecting the forequarter top point and the torso midpoint, a second line is obtained by connecting the forequarter top point and the hindquarter top point, and a third line is obtained by connecting the forequarter top point and the head centroid. A first angle between the first line and the second line, and a second angle between the first line and the third line are determined. If the first angle is less than the second angle threshold (e.g., 170 degrees), it is determined that the torso is bent. If the second angle is less than the third angle threshold (e.g., 170 degrees), it is determined that there is head deflection.

[0089] In this embodiment of the disclosure, it can also be to determine a first height value of the head's center of mass (i.e., the height h of the head's center of mass). The second height value of the leg root point of the left forelimb (i.e., the Z coordinate of the leg root point of the left forelimb) and the third height value of the leg root point of the right forelimb (i.e., the Z coordinate of the leg root point of the right forelimb) are determined; the second average value between the second height value and the third height value is determined, and if the first height value is less than the second average value, it is determined that head drooping exists.

[0090] In this embodiment, when any of the following posture abnormalities are detected: asymmetrical four-legged support, torso bending, head tilting, or head drooping, the current frame can be marked as a "non-standard standing posture," and the leg structure scoring process can be skipped. This strategy effectively prevents scoring bias caused by abnormal limb postures, ensuring the stability and reliability of the scoring.

[0091] In this embodiment of the disclosure, when it is determined that there are no abnormal posture types such as asymmetrical four-legged support, bent torso, head tilt, and drooping head, the posture determination result can be determined as a standard standing posture.

[0092] Step 106: If the posture judgment result indicates that the pig is in a standard standing posture, determine the pig's leg structure type and leg structure score based on the key leg point data.

[0093] In this embodiment of the disclosure, when the posture determination result indicates that the pig is in a standard standing posture, the pig's leg structure type and leg structure score are determined based on the key point data of the legs.

[0094] The leg structure score can be, for example, on a nine-point scale. The closer the final score is to 9, the more ideal the pig's leg structure is; the closer it is to 1, the more the structure deviates from the normal morphology. The scoring mechanism is highly consistent and reproducible in reflecting the symmetry, stability, and coordination of biological structures.

[0095] The leg structure type can be, for example, bent hind leg, straight leg, bent fore leg, etc., without any restrictions.

[0096] In other words, in this embodiment of the disclosure, the leg structure of a pig can be classified and judged from multiple angles, such as side view of the forelimbs, side view of the hindlimbs, front view, and back view, and then scored. See [link to relevant documentation]. Figure 9 , Figure 9 This is a schematic diagram of the leg structure scoring perspective provided in an embodiment of this application.

[0097] Optionally, in some embodiments, determining the pig's leg structure type and leg structure score based on leg key point data may involve determining the pig's forelimb lateral view structure type and forelimb lateral view score based on leg key point data; determining the pig's hindlimb lateral view structure type and hindlimb lateral view score based on leg key point data; determining the pig's frontal view structure type and frontal view score based on leg key point data; determining the pig's rearal view structure type and rearal view score based on leg key point data; defining the forelimb lateral view structure type, hindlimb lateral view structure type, frontal view structure type, and rearal view structure type as the leg structure type; and determining the leg structure score based on the forelimb lateral view score, hindlimb lateral view score, frontal view score, and rearal view score.

[0098] Optionally, in some embodiments, determining the forelimb lateral view structure type and forelimb lateral view score of a pig based on leg key point data may involve projecting the leg root point, joint point, and hoof point from the leg key point data onto a second plane, determining a first included angle with the joint point as the vertex, wherein the second plane is the plane to which the X-axis and Z-axis belong, determining the forelimb lateral view structure type based on a first angle interval corresponding to the first included angle, and determining the forelimb lateral view score based on the first included angle, a first reference angle corresponding to the forelimb lateral view structure type, and a first score interval.

[0099] Optionally, in some embodiments, determining the hind limb lateral view structure type and hind limb lateral view score of a pig based on leg key point data may involve projecting the leg root point, joint point, and hoof point in the leg key point data onto a second plane, determining a second included angle with the leg root point as the vertex, determining the hind limb lateral view structure type based on the second included angle interval corresponding to the second included angle, and determining the hind limb lateral view score based on the second included angle, and a second reference angle and a second scoring interval corresponding to the hind limb lateral view structure type.

[0100] In other words, in this embodiment, the key angles of the forelimbs and hindlimbs in the sagittal plane (second plane) can be calculated using key points on the lateral view, based on the joint angles between the forelimbs and hindlimbs in the sagittal plane (lateral plane). This quantitatively determines whether the joints are in a normal, excessively flexed, or hyperextended state, reflecting their structural stability and coordination. For the forelimbs, the shoulder joint, knee joint, and hoof are extracted to construct the arm-to-arm angle; for the hindlimbs, the hip (leg root), hock, and hoof are extracted to calculate the hock angle. The following judgment rules are the "recommended reference judgment rules" formed based on the aforementioned literature and expert opinions, and also serve as the unified judgment standard for this study. Based on the angle range and joint spatial arrangement, the structures are classified into the structural types shown in Table 4: Table 4

[0101] Optionally, in some embodiments, determining the pig's forward-looking structure type and forward-looking score based on leg key point data may involve determining the first horizontal distance difference between the pig's left and right forelegs at the leg root point, the second horizontal distance difference at the joint point, and the third horizontal distance difference at the hoof point; determining a first difference ratio based on the first, second, and third horizontal distance differences; determining a third angle between the first connecting line between the leg root point and the hoof point of the left foreleg and a third plane, and a fourth angle between the second connecting line between the leg root point and the hoof point of the right foreleg and a third plane, wherein the third plane is the plane to which the Y-axis and Z-axis belong; determining the forward-looking structure type based on the changing trends of the first difference ratio, the third angle, the fourth angle, and the first, second, and third horizontal distance differences; and determining the forward-looking score based on the first difference ratio, the third angle, the fourth angle, and a third reference angle and a third scoring interval corresponding to the forward-looking structure type.

[0102] Optionally, in some embodiments, determining the pig's posterior structure type and posterior score based on leg key point data may involve determining the fourth horizontal distance difference between the left and right hind legs at the leg root point, the fifth horizontal distance difference at the joint point, and the sixth horizontal distance difference at the hoof point; determining a second difference ratio based on the fourth, fifth, and sixth horizontal distance differences; determining the posterior structure type based on the second difference ratio, the fifth angle, the sixth angle, and the changing trends between the fourth, fifth, and sixth horizontal distance differences; determining the fifth angle between the third connecting line between the leg root point and the hoof point of the left hind leg and the third plane, and the sixth angle between the fourth connecting line between the leg root point and the hoof point of the right hind leg and the third plane; and determining the posterior score based on the second difference ratio, the fifth angle, the sixth angle, and the fourth reference angle and fourth scoring interval corresponding to the posterior structure type.

[0103] In this embodiment, the forward and backward structural analysis focuses on symmetry changes in the coronal plane (YZ plane) to assess the inward and outward offset of the limbs. Based on the extracted key points of the left and right forelegs and hindlegs at the shoulder / hip, knee / hock, and hoof heights, the horizontal (Y-axis) distance differences are calculated, including Top Difference, Middle Difference, and Bottom Difference. A core parameter, Difference Ratio, is defined to measure the opening and closing degree of the upper and lower limb segments. The formula for calculating this index is as follows: ; The introduction of the Difference Ratio aims to eliminate the influence of differences in absolute distance between individuals of different body types, focusing on assessing whether the structure gradually narrows or widens from top to bottom. If the ratio is close to 0, it indicates that the distance between the shoulder and hoof is approximately the same, and the legs are in a parallel and upright position; if the ratio is high, it indicates a significant asymmetrical opening and closing trend in the structure. For example, a high Difference Ratio that is larger at the top and smaller at the bottom often indicates "inward-pointing legs" (pigeon-toed); while if it is smaller at the top and larger at the bottom, it indicates "outward-pointing legs" (pigeon-toed).

[0104] In this embodiment of the disclosure, by combining the difference ratio and the projection angle of the leg on the yz plane, the system can automatically classify the coronal leg structure into the types listed in Table 5. Specifically, the difference ratio is mainly used to distinguish between the three modes: normal, inward, and abduction, because the projection angles of these modes may be similar, while the yz plane angle is sufficient to identify X-type and O-type deviations.

[0105] By combining the Difference Ratio, the trend of horizontal spacing, and the projection angle (tilt direction) of the legs in the third plane, the system can automatically classify the structural types shown in Table 5: Table 5

[0106] In this embodiment, the scoring system adopts a linear scoring system of 1 to 9 points. This system aligns with commonly used standards such as PIC breeding pigs and ICAR dairy cow conformation scoring. Furthermore, 5 points serves as the median score for ideal or normal structure, while 1 and 9 points represent severe deviations at either end. This system effectively characterizes the gradual change from ideal to bilateral deviation and facilitates genetic analysis. Based on this, the linear interpolation method is used to quantify the deviation of each type from the ideal structure within the corresponding scoring interval. The score changes continuously with the degree of deviation. Specific scoring methods are shown in Table 7. Compared to non-linear grading methods, linear scoring not only reflects the quality of an individual's leg structure but also possesses the ability to identify genotypes and correlate them with genetic structure. The weights of each scoring item are set equally.

[0107] Each scoring item uses the ideal structural state from a biomechanical perspective as a reference standard, and a linear scoring function is defined. The median score is... The ideal structure is represented by the larger the deviation, the closer the score will be to the two boundaries, as shown in Table 6 below: Table 6

[0108] in, The angle between the legs when viewed from the side of the forelimb; The angle between the legs when viewed from the side of the hind limb; The average angle between the legs when viewed from the front (forelimbs in front) and from the back (hindlimbs in back). The difference ratio for forelimb forward view / hindlimb backward view; The difference between the measured value and the quantified value (ideal value) corresponding to the highest score; The scores are for different scoring items (5 points is the highest score).

[0109] In this embodiment of the disclosure, a structural deviation loss function is defined to uniformly measure the degree of deviation: ; in, Indicates the first The distance between the item structure score and the ideal structure state is used to calculate the final comprehensive score. Let the weight of each item be . Then we have: ; In this embodiment of the disclosure, due to each scoring item The values ​​range from 1 to 9, and the weights are set equally and the sum is 1, therefore the overall score is... The value range is [0, 9]; the closer the score is to 9, the more ideal the structure is, and the closer it is to 0, the greater the deviation. In other words, in this embodiment of the disclosure, the final output score is still kept in the nine-point range by normalizing the linear deviation loss.

[0110] In this embodiment, the aforementioned scoring rules are primarily designed to verify the performance of the automatic scoring system based on 3D point clouds. Compared to traditional manual evaluation methods, the most significant feature of these rules is the introduction of explicit quantitative indicators, reducing the subjective differences arising from human judgment. The core logic is "classification first, scoring later": first, leg structures are categorized into distinct types (such as straight legs, bent legs, sickle-shaped legs, etc.) using geometric indicators; then, within each category, the deviation is mapped to a nine-point scoring range. This tiered scoring method not only aligns with the actual judgment approaches of breeding experts but also better reflects the description of leg structure diversity in real-world production scenarios.

[0111] In this embodiment of the disclosure, see Figure 10 , Figure 10 This is the second flowchart of the automatic scoring method for pig legs based on 3D point clouds provided in this application. It can be based on acquiring an initial point cloud set using a data acquisition device, then performing point cloud preprocessing on the initial point cloud set to obtain a target 3D point cloud model, then performing leg segmentation processing on the target 3D point cloud model to obtain key point data of the legs, then combining the key point data of the legs to determine the key point data of the torso, and then determining the posture judgment result. When the posture judgment result indicates a standard standing posture, structural features are extracted to determine the type of pig leg structure and the leg structure score.

[0112] In this embodiment of the disclosure, see Figure 11 , Figure 11 This application provides a schematic diagram of leg structure scoring based on 3D point clouds. Compared to 2D images, 3D point clouds can comprehensively represent the spatial morphological information of an individual, without being limited by the shooting angle and camera arrangement. Figure 11 As shown in the diagram, during actual data collection, pigs do not maintain a fixed posture for extended periods in their pens, and RGB images often fail to capture ideal angles from side, front, or back views. This results in variations in the calculated bending angle of the same leg at different shooting angles, reducing the accuracy of the scoring. Aligning the 3D point cloud using Principal Component Analysis (PCA) maximizes the consistency of angles during leg structure analysis, significantly reducing detection errors caused by different shooting directions, thus providing a more reliable data foundation for automated leg structure scoring.

[0113] This application provides an automatic scoring method for pig legs based on 3D point clouds. Through background removal, downsampling, and orientation standardization, a high-quality 3D model with consistent posture is generated, providing reliable input for subsequent analysis. Hierarchical clustering and decision rules are then used to robustly segment four leg point clouds from the complex point cloud. Multi-scale curvature analysis accurately locates three key points for each leg: joints, leg root, and hoof. The spatial relationships of these leg key points are used to infer key points of the torso, collectively forming a complete skeleton describing the posture. Based on multiple geometric rules such as hoof projection, torso connection angles, and head height, non-standard standing posture data is effectively filtered out, ensuring a reliable scoring basis. Finally, by integrating lateral, forward, and backward viewing angles, quantitative indicators such as joint angles and symmetry ratios are used to classify and linearly score the leg structure, ultimately outputting objective and consistent evaluation results. The entire process achieves full automation from raw point clouds to quantitative scoring, with each step interconnected to ensure the accuracy, robustness, and interpretability of the detection.

[0114] The automatic scoring device for pig legs based on three-dimensional point clouds provided in this application is described below. The automatic scoring device for pig legs based on three-dimensional point clouds described below can be referred to in correspondence with the automatic scoring method for pig legs based on three-dimensional point clouds described above.

[0115] Figure 12 This is a schematic diagram of the automatic scoring device for the legs of breeding pigs based on three-dimensional point clouds provided in this application, as shown below. Figure 12 As shown, the automatic scoring device for pig legs based on 3D point clouds includes the following: The first acquisition module 1201 is used to acquire the target three-dimensional point cloud model of the pig; Extraction module 1202 is used to extract the leg point cloud set corresponding to each leg of the pig from the target 3D point cloud model; The first determining module 1203 is used to determine the key point data of each leg from the leg point cloud set corresponding to each leg; The second determining module 1204 is used to determine the torso key point data from the target three-dimensional point cloud model based on the leg key point data; The third determining module 1205 is used to determine the pig's posture judgment result based on the target three-dimensional point cloud model, the key point data of each leg and the key point data of the torso. The fourth determination module 1206 is used to determine the pig's leg structure type and leg structure score based on the key point data of the legs when the posture judgment result indicates that the pig is in a standard standing posture.

[0116] In one embodiment, the acquisition module is specifically used for: Obtain the initial point cloud set for the pigs; Background point clouds are removed from the initial point cloud set, and the initial point cloud set after removing the background point cloud set is filtered to obtain the first point cloud set. The first point cloud set is downsampled to obtain the second point cloud set; The second point cloud set is standardized in body pose direction based on principal component analysis to obtain the target 3D point cloud model.

[0117] In one embodiment, the extraction module is specifically used for: Delete the head point cloud data corresponding to the pig in the target 3D point cloud model to obtain a third point cloud set; Based on the principal component analysis results of the third point cloud set, the central axis of the pig's body was determined; Based on the body's central axis and its center point, the third point cloud set is divided into multiple fourth point cloud sets; Based on the fourth point cloud set, determine the leg point cloud set.

[0118] In one embodiment, the extraction module is specifically used for: Select the fifth point cloud set belonging to the first preset range sequentially upwards from the ground along the Z-axis direction, where the Z-axis direction is from the ground to the back of the pig's body; Cluster the point clouds in the fifth point cloud set to obtain at least one point cloud cluster; If all point cloud clusters meet the leg determination criteria, each point cloud cluster is determined as the leg point cloud set corresponding to each leg.

[0119] In one embodiment, the first determining module is specifically used for: Divide the leg point cloud set into the first number of sixth point cloud sets along the Z-axis direction; Determine the first cloud centroid of each sixth-point cloud set; Multiple first-point cloud centroids are smoothed and spline interpolated to determine the three-dimensional feature curve corresponding to each leg; Multi-scale curvature analysis is performed on the three-dimensional feature curve to determine the first curvature value of each point in the three-dimensional feature curve under each first scale window; The first curvature value of each point in the three-dimensional feature curve is fused to determine the total curvature index of each point in the three-dimensional feature curve. Candidate joints are determined from multiple points in the three-dimensional feature curve based on the total curvature index.

[0120] Based on the candidate key points and the leg point cloud set, determine the key point data for each leg.

[0121] In one embodiment, the first determining module is specifically used for: Using the Z-coordinate of the candidate joint as the center point, select the seventh point cloud set belonging to the second preset range; Divide the seventh point cloud set into a second number of eighth point cloud sets along the Z-axis direction; Determine the second cloud centroid of each eighth-point cloud set; For each eighth point cloud set, multiple second point cloud centroids are smoothed and spline interpolated to determine local characteristic curves; Multi-scale curvature analysis is performed on the local characteristic curve to determine the second curvature value of each point in the local characteristic curve under each second scale window; The second curvature value of each point in the local feature curve is fused to determine the local curvature value of each point in the local feature curve; The first point cloud centroid corresponding to the local curvature value with the smallest value is determined as the joint point, the vertex of the three-dimensional feature curve to which the joint point belongs is determined as the leg root point, and the bottom point of the three-dimensional feature curve to which the joint point belongs is determined as the hoof point. The joint point, leg root point, and hoof point are collectively identified as the key leg point data.

[0122] In one embodiment, the third determining module is specifically used for: Four hoof points from the key point data of the pig's leg are projected onto the first plane to obtain the first projection rectangle. The first plane is the plane to which the X-axis and Y-axis belong. The X-axis coincides with the central axis of the pig's body, and the Y-axis is perpendicular to the X-axis. The Y-axis points from the left side of the pig's torso to the right side of the torso. Determine the first average value of the difference between each interior angle of the first projected rectangle and a preset angle value, and the length ratio between the two diagonals of the first projected rectangle; Project the forebody upper point, head centroid, torso midpoint and hindbody upper point from the torso key point data onto the first plane, connect the forebody upper point and the torso midpoint to obtain the first line, connect the forebody upper point and the hindbody upper point to obtain the second line, and connect the forebody upper point and the head centroid to obtain the third line. Determine the first included angle between the first and second lines, and the second included angle between the first and third lines; Determine the first height value of the head's center of mass, the second height value of the left forelimb's leg root point, and the third height value of the right forelimb's leg root point; Determine the second average value between the second and third altitude values; If the first average value is greater than or equal to the first angle threshold, the length ratio is less than or equal to the ratio threshold, the first included angle is greater than or equal to the second angle threshold, the second included angle is greater than or equal to the third angle threshold, and the first height value is greater than or equal to the second average value, the posture determination result is determined to be a standard standing posture.

[0123] In one embodiment, the second determining module is specifically used for: Based on the leg root point in the leg key point data, the third average value between the first X coordinate value of the leg root point of the left foreleg and the second X coordinate value of the leg root point of the right foreleg, the fourth average value between the X coordinate values ​​of the leg root point of the left hindleg and the right hindleg, and the fifth average value between the third X coordinate values ​​of the leg root points of the limbs are determined. From the target 3D point cloud, a first candidate point cloud with an X-coordinate value of the third average is selected; from the target 3D point cloud, a second candidate point cloud with an X-coordinate value of the fourth average is selected; and from the target 3D point cloud, a third candidate point cloud with an X-coordinate value of the fifth average is selected. Determine the first median among the Y coordinates of multiple first candidate point clouds, the second median among the Y coordinates of multiple second candidate point clouds, and the third median among the Y coordinates of multiple third candidate point clouds; The fourth candidate point cloud with the first median Y coordinate value is obtained from the target 3D point cloud; the fifth candidate point cloud with the second median Y coordinate value is obtained from the target 3D point cloud; and the sixth candidate point cloud with the third median Y coordinate value is obtained from the target 3D point cloud. Determine the first preset quantile between the Z coordinates of multiple fourth candidate point clouds, the second preset quantile between the Z coordinates of multiple fifth candidate point clouds, and the third preset quantile between the Z coordinates of multiple sixth candidate point clouds; The upper point of the forequarters is determined based on the third average, the first median, and the first preset quantile. The posterior superior point is determined based on the fourth mean, the second median, and the second preset quantile. The midpoint of the torso is determined based on the fifth mean, the third median, and the third preset quantile. Determine the centroid of the head from the head point cloud data of the target 3D point cloud model; The forequarters, hindquarters, mid-thigh, and head centroid are collectively defined as key trunk points.

[0124] In one embodiment, the key point data of the leg includes: the leg root point, the joint point, and the hoof point; The fourth determining module is specifically used for: Based on key leg data, determine the forelimb lateral view structure type and forelimb lateral view score of the pig; Based on key leg data, determine the lateral view structure type and lateral view score of the pig's hind limb; Based on key leg data, determine the type of anterior visual structure and anterior visual score of the pig; Based on the key point data of the legs, the posterior structure type and posterior score of the pig were determined; The forelimb lateral view structure type, hindlimb lateral view structure type, anterior view structure type, and posterior view structure type are identified as leg structure types; The leg structure score is determined based on the forelimb lateral view score, hindlimb lateral view score, anterior view score, and posterior view score.

[0125] In one embodiment, the fourth determining module is specifically used for: Project the leg root point, joint point and hoof point in the leg key point data onto the second plane, and determine the first included angle with the joint point as the vertex. The second plane is the plane to which the X-axis and Z-axis belong. The forelimb lateral view structure type is determined based on the first angle range corresponding to the first included angle. Based on the first included angle, and the first reference angle and first scoring interval corresponding to the forelimb lateral view structure type, the forelimb lateral view score is determined.

[0126] In one embodiment, the fourth determining module is specifically used for: Project the leg root point, joint point and hoof point from the key point data of the leg onto the second plane, and determine the second included angle with the leg root point as the vertex; The lateral view structure type of the hind limb is determined based on the second angle interval corresponding to the second included angle. The hindlimb lateral view score is determined based on the second included angle, the second reference angle corresponding to the hindlimb lateral view structure type, and the second scoring interval.

[0127] In one embodiment, the fourth determining module is specifically used for: Determine the first horizontal distance difference between the left and right forelegs of the pig at the leg joint point, the second horizontal distance difference at the joint point, and the third horizontal distance difference at the hoof point; The first difference ratio is determined based on the first horizontal distance difference, the second horizontal distance difference, and the third horizontal distance difference; Determine the third angle between the first connecting line between the heel point and the hoof point of the left foreleg and the third plane, and the fourth angle between the second connecting line between the heel point and the hoof point of the right foreleg and the third plane, where the third plane is the plane to which the Y-axis and Z-axis belong; Based on the changing trends of the first difference ratio, the third included angle, the fourth included angle, and the first horizontal distance difference, the second horizontal distance difference, and the third horizontal distance difference, determine the forward-looking structure type; The forward gaze score is determined based on the first difference ratio, the third included angle, the fourth included angle, and the third reference angle and the third scoring interval corresponding to the forward gaze structure type.

[0128] In one embodiment, the fourth determining module is specifically used for: Determine the fourth horizontal distance difference between the left and right hind legs of the pig at the leg joint point, the fifth horizontal distance difference at the joint point, and the sixth horizontal distance difference at the hoof point; The second difference ratio is determined based on the fourth, fifth, and sixth level distance differences; Based on the changing trends of the second difference ratio, the fifth included angle, the sixth included angle, and the fourth, fifth, and sixth horizontal distance differences, determine the rear view structure type; Determine the fifth angle between the third connecting line between the heel point and the hoof point of the left hind leg and the third plane, and the sixth angle between the fourth connecting line between the heel point and the hoof point of the right hind leg and the third plane. The rearview score is determined based on the second difference ratio, the fifth included angle, the sixth included angle, and the fourth reference angle and the fourth scoring interval corresponding to the rearview structure type.

[0129] The automatic scoring device for pig legs based on 3D point clouds provided in this application generates a high-quality and posture-uniform 3D model through background removal, downsampling, and orientation standardization, providing reliable input for subsequent analysis. Then, hierarchical clustering and decision rules are used to robustly segment four leg point clouds from the complex point cloud. Multi-scale curvature analysis accurately locates three key points for each leg: joints, leg root, and hoof. The spatial relationships of these key leg points are used to deduce key trunk points, collectively forming a complete skeleton describing the posture. Based on multiple geometric rules such as hoof projection, trunk connection angles, and head height, non-standard standing posture data is effectively filtered out, ensuring a reliable scoring basis. Finally, by integrating side, front, and back views, quantitative indicators such as joint angles and symmetry ratios are used to classify and linearly score the leg structure, ultimately outputting objective and consistent evaluation results. The entire process achieves full automation from raw point cloud to quantitative scoring, with each step interconnected to ensure the accuracy, robustness, and interpretability of the detection.

[0130] Figure 13 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 13 As shown, the electronic device may include a processor 1310, a communications interface 1320, a memory 1330, and a communication bus 1340. The processor 1310, communications interface 1320, and memory 1330 communicate with each other via the communication bus 1340. The processor 1310 can call logical instructions from the memory 1330 to execute an automatic scoring method for pig legs based on three-dimensional point clouds.

[0131] Furthermore, the logical instructions in the aforementioned memory 1330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0132] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the automatic scoring method for the legs of breeding pigs based on three-dimensional point clouds provided by the above methods.

[0133] In another aspect, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the automatic scoring method for pig legs based on three-dimensional point clouds provided by the methods described above.

[0134] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. 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 modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

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

[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for automatic scoring of a sow's rear leg based on a three-dimensional point cloud, characterized in that, include: Obtain a target 3D point cloud model of the pig; From the target 3D point cloud model, extract the leg point cloud set corresponding to each leg of the pig; Determine the key point data of each leg from the leg point cloud set corresponding to each leg; Based on the leg key point data, determine the torso key point data from the target 3D point cloud model; Based on the target 3D point cloud model, the key point data of each leg, and the key point data of the torso, the pig's posture determination result is determined; When the posture determination result indicates that the pig is in a standard standing posture, the leg structure type and leg structure score of the pig are determined based on the key leg point data.

2. The method according to claim 1, characterized in that, The acquisition of the target 3D point cloud model of the pig includes: Obtain the initial point cloud set of the pig; Background point clouds are removed from the initial point cloud set, and the initial point cloud set after removing the background point cloud set is filtered to obtain the first point cloud set. The first point cloud set is downsampled to obtain the second point cloud set; The second point cloud set is standardized in body pose direction based on principal component analysis to obtain the target three-dimensional point cloud model.

3. The method according to claim 1, characterized in that, The step of extracting the leg point cloud set corresponding to each leg of the pig from the target 3D point cloud model includes: Delete the head point cloud data corresponding to the pig in the target 3D point cloud model to obtain a third point cloud set; Based on the principal component analysis results of the third point cloud set, the body midline of the pig was determined; Based on the body's central axis and its center point, the third point cloud set is divided into multiple fourth point cloud sets; The leg point cloud set is determined based on the fourth point cloud set.

4. The method according to claim 3, characterized in that, The step of determining the leg point cloud set based on the fourth point cloud set includes: Select the fifth point cloud set belonging to the first preset range sequentially upward from the ground along the Z-axis direction, wherein the Z-axis direction is the direction from the ground to the back of the pig's body; Clustering is performed on the point clouds in the fifth point cloud set to obtain at least one point cloud cluster; If all point cloud clusters meet the leg determination criteria, each point cloud cluster is determined as the leg point cloud set corresponding to each leg.

5. The method according to claim 1, characterized in that, The step of determining the key point data of each leg from the leg point cloud set corresponding to each leg includes: The leg point cloud set is divided into a first number of sixth point cloud sets along the Z-axis direction; Determine the first point cloud centroid of each of the aforementioned sixth point cloud sets; Smoothing and spline interpolation are performed on multiple first point cloud centroids to determine the three-dimensional feature curve corresponding to each leg; Multi-scale curvature analysis is performed on the three-dimensional feature curve to determine the first curvature value of each point in the three-dimensional feature curve under each first scale window. The first curvature value of each point in the three-dimensional feature curve is fused to determine the total curvature index of each point in the three-dimensional feature curve; Candidate joint points are determined from multiple points in the three-dimensional feature curve based on the total curvature index. Based on the candidate joints and the leg point cloud set, the key point data of each leg are determined.

6. The method according to claim 5, characterized in that, The step of determining the key point data of each leg based on the candidate key points and the leg point cloud set includes: Using the Z coordinate of the candidate joint as the center point, select the seventh point cloud set belonging to the second preset range; The seventh point cloud set is divided into a second number of eighth point cloud sets along the Z-axis direction; Determine the second cloud centroid of each of the eighth cloud sets; For each of the eighth point cloud sets, multiple second point cloud centroids are smoothed and spline interpolated to determine local feature curves; Multi-scale curvature analysis is performed on the local feature curve to determine the second curvature value of each point in the local feature curve under each second scale window; The second curvature value of each point in the local feature curve is fused to determine the local curvature value of each point in the local feature curve; The centroid of the first point cloud corresponding to the local curvature value with the smallest value is determined as the joint point, the vertex of the three-dimensional feature curve to which the joint point belongs is determined as the leg root point, and the bottom point of the three-dimensional feature curve to which the joint point belongs is determined as the hoof point. The joint point, the leg root point, and the hoof point are collectively determined as the key leg point data.

7. The method according to claim 1, characterized in that, The step of determining the pig's posture based on the target 3D point cloud model, the key point data of each leg, and the key point data of the torso includes: Four hoof points from the key point data of the pig's leg are projected onto a first plane to obtain a first projection rectangle. The first plane is the plane to which the X-axis and Y-axis belong. The X-axis coincides with the central axis of the pig's body, and the Y-axis is perpendicular to the X-axis. The Y-axis points from the left side of the pig's torso to the right side of the torso. Determine the first average value of the difference between each interior angle of the first projection rectangle and a preset angle value, and the length ratio between the two diagonals of the first projection rectangle; Project the forebody upper point, head centroid, torso midpoint and hindbody upper point from the torso key point data onto the first plane, connect the forebody upper point and the torso midpoint to obtain the first line, connect the forebody upper point and the hindbody upper point to obtain the second line, and connect the forebody upper point and the head centroid to obtain the third line. Determine the first included angle between the first connecting line and the second connecting line, and the second included angle between the first connecting line and the third connecting line; Determine the first height value of the head's center of mass, the second height value of the leg root point of the left forelimb, and the third height value of the leg root point of the right forelimb; Determine a second average value between the second height value and the third height value; If the first average value is greater than or equal to the first angle threshold, the length ratio is less than or equal to the ratio threshold, the first included angle is greater than or equal to the second angle threshold, the second included angle is greater than or equal to the third angle threshold, and the first height value is greater than or equal to the second average value, the posture determination result is determined to be a standard standing posture.

8. The method according to claim 1, characterized in that, The step of determining torso key point data from the target 3D point cloud model based on the leg key point data includes: Based on the leg root point in the leg key point data, the third average value between the first X coordinate value of the leg root point of the left foreleg and the second X coordinate value of the leg root point of the right foreleg, the fourth average value between the X coordinate values ​​of the leg root point of the left hindleg and the right hindleg, and the fifth average value between the third X coordinate values ​​of the leg root points of the limbs are determined. A first candidate point cloud with an X-coordinate value of the third average value is obtained from the target 3D point cloud; a second candidate point cloud with an X-coordinate value of the fourth average value is obtained from the target 3D point cloud; and a third candidate point cloud with an X-coordinate value of the fifth average value is obtained from the target 3D point cloud. Determine the first median among the Y coordinates of the plurality of first candidate point clouds, the second median among the Y coordinates of the plurality of second candidate point clouds, and the third median among the Y coordinates of the plurality of third candidate point clouds; A fourth candidate point cloud with a Y-coordinate value of the first median is obtained from the target 3D point cloud; a fifth candidate point cloud with a Y-coordinate value of the second median is obtained from the target 3D point cloud; and a sixth candidate point cloud with a Y-coordinate value of the third median is obtained from the target 3D point cloud. Determine a first preset quantile among the Z coordinates of the plurality of fourth candidate point clouds, a second preset quantile among the Z coordinates of the plurality of fifth candidate point clouds, and a third preset quantile among the Z coordinates of the plurality of sixth candidate point clouds; The upper point of the forebody is determined based on the third average value, the first median, and the first preset quantile. The posterior point is determined based on the fourth average value, the second median, and the second preset quantile. The midpoint of the torso is determined based on the fifth average value, the third median, and the third preset quantile. Determine the centroid of the head from the head point cloud data of the target 3D point cloud model; The forequarters upper point, the hindquarters upper point, the trunk midpoint, and the head centroid are collectively determined as the trunk key point data.

9. The method according to claim 1, characterized in that, The key leg data includes: leg root point, joint point, and hoof point; Wherein, when the posture determination result indicates that the pig is in a standard standing posture, determining the pig's leg structure type and leg structure score based on the leg key point data includes: Based on the key leg data, the forelimb lateral view structure type and forelimb lateral view score of the pig were determined; Based on the key leg data, the hind limb lateral view structure type and hind limb lateral view score of the pig were determined; Based on the key leg point data, the anterior visual structure type and anterior visual score of the pig were determined; Based on the key leg point data, the posterior structural type and posterior score of the pig are determined; The forelimb lateral view structure type, the hindlimb lateral view structure type, the anterior view structure type, and the posterior view structure type are determined as the leg structure type; The leg structure score is determined based on the forelimb lateral view score, the hindlimb lateral view score, the anterior view score, and the posterior view score.

10. The method according to claim 9, characterized in that, The process of determining the forelimb lateral view structure type and forelimb lateral view score of the pig based on the leg key point data includes: The leg root point, joint point and hoof point in the leg key point data are projected onto the second plane to determine the first included angle with the joint point as the vertex, wherein the second plane is the plane to which the X-axis and Z-axis belong; The forelimb lateral view structure type is determined based on the first angle range corresponding to the first included angle. Based on the first included angle, and the first reference angle and first scoring interval corresponding to the forelimb side view structure type, the forelimb side view score is determined.

11. The method according to claim 9, characterized in that, The step of determining the hindlimb lateral view structure type and hindlimb lateral view score of the pig based on the leg key point data includes: Project the leg root point, joint point and hoof point in the leg key point data onto the second plane, and determine the second included angle with the leg root point as the vertex; The hind limb lateral view structure type is determined based on the second angle range corresponding to the second included angle. Based on the second included angle, and the second reference angle and the second scoring interval corresponding to the hindlimb lateral view structure type, the hindlimb lateral view score is determined.

12. The method according to claim 9, characterized in that, The step of determining the anterior visual structure type and anterior visual score of the pig based on the leg key point data includes: Determine the first horizontal distance difference between the left and right forelegs of the pig at the leg root point, the second horizontal distance difference at the joint point, and the third horizontal distance difference at the hoof point; A first difference ratio is determined based on the first horizontal distance difference, the second horizontal distance difference, and the third horizontal distance difference; Determine the third angle between the first connecting line between the heel point and the hoof point of the left foreleg and the third plane, and the fourth angle between the second connecting line between the heel point and the hoof point of the right foreleg and the third plane, wherein the third plane is the plane to which the Y-axis and Z-axis belong; Based on the first difference ratio, the third included angle, the fourth included angle, and the changing trends between the first horizontal distance difference, the second horizontal distance difference, and the third horizontal distance difference, the forward-looking structure type is determined; Based on the first difference ratio, the third included angle, the fourth included angle, and the third reference angle and the third scoring interval corresponding to the forward-looking structure type, the forward-looking score is determined.

13. The method according to claim 9, characterized in that, The step of determining the pig's posterior structural type and posterior score based on the leg key point data includes: Determine the fourth horizontal distance difference between the left and right hind legs of the pig at the leg root point, the fifth horizontal distance difference at the joint point, and the sixth horizontal distance difference at the hoof point; The second difference ratio is determined based on the fourth horizontal distance difference, the fifth horizontal distance difference, and the sixth horizontal distance difference; Based on the second difference ratio, the variation trend of the fifth included angle, the sixth included angle, and the fourth horizontal distance difference, the fifth horizontal distance difference, and the sixth horizontal distance difference, the rear view structure type is determined; Determine the fifth angle between the third connecting line between the heel point and the hoof point of the left hind leg and the third plane, and the sixth angle between the fourth connecting line between the heel point and the hoof point of the right hind leg and the third plane. The rearview score is determined based on the second difference ratio, the fifth included angle, the sixth included angle, and the fourth reference angle and the fourth scoring interval corresponding to the rearview structure type.

14. An automatic scoring device for the legs of breeding pigs based on three-dimensional point clouds, characterized in that, include: The first acquisition module is used to acquire the target 3D point cloud model of the pig. The extraction module is used to extract the leg point cloud set corresponding to each leg of the pig from the target three-dimensional point cloud model; The first determining module is used to determine the key point data of each leg from the leg point cloud set corresponding to each leg; The second determining module is used to determine the torso key point data from the target three-dimensional point cloud model based on the leg key point data; The third determining module is used to determine the pig's posture judgment result based on the target three-dimensional point cloud model, the key point data of each leg, and the key point data of the torso. The fourth determining module is used to determine the leg structure type and leg structure score of the pig based on the leg key point data when the posture determination result indicates that the pig is in a standard standing posture.

15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the automatic scoring method for the legs of breeding pigs based on three-dimensional point clouds as described in any one of claims 1 to 13.

16. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the automatic scoring method for the legs of breeding pigs based on three-dimensional point clouds as described in any one of claims 1 to 13.

17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the automatic scoring method for the legs of breeding pigs based on three-dimensional point clouds as described in any one of claims 1 to 13.