A fattening pig sorting system based on three-dimensional point cloud weight estimation
The fattening pig pensing system based on 3D point cloud weight estimation solves the problems of low efficiency and stress response in traditional pensing methods, realizes intelligent pensing and weight uniformity management of fattening pigs, and improves the production efficiency and animal welfare of farms.
Patent Information
- Application Number
- CN202410667792.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2044-05-28
AI Technical Summary
Traditional penning methods make it difficult to achieve precise group feeding of fattening pigs, which is time-consuming and labor-intensive, and can easily cause stress reactions in pigs and social hierarchy differences, leading to living space compression.
A fattening pig pensing system based on 3D point cloud weight estimation is adopted. Through data acquisition and processing modules, wireless data transmission modules, and pensing equipment modules, the system realizes automatic acquisition, processing, and intelligent pensing of fattening pig weight information.
It enables intelligent pensing of fattening pigs, reducing labor and time costs, improving production efficiency, enhancing animal welfare, reducing stress response, and ensuring uniform slaughter weight.
Smart Images

Figure CN118383291B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of precise livestock breeding, and relates to finishing pig management technology, computer technology, three-dimensional data processing technology, artificial intelligence technology, automatic control technology, software development and network transmission technology, in particular to a finishing pig penning system based on three-dimensional point cloud weight estimation. BACKGROUND
[0002] China has been in the forefront of the world in terms of pork production and consumption, and the demand for pork in China is increasing. In group pig production, the genetic traits of individual finishing pigs differ, resulting in significant differences in social relationship levels and large differences in slaughter weight. Therefore, finishing pig feeding should be reasonably grouped according to the principle of weak with weak and strong with strong, and the small pigs in the weak group should be strengthened in feeding management.
[0003] The traditional penning method generally uses visual assessment of body weight and manual driving to implement penning. Influenced by the experience of breeders, it is often difficult to find abnormal individuals in time and make treatment, which not only cannot achieve accurate grouping feeding according to weight data, but also is time-consuming and laborious in the penning process, and inevitably causes stress reaction in pigs, resulting in unnecessary losses, and the penning result also has certain fluctuations, thereby causing the hierarchical oppression of pig groups and causing the poor development of pigs. SUMMARY
[0004] The present application is based on three-dimensional point cloud weight estimation of finishing pigs to construct a multi-channel intelligent penning system. The body weight information of pigs is collected, and the corresponding penning port in the open multi-channel is selected based on the penning judgment result to complete intelligent penning of pigs, and specific feed is added in the trough of the corresponding pen to realize penning feeding.
[0005] TECHNICAL SCHEME
[0006] A finishing pig penning system based on three-dimensional point cloud weight estimation, comprising a data acquisition and processing module, a wireless data transmission module, a cloud server and a penning device module, wherein:
[0007] The data acquisition and processing module acquires the depth data of experimental pigs in the channel and constructs a standardized finishing pig three-dimensional point cloud database; after the finishing pigs to be tested go through the data acquisition and weight estimation process, the estimated weight information is obtained;
[0008] The wireless data transmission module uploads the weight information to the cloud server and waits for the penning instruction;
[0009] The cloud server compares the weight information with the median of the group and sends the judgment result to the penning device module;
[0010] The pen equipment module: based on the live pig weight data results, the corresponding pen opening in the multi-channel is selected, and the intelligent pen of the live pig is completed.
[0011] Preferably, the system further comprises a data display module for users to view the current live pig weight information, image data and historical data saved by the cloud server.
[0012] Specifically, the data acquisition and processing module constructs the standardized three-dimensional point cloud database of the fattening pig through the following steps:
[0013] S1-1, a pair of RGBD images are extracted at regular intervals, and the images with poor quality are removed, and the images with high similarity are deleted, and the remaining images are converted into original scene point cloud data through the following formula:
[0014] Q=D*K -1 P
[0015] In the formula, Q is the coordinate of each point in the point cloud, D is the depth image pixel value, K is the camera intrinsic matrix, and P is the second vector of the depth image pixel coordinate;
[0016] S1-2, point cloud filtering: based on the spatial distribution characteristics of point cloud environment noise points, a point cloud direct filter is defined to directly obtain the rectangular region of interest in the fattening pig point cloud channel; after statistical outlier filtering, the distance mean of each point of the fattening pig point cloud and all points in its neighborhood is calculated to detect points with significant distance from the surrounding points, so as to realize the filtering of outliers; the filtering strength R' is defined:
[0017]
[0018] In the formula, Af is the total number of point clouds before filtering; Bf is the total number of point clouds after filtering;
[0019] S1-3, point cloud clustering and downsampling;
[0020] S1-4, extracting key features of point cloud;
[0021] S1-5, sample automatic classification;
[0022] S1-6, repeating steps S1-1 to S1-5, extracting feature parameters and automatically classifying to construct the three-dimensional point cloud database of the fattening pig.
[0023] Specifically, in S1-4, five key features of point cloud hip width, shoulder width, hip height, shoulder height and body length are extracted, and the key feature parameter calculation steps are as follows:
[0024] S1-4-1, reconstructing a standardized fattening pig point cloud coordinate system, reconstructing a standardized coordinate system for pig back point clouds of different standing angles, taking the ground as the z plane, the y axis parallel to the fattening pig body, pointing to the pig head, and the x axis perpendicular to the body;
[0025] S1-4-2, extracting a slice fitting curve;
[0026] S1-4-3, according to the fitting curve, from the x-axis negative half axis, the first and second maximum value points corresponding to the x-axis position are defined as the hip width slice and the shoulder width slice; the y-axis span corresponding to the hip width and shoulder width slice is defined as the hip width and shoulder width, the highest point in the two point cloud slice clusters is defined as the hip height and shoulder height, and the interval between the two slices is calculated as the body length.
[0027] Specifically, in S1-4-2, the step of extracting the slice fitting curve includes the following steps:
[0028] 1) Calculate the centroid of the point cloud object in the z plane, set z as -1, and set the origin of the reconstructed coordinate system as the integrated set, and the calculation method is as follows:
[0029]
[0030] In the formula, r i =(x i , y i , -1), i = 1, 2, …, n, r i is the coordinates of each point, and m i is the mass of the corresponding point; the centroid coordinates P c are obtained, and a translation vector is calculated to move the point cloud to the origin of the coordinate axis.
[0031] 2) Select the z axis as the basic coordinate axis, and the z axis is the ground normal vector; without considering the z axis, the pig back point cloud is projected onto a two-dimensional plane, and the projected point cloud G is represented as:
[0032]
[0033] Calculate the covariance matrix C:
[0034]
[0035] Solve the eigenvalue k = (λ1, λ2) of the matrix C, and the corresponding characteristic matrix is:
[0036] C1 = (a1 b1), C2 = (a2 b2)
[0037] When λ1≥λ2, let the point P be (a1, b1), otherwise P be (a2, b2); take the original coordinate origin O as the basis after two-dimensional projection, and take OP as the unit after unitization as the point cloud body length direction, that is, the x-axis; after obtaining the z-axis and the x-axis, select the orthogonal vector of the two axes, and take the unitization as the y-axis;
[0038] 3) After obtaining the point cloud parallel to the y-axis, the segmentation plane is determined in the way of point cloud tomographic sectioning; the point cloud is divided into a plurality of thin slices along the x-axis at an interval of 3mm, the span of the point cloud in the y-axis direction in each thin slice is counted in sequence, and a fitting curve is extracted.
[0039] Specifically, the data acquisition and processing module constructs the finishing pig weight estimation model through the following steps:
[0040] S2-1, remove bad samples;
[0041] S2-2, take different models as weight estimation regression models for training;
[0042] S2-3, use mean square error MSE, mean absolute error MAE and mean relative error MRE as evaluation indexes to determine the optimal model as the finishing pig weight estimation model.
[0043] Specifically, in step S2-1, the point cloud tomographic sectioning method is combined with pig morphological analysis to remove bad samples.
[0044] Specifically, in step S2-2, the different models include: random forest model, MLP model, linear regression model based on least square method and ridge regression model.
[0045] Specifically, in step S2-3, the calculation methods of each evaluation index are as follows:
[0046]
[0047]
[0048] In the formula, n is the number of samples, y i is the true value, is the predicted value.
[0049] Specifically, the sorting equipment module comprises: a photoelectric sensing module, a gantry type collection device, a sorting pneumatic door, an electric control box and a mounting plate, a thin pig outlet walkway and a fat pig outlet walkway, wherein: the photoelectric sensing module (1) is installed at the front end and the tail end of the weighing channel of the sorting equipment, and identifies the entry and exit of the pigs; the gantry type collection device is arranged in the middle of the main channel of the sorting equipment and located at the rear side of the photoelectric sensing module, and is used to carry the data collection and processing module; the sorting pneumatic door is arranged at the tail end of the main channel of the sorting equipment, and performs the sorting action according to the judgment result returned by the cloud server; the sorting pneumatic door is connected with the thin pig outlet walkway and the fat pig outlet walkway, and leads to the thin pig feeding area and the fat pig feeding area respectively.
[0050] Advantages of the present application
[0051] (1) The system realizes automatic detection of fattening pig characteristic parameters by collecting point cloud data through the video acquisition channel and the gantry type collection system, selects the corresponding sorting port in the open multi-channel based on the body weight data result, and completes intelligent sorting.
[0052] (2) The system adopts a non-contact weight estimation technology to realize real-time and automatic weight monitoring, saves labor and time cost, and improves the production efficiency of the farm. The non-contact weight estimation method does not need manual intervention, reduces the interference to the pigs, helps to improve the animal welfare, and reduces the stress of the pigs.
[0053] (3) Through field test, the use of the system can significantly improve the sorting efficiency, reduce the further oppression of the survival space of small pigs caused by the social grade difference of the pigs due to body shape, improve the uniformity of the fattening pig weight, and protect the welfare of the pigs. BRIEF DESCRIPTION OF DRAWINGS
[0054] Figure 1 The system block diagram of the present application
[0055] Figure 2 The system workflow diagram of the present application
[0056] Figure 3 The structure diagram of the sorting equipment module
[0057] Figure 4 The point cloud feature extraction flowchart
[0058] Figure 5 The point cloud feature extraction and screening flowchart DETAILED DESCRIPTION
[0059] The present application will be further described below in conjunction with the embodiments, but the protection scope of the present application is not limited thereto:
[0060] The patent combines the demand for pig breeding and invents a fattening pig penning system based on three-dimensional point cloud weight estimation. The automatic detection of fattening pig weight parameters is realized through the video acquisition channel, the corresponding penning port in the open multi-channel is selected based on the weight estimation result, and specific feed is added in the trough of the corresponding penning area, realizing penning feeding. The system is composed of data acquisition and processing module, wireless data transmission module, cloud server, penning equipment module and data display module, as shown in the system working schematic diagram Figure 1 The data acquisition and processing module is responsible for collecting the depth data of experimental pigs in the channel, and obtains the weight estimation result after data acquisition, weight estimation and other processes. The wireless data transmission module uploads the weight information to the cloud server and waits for the penning instruction. The cloud server compares the weight information with the median of the group, and sends the judgment result to the penning equipment module. Based on the pig weight data result, the corresponding penning port in the open multi-channel is selected, and the intelligent penning of pigs is completed. Users can view the current weight information, image data and historical data of the pigs to be detected saved by the cloud server through the data display module.
[0061] Key problems to be solved:
[0062] (1) Development of penning equipment module: investigate the actual breeding environment, combine production practice, and build a multi-channel intelligent penning system based on non-contact weight estimation of fattening pigs. The detection of fattening pig weight parameters is realized through the video acquisition channel, the corresponding penning port in the open multi-channel is selected based on the weight estimation result, and the intelligent penning of fattening pigs is completed. The system needs to realize functions including device control, real-time recording of device state and weight data, uploading to cloud for data storage and processing, etc.
[0063] (2) Fattening pig point cloud segmentation: collect fattening pig weight and depth video data, and extract back point cloud. Collect fattening pig depth video data and corresponding weight information, and make original point cloud data set. Through point cloud filtering, clustering, downsampling and other preprocessing methods, the region of interest is obtained and the ground interference is filtered out to extract the back point cloud of fattening pigs.
[0064] (3) Fattening pig weight estimation: extract key features of point cloud, and train weight regression model. Reconstruct the standardized point cloud coordinate system, calculate the relevant feature parameters using the point cloud segmentation algorithm based on the morphological characteristics of fattening pigs. Train the weight regression model, use mean square error MSE, mean absolute error MAE and mean relative error MRE as evaluation indexes, and select the optimal model for fattening pig weight estimation.
[0065] Specific examples:
[0066] By field investigation of the environment of the breeding house, the applicant designs a fattening pig penning system based on three-dimensional point cloud weight estimation. After the system is started, when the fattening pigs are feeding, they can enter the data collection channel in the equipment. After the photoelectric induction switch in the channel senses the pigs, the penning equipment module closes the entrance and exit of the collection channel, and sends a command to the data collection and processing module to open the depth camera to collect point cloud data, realize automatic instantaneous collection of point cloud and weight estimation, and upload the weight estimation result to the server. The point cloud information needs to be preprocessed by space straight-through filtering, statistical filtering, clustering, downsampling, etc. to extract the target point cloud. A point cloud tomographic sectioning method based on animal morphology is studied to realize automatic segmentation of point cloud, extract target features, and train a regression model to realize weight prediction of fattening pigs. The penning system automatically consults the entire pig weight data of the previous day in the database, and calculates the median of the group as the weight standard for penning. The administrator can view the current pig weight information and equipment status through the mobile APP terminal and Web page terminal. The system workflow diagram is shown in Figure 2 The research route is as follows:
[0067] First step: develop a penning equipment module, mainly including a photoelectric induction module, an anti-pinch module, a 485 communication module, and a pneumatic door control mechanism, which are controlled by an STM32F103 chip.
[0068] Second step: the data collection and processing module includes an industrial computer and a depth camera. The photoelectric induction switch of the penning equipment module triggers the collection module to open the depth camera, which continuously shoots 5 depth images for each fattening pig.
[0069] Third step: data set preparation, mainly including RGBD image pair acquisition, data cleaning, and original point cloud generation. In the data cleaning stage, poor quality pictures are removed, and pictures with high similarity are also deleted. The data is randomly allocated to the training set, test set, and validation set in the ratio of 8:1:1.
[0070] Fourth step: to extract the target pig point cloud, use spatial straight-through filtering and statistical filtering to filter out noise points and useful points, extract the region of interest, use DBSCAN clustering for point cloud segmentation, and obtain the pig back point cloud. Use voxel downsampling to reduce the amount of point cloud data and retain key contour information.
[0071] Fifth step: study a point cloud segmentation algorithm based on the morphological characteristics of fattening pigs. Based on the point cloud tomographic sectioning method, the y-axis span value fitting curve is obtained, the curve features are observed, the point cloud cutting plane is located, the maximum value point of the curve is extracted, and the related features are calculated. For point clouds with improper posture, define them as bad samples, and realize automatic detection and removal of bad samples by comparing the curve features of normal point cloud samples.
[0072] The sixth step: for weight estimation of random forest model, the hyperparameters of the model are optimized by Bayesian optimization method, and the fattening pig weight estimation model is obtained.
[0073] The seventh step: the point cloud processing and weight estimation model are deployed on the industrial computer, and the model detection result is transmitted into the cloud server for storage, and the cloud platform sends the weight information, image and point cloud information of the corresponding fattening pig to the administrator's mobile APP and Web page.
[0074] The eighth step: at zero o'clock every day, the column system automatically checks the whole pig weight data of the previous day in the database, arranges these data from small to large, takes the average value as the grouping median, saves it into the database as the weight standard for column.
[0075] The ninth step: the cloud sends the column judgment result to the STM32F103 single-chip microcomputer control board through the wireless transmission module and the 485 communication module, the control board drives the pneumatic door control mechanism, opens the corresponding exit aisle, and realizes the automatic column of fattening pigs.
[0076] The tenth step: the anti-injury module detects the air pressure of the pneumatic door outlet and the piston travel of the pneumatic cylinder, and comprehensively judges the state of the pneumatic door control structure, and automatically opens the pneumatic door when the pig is injured.
[0077] The tenth step: the system power is provided by the 220V power supply in the pig house, which is responsible for power supply to the data acquisition and processing module, the wireless data transmission module and the column equipment module.
[0078] The specific design scheme of the system is as follows:
[0079] (I) Development of column equipment module
[0080] In order to realize the intelligent column of fattening pigs in group environment, the column equipment module is designed, which is divided into three parts of acquisition channel, column channel and gantry type data acquisition equipment, and the whole adopts galvanized stainless steel material, which improves the ability of the device to resist the high temperature and high humidity environment in the pig farm, greatly prolongs the service life and strength of the device. Figure 3The sorting device module comprises: a photoelectric sensing module 1, a gantry type collection device 2, a sorting pneumatic door 3, an electric control box and mounting plate 4, a thin pig outlet walkway 5 and a fat pig outlet walkway 6, wherein: the photoelectric sensing module 1 is installed at the front end of the main channel of the sorting device, and identifies the entry of pigs; the gantry type collection device 2 is arranged in the middle of the main channel of the sorting device and is located at the rear side of the photoelectric sensing module 1, and is used to carry a data collection and processing module; the sorting pneumatic door 3 is arranged at the end of the main channel of the sorting device, and performs a sorting action according to the judgment result returned by the cloud server; the sorting pneumatic door 3 connects the thin pig outlet walkway 5 and the fat pig outlet walkway 6, and leads to the thin pig feeding area and the fat pig feeding area respectively. According to the actual production environment and work requirements, the sorting device module has the following basic functions:
[0081] (1)485 communication function: during the working process of the sorting module, real-time communication is needed with the wireless data transmission module, the working state and the estimated weight of the finishing pig are reported in real time, the web control instruction is received, and the corresponding function is executed.
[0082] (2)Point cloud automatic instantaneous step collection: after the sorting device detects that the finishing pig enters the specified position in the device, the depth camera is started, the pig back point cloud is automatically collected, and the original scene point cloud and pig back point cloud are saved, and the finishing pig point cloud data set is accumulated.
[0083] (3)Real-time weight estimation of finishing pigs: after the sorting device collects the finishing pig back point cloud, the real-time weight estimation is performed, and the data is uploaded to the cloud database.
[0084] (4)Intelligent sorting: the sorting device allows the pig to smoothly enter the corresponding feeding area according to the obtained weight estimation result.
[0085] (5)Anti-pinch function: when the pig is accidentally pinched by the device, the sorting device will judge the state of the door according to the sensor data and automatically open the channel door.
[0086] (II) Finishing pig point cloud segmentation
[0087] The processing of the finishing pig point cloud data in the design includes:
[0088] (1)Point cloud data collection: the weight and video data of 50 finishing pigs are collected in the experiment, and one pair of RGBD images is extracted every 5s. The poor quality pictures are removed, and the pictures with high similarity are also removed. The remaining pictures are registered and fused with the color image and the depth image through the camera internal parameter matrix, and are converted into original scene point cloud data. The conversion method is as follows.
[0089] Q=D·K -1 ·P
[0090] In the formula, Q is the coordinate of each point in the point cloud, D is the depth image pixel value, K is the camera intrinsic matrix, and P is the secondary vector of the depth image pixel coordinate.
[0091] (2) Point cloud filtering: Based on the spatial distribution characteristics of point cloud environmental noise, a point cloud straight-through filter is defined to directly obtain the rectangular region of interest in the fattening pig point cloud channel. There are still many random noise points in the point cloud in the determined collection space, and there is a phenomenon of adhesion between the extracted pig back point cloud and the railing. After statistical outlier filtering, the average distance of each point in the fattening pig point cloud and all points in its neighborhood is calculated to detect points with significantly different distances from the surrounding points, thereby achieving the filtering of outliers. Further quantify the influence of R on the filtering effect, define the filtering strength
[0092]
[0093] In the formula, Af is the total number of points in the point cloud before filtering; Bf is the total number of points in the point cloud after filtering. At the same time, samples with obviously incomplete pig back point cloud and samples with obvious adhesion between pig back point cloud and channel are recorded and marked as incomplete samples and redundant samples respectively. In order to guarantee the filtering effect and at the same time preserve the complete back point cloud as much as possible, it is necessary to select a suitable R value as the parameter of statistical filtering.
[0094] (3) Point cloud clustering and downsampling method
[0095] In order to extract the target fattening pig point cloud, the point cloud after statistical filtering needs to be clustered. The influence of different parameters on the clustering effect of DBSCAN is compared, and the best parameters are selected to better separate the pig back point cloud. The segmented pig back point cloud data is large and the processing time is long, which cannot meet the needs of actual production, so the pig back point cloud obtained needs to be downsampled. The rich high-frequency detail information in the point cloud is filtered out, and the low-frequency contour information is retained, thereby reducing the data volume and simplifying the subsequent processing process.
[0096] (4) Extraction of key features of point cloud
[0097] Under normal circumstances, during the growth and development of animals, there is a positive correlation between pig body weight and body size. Before estimating the body weight of fattening pigs, key feature parameters with high correlation to body size need to be obtained from point cloud. In this study, five features of point cloud hip width, shoulder width, hip height, shoulder height and body length are defined as key features to train the body weight estimation model. The feature extraction process is shown in Figure 4
[0098] Reconstructing the standardized coordinate system of finishing pig point cloud is conducive to extracting features in subsequent fault slice. The standardized coordinate system of pig back point cloud at different standing angles is reconstructed, the ground is set as the z plane, the y axis is parallel to the pig body, pointing to the pig head, and the x axis is perpendicular to the pig body.
[0099] To reduce the influence of point cloud rotation and the calculation complexity in reconstructing the coordinate system, the centroid of the point cloud object in the z plane needs to be calculated. Since the z axis direction value of the point cloud is also one of the feature parameters, z is set to -1, and the origin of the reconstructed coordinate system is set. The centroid P c The calculation method is as follows:
[0100]
[0101] In the formula, r i =(x i , y i , -1), i = 1, 2, …, n is the coordinate of each point, and m i is the mass of the corresponding point. In this study, m i = 1. By obtaining the centroid coordinates, the translation vector is calculated to move the point cloud to the origin of the coordinate axis.
[0102] The z axis is selected as the basic coordinate axis. Since the pig stands on the ground, the body is parallel to the ground, and the z axis is the ground normal vector. Without considering the z axis, the pig back point cloud is projected onto a two-dimensional plane, and the projected point cloud is represented as:
[0103]
[0104] The covariance matrix is calculated:
[0105]
[0106] The eigenvalues k = (λ1, λ2) of the matrix C are calculated, and the corresponding characteristic matrix is:
[0107] C1 = (a1 b1), C2 = (a2 b2)
[0108] When λ1≥λ2, let the point P be (a1, b1), otherwise (a2, b2). Based on the original coordinates of the two-dimensional projection, OP is unitized and used as the body length direction (x axis) of the point cloud. After obtaining the z axis and x axis, the orthogonal vectors of the two axes are unitized and used as the y axis.
[0109] After obtaining the point cloud parallel to the y-axis, the segmentation plane is determined by taking the point cloud tomographic section. The point cloud is divided into thin slices along the x-axis at 3mm intervals, and the span of the point cloud in the y-axis direction within each slice is counted in turn, and the fitting curve is extracted. According to the fitting curve, from the negative half of the x-axis, the point cloud slices corresponding to the first and second maximum points of the x-axis are defined as the hip width slice and the shoulder width slice. The y-axis span corresponding to the hip width and shoulder width slices is defined as the hip width and shoulder width, the highest points in the two point cloud slice clusters are defined as the hip height and shoulder height, and the interval between the two slices is calculated as the body length.
[0110] (5) Automatic classification of samples
[0111] Combined with Figure 5 , for posture bending and other inappropriate postures, redundant and incomplete pig point cloud samples, the point cloud tomographic section method cannot obtain its features. After obtaining the fitting function, the number of maximum points of the curve is calculated. If the number of maximum points is less than three, the point cloud sample is determined to be a defective sample or a body bending sample. When the y-axis slice peak value of the curve is greater than a certain threshold, the point cloud is determined to be a redundant sample, and the point cloud data with appropriate posture needs to be re-collected. For redundant samples, the accuracy and recall rate of different threshold values in judging redundant samples under this rule are calculated, and the appropriate threshold value is selected to realize automatic classification of samples.
[0112] Repeat (1)-(5) to obtain a finishing pig point cloud segmentation algorithm. Deploy the point cloud segmentation algorithm to an industrial computer to extract feature parameters and construct a standard point cloud database of finishing pigs. The standardized three-dimensional point cloud database of finishing pigs can provide a basis for subsequent research on finishing pig growth monitoring and yield prediction.
[0113] (Three) Estimation of the body weight of finishing pigs
[0114] By the point cloud tomographic section method, combined with pig morphological analysis, bad samples are removed. Then, the random forest model, MLP model, linear regression model based on least squares method and ridge regression model are studied for weight estimation regression model, and mean square error MSE, mean absolute error MAE and mean relative error MRE are used as evaluation indexes. The error calculation formula is as follows:
[0115]
[0116]
[0117] In the formula, n is the number of samples, y i is the true value, is the predicted value.
[0118] The hyperparameters of the model are optimized by using the Bayesian optimization method, the model with the best effect is used for training, the evaluation result is obtained, and the random forest model is determined as the weight estimation model based on the characteristic parameters of the fattening pigs.
[0119] Compared with the contact type electronic scale weighing, there are the disadvantages of easy to cause pig stress, increase the risk of disease, short service life of the equipment and poor precision (influenced by excrement at the weighing place).
[0120] The non-contact weight estimation algorithm can realize real-time and automatic weight monitoring, save the labor and time cost, and improve the production efficiency of the farm. The non-contact weight estimation method does not need manual intervention, reduces the interference to the pigs, helps to improve the animal welfare, and reduces the stress of the pigs.
[0121] The specific embodiments described herein are merely illustrative of the spirit of the present application. Those skilled in the art of the present application can make various modifications or supplements to the described specific embodiments or replace them with similar ways, without departing from the spirit of the present application or exceeding the scope defined by the appended claims.
Claims
1. A finishing pig sorting system based on three-dimensional point cloud weight estimation, characterized in that It comprises a data acquisition and processing module, a wireless data transmission module, a cloud server and a columnar equipment module, wherein: The data acquisition and processing module acquires the depth data of the experimental pigs in the channel, and constructs a standardized fattening pig three-dimensional point cloud database; after the to-be-tested fattening pigs pass through the data acquisition and weight estimation process, the estimated weight information is obtained; the data acquisition and processing module constructs the standardized fattening pig three-dimensional point cloud database through the following steps: S1-1, a pair of RGBD images are extracted at regular intervals, and the pictures with poor quality are removed, and the pictures with too high similarity are also removed, and the remaining pictures are converted into original scene point cloud data through the following formula: Q = D - K -1 • P In the formula, Q is the coordinate of each point in the point cloud, D is the depth image pixel value, K is the camera intrinsic matrix, and P is the second vector of the depth image pixel coordinate; S1-2, point cloud filtering: based on the spatial distribution characteristics of the point cloud environment noise points, a point cloud direct filter is defined to directly obtain the rectangular region of interest of the fattening pig point cloud in the channel; after statistical outlier filtering, the distance mean of each point of the fattening pig point cloud and all points in its neighborhood is calculated to detect points with significantly different distances from the surrounding points, thereby realizing the filtering of outliers; the filtering strength R' is defined as: In the formula, Af is the total number of point clouds before filtering; Bf is the total number of point clouds after filtering; S1-3, point cloud clustering and downsampling; S1-4, extracting key features of point cloud; in S1-4, five key features of point cloud, i.e. hip width, shoulder width, hip height, shoulder height and body length, are extracted, and the key feature parameter calculation steps are as follows: S1-4-1, reconstructing the standardized fattening pig point cloud coordinate system, reconstructing the standardized coordinate system of the pig back point cloud at different standing angles, making the ground as the z plane, the y axis parallel to the fattening pig body, pointing to the pig head, and the x axis perpendicular to the body; S1-4-2, extracting slice fitting curve; in S1-4-2, extracting slice fitting curve comprises the following steps: 1) calculating the centroid of the point cloud object on the z plane, setting z as-1, and setting the origin of the reconstructed coordinate system as the integrated set, and the calculation method is as shown below: In the formula, r i = (x i , y i , -1), i = 1, 2,..., n, r i is the coordinate of each point, m i is the mass of the corresponding point; the centroid coordinate P c is obtained, and a translation vector is calculated to translate the point cloud to the coordinate axis origin. 2) selecting the z axis as the basic coordinate axis, and the z axis is the ground normal vector; without considering the z axis, the pig back point cloud is projected onto a two-dimensional plane, and the projected point cloud G is represented as: Calculate its covariance matrix C: Solve the eigenvalue k=(λ1, λ2) of the matrix C, and its corresponding feature matrix is: C1=(a1b1), C2=(a2b2) When λ1≥λ2, let the point P be (a1, b1), otherwise P be (a2, b2); based on the original coordinate origin O after two-dimensional projection, OP is unitized as the body length direction of the point cloud, i.e. the x axis; after obtaining the z axis and the x axis, the orthogonal vector of the two axes is unitized as the y axis; 3) after obtaining the point cloud parallel to the y axis, the point cloud tomographic slice method is adopted to determine the segmentation plane; the point cloud is divided into a plurality of thin slices along the x axis at an interval of 3mm, the span of the point cloud in the y axis direction in each thin slice is counted in sequence, and the fitting curve is extracted. S1-4-3、According to the fitted curve, from the negative half of the x-axis, the point cloud slices corresponding to the first and second maximum points of the x-axis position are defined as the hip width slice and the shoulder width slice; the y-axis span corresponding to the hip width and shoulder width slices is defined as the hip width and shoulder width, the highest points in the two point cloud slice clusters are defined as the hip height and shoulder height, and the interval between the two slices is calculated as the body length; S1-5, automatically classifying the samples; S1-6, repeating steps S1-1 to S1-5 to extract feature parameters and automatically classify them to build a three-dimensional point cloud database of finishing pigs; The wireless data transmission module uploads the weight information to the cloud server and waits for the acceptance of the sorting instruction; The cloud server compares the weight information with the median of the group and sends the judgment result to the sorting device module; The sorting device module selects the corresponding sorting port in the open multi-channel based on the live pig weight data result, and completes the intelligent sorting of live pigs.
2. The system of claim 1, wherein It also includes a data display module for users to view the current weight information, image data, and historical data of the pigs to be detected saved by the cloud server.
3. The system of claim 1, wherein The data acquisition and processing module builds a finishing pig weight estimation model through the following steps: S2-1, remove bad samples; S2-2, use different models as weight estimation regression models for training; S2-3, use mean squared error MSE, mean absolute error MAE, and mean relative error MRE as evaluation indicators to determine the optimal model as the finishing pig weight estimation model.
4. The system of claim 3, wherein In step S2-1, by the point cloud slice tomography method, combined with pig morphological analysis, bad samples are removed.
5. The system of claim 3, wherein In step S2-2, different models include: random forest model, MLP model, linear regression model based on least squares method, and ridge regression model.
6. The system of claim 3, wherein In step S2-3, the calculation methods of each evaluation indicator are as follows: In the formula, n is the number of samples, y i is the true value, is the predicted value.
7. The system of claim 1, wherein The sorting device module includes: a photoelectric sensing module (1), a gantry type collection device (2), a sorting pneumatic door (3), an electric control box and a mounting plate (4), a thin pig outlet walkway (5), and a fat pig outlet walkway (6). Among them: the photoelectric sensing module (1) is installed at the front and rear ends of the sorting device weighing channel, and identifies the entry and exit of pigs; the gantry type collection device (2) is set in the middle of the main channel of the sorting device, and is located at the rear side of the photoelectric sensing module (1), used to carry the data acquisition and processing module; the sorting pneumatic door (3) is set at the end of the main channel of the sorting device, and performs sorting action according to the judgment result returned by the cloud server; the sorting pneumatic door (3) connects the thin pig outlet walkway (5) and the fat pig outlet walkway (6), which lead to the thin pig feeding area and the fat pig feeding area respectively.
Citation Information
Patent Citations
Live pig big data system based on internet of things technology
CN107667904A
Automatic living pig measuring device and method
CN109380146A